CARMA C++
PDB_Enum.h
1 /*
2  * CARMA Project Database Enumeration Helpers
3  *
4  * Since C++ lacks support for converting enumerations to/from a string
5  * representation automatically, we have made some generic utilities that
6  * help with the problem.
7  */
8 
9 #ifndef PDB_ENUM_H
10 #define PDB_ENUM_H
11 
12 #include <string>
13 #include <vector>
14 #include <map>
15 
16 namespace carma {
17 namespace observertools {
18 
19 /* -------------------------------------------------------------------------- */
20 /* Enumeration Conversion Helpers */
21 /* -------------------------------------------------------------------------- */
22 
23 typedef std::map<std::string, int> StringEnumMap;
24 typedef std::map<int, std::string> EnumStringMap;
25 
26 // Get a vector of just the names from the map
27 std::vector<std::string> getEnumNames(const StringEnumMap &m);
28 
29 // Reverse a string -> enum map so that you can search in the other direction
30 EnumStringMap getReverseMap(const StringEnumMap &m);
31 
32 // Get the stringified enumeration value by using either type of map
33 std::string enumToString(const int value, const EnumStringMap &m);
34 std::string enumToString(const int value, const StringEnumMap &m);
35 
36 /* -------------------------------------------------------------------------- */
37 /* Maps for all CORBA types */
38 /* -------------------------------------------------------------------------- */
39 
40 StringEnumMap getProjectStatusMap();
41 StringEnumMap getObsCategoryMap();
42 StringEnumMap getObsLikelihoodMap();
43 StringEnumMap getObsTypeMap();
44 
45 /* -------------------------------------------------------------------------- */
46 /* Vectors for all non-enumeration types stored in the database */
47 /* -------------------------------------------------------------------------- */
48 
49 std::vector<std::string> getArrayConfigurationVec();
50 std::vector<std::string> getReceiverBandVec();
51 std::vector<std::string> getImgVsSnrVec();
52 
53 } // namespace carma::observertools
54 } // namespace carma
55 
56 #endif /* PDB_ENUM_H */
57 
58 /* vim: set ts=8 sts=8 sw=8 noet tw=92: */