diff options
Diffstat (limited to 'ipc/ipc_message_macros.h')
-rw-r--r-- | ipc/ipc_message_macros.h | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/ipc/ipc_message_macros.h b/ipc/ipc_message_macros.h index 2993014..cd03680 100644 --- a/ipc/ipc_message_macros.h +++ b/ipc/ipc_message_macros.h @@ -130,7 +130,9 @@ // to proclaim equivalent struct declarations for use by callers, as well // as later registering the type with the message generation. Note that // IPC_STRUCT_MEMBER() is only permitted inside matching calls to -// IPC_STRUCT_BEGIN() / IPC_STRUCT_END(). +// IPC_STRUCT_BEGIN() / IPC_STRUCT_END(). There is also an +// IPC_STRUCT_BEGIN_WITH_PARENT(), which behaves like IPC_STRUCT_BEGIN(), +// but also accomodates structs that inherit from other structs. // // Externally-defined structs are registered with IPC_STRUCT_TRAITS_BEGIN(), // IPC_STRUCT_TRAITS_MEMBER(), and IPC_STRUCT_TRAITS_END() macros. These @@ -141,8 +143,16 @@ // inside matching calls to IPC_STRUCT_TRAITS_BEGIN() / // IPC_STRUCT_TRAITS_END(). // -// Enum types are registered with a single IPC_ENUM_TRAITS() macro. There -// is no need to enumerate each value to the IPC mechanism. +// Enum types are registered with a single IPC_ENUM_TRAITS_VALIDATE() macro. +// There is no need to enumerate each value to the IPC mechanism. Instead, +// pass an expression in terms of the parameter |value| to provide +// range-checking. For convenience, the IPC_ENUM_TRAITS() is provided which +// performs no checking, passing everything including out-of-range values. +// Its use is discouraged. The IPC_ENUM_TRAITS_MAX_VALUE() macro can be used +// for the typical case where the enum must be in the range 0..maxvalue +// inclusive. The IPC_ENUM_TRAITS_MIN_MAX_VALUE() macro can be used for the +// less typical case where the enum must be in the range minvalue..maxvalue +// inclusive. // // Do not place semicolons following these IPC_ macro invocations. There // is no reason to expect that their expansion corresponds one-to-one with @@ -192,9 +202,12 @@ #include "ipc/ipc_message_utils_impl.h" #endif -// Macros for defining structs. May be subsequently redefined. +// Convenience macro for defining structs without inheritence. Should not need +// to be subsequently redefined. #define IPC_STRUCT_BEGIN(struct_name) \ IPC_STRUCT_BEGIN_WITH_PARENT(struct_name, IPC::NoParams) + +// Macros for defining structs. Will be subsequently redefined. #define IPC_STRUCT_BEGIN_WITH_PARENT(struct_name, parent) \ struct struct_name; \ IPC_STRUCT_TRAITS_BEGIN(struct_name) \ |