16 #ifndef __OMNETPP_CENUM_H 17 #define __OMNETPP_CENUM_H 19 #include "cownedobject.h" 35 std::map<int,std::string> valueToNameMap;
36 std::map<std::string,int> nameToValueMap;
37 std::vector<std::string> tmpNames;
40 void copy(
const cEnum& other);
44 cEnum *registerNames(
const char *nameList);
46 cEnum *registerValues(
int first, ...);
54 explicit cEnum(
const char *name=
nullptr);
68 cEnum(
const char *name,
const char *str, ...);
99 virtual std::string str()
const override;
107 void insert(
int value,
const char *name);
120 void bulkInsert(
const char *name1, ...);
126 const char *getStringFor(
int value);
132 int lookup(
const char *name,
int fallback=-1);
137 int resolve(
const char *name);
152 static cEnum *find(
const char *enumName,
const char *contextNamespace=
nullptr);
157 static cEnum *
get(
const char *enumName,
const char *contextNamespace=
nullptr);
virtual cEnum * dup() const override
Definition: cenum.h:94
A cObject that keeps track of its owner. It serves as base class for many classes in the OMNeT++ libr...
Definition: cownedobject.h:104
Provides string representation for enums.
Definition: cenum.h:32
Definition: cabstracthistogram.h:21
std::map< std::string, int > getNameValueMap() const
Definition: cenum.h:142