INET Framework for OMNeT++/OMNEST
inet::LifecycleOperation Class Referenceabstract

Base class for operations used by the ILifecycle interface. More...

#include <LifecycleOperation.h>

Inheritance diagram for inet::LifecycleOperation:
inet::ApplicationOperationBase inet::InterfaceOperationBase inet::ModuleCrashOperation inet::ModuleStartOperation inet::ModuleStopOperation inet::ApplicationStartOperation inet::ApplicationStopOperation inet::InterfaceDownOperation inet::InterfaceUpOperation

Public Types

typedef std::map< std::string, std::string > StringMap
 

Public Member Functions

 LifecycleOperation ()
 
virtual void initialize (cModule *module, StringMap &params)
 Initialize the operation using the parameters provided in the string map. More...
 
cModule * getRootModule () const
 Returns the module the operation is initiated on. More...
 
virtual int getNumStages () const =0
 Returns the number of stages required by this operation. More...
 
int getCurrentStage () const
 Returns the current stage, an integer in 0..numStages-1. More...
 

Private Attributes

cModule * rootModule = nullptr
 
int currentStage = 0
 
std::vector< IDoneCallback * > pendingList
 
bool insideInitiateOperation = false
 
IDoneCallbackoperationCompletionCallback = nullptr
 

Friends

class LifecycleController
 

Detailed Description

Base class for operations used by the ILifecycle interface.

Subclasses represent "operations" like shutdown, suspend, failure, restart, etc.

See also
LifecycleController, ILifecycle

Member Typedef Documentation

◆ StringMap

typedef std::map<std::string, std::string> inet::LifecycleOperation::StringMap

Constructor & Destructor Documentation

◆ LifecycleOperation()

inet::LifecycleOperation::LifecycleOperation ( )
inline
38  :

Member Function Documentation

◆ getCurrentStage()

◆ getNumStages()

virtual int inet::LifecycleOperation::getNumStages ( ) const
pure virtual

◆ getRootModule()

◆ initialize()

virtual void inet::LifecycleOperation::initialize ( cModule *  module,
StringMap params 
)
inlinevirtual

Initialize the operation using the parameters provided in the string map.

The implementation should destructively modify the map, removing from it the parameters it understands. Ideally, the map should be empty when this method returns; if it is not, the caller should treat that as an error, and report the remaining parameters as unrecognized by the operation.

Reimplemented in inet::InterfaceOperationBase, and inet::ApplicationOperationBase.

49  {
50  cProperties *props = module->getProperties();
51  if (props && (props->getAsBool("networkNode") || props->getAsBool("lifecycleSupport")))
52  rootModule = module;
53  else
54  throw cRuntimeError("LifecycleOperation not accepted directly by '(%s)%s' module", module->getClassName(), module->getFullPath().c_str());
55  }

Referenced by inet::power::SimpleEpEnergyManagement::executeNodeOperation(), inet::power::SimpleCcBattery::executeNodeOperation(), inet::power::SimpleEpEnergyStorage::executeNodeOperation(), inet::ApplicationOperationBase::initialize(), inet::InterfaceOperationBase::initialize(), and inet::ScenarioManager::processLifecycleCommand().

Friends And Related Function Documentation

◆ LifecycleController

friend class LifecycleController
friend

Member Data Documentation

◆ currentStage

◆ insideInitiateOperation

◆ operationCompletionCallback

IDoneCallback* inet::LifecycleOperation::operationCompletionCallback = nullptr
private

◆ pendingList

◆ rootModule

cModule* inet::LifecycleOperation::rootModule = nullptr
private

The documentation for this class was generated from the following file:
inet::LifecycleOperation::insideInitiateOperation
bool insideInitiateOperation
Definition: LifecycleOperation.h:34
inet::LifecycleOperation::operationCompletionCallback
IDoneCallback * operationCompletionCallback
Definition: LifecycleOperation.h:35
inet::LifecycleOperation::currentStage
int currentStage
Definition: LifecycleOperation.h:32
inet::LifecycleOperation::rootModule
cModule * rootModule
Definition: LifecycleOperation.h:31