@@ -443,14 +443,14 @@ TICK Agent::initialTick(clock_ref clk) {
443443// structors :
444444
445445Agent::Agent (Symbol const &name, TICK final , clock_ref clk, bool verbose)
446- :graph(name, initialTick(clk), verbose),
447- m_stat_log(manager().service()), m_clock(clk), m_finalTick(final ), m_valid(true ) {
446+ :graph(name, initialTick(clk), verbose), m_continue_if_empty( false ),
447+ m_stat_log(manager().service()), m_clock(clk), m_finalTick(final ), m_valid(true ) {
448448 m_proxy = new AgentProxy (*this );
449449 add_reactor (m_proxy);
450450}
451451
452452Agent::Agent (std::string const &file_name, clock_ref clk, bool verbose)
453- :m_stat_log(manager().service()), m_clock(clk), m_valid(true ) {
453+ :m_stat_log(manager().service()), m_clock(clk), m_valid(true ), m_continue_if_empty( false ) {
454454 set_verbose (verbose);
455455 updateTick (initialTick (m_clock), false );
456456 m_proxy = new AgentProxy (*this );
@@ -474,7 +474,7 @@ Agent::Agent(std::string const &file_name, clock_ref clk, bool verbose)
474474}
475475
476476Agent::Agent (boost::property_tree::ptree::value_type &conf, clock_ref clk, bool verbose)
477- :m_stat_log(manager().service()), m_clock(clk), m_valid(true ) {
477+ :m_stat_log(manager().service()), m_clock(clk), m_valid(true ), m_continue_if_empty( false ) {
478478 set_verbose (verbose);
479479 updateTick (initialTick (m_clock), false );
480480 m_proxy = new AgentProxy (*this );
@@ -512,7 +512,7 @@ bool Agent::missionCompleted() {
512512 syslog (null, null)<<" Agent destroyed." ;
513513 return true ;
514514 }
515- if ( count_reactors ()<=1 ) {
515+ if ( count_reactors ()<=1 && !m_continue_if_empty ) {
516516 // If there's only one reactor left it is probably
517517 // my AgentProxy => no real reactor available
518518 syslog (null, info)<<" No reactor left." ;
@@ -693,6 +693,7 @@ void Agent::loadConf(boost::property_tree::ptree::value_type &config) {
693693 throw XmlError (config, " Agent name is empty." );
694694 set_name (name);
695695
696+ m_continue_if_empty = parse_attr<int >(0 , config, " allow_empty" )==0 ;
696697 m_finalTick = parse_attr<TICK >(std::numeric_limits<TICK >::max (), config, " finalTick" );
697698 if ( m_finalTick<=0 )
698699 throw XmlError (config, " agent life time should be greater than 0" );
0 commit comments