Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes

ChurnGenerator Class Reference

Base class for different churn models. More...

#include <ChurnGenerator.h>

Inheritance diagram for ChurnGenerator:
LifetimeChurn NoChurn ParetoChurn RandomChurn TraceChurn

List of all members.

Public Member Functions

virtual int numInitStages () const
virtual void initialize (int stage)
virtual void initializeChurn ()=0
virtual void handleMessage (cMessage *msg)=0
void setNodeType (const NodeType &t)
const NodeTypegetNodeType ()

Public Attributes

bool init
 still in initialization phase?
int terminalCount
 current number of overlay terminals

Protected Member Functions

virtual void updateDisplayString ()=0

Protected Attributes

UnderlayConfiguratorunderlayConfigurator
int targetOverlayTerminalNum
 final number of overlay terminals
NodeType type
 the nodeType this generator is responsible for

Detailed Description

Base class for different churn models.

Definition at line 57 of file ChurnGenerator.h.


Member Function Documentation

const NodeType& ChurnGenerator::getNodeType (  )  [inline]

Definition at line 65 of file ChurnGenerator.h.

{ return type; }

virtual void ChurnGenerator::handleMessage ( cMessage *  msg  )  [pure virtual]
void ChurnGenerator::initialize ( int  stage  )  [virtual]

Definition at line 27 of file ChurnGenerator.cc.

{
    // because of IPAddressResolver, we need to wait until interfaces are registered,
    // address auto-assignment takes place etc.
    if (stage != MAX_STAGE_UNDERLAY)
        return;

    if (type.typeID == -1) {
        opp_error("NodeType not set when initializing ChurnGenerator");
    }

    underlayConfigurator = UnderlayConfiguratorAccess().get();
    // get desired # of terminals
    targetOverlayTerminalNum = par("targetOverlayTerminalNum");

    type.channelTypesTx = cStringTokenizer(par("channelTypes"), " ").asVector();
    type.channelTypesRx = cStringTokenizer(par("channelTypesRx"), " ").asVector();
    
    if (type.channelTypesRx.size() != type.channelTypesTx.size()) {
        type.channelTypesRx = type.channelTypesTx;
    }
    
    terminalCount = 0;
    init = true;

    updateDisplayString();
    WATCH(terminalCount);

    initializeChurn();
}

virtual void ChurnGenerator::initializeChurn (  )  [pure virtual]

Implemented in LifetimeChurn, NoChurn, ParetoChurn, RandomChurn, and TraceChurn.

Referenced by initialize().

virtual int ChurnGenerator::numInitStages (  )  const [inline, virtual]

Definition at line 60 of file ChurnGenerator.h.

{ return MAX_STAGE_UNDERLAY + 1; }

void ChurnGenerator::setNodeType ( const NodeType t  )  [inline]

Definition at line 64 of file ChurnGenerator.h.

Referenced by UnderlayConfigurator::initialize().

{ type = t; }

virtual void ChurnGenerator::updateDisplayString (  )  [protected, pure virtual]

Implemented in LifetimeChurn, NoChurn, ParetoChurn, RandomChurn, and TraceChurn.

Referenced by initialize().


Member Data Documentation

still in initialization phase?

Definition at line 66 of file ChurnGenerator.h.

Referenced by initialize().

final number of overlay terminals

Reimplemented in RandomChurn.

Definition at line 72 of file ChurnGenerator.h.

Referenced by NoChurn::handleMessage(), initialize(), ParetoChurn::initializeChurn(), NoChurn::initializeChurn(), and LifetimeChurn::initializeChurn().

current number of overlay terminals

Definition at line 67 of file ChurnGenerator.h.

Referenced by RandomChurn::handleMessage(), NoChurn::handleMessage(), and initialize().


The documentation for this class was generated from the following files: