#ifndef IPC_PARAM_TRAITS_MACROS_H_
#define IPC_PARAM_TRAITS_MACROS_H_
#include <string>
#define IPC_STRUCT_TRAITS_BEGIN(struct_name) \
namespace IPC { \
template <> \
struct IPC_MESSAGE_EXPORT ParamTraits<struct_name> { \
typedef struct_name param_type; \
static void Write(Message* m, const param_type& p); \
static bool Read(const Message* m, PickleIterator* iter, param_type* p); \
static void Log(const param_type& p, std::string* l); \
}; \
}
#define IPC_STRUCT_TRAITS_MEMBER(name)
#define IPC_STRUCT_TRAITS_PARENT(type)
#define IPC_STRUCT_TRAITS_END()
#define IPC_ENUM_TRAITS(type) \
IPC_ENUM_TRAITS_VALIDATE(type, true)
#define IPC_ENUM_TRAITS_MAX_VALUE(type, maxvalue) \
IPC_ENUM_TRAITS_MIN_MAX_VALUE(type, 0, maxvalue)
#define IPC_ENUM_TRAITS_MIN_MAX_VALUE(type, minvalue, maxvalue) \
IPC_ENUM_TRAITS_VALIDATE(type, (value >= (minvalue) && value <= (maxvalue)))
#define IPC_ENUM_TRAITS_VALIDATE(enum_name, validation_expression) \
namespace IPC { \
template <> \
struct IPC_MESSAGE_EXPORT ParamTraits<enum_name> { \
typedef enum_name param_type; \
static void Write(Message* m, const param_type& p); \
static bool Read(const Message* m, PickleIterator* iter, param_type* p); \
static void Log(const param_type& p, std::string* l); \
}; \
}
#endif