xorp

VarMap Class Reference

A VarMap contains all information for legal protocol variables. More...

#include <var_map.hh>

Inheritance diagram for VarMap:
NONCOPYABLE

List of all members.

Classes

struct  Variable
 A variable has Access control, it has a name, and a type. More...
class  VarMapErr
 Exception thrown on VarMap errors such as on unknown variables. More...

Public Types

enum  Access { READ, READ_WRITE, WRITE }
 

A variable may be READ [readonly] or READ_WRITE [read/write].


typedef map< VarRW::Id,
Variable * > 
VariableMap
typedef map< string,
VariableMap * > 
ProtoMap

Public Member Functions

const Variablevariable (const string &protocol, const VarRW::Id &varname) const
 Return Variable information for a variable of a specific protocol.
VarRW::Id var2id (const string &protocol, const string &varname) const
 VarMap (ProcessWatchBase &pw)
 As the VarMap learns about new protocols, it will register interest with the process watcher for that protocol to monitor the status of the protocol process.
bool protocol_known (const string &protocol)
void add_protocol_variable (const string &protocol, Variable *var)
 Add a variable to a protocol.
string str ()
 String representation of varmap.

Private Types

typedef VariableMap MetaVarContainer

Private Member Functions

void add_metavariable (Variable *var)
 Use this if you want a variable to be present for all protocols.
void add_variable (VariableMap &vm, Variable *var)
 Add a variable to a specific protocol.
const VariableMap & variablemap (const string &protocol) const
 A VariableMap relates a variable name to its Variable information [access and type].

Private Attributes

ProtoMap _protocols
ProcessWatchBase_process_watch
MetaVarContainer _metavars

Detailed Description

A VarMap contains all information for legal protocol variables.

It contains all the possible protocols. All the possible variables those protocols support and whether the variables are read-only or read-write.

This is crutial for semantic checking.


Constructor & Destructor Documentation

VarMap::VarMap ( ProcessWatchBase pw)

As the VarMap learns about new protocols, it will register interest with the process watcher for that protocol to monitor the status of the protocol process.

Parameters:
pwprocessWatch to use.

Member Function Documentation

void VarMap::add_metavariable ( Variable var) [private]

Use this if you want a variable to be present for all protocols.

Parameters:
varthe variable to add. Watch out for clashes and don't delete.
void VarMap::add_protocol_variable ( const string &  protocol,
Variable var 
)

Add a variable to a protocol.

Parameters:
protocolprotocol for which variable should be added.
varthe variable to add. Do not delete.
void VarMap::add_variable ( VariableMap &  vm,
Variable var 
) [private]

Add a variable to a specific protocol.

Parameters:
vmVariableMap where variable should be added.
varthe variable to add. Do not delete.
bool VarMap::protocol_known ( const string &  protocol)
Returns:
True if the protocol is known to the VarMap, false otherwise.
Parameters:
protocolprotocol caller wish to knows existance of.
string VarMap::str ( )

String representation of varmap.

Use only for debugging.

Returns:
string representation of varmap.
const VarMap::Variable & VarMap::variable ( const string &  protocol,
const VarRW::Id &  varname 
) const

Return Variable information for a variable of a specific protocol.

Throws an exception if no information is found.

Caller must not delete the map.

Returns:
access and type information for the requested variable.
Parameters:
protocolprotocol of variable interested in.
varnamename of variable interested in.
const VarMap::VariableMap & VarMap::variablemap ( const string &  protocol) const [private]

A VariableMap relates a variable name to its Variable information [access and type].

Throws an exception if no map is found.

Returns:
variable map for requested protocol.
Parameters:
protocolprotocol name for which variable map is requested.

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations