xorp

SemanticVarRW Class Reference

A VarRW used for semantic checking. More...

#include <semantic_varrw.hh>

Inheritance diagram for SemanticVarRW:
NONCOPYABLE VarRW

List of all members.

Classes

class  var_error
 Exception thrown on illegal variable use. More...

Public Member Functions

 SemanticVarRW (VarMap &vars)
const Elementread (const Id &id)
 VarRW read interface.
void write (const Id &id, const Element &elem)
 VarRW write interface.
void sync ()
 VarRW sync interface.
void set_protocol (const string &proto)
 Change the protocol being simulated.

Private Attributes

string _protocol
VarMap_vars
ElementFactory _ef
set< Element * > _trash

Detailed Description

A VarRW used for semantic checking.

This VarRW checks if elements may be read/written to and does typechecking according to the VarMap.

The user may set which protocols should be "simulated" by the VarRW.

The SemanticVarRW will create dummy elements which are initialized to a default value. This may not be optimal for semantic checking.


Constructor & Destructor Documentation

SemanticVarRW::SemanticVarRW ( VarMap vars)
Parameters:
varsthe VarMap to use.

Member Function Documentation

const Element & SemanticVarRW::read ( const Id &  id) [virtual]

VarRW read interface.

Checks if a variable may be read.

Throws exception on error.

Returns:
dummy element initialized to a default value.
Parameters:
idname of variable.

Implements VarRW.

void SemanticVarRW::set_protocol ( const string &  proto)

Change the protocol being simulated.

Parameters:
protoprotocol to simulate.
void SemanticVarRW::sync ( ) [virtual]

VarRW sync interface.

Does garbage collection.

Reimplemented from VarRW.

void SemanticVarRW::write ( const Id &  id,
const Element elem 
) [virtual]

VarRW write interface.

Checks if a variable may be written to, and if the type is correct.

Throws exception on error.

Parameters:
idname of variable.
elemvalue of variable.

Implements VarRW.


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