void HumanClientFSM::unconsumed_event(const boost::statechart::event_base &event) { std::string most_derived_message_type_str = "[ERROR: Unknown Event]"; const boost::statechart::event_base* event_ptr = &event; if (dynamic_cast<const Disconnection*>(event_ptr)) most_derived_message_type_str = "Disconnection"; #define EVENT_CASE(r, data, name) \ else if (dynamic_cast<const name*>(event_ptr)) \ most_derived_message_type_str = BOOST_PP_STRINGIZE(name); BOOST_PP_SEQ_FOR_EACH(EVENT_CASE, _, HUMAN_CLIENT_FSM_EVENTS) BOOST_PP_SEQ_FOR_EACH(EVENT_CASE, _, MESSAGE_EVENTS) #undef EVENT_CASE if (terminated()) { ErrorLogger(FSM) << "A " << most_derived_message_type_str << " event was passed to " "the HumanClientFSM. The FSM has terminated. The event is being ignored."; return; } std::stringstream ss; ss << "["; for (auto leaf_state_it = state_begin(); leaf_state_it != state_end();) { // The following use of typeid assumes that // BOOST_STATECHART_USE_NATIVE_RTTI is defined const auto& leaf_state = *leaf_state_it; ss << typeid(leaf_state).name(); ++leaf_state_it; if (leaf_state_it != state_end()) ss << ", "; } ss << "]"; ErrorLogger(FSM) << "A " << most_derived_message_type_str << " event was not handled by any of these states : " << ss.str() << ". It is being ignored."; }
int main(int argc, char *argv[]) { DISABLE_SSE_EXCEPTIONS(); // this is the list of matrix type and size we want to bench: // ((suffix) (matrix size) (number of iterations)) #define MODES ((3d)(3)(4000000)) ((4d)(4)(1000000)) ((Xd)(4)(1000000)) ((Xd)(20)(10000)) // #define MODES ((Xd)(20)(10000)) #define _GENERATE_HEADER(R,ARG,EL) << BOOST_PP_STRINGIZE(BOOST_PP_SEQ_HEAD(EL)) << "-" \ << BOOST_PP_STRINGIZE(BOOST_PP_SEQ_ELEM(1,EL)) << "x" \ << BOOST_PP_STRINGIZE(BOOST_PP_SEQ_ELEM(1,EL)) << " / " std::cout BOOST_PP_SEQ_FOR_EACH(_GENERATE_HEADER, ~, MODES ) << endl; const int tries = 10; #define _RUN_BENCH(R,ARG,EL) \ std::cout << ARG( \ BOOST_PP_CAT(Matrix, BOOST_PP_SEQ_HEAD(EL)) (\ BOOST_PP_SEQ_ELEM(1,EL),BOOST_PP_SEQ_ELEM(1,EL)), BOOST_PP_SEQ_ELEM(2,EL), tries) \ << " "; BOOST_PP_SEQ_FOR_EACH(_RUN_BENCH, benchBasic<LazyEval>, MODES ); std::cout << endl; BOOST_PP_SEQ_FOR_EACH(_RUN_BENCH, benchBasic<EarlyEval>, MODES ); std::cout << endl; return 0; }
void HumanClientFSM::unconsumed_event(const boost::statechart::event_base &event) { std::string most_derived_message_type_str = "[ERROR: Unknown Event]"; const boost::statechart::event_base* event_ptr = &event; if (dynamic_cast<const Disconnection*>(event_ptr)) most_derived_message_type_str = "Disconnection"; #define EVENT_CASE(r, data, name) \ else if (dynamic_cast<const name*>(event_ptr)) \ most_derived_message_type_str = BOOST_PP_STRINGIZE(name); BOOST_PP_SEQ_FOR_EACH(EVENT_CASE, _, HUMAN_CLIENT_FSM_EVENTS) BOOST_PP_SEQ_FOR_EACH(EVENT_CASE, _, MESSAGE_EVENTS) #undef EVENT_CASE ErrorLogger(FSM) << "HumanClientFSM : A " << most_derived_message_type_str << " event was passed to " "the HumanClientFSM. This event is illegal in the FSM's current state. It is being ignored."; }
ETCalcParameters::ETCalcParameters(pt::time_period interval, BOOST_PP_SEQ_ENUM(BOOST_PP_SEQ_FOR_EACH(TYPED_PARAMS,ET_float_t,ETDATA_PARAMS))) : interval_(interval) { #define SET_VAL_FUNC(r, data, elem) SetValue(data::elem, elem); BOOST_PP_SEQ_FOR_EACH(SET_VAL_FUNC, ETCalcData_t, ETDATA_PARAMS); #undef SET_VAL_FUNC SetLengthType(); }
pixel_size_type bitsPerPixel(::ome::xml::model::enums::PixelType pixeltype) { pixel_size_type size = 0; switch(pixeltype) { BOOST_PP_SEQ_FOR_EACH(BIT_PT_CASE, size, OME_XML_MODEL_ENUMS_PIXELTYPE_VALUES); } return size; }
bool isComplex(::ome::xml::model::enums::PixelType pixeltype) { bool is_complex = false; switch(pixeltype) { BOOST_PP_SEQ_FOR_EACH(COMPLEX_PT_CASE, is_complex, OME_XML_MODEL_ENUMS_PIXELTYPE_VALUES); } return is_complex; }
bool isInteger(::ome::xml::model::enums::PixelType pixeltype) { bool is_integer = false; switch(pixeltype) { BOOST_PP_SEQ_FOR_EACH(INTEGER_PT_CASE, is_integer, OME_XML_MODEL_ENUMS_PIXELTYPE_VALUES); } return is_integer; }
bool isSigned(::ome::xml::model::enums::PixelType pixeltype) { bool is_signed = false; switch(pixeltype) { BOOST_PP_SEQ_FOR_EACH(SIGN_PT_CASE, is_signed, OME_XML_MODEL_ENUMS_PIXELTYPE_VALUES); } return is_signed; }
void GLFormat::Initialize() { s_idMap = new IDMap(4096); #include "glformat_const.inc" // フォーマット判定用エントリ BOOST_PP_SEQ_FOR_EACH(ADD_FMTID1, Internal, SEQ_INTERNAL) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID1, Internal_Sized, SEQ_INTERNALSIZED) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID1, Internal_Compressed, SEQ_INTERNALCOMPRESSED) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID1, Internal_Render, SEQ_INTERNALRENDER) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID1, Internal_Read, SEQ_INTERNALREAD) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID1, Type, SEQ_TYPE) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID1, DepthStencil, PSEQ_DSFORMAT) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID1, Depth, PSEQ_DEPTHFORMAT) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID1, Stencil, PSEQ_STENCILFORMAT) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID1, DepthStencil, PSEQ_DSFORMAT) // フォーマット検索用エントリ // より根本のクラスが優先される BOOST_PP_SEQ_FOR_EACH(ADD_FMTID_ALL, DepthStencil, PSEQ_DSFORMAT) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID_ALL, Stencil, PSEQ_STENCILFORMAT) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID_ALL, Depth, PSEQ_DEPTHFORMAT) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID_ALL, Type, SEQ_TYPE) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID_ALL, Internal_Read, SEQ_INTERNALREAD) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID_ALL, Internal_Render, SEQ_INTERNALRENDER) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID_ALL, Internal_Compressed, SEQ_INTERNALCOMPRESSED) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID_ALL, Internal_Sized, SEQ_INTERNALSIZED) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID_ALL, Internal, SEQ_INTERNAL) // Depth | Stencil | DS | Color の判別用 BOOST_PP_SEQ_FOR_EACH(ADD_FMTID_DSC, Internal, SEQ_INTERNAL) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID_DSC, DepthStencil, PSEQ_DSFORMAT) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID_DSC, Stencil, PSEQ_STENCILFORMAT) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID_DSC, Depth, PSEQ_DEPTHFORMAT) for(auto& p : c_GLFormatList) s_idMap->insert(std::make_pair(FmtID(Query_Info, p.first), p.second)); for(auto& p : c_GLTypeList) s_idMap->insert(std::make_pair(FmtID(Query_TypeSize, p.first), p.second)); for(auto& p : c_GLSLTypeList) s_idMap->insert(std::make_pair(FmtID(Query_GLSLTypeInfo, p.first), p.second)); }
void GLFormat::Initialize() { // エントリの予約数は適当 s_idMap = new IDMap(1024); s_SDLtoGL = new SDLtoGL(1024); s_valueMap = new GLValueMap(1024); #include "opengl_define/glformat_const.inc" // フォーマット判定用エントリ BOOST_PP_SEQ_FOR_EACH(ADD_FMTID1, Internal, SEQ_INTERNAL) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID1, Internal_Sized, SEQ_INTERNALSIZED) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID1, Internal_Compressed, SEQ_INTERNALCOMPRESSED) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID1, Internal_Render, SEQ_INTERNALRENDER) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID1, Internal_Read, SEQ_INTERNALREAD) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID1, Type, SEQ_TYPE) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID1, DepthStencil, PSEQ_DSFORMAT) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID1, Depth, PSEQ_DEPTHFORMAT) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID1, Stencil, PSEQ_STENCILFORMAT) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID1, DepthStencil, PSEQ_DSFORMAT) // フォーマット検索用エントリ // より根本のクラスが優先される BOOST_PP_SEQ_FOR_EACH(ADD_FMTID_ALL, DepthStencil, PSEQ_DSFORMAT) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID_ALL, Stencil, PSEQ_STENCILFORMAT) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID_ALL, Depth, PSEQ_DEPTHFORMAT) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID_ALL, Type, SEQ_TYPE) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID_ALL, Internal_Read, SEQ_INTERNALREAD) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID_ALL, Internal_Render, SEQ_INTERNALRENDER) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID_ALL, Internal_Compressed, SEQ_INTERNALCOMPRESSED) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID_ALL, Internal_Sized, SEQ_INTERNALSIZED) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID_ALL, Internal, SEQ_INTERNAL) // Depth | Stencil | DS | Color の判別用 BOOST_PP_SEQ_FOR_EACH(ADD_FMTID_DSC, Internal, SEQ_INTERNAL) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID_DSC, DepthStencil, PSEQ_DSFORMAT) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID_DSC, Stencil, PSEQ_STENCILFORMAT) BOOST_PP_SEQ_FOR_EACH(ADD_FMTID_DSC, Depth, PSEQ_DEPTHFORMAT) for(auto& p : c_GLFormatList) s_idMap->insert(std::make_pair(FmtID(Query_Info, p.format), p)); for(auto& p : c_GLTypeList) s_idMap->insert(std::make_pair(FmtID(Query_TypeSize, p.first), p.second)); for(auto& p : c_GLSLTypeList) s_idMap->insert(std::make_pair(FmtID(Query_GLSLTypeInfo, p.first), p.second)); // SDLのフォーマット -> 対応するOpenGLフォーマット for(auto& p : c_SDLtoGL) { auto info = QueryInfo(p.second); AssertP(Trap, info) s_SDLtoGL->emplace(p.first, *info); } // 上記と同じだがc_GLFormatListの逆パターンで登録 for(auto& p : c_GLFormatList) { auto itr = s_SDLtoGL->find(p.sdlFormat); if(p.sdlFormat!=SDL_PIXELFORMAT_UNKNOWN && itr==s_SDLtoGL->end()) s_SDLtoGL->emplace(p.sdlFormat, p); } // --------------- Const変数名の登録 --------------- auto fnAddValue = [](std::string name, GLenum value){ auto itr = s_valueMap->find(value); if(itr == s_valueMap->end()) { // エントリ作成 s_valueMap->emplace(value, std::move(name)); } else { // 併記 itr->second.append(" or "); itr->second.append(name); } }; #define DEF_GLMETHOD(...) #define GLDEFINE(...) #define DEF_GLCONST(name, value) fnAddValue(#name, static_cast<GLenum>(value)); #ifdef ANDROID #include "opengl_define/android_gl.inc" #elif defined(WIN32) #include "opengl_define/mingw_gl.inc" #else #include "opengl_define/linux_gl.inc" #endif #undef DEF_GLCONST #undef GLDEFINE #undef DEF_GLMETHOD }