本文整理汇总了C++中so_5::environment_t::create_coop方法的典型用法代码示例。如果您正苦于以下问题:C++ environment_t::create_coop方法的具体用法?C++ environment_t::create_coop怎么用?C++ environment_t::create_coop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类so_5::environment_t
的用法示例。
在下文中一共展示了environment_t::create_coop方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: a_throwing_t
void
reg_coop(
so_5::environment_t & env )
{
so_5::coop_unique_ptr_t coop =
env.create_coop( "test_coop" );
coop->add_agent( new a_ordinary_t( env ) );
coop->add_agent( new a_ordinary_t( env ) );
coop->add_agent( new a_ordinary_t( env ) );
coop->add_agent( new a_ordinary_t( env ) );
coop->add_agent( new a_ordinary_t( env ) );
// This agent will throw an exception during binding for dispatcher.
coop->add_agent(
new a_throwing_t( env ),
so_5::disp_binder_unique_ptr_t( new throwing_disp_binder_t ) );
coop->add_agent( new a_ordinary_t( env ) );
coop->add_agent( new a_ordinary_t( env ) );
coop->add_agent( new a_ordinary_t( env ) );
coop->add_agent( new a_ordinary_t( env ) );
try
{
env.register_coop( std::move( coop ) );
}
catch(...) {}
}
示例2: a_test_t
void
create_and_register_agent(
so_5::environment_t & env,
const std::string & parent_coop_name,
int ordinal,
int max_children,
int level,
int max_deep )
{
so_5::coop_unique_ptr_t coop = env.create_coop(
create_coop_name( parent_coop_name, level, ordinal ) );
if( level )
coop->set_parent_coop_name( parent_coop_name );
coop->add_agent(
new a_test_t(
env,
coop->query_coop_name(),
parent_coop_name,
max_children,
level,
max_deep ) );
env.register_coop( std::move( coop ) );
}
示例3:
void
init( so_5::environment_t & env )
{
auto coop = env.create_coop( "test" );
coop->add_agent( new a_parent_t( env ) );
coop->add_agent( new a_time_sentinel_t( env ) );
env.register_coop( std::move( coop ) );
}
示例4:
void
init( so_5::environment_t & env )
{
auto coop = env.create_coop( "driver",
so_5::disp::active_obj::create_disp_binder( "active_obj" ) );
coop->add_agent( new a_driver_t( env ) );
coop->add_agent( new a_time_sentinel_t( env ) );
env.register_coop( std::move( coop ) );
}
示例5:
void
init(
so_5::environment_t & env )
{
auto coop = env.create_coop(
"test_coop",
so_5::disp::active_obj::create_disp_binder( "active_obj" ) );
auto svc_mbox = env.create_mbox();
coop->add_agent( new a_convert_service_t( env, svc_mbox ) );
coop->add_agent( new a_convert_service_t( env, svc_mbox ) );
coop->add_agent( new a_client_t( env, svc_mbox ) );
coop->add_agent( new a_time_sentinel_t( env ) );
env.register_coop( std::move( coop ) );
}