当前位置: 首页>>代码示例>>C++>>正文


C++ environment_t::create_coop方法代码示例

本文整理汇总了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(...) {}
}
开发者ID:crystax,项目名称:android-vendor-sobjectizer,代码行数:29,代码来源:main.cpp

示例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 ) );
}
开发者ID:crystax,项目名称:android-vendor-sobjectizer,代码行数:25,代码来源:main.cpp

示例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 ) );
}
开发者ID:crystax,项目名称:android-vendor-sobjectizer,代码行数:9,代码来源:main.cpp

示例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 ) );
}
开发者ID:crystax,项目名称:android-vendor-sobjectizer,代码行数:11,代码来源:main.cpp

示例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 ) );
	}
开发者ID:crystax,项目名称:android-vendor-sobjectizer,代码行数:17,代码来源:main.cpp


注:本文中的so_5::environment_t::create_coop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。