#include <string>#include <vector>#include <dtUtil/export.h>#include <osg/Referenced>Namespaces | |
| namespace | dtUtil |
Classes | |
| class | dtUtil::Enumeration |
| This class represents a type-safe enumeration pattern. More... | |
Defines | |
| #define | DECLARE_ENUM(EnumType) |
| Helper macros used to create the static data and methods needed to enumerate an enumeration. | |
| #define | IMPLEMENT_ENUM(EnumType) |
| #define DECLARE_ENUM | ( | EnumType | ) |
Value:
private: \ static std::vector<EnumType*> mInstances; \ static std::vector<dtUtil::Enumeration*> mGenericInstances; \ static void AddInstance(EnumType* instance) \ { \ EnumType::mInstances.push_back(instance); \ EnumType::mGenericInstances.push_back(instance); \ } \ public: \ static const std::vector<EnumType*>& EnumerateType() \ { \ return EnumType::mInstances; \ } \ \ static const std::vector<dtUtil::Enumeration*>& Enumerate() \ { \ return EnumType::mGenericInstances; \ } \ \ static EnumType* GetValueForName(const std::string& name) \ { \ for(unsigned i = 0; i < mInstances.size(); i++) \ { \ if(name == mInstances[i]->GetName()) \ { \ return mInstances[i]; \ } \ } \ return NULL; \ }
| #define IMPLEMENT_ENUM | ( | EnumType | ) |
Value:
std::vector<EnumType*> EnumType::mInstances; \ std::vector<dtUtil::Enumeration*> EnumType::mGenericInstances;