Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4487 in orxonox.OLD for orxonox/trunk/src


Ignore:
Timestamp:
Jun 3, 2005, 12:56:57 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: more doxygen-tags in util

Location:
orxonox/trunk/src/util/loading
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/util/loading/factory.cc

    r4261 r4487  
    3030   set everything to zero and define factoryName
    3131*/
    32 Factory::Factory (const char* name)
     32Factory::Factory (const char* factoryName)
    3333{
    3434  this->factoryName = NULL;
    35   this->setFactoryName(name);
     35  this->setFactoryName(factoryName);
    3636  next = NULL;
    3737 
     
    5151  if (this->next)
    5252    delete this->next;
     53
     54  if (this->factoryName)
     55    delete []this->factoryName;
    5356}
    5457
    55 void Factory::setFactoryName(const char* name)
     58/**
     59   \brief sets the name of this factory
     60*/
     61void Factory::setFactoryName(const char* factoryName)
    5662{
    57   if (factoryName)
    58     delete factoryName;
    59   factoryName = new char[strlen(name)+1];
    60   strcpy(factoryName, name);
     63  if (this->factoryName)
     64    delete this->factoryName;
     65  this->factoryName = new char[strlen(factoryName)+1];
     66  strcpy(this->factoryName, factoryName);
    6167}
    6268
     
    8894}
    8995
    90 const char* grabParameter(const TiXmlElement* root, const char* name)
     96/**
     97   \param root: The XML-element to grab a parameter from
     98   \param parameterName: the parameter to grab
     99   \returns the Value of the parameter if found, NULL otherwise
     100*/
     101const char* grabParameter(const TiXmlElement* root, const char* parameterName)
    91102{
    92103  const TiXmlElement* element;
     
    95106  if (root == NULL)
    96107    return NULL;
    97   assert( name != NULL);
     108  assert( parameterName != NULL);
    98109       
    99   element = root->FirstChildElement( name);
     110  element = root->FirstChildElement( parameterName);
    100111  if( element == NULL) return NULL;
    101112       
  • orxonox/trunk/src/util/loading/factory.h

    r4261 r4487  
    1616/*!
    1717  \file factory.h
    18   \brief philosophy stuff
     18  \brief A loadable object handler
    1919*/
    2020
     
    3434*/
    3535#define CREATE_FACTORY(CLASS_NAME) tFactory<CLASS_NAME>* global_##CLASS_NAME##Factory = new tFactory<CLASS_NAME>(#CLASS_NAME)           
    36 //! The Factory is
     36
     37//! The Factory is a loadable object handler
    3738class Factory {
    3839
    3940 public:
    40   Factory (const char* name = NULL);
     41  Factory (const char* factoryName = NULL);
    4142  ~Factory ();
    4243 
     
    4546  void initialize();
    4647  void registerFactory( Factory* factory);
    47   void setFactoryName(const char* name);
    48   const char* getFactoryName() {return factoryName;};
    49   void setNext( Factory* factory) {next = factory;}
    50   Factory* getNext() {return next;}
     48  void setFactoryName(const char* factoryName);
     49  /** \returns the name of the factory */
     50  const char* getFactoryName() { return this->factoryName; };
     51  /** \brief sets the Next factory in the list \param nextFactory the next factory */
     52  inline void setNext( Factory* nextFactory) { this->next = nextFactory; };
     53  /** \returns the next factory */
     54  Factory* getNext(void) const { return this->next; };
    5155       
     56 protected:
     57  char*         factoryName;          //!< the name of the factory
    5258 private:
    53   char* factoryName;
    54        
    55   Factory* next;
     59  Factory*      next;                 //!< pointer to the next factory.
    5660};
    5761
     62/**
     63   \brief a factory that is able to load any kind of Object
     64   (this is a Functor)
     65*/
    5866template<class T> class tFactory : public Factory
    5967{
    6068 public:
    61   tFactory(const char* name);
     69  tFactory(const char* factoryName);
    6270  virtual ~tFactory();
    6371 
     
    6674};
    6775
     76/**
     77   \brief construnts a factory with
     78   \param factoryName the name of the factory
     79*/
    6880template<class T>
    69 tFactory<T>::tFactory(const char* name) : Factory(name)
     81tFactory<T>::tFactory(const char* factoryName) : Factory(factoryName)
    7082{
    71   PRINTF(5)("fileName: %s\n", name);
     83  PRINTF(5)("fileName: %s loadable\n", this->factoryName);
    7284}
    7385 
     
    90102// helper function
    91103
    92 const char* grabParameter(const TiXmlElement* root, const char* name);
     104const char* grabParameter(const TiXmlElement* root, const char* parameterName);
    93105
    94106#endif /* _FACTORY_H */
  • orxonox/trunk/src/util/loading/game_loader.cc

    r4445 r4487  
    3737
    3838/**
    39   \brief simple constructor
    40  */
     39   \brief simple constructor
     40*/
    4141GameLoader::GameLoader ()
    4242{
     
    4646
    4747/**
    48   \brief simple deconstructor
    49  */
     48   \brief simple deconstructor
     49*/
    5050GameLoader::~GameLoader () {}
    5151
     
    6464}
    6565
    66 
     66/**
     67   \brief initializes the GameLoader
     68*/
    6769ErrorMessage GameLoader::init()
    6870{
     
    8082/**
    8183   \brief reads a campaign definition file into a campaign class
    82    \param filename to be loaded
     84   \param fileName to be loaded
    8385   \returns the loaded campaign
    8486
    8587   this will interprete the map/campaign files and recursivly load a tree of worlds/campaigns
    8688*/
    87 ErrorMessage GameLoader::loadCampaign(const char* name)
     89ErrorMessage GameLoader::loadCampaign(const char* fileName)
    8890{
    8991  ErrorMessage errorCode;
    90   char* campaignName = ResourceManager::getFullName(name);
     92  char* campaignName = ResourceManager::getFullName(fileName);
    9193  if (campaignName)
    9294    {
     
    101103/**
    102104   \brief loads a debug campaign for test purposes only.
    103    \param the identifier of the campaign.
     105   \param campaignID the identifier of the campaign.
    104106   \returns error message if not able to do so.
    105107*/
     
    198200 */
    199201ErrorMessage GameLoader::destroy()
    200 {}
     202{
     203
     204}
    201205
    202206
    203207/**
    204208   \brief reads a campaign definition file into a campaign class
    205    \param filename to be loaded
     209   \param fileName to be loaded
    206210   \returns the loaded campaign
    207211
    208212   this will interprete the map/campaign files and recursivly load a tree of worlds/campaigns
    209213*/
    210 Campaign* GameLoader::fileToCampaign(const char *name)
     214Campaign* GameLoader::fileToCampaign(const char* fileName)
    211215{
    212216  /* do not entirely load the campaign. just the current world
     
    215219  */
    216220 
    217   if( name == NULL)
     221  if( fileName == NULL)
    218222    {
    219223      PRINTF(2)("No filename specified for loading");
     
    221225    }
    222226 
    223   TiXmlDocument* XMLDoc = new TiXmlDocument( name);
     227  TiXmlDocument* XMLDoc = new TiXmlDocument( fileName);
    224228  // load the campaign document
    225229  if( !XMLDoc->LoadFile())
    226230    {
    227231      // report an error
    228       PRINTF(1)("Could not load XML File %s: %s @ %d:%d\n", name, XMLDoc->ErrorDesc(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
     232      PRINTF(1)("Could not load XML File %s: %s @ %d:%d\n", fileName, XMLDoc->ErrorDesc(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
    229233      delete XMLDoc;
    230234      return NULL;
     
    255259/**
    256260   \brief handle keyboard commands
    257    \param the event to handle
     261   \param event the event to handle
    258262*/
    259263void GameLoader::process(const Event& event)
     
    290294
    291295
    292 /*
     296/**
    293297  \brief this changes to the next level
    294298*/
     
    300304
    301305
    302 /*
     306/**
    303307  \brief change to the previous level - not implemented
    304308
  • orxonox/trunk/src/util/loading/game_loader.h

    r4411 r4487  
    4242
    4343 public:
     44  ~GameLoader ();
     45
    4446  static GameLoader* getInstance();
    4547
     
    5557  void previousLevel();
    5658
     59  /** \brief a world command to send to the GameLoader \param cmd the command */
    5760  bool worldCommand(Command* cmd);
    5861  ErrorMessage loadDebugCampaign(Uint32 campaignID);
    5962 
    60   void registerFactory( Factory* factory);
     63  void registerFactory( Factory* factory );
    6164  BaseObject* fabricate( TiXmlElement* data);
    6265
     
    6568 private:
    6669  GameLoader ();
    67   ~GameLoader ();
    68   Uint32 startTime; //!> start time of the campaign
    69   static GameLoader* singletonRef;
    70   bool isPaused;
    7170
    72   Campaign* currentCampaign; //!> the current campaign playing
     71  Campaign* fileToCampaign(const char* name);
     72
     73 private:
     74  static GameLoader*     singletonRef;         //!< The singleton-reference to this object
     75
     76  Uint32                 startTime;            //!< start time of the campaign
     77  bool                   isPaused;             //!< if the game is paused
     78
     79  Campaign*              currentCampaign;      //!< the current campaign playing
    7380 
    74   Campaign* fileToCampaign(const char* name);
    75   EventHandler* eventHandler;
     81  EventHandler*          eventHandler;         //!< reference to the eventHandler
    7682
    77   Factory* first;
     83  Factory*               first;                //!< the first factory of them all
    7884};
    7985
  • orxonox/trunk/src/util/loading/load_param.cc

    r4299 r4487  
    2323/**
    2424   \param object The object this Parameter is loaded too.
    25    \param paramName The name of the parameter loaded.
    26    \param paramCount how many parameters this loading-function takes
    27    \param ... the parameter information
     25   \param root: the XML-element to load this option from.
     26   \param paramName: The name of the parameter loaded.
     27   \param paramCount: how many parameters this loading-function takes
     28   \param ...: the parameter information
    2829*/
    2930BaseLoadParam::BaseLoadParam(const TiXmlElement* root, BaseObject* object, const char* paramName, int paramCount, ...)
  • orxonox/trunk/src/util/loading/load_param.h

    r4318 r4487  
    3838*/
    3939
    40 #define l_INT_TYPE int
    41 #define l_INT_FUNC atoi
    42 #define l_INT_NAME "int"
    43 
    44 #define l_LONG_TYPE long
    45 #define l_LONG_FUNC atol
    46 #define l_LONG_NAME "long"
    47 
    48 #define l_SHORT_TYPE short
    49 #define l_SHORT_FUNC atoi
    50 #define l_SHORT_NAME "short"
    51 
    52 #define l_FLOAT_TYPE float
    53 #define l_FLOAT_FUNC atof
    54 #define l_FLOAT_NAME "float"
    55 
    56 #define l_STRING_TYPE const char*
    57 #define l_STRING_FUNC
    58 #define l_STRING_NAME "string"
    59 
    60 
    61 /**
    62    \brief a Macro to easily implement many different Constructors for the LoadParam-Class
     40#define l_INT_TYPE       int              //!< The type of an INT
     41#define l_INT_FUNC       atoi             //!< the function to call to parse INT
     42#define l_INT_NAME       "int"            //!< the name of an INT
     43
     44#define l_LONG_TYPE      long             //!< The type of a LONG
     45#define l_LONG_FUNC      atol             //!< The function to parse a LONG
     46#define l_LONG_NAME      "long"           //!< The name of a LONG
     47
     48#define l_SHORT_TYPE     short            //!< The type of a SHORT
     49#define l_SHORT_FUNC     atoi             //!< The function to parse a SHORT
     50#define l_SHORT_NAME     "short"          //!< The name of a SHORT
     51
     52#define l_FLOAT_TYPE     float            //!< The type of a FLOAT
     53#define l_FLOAT_FUNC     atof             //!< The function to parse a FLOAT
     54#define l_FLOAT_NAME     "float"          //!< The name of a FLOAT
     55
     56#define l_STRING_TYPE    const char*      //!< The type fo a STRING
     57#define l_STRING_FUNC                     //!< The function to parse a STRING
     58#define l_STRING_NAME    "string"         //!< The name of a STRING
     59
     60// 1. TYPE
     61/**
     62   \brief a Macro to easily implement many different Constructors for the LoadParam-Class with 1 argument
    6363   \param type1 The type of the first functionParameter
    6464*/
     
    7575
    7676// 2. TYPES
     77/**
     78   \brief a Macro to easily implement many different Constructors for the LoadParam-Class with 2 arguments
     79   \param type1 The type of the first functionParameter
     80   \param type2 The type of the second functionParameter
     81*/
    7782#define LoadParam2(type1, type2) \
    7883 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE)) \
     
    9499
    95100// 3. TYPES
     101/**
     102   \brief a Macro to easily implement many different Constructors for the LoadParam-Class with 3 arguments
     103   \param type1 The type of the first functionParameter
     104   \param type2 The type of the second functionParameter
     105   \param type3 The type of the third functionParameter
     106*/
    96107#define LoadParam3(type1, type2, type3) \
    97108 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE, type3##_TYPE))\
     
    113124
    114125// 4. TYPES
     126/**
     127   \brief a Macro to easily implement many different Constructors for the LoadParam-Class with 4 arguments
     128   \param type1 The type of the first functionParameter
     129   \param type2 The type of the second functionParameter
     130   \param type3 The type of the third functionParameter
     131   \param type4 The type of the forth functionParameter
     132*/
    115133#define LoadParam4(type1, type2, type3, type4) \
    116134 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE)) \
     
    132150
    133151// 5. TYPES
     152/**
     153   \brief a Macro to easily implement many different Constructors for the LoadParam-Class with 5 arguments
     154   \param type1 The type of the first functionParameter
     155   \param type2 The type of the second functionParameter
     156   \param type3 The type of the third functionParameter
     157   \param type4 The type of the forth functionParameter
     158   \param type5 The type of the fifth functionParameter
     159*/
    134160#define LoadParam5(type1, type2, type3, type4, type5) \
    135161 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE, type5##_TYPE)) \
     
    161187  void setDescription(const char* descriptionText);
    162188  /** \returns the descriptionString */
    163   const char* getDescription(void) { return this->description;};
     189  const char* getDescription(void) { return this->description; };
    164190
    165191  void print(void) const;
    166192 private:
    167   char* paramName;              //!< The name of the parameter
    168   int paramCount;               //!< The count of parameters
    169   char** types;                 //!< What kind of parameters does this function take ??
    170   char* description;            //!< A longer description about this function
    171 };
    172 
     193  char*         paramName;             //!< The name of the parameter
     194  int           paramCount;            //!< The count of parameters
     195  char**        types;                 //!< What kind of parameters does this function take ??
     196  char*         description;           //!< A longer description about this function
     197};
     198
     199//! A class for descriptions of a loadable module
    173200class LoadClassDescription
    174201{
     
    184211  static void printAll(const char* fileName = NULL);
    185212
    186   static bool parametersDescription;             //!< if parameter-description should be enabled.
    187   static tList<LoadClassDescription>* classList; //!< a list, that holds all the loadable classes. (after one instance has been loaded)
    188213 private:
    189   char* className;                               //!< name of the class
    190   tList<LoadParamDescription>* paramList;        //!< List of parameters this class knows.
    191 };
    192 
    193 // abstract Base class
     214  static bool                         parametersDescription;  //!< if parameter-description should be enabled.
     215  static tList<LoadClassDescription>* classList;              //!< a list, that holds all the loadable classes. (after one instance has been loaded)
     216  char*                               className;              //!< name of the class
     217  tList<LoadParamDescription>*        paramList;              //!< List of parameters this class knows.
     218};
     219
     220//! abstract Base class for a Loadable parameter
    194221class BaseLoadParam
    195222{
     
    201228
    202229 protected:
    203   LoadClassDescription* classDesc;               //!< The LoadClassDescription of this LoadParameter
    204   LoadParamDescription* paramDesc;               //!< The LoadParameterDescription of this LoadParameter
    205   const char* loadString;                        //!< The string loaded by this LoadParam
     230  LoadClassDescription*    classDesc;            //!< The LoadClassDescription of this LoadParameter
     231  LoadParamDescription*    paramDesc;            //!< The LoadParameterDescription of this LoadParameter
     232  const char*              loadString;           //!< The string loaded by this LoadParam
    206233};
    207234
     
    211238{
    212239 public:
     240  //! makes functions with one string loadable
    213241  LoadParam1(l_STRING);
     242  //! makes functions with two strings loadable
    214243  LoadParam2(l_STRING, l_STRING);
     244  //! makes functions with three strings loadable
    215245  LoadParam3(l_STRING, l_STRING, l_STRING);
     246  //! makes functions with four strings loadable
    216247  LoadParam4(l_STRING, l_STRING, l_STRING, l_STRING);
    217248
     249  //! makes functions with one int loadable
    218250  LoadParam1(l_INT);
     251  //! makes functions with two ints loadable
    219252  LoadParam2(l_INT, l_INT);
     253  //! makes functions with three ints loadable
    220254  LoadParam3(l_INT, l_INT, l_INT);
     255  //! makes functions with four ints loadable
    221256  LoadParam4(l_INT, l_INT, l_INT, l_INT);
    222257
     258  //! makes functions with one float loadable
    223259  LoadParam1(l_FLOAT);
     260  //! makes functions with two floats loadable
    224261  LoadParam2(l_FLOAT, l_FLOAT);
     262  //! makes functions with three floats loadable
    225263  LoadParam3(l_FLOAT, l_FLOAT, l_FLOAT);
     264  //! makes functions with four floats loadable
    226265  LoadParam4(l_FLOAT, l_FLOAT, l_FLOAT, l_FLOAT);
    227266};
Note: See TracChangeset for help on using the changeset viewer.