participants.h
Go to the documentation of this file.00001 00013 #ifndef PARTICIPANTS_H 00014 #define PARTICIPANTS_H 00015 00016 00017 #include "bdmbase.h" 00018 #include "../base/user_info.h" 00019 00020 namespace bdm { 00027 class Participant : public root { 00028 protected: 00030 string name; 00031 public: 00033 Participant() {} 00035 void set_name(const string &name0) { 00036 name=name0; 00037 } 00039 virtual void adapt(const vec &glob_dt) {} 00049 void create_message(Setting &msg,const string &to, const string &what, const root &data) { 00050 Setting &m_to=msg.add("to",Setting::TypeString); 00051 m_to=to; 00052 Setting &m_what=msg.add("what",Setting::TypeString); 00053 m_what=what; 00054 //Setting &m_data=msg.add("data",Setting::TypeGroup); 00055 UI::save(&data, msg, "data"); 00056 } 00059 virtual void broadcast(Setting& queue) {} 00061 virtual void receive(const Setting& msg) { 00062 bdm_warning("unhandled message"); 00063 } 00065 virtual void act(vec &glob_ut) {} 00067 virtual void step() {} 00069 void from_setting(const Setting& set) { 00070 UI::get(name,set,"name",UI::compulsory); 00071 } 00072 void to_setting(Setting& set) const { 00073 UI::save(name,set,"name"); 00074 } 00076 const string &_name() { 00077 return name; 00078 } 00080 virtual void ds_register(const DS &ds) { } 00081 00082 }; 00083 00084 }; //namespace 00085 00086 #endif // PARTICIPANTS_H
Generated on 2 Dec 2013 for mixpp by 1.4.7