[4592] | 1 | /* |
---|
[4250] | 2 | orxonox - the future of 3D-vertical-scrollers |
---|
[4233] | 3 | |
---|
[4250] | 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 | |
---|
[4592] | 16 | /*! |
---|
[9765] | 17 | * @file load_param_class_description.h |
---|
[5129] | 18 | * A Class and macro-functions, that makes our lives easy to load-in parameters |
---|
| 19 | */ |
---|
[4250] | 20 | |
---|
[9765] | 21 | #ifndef _LOAD_PARAM_CLASS_DESCRIPTION_H |
---|
| 22 | #define _LOAD_PARAM_CLASS_DESCRIPTION_H |
---|
[4233] | 23 | |
---|
[9765] | 24 | #include "load_param_description.h" |
---|
[9771] | 25 | #include "class_id.h" |
---|
| 26 | #include <map> |
---|
[4251] | 27 | // Forward Declaration // |
---|
[5556] | 28 | class MultiType; |
---|
[4251] | 29 | |
---|
[9765] | 30 | //! A class for descriptions of a loadable module |
---|
| 31 | class LoadParamClassDescription |
---|
[5332] | 32 | { |
---|
[7221] | 33 | public: |
---|
[9771] | 34 | LoadParamClassDescription(const std::string& className = ""); |
---|
[5332] | 35 | |
---|
[9776] | 36 | //! Compares a LoadParamClassDescription with a String. |
---|
[9767] | 37 | bool operator==(const std::string& className) const { return this->_className == className; }; |
---|
[9776] | 38 | //! Compares two LoadParamClassDescription with each other |
---|
[9767] | 39 | bool operator==(const LoadParamClassDescription& classDescr) const { return this->_className == classDescr._className; }; |
---|
[9776] | 40 | //! Compares two LoadParamClassDescription with each other, using the less operator |
---|
[9767] | 41 | bool operator<(const LoadParamClassDescription& classDescr) const { return this->_className < classDescr._className; } |
---|
[5332] | 42 | |
---|
| 43 | |
---|
[9771] | 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); |
---|
[9767] | 52 | |
---|
[9776] | 53 | /** @param createThem: if the Parameters should be created/stored. */ |
---|
[9779] | 54 | static void captureDescriptions(bool createThem) { _captureDescriptions = createThem; }; |
---|
[9776] | 55 | /** @returns if the Parameters are created/stored. */ |
---|
[9779] | 56 | static bool descriptionsCaptured() { return _captureDescriptions; }; |
---|
[9775] | 57 | |
---|
[9771] | 58 | static void deleteAllDescriptions(); |
---|
[9767] | 59 | |
---|
[9779] | 60 | void print(FILE* stream = stdout, bool withComments = true) const; |
---|
[9777] | 61 | static void printAll(const std::string& fileName = "", bool withComments = true); |
---|
| 62 | static void printAllTo(FILE* stream = stdout, bool withComments = true); |
---|
[5332] | 63 | |
---|
[7221] | 64 | private: |
---|
[9776] | 65 | //! A Type definition for the Map of Class Descriptions |
---|
[9771] | 66 | typedef std::map<ClassID, LoadParamClassDescription> ClassDescriptionMap; |
---|
[9776] | 67 | //! A type definition for the Map of Parameter Descriptions inside of Class-descriptions. |
---|
[9771] | 68 | typedef std::map<std::string, LoadParamDescription> ParamDescriptionMap; |
---|
[9765] | 69 | |
---|
[9771] | 70 | private: |
---|
| 71 | static ParamDescriptionMap::iterator getParamDescription(const ClassID& classID, const std::string& paramName); |
---|
| 72 | |
---|
| 73 | private: |
---|
| 74 | |
---|
[9779] | 75 | static bool _captureDescriptions; //!< if parameter-description should be enabled globally. |
---|
[5556] | 76 | |
---|
[9771] | 77 | static ClassDescriptionMap _classList; //!< a list, that stores all the loadable classes. (after one instance has been loaded) |
---|
[9767] | 78 | |
---|
| 79 | private: |
---|
| 80 | std::string _className; //!< name of the class |
---|
[9771] | 81 | ParamDescriptionMap _parameters; //!< List of parameters this class knows. |
---|
[5332] | 82 | }; |
---|
| 83 | |
---|
[9765] | 84 | #endif /* _LOAD_PARAM_CLASS_DESCRIPTION_H */ |
---|