Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/new_class_id/src/lib/util/loading/load_param_class_description.h @ 9775

Last change on this file since 9775 was 9775, checked in by bensch, 18 years ago

loadParam descriptions can be printed nicely, and also switched on and off globally

File size: 2.8 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11   ### File Specific:
12   main-programmer: Benjamin Grauer
13   co-programmer: ...
14*/
15
16/*!
17 * @file load_param_class_description.h
18 * A Class and macro-functions, that makes our lives easy to load-in parameters
19 */
20
21#ifndef _LOAD_PARAM_CLASS_DESCRIPTION_H
22#define _LOAD_PARAM_CLASS_DESCRIPTION_H
23
24#include "load_param_description.h"
25#include "class_id.h"
26#include <map>
27#include <set>
28// Forward Declaration //
29class MultiType;
30
31//! A class for descriptions of a loadable module
32class LoadParamClassDescription
33{
34public:
35  LoadParamClassDescription(const std::string& className = "");
36  ~LoadParamClassDescription();
37
38  bool operator==(const std::string& className) const { return this->_className == className; };
39  bool operator==(const LoadParamClassDescription& classDescr) const { return this->_className == classDescr._className; };
40  bool operator<(const LoadParamClassDescription& classDescr) const { return this->_className < classDescr._className; }
41
42
43  static void describeClass(const ClassID& classID,
44                            const std::string& paramName,
45                            const std::string& descriptionText);
46  static void setValuesOf(const ClassID& classID,
47                          const std::string& paramName,
48                          unsigned int paramCount,
49                          const MultiType* const defaultValues,
50                          bool retVal = false);
51
52
53  static void createDescriptions(bool createThem) { _createParametersDescription = createThem; };
54  static bool createsDescriptions() { return _createParametersDescription; };
55
56  static void deleteAllDescriptions();
57
58  static void printAll(const std::string& fileName = "");
59
60private:
61  typedef std::map<ClassID, LoadParamClassDescription>  ClassDescriptionMap;
62  typedef std::map<std::string, LoadParamDescription>   ParamDescriptionMap;
63
64private:
65  static ParamDescriptionMap::iterator getParamDescription(const ClassID& classID, const std::string& paramName);
66
67private:
68
69  static bool                                  _createParametersDescription;  //!< if parameter-description should be enabled globally.
70
71  static ClassDescriptionMap                   _classList;              //!< a list, that stores all the loadable classes. (after one instance has been loaded)
72
73private:
74  std::string                                  _className;              //!< name of the class
75  ParamDescriptionMap                          _parameters;             //!< List of parameters this class knows.
76};
77
78#endif /* _LOAD_PARAM_CLASS_DESCRIPTION_H */
Note: See TracBrowser for help on using the repository browser.