Пример #1
0
// The SObjectizer Environment initialization.
void init( so_5::environment_t & env )
{
	// Creating and registering a cooperation.
	env.register_agent_as_coop( "coop", env.make_agent< a_hello_t >() );

	// Stopping SObjectizer.
	env.stop();
}
Пример #2
0
void
init( so_5::environment_t & env )
{
	const std::string coop_name( "main_coop" );

	env.register_agent_as_coop( coop_name, new test_agent_t( env ) );

	bool exception_thrown = false;
	try
	{
		// Create a duplicate.
		env.register_agent_as_coop( coop_name, new test_agent_t( env ) );
	}
	catch( const so_5::exception_t & )
	{
		exception_thrown = true;
	}

	if( !exception_thrown )
		throw std::runtime_error( "duplicating coop should not be registered" );

	env.stop();
}
Пример #3
0
		void
		init( so_5::environment_t & env )
		{
			auto on_reg =
					[this]( so_5::environment_t &,
							const std::string & )
					{
						m_reg_notify_received = true;
					};
			auto on_dereg =
					[this]( so_5::environment_t &,
							const std::string &,
							const so_5::coop_dereg_reason_t &)
					{
						m_dereg_notify_received = true;
					};

			env.register_agent_as_coop(
					"test",
					new a_test_t( env, on_reg, on_dereg ) );
		}
Пример #4
0
	void
	init( so_5::environment_t & env )
	{
		env.register_agent_as_coop( "test_coop",
				new a_test_t( env, m_message_counter ) );
	}
Пример #5
0
void
init( so_5::environment_t & env )
{
	env.register_agent_as_coop( so_5::autoname,
			env.make_agent< a_test_t >() );
}
Пример #6
0
void
init( so_5::environment_t & env )
{
	env.register_agent_as_coop( "test_coop", new test_agent_t( env ) );
}