Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/util/loading/load_param_class_description.h @ 10317

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

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

File size: 3.4 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// Forward Declaration //
28class MultiType;
29
30//! A class for descriptions of a loadable module
31class LoadParamClassDescription
32{
33public:
34  LoadParamClassDescription(const std::string& className = "");
35
36  //! Compares a LoadParamClassDescription with a String.
37  bool operator==(const std::string& className) const { return this->_className == className; };
38  //! Compares two LoadParamClassDescription with each other
39  bool operator==(const LoadParamClassDescription& classDescr) const { return this->_className == classDescr._className; };
40  //! Compares two LoadParamClassDescription with each other, using the less operator
41  bool operator<(const LoadParamClassDescription& classDescr) const { return this->_className < classDescr._className; }
42
43
44  static void describeClass(const ClassID& classID,
45                            const std::string& paramName,
46                            const std::string& descriptionText);
47  static void setValuesOf(const ClassID& classID,
48                          const std::string& paramName,
49                          unsigned int paramCount,
50                          const MultiType* const defaultValues,
51                          bool retVal = false);
52
53  /** @param createThem: if the Parameters should be created/stored. */
54  static void captureDescriptions(bool createThem) { _captureDescriptions = createThem; };
55  /** @returns if the Parameters are created/stored. */
56  static bool descriptionsCaptured() { return _captureDescriptions; };
57
58  static void deleteAllDescriptions();
59
60  void print(FILE* stream = stdout, bool withComments = true) const;
61  static void printAll(const std::string& fileName = "", bool withComments = true);
62  static void printAllTo(FILE* stream = stdout, bool withComments = true);
63
64private:
65  //! A Type definition for the Map of Class Descriptions
66  typedef std::map<ClassID, LoadParamClassDescription>  ClassDescriptionMap;
67  //! A type definition for the Map of Parameter Descriptions inside of Class-descriptions.
68  typedef std::map<std::string, LoadParamDescription>   ParamDescriptionMap;
69
70private:
71  static ParamDescriptionMap::iterator getParamDescription(const ClassID& classID, const std::string& paramName);
72
73private:
74
75  static bool                                  _captureDescriptions;    //!< if parameter-description should be enabled globally.
76
77  static ClassDescriptionMap                   _classList;              //!< a list, that stores all the loadable classes. (after one instance has been loaded)
78
79private:
80  std::string                                  _className;              //!< name of the class
81  ParamDescriptionMap                          _parameters;             //!< List of parameters this class knows.
82};
83
84#endif /* _LOAD_PARAM_CLASS_DESCRIPTION_H */
Note: See TracBrowser for help on using the repository browser.