IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
LogMessageManagerSrcMacros.h
Go to the documentation of this file.
1 // LogMessageManagerSrcMacros.h:
3 // -----------------------------
4 //
15 
16 #ifndef __IPSDKUTIL_LOGMESSAGEMANAGERSRCMACROS_H__
17 #define __IPSDKUTIL_LOGMESSAGEMANAGERSRCMACROS_H__
18 
21 
25 #define START_LOG_MESSAGE_MAP(libraryName, enumTypeStr) \
26  namespace details { \
27  typedef enumTypeStr TargetEnumType; \
28  template <typename EnumType, typename DelayImpl = void> \
29  struct MsgMapRegistratorDerived; \
30  } \
31  template <typename DelayImpl> \
32  struct MessageMapRegistrator<enumTypeStr, DelayImpl> \
33  { \
34  static bool process() \
35  { \
36  return details::MsgMapRegistratorDerived<enumTypeStr, DelayImpl>:: \
37  registerMessageMap(); \
38  } \
39  }; \
40  namespace details { \
41  template <typename EnumType, typename DelayImpl> \
42  struct MsgMapRegistratorDerived : \
43  public IPSDK_LIB_NAMESPACE(libraryName)::MsgMapRegistrator<EnumType, \
44  MsgMapRegistratorDerived<EnumType> > \
45  { \
46  template <enumTypeStr::domain enumValue, typename DelayImpl2 = void> \
47  struct MsgInfo \
48  { \
49  static const char* getMsg() \
50  { \
51  BOOST_STATIC_ASSERT_MSG(enumValue == -1, \
52  "This enumerate value has no associated message"); \
53  } \
54  };
55 
56 
57 
61 #define ADD_LOG_MESSAGE(msgId, msgStr) \
62  template <typename DelayImpl2> \
63  struct MsgInfo<TargetEnumType::msgId, DelayImpl2> \
64  { \
65  static const char* getMsg() \
66  { \
67  return msgStr; \
68  } \
69  };
70 
73 #define END_LOG_MESSAGE_MAP() \
74  }; \
75  static bool g_bRegistred = MessageMapRegistrator<TargetEnumType>::process(); \
76  } \
77  template struct MessageMapRegistrator<details::TargetEnumType, void>;
78 
79 
82 
83 #endif // __IPSDKUTIL_LOGMESSAGEMANAGERSRCMACROS_H__