The base class for all network processes. More...
#include <CjNetworkProcess.hh>
Public Types | |
typedef CjNetworkProcess_ctor_va_t | ctor_va_t |
typedef CjNetworkProcess_act_va_t | action_va_t |
Public Member Functions | |
CjNetworkProcess (std::string args, ctor_va_t va) | |
Construct a CjNetworkProcess base by setting the associated topology and extracting the timing from the free-form string. | |
virtual bool | activeEpoch (const unsigned int t) const |
returns true if the epoch t is an epoch in which this process should be applied | |
virtual bool | expiredPolicy (const unsigned int t) const |
returns true if this policy has expired its lifetime and will never be required again for epochs higher than t | |
virtual unsigned int | getStartEpoch () const |
virtual unsigned int | getLifetime () const |
virtual unsigned int | getEpochStep () const |
virtual unsigned int | getProcessPriority () const |
virtual bool | atEnd () const |
virtual std::string | getName () const =0 |
Returns the free-form name of this class. | |
virtual std::string | getProperty (const std::string &) const =0 |
Returns a property of this class. | |
virtual std::string | toString () const |
Returns the original free-form text used to create this process ( m_orig_args ). | |
virtual std::string | getCmd () const |
Returns m_cmd. | |
virtual void | performAction (const action_va_t &opts)=0 |
Called by the simulator when this action is to be performed. | |
Static Public Member Functions | |
static std::string | getName_static () |
Returns the free-form name of this class (static version). | |
static std::string | getProperty_static (const std::string &) |
Returns a property of this class (static version). | |
static std::string | getProcName (const std::string &instr) |
static bool | parseEpochs (std::string &instr, std::string &proc_name, unsigned int &start, unsigned int &lifetime, unsigned int &step, unsigned int &prio) |
Parses the free-form configuration string into a process name and timing elements. | |
Protected Attributes | |
std::string | m_orig_args |
the full string that this process was parsed from | |
std::string | m_cmd |
the {} enclosed string containing the raw arguments for the process | |
std::string | m_name |
the string name of this process | |
unsigned int | m_start |
the first epoch in which this process is active | |
unsigned int | m_lifetime |
the number of epochs that this process is potentially (subject to m_step) active | |
unsigned int | m_step |
the period of repetition of this process | |
unsigned int | m_priority |
the priority of this process | |
bool | m_atEnd |
if true this process is performed at the end of the epochs | |
CjNLTopology * | m_top |
A pointer to the topology with which this process is associated. |
The base class for all network processes.
Additional simulator functionality can be added by extending this class and overriding the performAction(...) method. All simulation-specific constructor data should be supplied through CjNetworkProcess_ctor_va_t (such as the factories, the topology object with which this process is to associate, RNG during construction)
and instance-specific configuration such as which type of dimensioner to use etc.. should be specified in the free-form string argument of the constructor. The constructor of the derived class can pass the instance-specific configuration free-form text (of the form "start[+lifetime][@step][,prio]:proc_name{opts}" ) to the constructor of CjNetworkProcess and it will fill in m_start, m_lifetime, m_step, m_priority and place the remainder of the text in m_cmd.
Alternatively the derived class can optionally not use that format and that constructor and should parse the free-form string by itself and implement activeEpoch(...) and expiredPolicy(...)
bool jmitie::CjNetworkProcess::parseEpochs | ( | std::string & | instr, | |
std::string & | proc_name, | |||
unsigned int & | start, | |||
unsigned int & | lifetime, | |||
unsigned int & | step, | |||
unsigned int & | prio | |||
) | [static] |
Parses the free-form configuration string into a process name and timing elements.
parses instr which is formatted as start[+lifetime][@step][,prio]:proc_name{fn,opts} and returns { } clause in instr - returns false if n1 != END, true otherwise