/* * * HL demo implementation * * */ #include #include #include #include #include #include #include #include #ifdef __J_ACTIVE #include #endif #include #include #include namespace impl { template struct invoke_backend { // template template inline void invoke(Backend& backend) { std::cout << ((std::string)backend).c_str() << std::endl; } }; template struct archive_backend : Invoker { // TODO we should implement any logic of you backend serialization }; // Service base functionality // implementation placed below struct base_interface { HL_META_CLASS_DECLARATION(base_interface); HL_RPC_TYPE(((std::string, first_filed), (std::string, second_field)), ReflType); HL_RPC_FUNCTION( ((bool, result)) , run , ((std::string, first_field), (ReflType, refl_demo)) ); HL_RPC_FUNCTION(((bool, result)), exit, ((bool, mustexit))); }; #ifdef __J_ACTIVE struct implementation : hl::Interface< hl::Impl , std::string , hl::JsonBackend > > { HL_RPC_SERVICE_CLIENT_DECLARATION(implementation, "I_am", "I_am", ""); }; #else struct implementation : hl::Interface< hl::Impl , std::string , impl::archive_backend > > { HL_RPC_SERVICE_CLIENT_DECLARATION(implementation, "I_am", "I_am", ""); }; #endif } template inline void print_type() { std::cout << __PRETTY_FUNCTION__ << std::endl; } // The global test runner // we should use this only as global int main() { #ifdef __J_ACTIVE impl::implementation::run_result r = impl::implementation().invoke("hell world!" , impl::base_interface::ReflType("1-1-1", "2-2-2")); #endif typedef hl::refl_extract::type functions; // but I can do anythink here with methods print_type(); return 0; }