Preprocessor definitions
In yasmine a couple preprocessor definitions can be used to customize build, compile, and run behavior. Refer to the following tables which explain all of them:
Definition |
Description |
SX_NO_LOGGING |
Use when you want to use no logging at all (no logging code is created). |
SX_NO_STD_MAKE_UNIQUE |
When the standard make_unique is not available (e.g. no C++14 support), you have to define this preprocessor definition. A yasmine drop-in replacement template will be used instead then. |
Y_LEAN_AND_MEAN |
If you compile the library with Y_LEAN_AND_MEAN being defined or if you define the macro locally before including yasmine.hpp, all the state pseudostates and the asynchronous simple state (with the asynchronous behavior) are excluded (i.e. those headers are not included). This can reduce compile time. |
Y_PROFILER |
If this is defined, the state machine will count the number of events that were processed. The user can query the counter by calling the 'get_number_of_processed_events' method. |
SX_CPP03_BOOST |
Defining this, will set yasmine to be C++03 compatible. Additional information is available on the building yasmine page. Note: starting with version 0.6.0, yasmine supports C++03. |
SX_NO_WINDOWS_H |
Directive for yasmine not to include "windows.h". This can be used if the header needs to be included manually or is included by another framework with a special configuration. |
SX_GCC_EXPAND_TEMPLATE_PARAM_PACK_BUG |
Use alternative code to work around a bug occuring during the expansion of template parameter packs that appear in a lambda-expression. This problem was reported for GCC 4.8.4 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47226). |
Y_USE_DEPRECATED |
If this is defined, deprecated features for the given level will be available. For a list of deprecated macros and deprecation levels, see the Assembly page. |
BOOST_BIND_OVER_9 |
(C++03) Removes the limit of 7 methods/free functions as parameters for creating behaviors/guards using the assembly macros. The limit is because of boost::bind limitation to 9 arguments. |
Deprecated preprocessor definitions
Definition |
Replaced with |
Y_NO_LOGGING |
SX_NO_LOGGING |
Y_NO_STD_MAKE_UNIQUE |
SX_NO_STD_MAKE_UNIQUE |
Y_CPP03_BOOST |
SX_CPP03_BOOST |
Y_NO_WINDOWS_H |
SX_NO_WINDOWS_H |
Optimization
There are also preprocessor definitions for performance optimization.
Definition |
Description |
Y_OPTIMIZE_4_SPEED |
Optimize yasmine for speed. Certain information is cached and not calculated repeatedly on the fly. |
Y_OPTIMIZE_4_SIZE |
Used for memory optimization. Certain information is not cached and will be calculated repeatedly on the fly. |
Obviously the two performance macros will not work at the same time. If Y_OPTIMIZE_4_SPEED is not defined, Y_OPTIMIZE_4_SIZE will be automatically defined.
In the yasmine property sheet, the Y_OPTIMIZE_4_SPEED is defined by default.