xorp

FileVarRW Class Reference

Inheritance diagram for FileVarRW:
VarRW

List of all members.

Classes

class  Error

Public Member Functions

const Elementread (const Id &)
 Read a variable from a route [such as nexthop].
void write (const Id &, const Element &)
 Write a variable to a route.
void sync ()
 VarRW must perform all pending writes to the route now.
void printVars ()
void load (const string &fname)
void set_verbose (bool)

Private Member Functions

bool doLine (const string &line)
void clear_trash ()

Private Attributes

const Element_map [VAR_MAX]
ElementFactory _ef
Element_trash [MAX_TRASH]
int _trashc
bool _verbose

Static Private Attributes

static const int MAX_TRASH = 666

Member Function Documentation

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

Read a variable from a route [such as nexthop].

If the protocol doesn't support the requested variable, and exception should be thrown.

If the variable is not present in the current route, then an ElemNull should be returned [for example if ipv6 is requested on a v4 route].

VarRW is responsible for deleting the object read [it owns it]. However care must be taken not to delete objects that were obtained by write() even though we pass them to read() later.

Returns:
Element requested, or ElemNull of element is not available.
Parameters:
idThe variable that is being requested [such as metric].

Implements VarRW.

void FileVarRW::sync ( ) [virtual]

VarRW must perform all pending writes to the route now.

This is usefull in scenarios where VarRW decides to cache read and writes and perform the actual writes at the end [i.e. it stores pointers to elements].

All pointers to elements [by write] may become invalid after a sync.

Reimplemented from VarRW.

void FileVarRW::write ( const Id &  id,
const Element e 
) [virtual]

Write a variable to a route.

VarRW does not own Element, so it must not delete it.

Parameters:
idIdentifier of variable that must be written to.
eValue that must be written to the variable.

Implements VarRW.


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