#include <processor.h>


Public Types | |
| enum | ProcessorState { Active, Sleeping, Inactive } |
Public Member Functions | |
construction / destruction | |
| Processor () | |
| virtual | ~Processor () |
node membership | |
| virtual void | set_owner (Node &) throw () |
| virtual const Node & | owner (void) const throw () |
| virtual Node & | owner_w (void) throw () |
processor interface | |
| virtual void | special_boot (void) throw () |
| virtual void | boot (void) throw () |
| virtual bool | process_message (const ConstMessageHandle &) throw () |
| virtual void | work (void) throw () |
misc access | |
| virtual int | id (void) const throw () |
| virtual ProcessorState | state (void) const throw () |
| bool | auto_terminate (void) const throw () |
| virtual int | simulation_round (void) const throw () |
| virtual void | sync_to_tags (TagContainer &) throw () |
| virtual void | sync_from_tags (const TagContainer &) throw ( std::runtime_error ) |
Protected Member Functions | |
Message sending | |
| virtual void | send (const MessageHandle &) throw () |
State management | |
| virtual void | set_state (const ProcessorState &) throw () |
| void | set_auto_terminate (bool enable) throw () |
Superclass for anything that runs inside a node and processes messages. A node can contain multiple processors, eg, one for each protocol that is simulated simultaneously.
Most important methods are
| Active | usual state |
| Sleeping | message reception stopped, but work() continues |
| Inactive | nonrevertable death |
| shawn::Processor::Processor | ( | ) |
| virtual shawn::Processor::~Processor | ( | ) | [virtual] |
| virtual void shawn::Processor::set_owner | ( | Node & | ) | throw () [virtual] |
called by Node when processor gets added
| virtual const Node& shawn::Processor::owner | ( | void | ) | const throw () [virtual] |
| virtual Node& shawn::Processor::owner_w | ( | void | ) | throw () [virtual] |
| virtual void shawn::Processor::special_boot | ( | void | ) | throw () [virtual] |
This method is called once for every Processor that is contained in one special node, which is chosen arbitrarily. It can be identified by Node::is_special_node()
It is called before boot() occurs. A Processor whose special_boot() is called will still get a boot() afterwards.
| virtual void shawn::Processor::boot | ( | void | ) | throw () [virtual] |
This method is called once for every Processor before the simulation starts (and again, if the simulation is reset)
| virtual bool shawn::Processor::process_message | ( | const ConstMessageHandle & | ) | throw () [virtual] |
| virtual void shawn::Processor::work | ( | void | ) | throw () [virtual] |
Called once in each simulation round. Used for periodic tasks like collecting sensor values and generating messages if someting interesting has happened.
| virtual int shawn::Processor::id | ( | void | ) | const throw () [virtual] |
| virtual ProcessorState shawn::Processor::state | ( | void | ) | const throw () [virtual] |
| bool shawn::Processor::auto_terminate | ( | void | ) | const throw () |
| virtual int shawn::Processor::simulation_round | ( | void | ) | const throw () [virtual] |
| virtual void shawn::Processor::sync_to_tags | ( | TagContainer & | ) | throw () [virtual] |
to be implemented
Implements shawn::TagSyncable.
| virtual void shawn::Processor::sync_from_tags | ( | const TagContainer & | ) | throw ( std::runtime_error ) [virtual] |
to be implemented
Implements shawn::TagSyncable.
| virtual void shawn::Processor::send | ( | const MessageHandle & | ) | throw () [protected, virtual] |
Enqueues a message for sending. Because the message is passed as a handle (see refcnt_pointer), a construct like
send( new MyCoolMessage(1,2,3,4) );
| virtual void shawn::Processor::set_state | ( | const ProcessorState & | ) | throw () [protected, virtual] |
Sets the state of the processor, where
| void shawn::Processor::set_auto_terminate | ( | bool | enable | ) | throw () [protected] |
Sets the state of the processor, where
1.5.6