The base class for all link selectors. More...
#include <CjLinkSelector.hh>
Public Types | |
typedef CjLinkSelector_ctor_va_t | ctor_va_t |
typedef CjLinkSelector_select_va_t | select_arg_t |
Public Member Functions | |
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. | |
CjLinkSelector (const ctor_va_t &va) | |
Construct a CjLinkSelector base by copying settings from the CjLinkSelector_ctor_va_t object. | |
virtual bool | selectLink (select_arg_t &, unsigned int &from, unsigned int &to)=0 |
performs the link selection | |
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). | |
Protected Attributes | |
const CjNLTopology * | m_top |
The topology that this link selector is associated with. | |
bool | m_add_remove |
if false then this selector will be adding a link, removing otherwise | |
std::string | m_parent_name |
The free-form name of the parent. | |
Static Protected Attributes | |
static std::vector< wheelVal_t > | m_wheel |
The link selection wheel. |
The base class for all link selectors.
Additional simulator functionality in the form of link selectors can be added by extending this class and overriding the selectLink(...) method. All simulation-specific constructor data should be supplied through CjLinkSelector_ctor_va_t (such as the topology object with which this selector is to associate, RNG during construction)
and instance-specific configuration such as link selector parameters to use etc.. should be specified in the free-form string argument of the constructor.
std::vector<wheelVal_t> jmitie::CjLinkSelector::m_wheel [static, protected] |
The link selection wheel.
In most implementations of a link selector there will be the need for roulette wheel selection to choose the link. This will most likely be implemented with a std::vector as the number of links to choose from will most likely change as the simulation progresses. Including this common functionality in the base class, and as a static minimises vector (re-)creation, re-sizing, and memory usage (because all link selectors will share the same wheel) Care must be taken to clear() the contents before use. TODO: this break MT safeness