main.cpp
#include <iostream>
#include <stdexcept>
class sample_event_exception_response_action_t
:
{
public:
sample_event_exception_response_action_t(
:
m_so_environment( so_environment )
{}
virtual ~sample_event_exception_response_action_t()
{}
virtual void
{
std::cout
<< "Respond to exception: stop SO Environment."
<< std::endl;
m_so_environment.stop();
}
private:
};
class sample_event_exception_handler_t
:
{
public:
virtual ~sample_event_exception_handler_t()
{}
const std::exception & ,
const std::string & )
{
new sample_event_exception_response_action_t( so_environment ) );
}
};
class a_hello_t
:
{
public:
:
base_type_t( env )
{}
virtual ~a_hello_t()
{}
virtual void
{
new sample_event_exception_handler_t ) );
throw std::runtime_error( "sample exception" );
}
};
void
{
coop->add_agent(
new a_hello_t( env ) ) );
}
int
main( int, char ** )
{
try
{
}
catch( const std::exception & ex )
{
std::cerr << "Error: " << ex.what() << std::endl;
return 1;
}
return 0;
}