| 
									
										
										
										
											2012-10-02 22:40:07 +08:00
										 |  |  |   // comments!
 | 
					
						
							| 
									
										
										
										
											2011-10-14 02:41:56 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-16 05:23:20 +08:00
										 |  |  | class VectorNotEigen; | 
					
						
							| 
									
										
										
										
											2014-12-19 23:19:02 +08:00
										 |  |  | virtual class ns::OtherClass; | 
					
						
							| 
									
										
										
										
											2011-12-16 05:23:20 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-13 08:26:06 +08:00
										 |  |  | namespace gtsam { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-10-14 02:41:56 +08:00
										 |  |  | class Point2 { | 
					
						
							|  |  |  |  Point2(); | 
					
						
							|  |  |  |  Point2(double x, double y); | 
					
						
							| 
									
										
										
										
											2011-12-02 10:32:18 +08:00
										 |  |  |  double x() const; | 
					
						
							|  |  |  |  double y() const; | 
					
						
							| 
									
										
										
										
											2011-10-14 02:41:56 +08:00
										 |  |  |  int dim() const; | 
					
						
							| 
									
										
										
										
											2012-01-24 02:28:11 +08:00
										 |  |  |  char returnChar() const; | 
					
						
							|  |  |  |  void argChar(char a) const; | 
					
						
							| 
									
										
										
										
											2012-05-05 02:50:36 +08:00
										 |  |  |  void argUChar(unsigned char a) const; | 
					
						
							| 
									
										
										
										
											2014-11-30 04:43:48 +08:00
										 |  |  |  void eigenArguments(Vector v, Matrix m) const; | 
					
						
							| 
									
										
										
										
											2011-12-07 11:05:37 +08:00
										 |  |  |  VectorNotEigen vectorConfusion(); | 
					
						
							| 
									
										
										
										
											2013-06-20 01:50:05 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |  void serializable() const; // Sets flag and creates export, but does not make serialization functions
 | 
					
						
							| 
									
										
										
										
											2011-10-14 02:41:56 +08:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class Point3 { | 
					
						
							|  |  |  |   Point3(double x, double y, double z); | 
					
						
							|  |  |  |   double norm() const; | 
					
						
							| 
									
										
										
										
											2011-12-02 10:32:18 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-07 11:05:30 +08:00
										 |  |  |   // static functions - use static keyword and uppercase
 | 
					
						
							|  |  |  |   static double staticFunction(); | 
					
						
							| 
									
										
										
										
											2014-11-13 08:26:06 +08:00
										 |  |  |   static gtsam::Point3 StaticFunctionRet(double z); | 
					
						
							| 
									
										
										
										
											2013-06-20 01:49:55 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   // enabling serialization functionality
 | 
					
						
							|  |  |  |   void serialize() const; // Just triggers a flag internally and removes actual function
 | 
					
						
							| 
									
										
										
										
											2011-10-14 02:41:56 +08:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-13 08:26:06 +08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2011-12-02 06:06:03 +08:00
										 |  |  | // another comment
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-09 04:50:38 +08:00
										 |  |  | // another comment
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-07 11:05:37 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * A multi-line comment! | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-18 02:30:02 +08:00
										 |  |  | // An include! Can go anywhere outside of a class, in any order
 | 
					
						
							| 
									
										
										
										
											2011-12-09 23:44:35 +08:00
										 |  |  | #include <folder/path/to/Test.h>
 | 
					
						
							| 
									
										
										
										
											2012-07-18 02:30:02 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-16 00:18:03 +08:00
										 |  |  | class Test { | 
					
						
							| 
									
										
										
										
											2011-12-09 23:44:35 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-10-02 22:40:07 +08:00
										 |  |  |   /* a comment! */ | 
					
						
							|  |  |  |   // another comment
 | 
					
						
							| 
									
										
										
										
											2011-10-14 02:41:56 +08:00
										 |  |  |   Test(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-07 11:05:33 +08:00
										 |  |  |   pair<Vector,Matrix> return_pair (Vector v, Matrix A) const; // intentionally the first method
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-02 10:32:18 +08:00
										 |  |  |   bool   return_bool   (bool   value) const; // comment after a line!
 | 
					
						
							|  |  |  |   size_t return_size_t (size_t value) const; | 
					
						
							|  |  |  |   int    return_int    (int    value) const; | 
					
						
							|  |  |  |   double return_double (double value) const; | 
					
						
							| 
									
										
										
										
											2011-10-14 02:41:56 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-07 11:05:37 +08:00
										 |  |  |   Test(double a, Matrix b); // a constructor in the middle of a class
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-02 06:06:03 +08:00
										 |  |  |   // comments in the middle!
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // (more) comments in the middle!
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-02 10:32:18 +08:00
										 |  |  |   string return_string (string value) const; | 
					
						
							|  |  |  |   Vector return_vector1(Vector value) const; | 
					
						
							|  |  |  |   Matrix return_matrix1(Matrix value) const; | 
					
						
							|  |  |  |   Vector return_vector2(Vector value) const; | 
					
						
							|  |  |  |   Matrix return_matrix2(Matrix value) const; | 
					
						
							| 
									
										
										
										
											2011-12-07 11:05:37 +08:00
										 |  |  |   void arg_EigenConstRef(const Matrix& value) const; | 
					
						
							| 
									
										
										
										
											2011-10-14 02:41:56 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   bool return_field(const Test& t) const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-02 10:32:18 +08:00
										 |  |  |   Test* return_TestPtr(Test* value) const; | 
					
						
							| 
									
										
										
										
											2011-12-07 11:05:33 +08:00
										 |  |  |   Test  return_Test(Test* value) const; | 
					
						
							| 
									
										
										
										
											2011-10-14 02:41:56 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-13 08:26:06 +08:00
										 |  |  |   gtsam::Point2* return_Point2Ptr(bool value) const; | 
					
						
							| 
									
										
										
										
											2011-12-02 06:06:03 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-02 10:32:18 +08:00
										 |  |  |   pair<Test*,Test*> create_ptrs () const; | 
					
						
							| 
									
										
										
										
											2011-12-07 11:05:33 +08:00
										 |  |  |   pair<Test ,Test*> create_MixedPtrs () const; | 
					
						
							| 
									
										
										
										
											2011-12-02 10:32:18 +08:00
										 |  |  |   pair<Test*,Test*> return_ptrs (Test* p1, Test* p2) const; | 
					
						
							| 
									
										
										
										
											2011-10-14 02:41:56 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-02 10:32:18 +08:00
										 |  |  |   void print() const; | 
					
						
							| 
									
										
										
										
											2011-12-02 06:06:03 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   // comments at the end!
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // even more comments at the end!
 | 
					
						
							| 
									
										
										
										
											2011-10-14 02:41:56 +08:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2011-12-02 06:06:03 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-23 22:09:40 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | Vector aGlobalFunction(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-26 04:28:59 +08:00
										 |  |  | // An overloaded global function
 | 
					
						
							|  |  |  | Vector overloadedGlobalFunction(int a); | 
					
						
							|  |  |  | Vector overloadedGlobalFunction(int a, double b); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-12 00:30:18 +08:00
										 |  |  | // A base class
 | 
					
						
							|  |  |  | virtual class MyBase { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // A templated class
 | 
					
						
							| 
									
										
										
										
											2014-12-01 21:42:19 +08:00
										 |  |  | template<T = {gtsam::Point2, Matrix}> | 
					
						
							| 
									
										
										
										
											2014-11-12 00:30:18 +08:00
										 |  |  | virtual class MyTemplate : MyBase { | 
					
						
							|  |  |  |   MyTemplate(); | 
					
						
							| 
									
										
										
										
											2014-11-12 05:38:50 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-29 20:45:11 +08:00
										 |  |  |   template<ARG = {gtsam::Point2, gtsam::Point3, Vector, Matrix}> | 
					
						
							| 
									
										
										
										
											2014-11-30 17:37:25 +08:00
										 |  |  |   ARG templatedMethod(const ARG& t); | 
					
						
							| 
									
										
										
										
											2014-11-13 02:09:30 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   // Stress test templates and pointer combinations
 | 
					
						
							|  |  |  |   void accept_T(const T& value) const; | 
					
						
							|  |  |  |   void accept_Tptr(T* value) const; | 
					
						
							|  |  |  |   T* return_Tptr(T* value) const; | 
					
						
							|  |  |  |   T  return_T(T* value) const; | 
					
						
							|  |  |  |   pair<T*,T*> create_ptrs () const; | 
					
						
							|  |  |  |   pair<T ,T*> create_MixedPtrs () const; | 
					
						
							|  |  |  |   pair<T*,T*> return_ptrs (T* p1, T* p2) const; | 
					
						
							| 
									
										
										
										
											2014-11-12 00:30:18 +08:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-12 06:09:20 +08:00
										 |  |  | // A doubly templated class
 | 
					
						
							|  |  |  | template<POSE, POINT> | 
					
						
							|  |  |  | class MyFactor { | 
					
						
							|  |  |  |   MyFactor(size_t key1, size_t key2, double measured, const gtsam::noiseModel::Base* noiseModel); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // and a typedef specializing it
 | 
					
						
							| 
									
										
										
										
											2014-11-29 20:53:59 +08:00
										 |  |  | typedef MyFactor<gtsam::Pose2, Matrix> MyFactorPosePoint2; | 
					
						
							| 
									
										
										
										
											2014-11-12 00:30:18 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-02 06:06:03 +08:00
										 |  |  | // comments at the end!
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // even more comments at the end!
 |