xorp

PolicyStatement Class Reference

A policy statement is a collection of terms. More...

#include <policy_statement.hh>

Inheritance diagram for PolicyStatement:
NONCOPYABLE

List of all members.

Classes

class  PolicyStatementErr
 Exception thrown on error such as when no term is found. More...

Public Types

typedef ConfigNodeIdMap< Term * > TermContainer

Public Member Functions

 PolicyStatement (const string &name, SetMap &smap, PolicyMap &pmap)
void add_term (const ConfigNodeId &order, Term *term)
 Append a term at the end of the policy.
Termfind_term (const string &name) const
 Throws exception if no term is found.
bool term_exists (const string &name) const
 Checks if a term already exists.
bool delete_term (const string &name)
 Attempts to delete a term.
void set_policy_end ()
 Perform operations at the end of the policy.
const string & name () const
bool accept (Visitor &v)
 Visitor implementation.
TermContainerterms ()
void set_dependency (const DEPS &sets, const DEPS &policies)
 Replace the set dependencies.

Private Types

typedef list< pair
< ConfigNodeId, Term * > > 
OOL

Private Member Functions

void del_dependencies ()
 Delete all set dependencies of this policy.
TermContainer::iterator get_term_iter (const string &name)
 Get the iterator for a specific term.
TermContainer::const_iterator get_term_iter (const string &name) const
OOL::iterator find_out_of_order_term (const ConfigNodeId &order)
 Get the iterator for a term that is out of order.
OOL::iterator find_out_of_order_term (const string &name)
 Get the iterator for a term that is out of order.
OOL::const_iterator find_out_of_order_term (const string &name) const

Private Attributes

string _name
TermContainer _terms
list< pair< ConfigNodeId, Term * > > _out_of_order_terms
DEPS _sets
DEPS _policies
SetMap_smap
PolicyMap_pmap

Detailed Description

A policy statement is a collection of terms.


Constructor & Destructor Documentation

PolicyStatement::PolicyStatement ( const string &  name,
SetMap smap,
PolicyMap pmap 
)
Parameters:
namethe name of the policy.
smapthe SetMap. Used for dependency tracking.
pmapthe PolicyMap. Used for dependency tracking.

Member Function Documentation

bool PolicyStatement::accept ( Visitor v)

Visitor implementation.

Parameters:
vvisitor to visit policy.
void PolicyStatement::add_term ( const ConfigNodeId order,
Term term 
)

Append a term at the end of the policy.

Caller must not delete / modify pointer.

Parameters:
ordernode ID with position of term.
termterm to append to policy.
bool PolicyStatement::delete_term ( const string &  name)

Attempts to delete a term.

Returns:
true on successful delete, false otherwise.
Parameters:
namename of term to delete.
list< pair< ConfigNodeId, Term * > >::iterator PolicyStatement::find_out_of_order_term ( const ConfigNodeId order) [private]

Get the iterator for a term that is out of order.

Parameters:
orderthe order for the term.
Returns:
iterator for term.
list< pair< ConfigNodeId, Term * > >::iterator PolicyStatement::find_out_of_order_term ( const string &  name) [private]

Get the iterator for a term that is out of order.

Parameters:
namethe name for the term.
Returns:
iterator for term.
Term & PolicyStatement::find_term ( const string &  name) const

Throws exception if no term is found.

Returns:
term requested.
Parameters:
namename of term to find.
PolicyStatement::TermContainer::iterator PolicyStatement::get_term_iter ( const string &  name) [private]

Get the iterator for a specific term.

Returns:
iterator for term.
Parameters:
namename of the term.
const string & PolicyStatement::name ( ) const
Returns:
name of policy.
void PolicyStatement::set_dependency ( const DEPS &  sets,
const DEPS &  policies 
)

Replace the set dependencies.

Parameters:
setsthe new sets this policy is dependent on.
bool PolicyStatement::term_exists ( const string &  name) const

Checks if a term already exists.

Returns:
true if term exists, false otherwise.
Parameters:
nameterm name.
PolicyStatement::TermContainer & PolicyStatement::terms ( )
Returns:
terms of this policy

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