|
DynaMix
1.3.7
A new take on polymorphism in C++
|
Classes | |
| struct | dynamix::internal::msg_caller< Ret, Args > |
| struct | dynamix::internal::msg_unicast< Derived, Object, Ret, Args > |
| struct | dynamix::internal::msg_multicast< Derived, Object, Ret, Args > |
Macros | |
| #define | I_DYNAMIX_MESSAGE_STRUCT_NAME(message_name) I_DYNAMIX_PP_CAT(dynamix_msg_, message_name) |
| #define | I_DYNAMIX_MESSAGE_TAG(message_name) I_DYNAMIX_PP_CAT(message_name, _msg) |
| #define | I_DYNAMIX_MESSAGE_CALLER_STRUCT(mechanism) I_DYNAMIX_PP_CAT(msg_, mechanism) |
| #define | DYNAMIX_DEFAULT_IMPL_STRUCT(message_name) I_DYNAMIX_PP_CAT(message_name, _default_impl_t) |
| #define | I_DYNAMIX_MESSAGE_ARG_ERROR static_assert(false, "DynaMix macro called with a bad number of arguments") |
| #define | I_DYNAMIX_VA_ARGS_PROXY(MACRO, args) MACRO args |
| #define | I_DYNAMIX_GET_MIXIN_DATA(obj, id) reinterpret_cast<char*>(const_cast<void*>(obj._mixin_data[obj._type_info->_mixin_indices[id]].mixin())) |
| #define | DYNAMIX_MESSAGE_N(return_type, message, args) |
| #define | DYNAMIX_DEFINE_MESSAGE_N_WITH_DEFAULT_IMPL(return_type, message_name, args) |
| #define | DYNAMIX_DEFINE_MESSAGE(message_name) |
Macros used to declare and define messages.
| #define DYNAMIX_MESSAGE_N | ( | return_type, | |
| message, | |||
| args | |||
| ) |
Macro that declares a message
This generates the stand-alone function which is users should use to call messages.
The calls will throw the exception bad_message_call if none of the mixins from which the object is composed handles this message. To prevent the message calls from Throwing exceptions you can define DYNAMIX_NO_MSG_THROW before including the library's headers.
N in those variant names is a number that indicates how many parameters the message takes. If N is 0, then args is omitted.args is a coma-separated list of the argument types and argument names of the message's argumentsMULTICAST is a part of a macro, it declares a multicast message. Otherwise it declares a unicast message.CONST is part of a macro, then the message works with const object& and should be bound to const methods of a mixin class. Otherwise it works with simply object& and should be bound no non-const methods of the mixin class.EXPORTED is part of a macro, then it's used to declare a message that is exported from a dynamic library. The export parameter should be the appropriate export/import symbols for the particular compiler (i.e. __declspec(dllexport))OVERLOAD is part of a macro, it defines a message overload. It splits the ways of referring to the message in two. The first - message_name - should be used when referring to the message - in mixin feature lists, in object::implements, and in DYNAMIX_DEFINE_MESSAGE. The second - method_name - is the name of the method in the mixin class, and will be the name of the message function generated by the macro.| #define DYNAMIX_DEFINE_MESSAGE_N_WITH_DEFAULT_IMPL | ( | return_type, | |
| message_name, | |||
| args | |||
| ) |
Macro that defines a message by also providing a default implementation
Use it once per message in a compilation unit (.cpp file)
A default implementation lets the user provide code to be executed if a message is called for an object which has no mixin implementing it.
N is a number that indicates how many parameters the message takes. If N is 0, then args is omitted.args is a coma-separated list of the argument types and argument names of the message's argumentsmessage_name - is the name of the messagedm_this is valid| #define DYNAMIX_DEFINE_MESSAGE | ( | message_name | ) |
The macro for defining a message. Use it once per message in a compilation unit (.cpp file)