cconfigoption.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef __CCONFIGOPTION_H
00017 #define __CCONFIGOPTION_H
00018
00019 #include <string>
00020 #include "cownedobject.h"
00021
00022 NAMESPACE_BEGIN
00023
00024
00034 class SIM_API cConfigOption : public cNoncopyableOwnedObject
00035 {
00036 public:
00038 enum Type {
00039 CFG_BOOL,
00040 CFG_INT,
00041 CFG_DOUBLE,
00042 CFG_STRING,
00043 CFG_FILENAME,
00044 CFG_FILENAMES,
00045 CFG_PATH,
00046 CFG_CUSTOM
00047 };
00048
00050 enum ObjectKind {
00051 KIND_NONE,
00052 KIND_MODULE,
00053 KIND_SIMPLE_MODULE,
00054 KIND_UNSPECIFIED_TYPE,
00055 KIND_PARAMETER,
00056 KIND_STATISTIC,
00057 KIND_SCALAR,
00058 KIND_VECTOR,
00059 KIND_OTHER
00060 };
00061
00062
00063 bool isPerObject_;
00064 bool isGlobal_;
00065 ObjectKind objectKind_;
00066 Type type_;
00067 std::string unit_;
00068 std::string defaultValue_;
00069 std::string description_;
00070
00071 public:
00077 cConfigOption(const char *name, bool isGlobal, Type type, const char *unit,
00078 const char *defaultValue, const char *description);
00079
00083 cConfigOption(const char *name, ObjectKind kind, Type type, const char *unit,
00084 const char *defaultValue, const char *description);
00086
00089 virtual std::string info() const;
00091
00100 bool isPerObject() const {return isPerObject_;}
00101
00106 bool isGlobal() const {return isGlobal_;}
00107
00112 ObjectKind getObjectKind() const {return objectKind_;}
00113
00117 static const char *getObjectKindName(ObjectKind kind);
00118
00122 Type getType() const {return type_;}
00123
00127 static const char *getTypeName(Type type);
00128
00133 const char *getUnit() const {return unit_.empty() ? NULL : unit_.c_str();}
00134
00138 const char *getDefaultValue() const {return defaultValue_.empty() ? NULL : defaultValue_.c_str();}
00139
00144 const char *getDescription() const {return description_.c_str();}
00146 };
00147
00148 NAMESPACE_END
00149
00150
00151 #endif
00152
00153