OpenASIP  2.0
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
StateLocator Class Reference

#include <StateLocator.hh>

Collaboration diagram for StateLocator:
Collaboration graph

Public Member Functions

 StateLocator ()
 
virtual ~StateLocator ()
 
void addState (const TTAMachine::MachinePart &momComponent, StateData &state)
 
StateDatastate (const TTAMachine::MachinePart &momComponent) const
 

Private Types

typedef std::map< const TTAMachine::MachinePart *, StateData * > StateContainer
 State objects indexed by MOM components. More...
 

Private Member Functions

 StateLocator (const StateLocator &)
 Copying not allowed. More...
 
StateLocatoroperator= (const StateLocator &)
 Assignment not allowed. More...
 

Private Attributes

StateContainer states_
 Contains all the states indexed by MOM components. More...
 

Detailed Description

Class that makes it possible to lookup state objects corresponding to MOM component instances.

Definition at line 51 of file StateLocator.hh.

Member Typedef Documentation

◆ StateContainer

State objects indexed by MOM components.

Definition at line 69 of file StateLocator.hh.

Constructor & Destructor Documentation

◆ StateLocator() [1/2]

StateLocator::StateLocator ( )

Constructor.

Definition at line 45 of file StateLocator.cc.

45  {
46 }

◆ ~StateLocator()

StateLocator::~StateLocator ( )
virtual

Destructor.

Definition at line 51 of file StateLocator.cc.

51  {
52 }

◆ StateLocator() [2/2]

StateLocator::StateLocator ( const StateLocator )
private

Copying not allowed.

Member Function Documentation

◆ addState()

void StateLocator::addState ( const TTAMachine::MachinePart momComponent,
StateData state 
)

Adds state to to StateLocator.

Parameters
momComponentMachine object model component.
stateMachine state model state.

Definition at line 61 of file StateLocator.cc.

61  {
62  StateContainer::iterator iter = states_.find(&momComponent);
63  if (iter != states_.end()) {
64  (*iter).second = &state;
65  } else {
66  states_[&momComponent] = &state;
67  }
68 }

Referenced by MachineStateBuilder::addPortToFU(), and MachineStateBuilder::buildMachineState().

◆ operator=()

StateLocator& StateLocator::operator= ( const StateLocator )
private

Assignment not allowed.

◆ state()

StateData & StateLocator::state ( const TTAMachine::MachinePart momComponent) const

Returns state corresponding to the given component.

Parameters
momComponentComponent.
Returns
State corresponding to given component.
Exceptions
IllegalParametersIf state is not found.

Definition at line 78 of file StateLocator.cc.

78  {
79  StateContainer::const_iterator iter = states_.find(&momComponent);
80  if (iter == states_.end()) {
81  string msg = "State corresponding to component not found";
82  throw IllegalParameters(__FILE__, __LINE__, __func__, msg);
83  }
84 
85  return *((*iter).second);
86 }

References __func__.

Member Data Documentation

◆ states_

StateContainer StateLocator::states_
private

Contains all the states indexed by MOM components.

Definition at line 72 of file StateLocator.hh.


The documentation for this class was generated from the following files:
StateLocator::state
StateData & state(const TTAMachine::MachinePart &momComponent) const
Definition: StateLocator.cc:78
IllegalParameters
Definition: Exception.hh:113
StateLocator::states_
StateContainer states_
Contains all the states indexed by MOM components.
Definition: StateLocator.hh:72
__func__
#define __func__
Definition: Application.hh:67