WSF
FieldEnumDefines.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI//REL TO USA ONLY
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// Copyright 2003-2015 The Boeing Company. All rights reserved.
7//
8// The use, dissemination or disclosure of data in this file is subject to
9// limitation or restriction. See accompanying README and LICENSE for details.
10// ****************************************************************************
11#ifndef L16_FIELDENUMDEFINES_HPP
12#define L16_FIELDENUMDEFINES_HPP
13
14#define ADD_ENUM(X) sEnumMap.emplace(X, #X);
15
16#define ADD_ENUM2(A, B) ADD_ENUM(A) ADD_ENUM(B)
17#define ADD_ENUM4(A, B, C, D) ADD_ENUM2(A, B) ADD_ENUM2(C, D)
18#define ADD_ENUM8(A, B, C, D, E, F, G, H) ADD_ENUM4(A, B, C, D) ADD_ENUM4(E, F, G, H)
19#define ADD_ENUM16(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P) \
20 ADD_ENUM8(A, B, C, D, E, F, G, H) ADD_ENUM8(I, J, K, L, M, N, O, P)
21#define DEFINE_GET_ENUM_STRING(_CLASS_) \
22 const char* _CLASS_::GetEnumString(int aValue) \
23 { \
24 std::map<int, const char*>::iterator i = sEnumMap.find(aValue); \
25 if (i != sEnumMap.end()) \
26 { \
27 return i->second; \
28 } \
29 return 0; \
30 }
31
32#define IMPLEMENT_ENUM_MAP(_CLASS_) \
33 std::map<int, const char*> _CLASS_::sEnumMap; \
34 DEFINE_GET_ENUM_STRING(_CLASS_) \
35 void _CLASS_::CreateEnumMap()
36
37#endif
Copyrights Multiple, All Rights Reserved