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, ...);
47 cEnum *registerValues() {
return this;}
55 explicit cEnum(
const char *name=
nullptr);
69 cEnum(
const char *name,
const char *str, ...);
100 virtual std::string str()
const override;
108 void insert(
int value,
const char *name);
121 void bulkInsert(
const char *name1, ...);
127 const char *getStringFor(
int value);
133 int lookup(
const char *name,
int fallback=-1);
138 int resolve(
const char *name);
153 static cEnum *find(
const char *enumName,
const char *contextNamespace=
nullptr);
158 static cEnum *get(
const char *enumName,
const char *contextNamespace=
nullptr);