Changeset 5536 in orxonox.OLD for trunk/src/lib
- Timestamp:
- Nov 10, 2005, 10:52:34 PM (19 years ago)
- Location:
- trunk/src/lib
- Files:
-
- 2 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/Makefile.am
r5463 r5536 39 39 util/color.cc \ 40 40 util/helper_functions.cc \ 41 util/multi_type.cc \ 41 42 math/vector.cc \ 42 43 math/curve.cc … … 55 56 util/color.h \ 56 57 util/helper_functions.h \ 58 util/multi_type.h \ 57 59 math/vector.h \ 58 60 math/curve.h -
trunk/src/lib/Makefile.in
r5479 r5536 57 57 base_object.$(OBJEXT) class_list.$(OBJEXT) \ 58 58 ini_parser.$(OBJEXT) substring.$(OBJEXT) color.$(OBJEXT) \ 59 helper_functions.$(OBJEXT) vector.$(OBJEXT) curve.$(OBJEXT) 59 helper_functions.$(OBJEXT) multi_type.$(OBJEXT) \ 60 vector.$(OBJEXT) curve.$(OBJEXT) 60 61 libORXlibs_a_OBJECTS = $(am_libORXlibs_a_OBJECTS) 61 62 DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) … … 227 228 util/color.cc \ 228 229 util/helper_functions.cc \ 230 util/multi_type.cc \ 229 231 math/vector.cc \ 230 232 math/curve.cc … … 243 245 util/color.h \ 244 246 util/helper_functions.h \ 247 util/multi_type.h \ 245 248 math/vector.h \ 246 249 math/curve.h … … 310 313 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/helper_functions.Po@am__quote@ 311 314 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ini_parser.Po@am__quote@ 315 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/multi_type.Po@am__quote@ 312 316 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/null_parent.Po@am__quote@ 313 317 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/p_node.Po@am__quote@ … … 440 444 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 441 445 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o helper_functions.obj `if test -f 'util/helper_functions.cc'; then $(CYGPATH_W) 'util/helper_functions.cc'; else $(CYGPATH_W) '$(srcdir)/util/helper_functions.cc'; fi` 446 447 multi_type.o: util/multi_type.cc 448 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT multi_type.o -MD -MP -MF "$(DEPDIR)/multi_type.Tpo" -c -o multi_type.o `test -f 'util/multi_type.cc' || echo '$(srcdir)/'`util/multi_type.cc; \ 449 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/multi_type.Tpo" "$(DEPDIR)/multi_type.Po"; else rm -f "$(DEPDIR)/multi_type.Tpo"; exit 1; fi 450 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='util/multi_type.cc' object='multi_type.o' libtool=no @AMDEPBACKSLASH@ 451 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 452 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o multi_type.o `test -f 'util/multi_type.cc' || echo '$(srcdir)/'`util/multi_type.cc 453 454 multi_type.obj: util/multi_type.cc 455 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT multi_type.obj -MD -MP -MF "$(DEPDIR)/multi_type.Tpo" -c -o multi_type.obj `if test -f 'util/multi_type.cc'; then $(CYGPATH_W) 'util/multi_type.cc'; else $(CYGPATH_W) '$(srcdir)/util/multi_type.cc'; fi`; \ 456 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/multi_type.Tpo" "$(DEPDIR)/multi_type.Po"; else rm -f "$(DEPDIR)/multi_type.Tpo"; exit 1; fi 457 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='util/multi_type.cc' object='multi_type.obj' libtool=no @AMDEPBACKSLASH@ 458 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 459 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o multi_type.obj `if test -f 'util/multi_type.cc'; then $(CYGPATH_W) 'util/multi_type.cc'; else $(CYGPATH_W) '$(srcdir)/util/multi_type.cc'; fi` 442 460 443 461 vector.o: math/vector.cc -
trunk/src/lib/util/multi_type.cc
r5529 r5536 16 16 //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_ 17 17 18 #include "proto_class.h" 18 #include "multi_type.h" 19 #include "stdincl.h" 19 20 20 21 using namespace std; 21 22 22 23 /** 24 * standard constructor 25 * @todo this constructor is not jet implemented - do it 26 */ 27 ProtoClass::ProtoClass () 23 MultiType::MultiType(int value) 28 24 { 29 this->setClassID(CL_PROTO_ID, "ProtoClass"); 30 31 /* If you make a new class, what is most probably the case when you write this file 32 don't forget to: 33 1. Add the new file new_class.cc to the ./src/Makefile.am 34 2. Add the class identifier to ./src/class_id.h eg. CL_NEW_CLASS 35 36 Advanced Topics: 37 - if you want to let your object be managed via the ObjectManager make sure to read 38 the object_manager.h header comments. You will use this most certanly only if you 39 make many objects of your class, like a weapon bullet. 40 */ 25 this->type = M_Int; 26 this->value.typeInt = value; 41 27 } 42 28 29 30 MultiType::MultiType(float value) 31 { 32 this->type = M_Float; 33 this->value.typeFloat = value; 34 } 35 36 37 MultiType::MultiType(char value) 38 { 39 this->type = M_Char; 40 this->value.typeChar = value; 41 } 42 43 44 MultiType::MultiType(const char* value) 45 { 46 this->type = M_String; 47 this->value.typeString = new char[strlen(value)+1]; 48 strcpy(this->value.typeString, value); 49 } 43 50 44 51 /** 45 52 * standard deconstructor 46 53 */ 47 ProtoClass::~ProtoClass()54 MultiType::~MultiType () 48 55 { 49 56 // delete what has to be deleted here -
trunk/src/lib/util/multi_type.h
r5529 r5536 1 1 /*! 2 * @file proto_class.h2 * @file multi_type.h 3 3 * @brief Definition of ... 4 4 */ 5 5 6 #ifndef _PROTO_CLASS_H 7 #define _PROTO_CLASS_H 8 9 #include "base_object.h" 6 #ifndef _MULTI_TYPE_H 7 #define _MULTI_TYPE_H 10 8 11 9 // FORWARD DECLARATION 12 10 13 11 12 typedef enum 13 { 14 M_Int, 15 M_Float, 16 M_Char, 17 M_String, 18 19 } M_Type; 20 21 14 22 15 23 //! A class for ... 16 class ProtoClass : public BaseObject{24 class MultiType { 17 25 18 26 public: 19 ProtoClass(); 20 virtual ~ProtoClass(); 27 MultiType(int value); 28 MultiType(float value); 29 MultiType(char value); 30 MultiType(const char* value); 31 32 virtual ~MultiType(); 21 33 22 34 23 35 private: 24 36 37 M_Type type; 38 union Type 39 { 40 int typeInt; 41 float typeFloat; 42 char typeChar; 43 char* typeString; 44 } value; 45 46 47 25 48 }; 26 49 27 #endif /* _ PROTO_CLASS_H */50 #endif /* _MULTI_TYPE_H */
Note: See TracChangeset
for help on using the changeset viewer.