| 
									
										
										
										
											2012-07-14 05:54:48 +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 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  * -------------------------------------------------------------------------- */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @file Class.h | 
					
						
							|  |  |  |  * @brief describe the C++ class that is being wrapped | 
					
						
							|  |  |  |  * @author Frank Dellaert | 
					
						
							|  |  |  |  * @author Andrew Melim | 
					
						
							|  |  |  |  * @author Richard Roberts | 
					
						
							|  |  |  |  **/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <map>
 | 
					
						
							|  |  |  | #include <string>
 | 
					
						
							|  |  |  | #include <vector>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace wrap { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-30 02:38:51 +08:00
										 |  |  | // Forward declarations
 | 
					
						
							| 
									
										
										
										
											2016-11-25 08:24:25 +08:00
										 |  |  | class Qualified; | 
					
						
							| 
									
										
										
										
											2014-11-30 02:38:51 +08:00
										 |  |  | class Class; | 
					
						
							| 
									
										
										
										
											2016-12-17 08:26:40 +08:00
										 |  |  | struct ForwardDeclaration; | 
					
						
							| 
									
										
										
										
											2014-11-30 02:38:51 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-14 05:54:48 +08:00
										 |  |  | /** Attributes about valid classes, both for classes defined in this module and
 | 
					
						
							|  |  |  |  * also those forward-declared from others.  At the moment this only contains | 
					
						
							|  |  |  |  * whether the class is virtual, which is used to know how to copy the class, | 
					
						
							|  |  |  |  * and whether to try to convert it to a more derived type upon returning it. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | struct TypeAttributes { | 
					
						
							| 
									
										
										
										
											2012-10-02 22:40:07 +08:00
										 |  |  |   bool isVirtual; | 
					
						
							| 
									
										
										
										
											2014-11-30 02:38:51 +08:00
										 |  |  |   TypeAttributes() : | 
					
						
							|  |  |  |       isVirtual(false) { | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   TypeAttributes(bool isVirtual) : | 
					
						
							|  |  |  |       isVirtual(isVirtual) { | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2012-07-14 05:54:48 +08:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** Map of type names to attributes. */ | 
					
						
							| 
									
										
										
										
											2014-11-30 02:38:51 +08:00
										 |  |  | class TypeAttributesTable { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   std::map<std::string, TypeAttributes> table_; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-14 05:54:48 +08:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2014-11-30 02:38:51 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   /// Constructor
 | 
					
						
							|  |  |  |   TypeAttributesTable() { | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2012-07-14 05:54:48 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-10-02 22:40:07 +08:00
										 |  |  |   void addClasses(const std::vector<Class>& classes); | 
					
						
							| 
									
										
										
										
											2016-11-25 08:24:25 +08:00
										 |  |  |   void addType(const Qualified& types); | 
					
						
							| 
									
										
										
										
											2014-11-30 02:38:51 +08:00
										 |  |  |   void addForwardDeclarations( | 
					
						
							|  |  |  |       const std::vector<ForwardDeclaration>& forwardDecls); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /// Access attributes associated with key, informative failure
 | 
					
						
							|  |  |  |   const TypeAttributes& attributes(const std::string& key) const; | 
					
						
							| 
									
										
										
										
											2012-07-14 05:54:48 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-30 02:38:51 +08:00
										 |  |  |   /// Check that all virtual classes are properly defined
 | 
					
						
							| 
									
										
										
										
											2012-10-02 22:40:07 +08:00
										 |  |  |   void checkValidity(const std::vector<Class>& classes) const; | 
					
						
							| 
									
										
										
										
											2012-07-14 05:54:48 +08:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-13 06:22:59 +08:00
										 |  |  | } |