| 
									
										
										
										
											2010-10-14 12:54:38 +08:00
										 |  |  | /* ----------------------------------------------------------------------------
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  * GTSAM Copyright 2010, Georgia Tech Research Corporation,  | 
					
						
							|  |  |  |  * Atlanta, Georgia 30332-0415 | 
					
						
							|  |  |  |  * All Rights Reserved | 
					
						
							|  |  |  |  * Authors: Frank Dellaert, et al. (see THANKS for the full author list) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  * See LICENSE for the license information | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  * -------------------------------------------------------------------------- */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-09 06:04:47 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @file    VariableSlots.cpp | 
					
						
							|  |  |  |  * @brief    | 
					
						
							|  |  |  |  * @author  Richard Roberts | 
					
						
							|  |  |  |  * @created Oct 5, 2010 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <gtsam/inference/VariableSlots.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <iostream>
 | 
					
						
							|  |  |  | #include <boost/foreach.hpp>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | using namespace std; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace gtsam { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** print */ | 
					
						
							|  |  |  | void VariableSlots::print(const std::string& str) const { | 
					
						
							|  |  |  |   if(this->empty()) | 
					
						
							|  |  |  |     cout << "empty" << endl; | 
					
						
							|  |  |  |   else { | 
					
						
							|  |  |  |     cout << str << "\n"; | 
					
						
							|  |  |  |     cout << "Var:\t"; | 
					
						
							|  |  |  |     BOOST_FOREACH(const value_type& slot, *this) { cout << slot.first << "\t"; } | 
					
						
							|  |  |  |     cout << "\n"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     for(size_t i=0; i<this->begin()->second.size(); ++i) { | 
					
						
							|  |  |  |       cout << "    \t"; | 
					
						
							|  |  |  |       BOOST_FOREACH(const value_type& slot, *this) { | 
					
						
							| 
									
										
										
										
											2010-10-12 05:14:35 +08:00
										 |  |  |         if(slot.second[i] == numeric_limits<Index>::max()) | 
					
						
							| 
									
										
										
										
											2010-10-09 06:04:47 +08:00
										 |  |  |           cout << "x" << "\t"; | 
					
						
							|  |  |  |         else | 
					
						
							|  |  |  |           cout << slot.second[i] << "\t"; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       cout << "\n"; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** equals */ | 
					
						
							|  |  |  | bool VariableSlots::equals(const VariableSlots& rhs, double tol) const { | 
					
						
							|  |  |  |   return *this == rhs; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |