xorp

CodeGenerator Class Reference

Generic code generator. More...

#include <code_generator.hh>

Inheritance diagram for CodeGenerator:
Visitor ExportCodeGenerator SourceMatchCodeGenerator

List of all members.

Classes

class  CodeGeneratorErr
 Exception thrown if code generation fails. More...

Public Member Functions

 CodeGenerator (const VarMap &varmap, PolicyMap &pmap)
 CodeGenerator (const string &proto, const filter::Filter &filter, const VarMap &varmap, PolicyMap &pmap)
 Generate code for a specific protocol and filter [target].
 CodeGenerator (const string &proto, const VarMap &varmap, PolicyMap &pmap)
 Initialize code generation for an import of a specific protocol.
const Elementvisit (NodeUn &node)
const Elementvisit (NodeBin &node)
const Elementvisit (NodeAssign &node)
const Elementvisit (NodeElem &node)
const Elementvisit (NodeVar &node)
const Elementvisit (NodeSet &node)
const Elementvisit (NodeAccept &node)
const Elementvisit (NodeReject &node)
const Elementvisit (PolicyStatement &policy)
const Elementvisit (Term &policy)
const Elementvisit (NodeProto &policy)
const Elementvisit (NodeNext &node)
const Elementvisit (NodeSubr &node)
const Codecode ()

Protected Member Functions

virtual const Elementvisit_policy (PolicyStatement &policy)
virtual const Elementvisit_term (Term &term)
virtual const Elementvisit_proto (NodeProto &node)
virtual const string & protocol ()

Protected Attributes

Code _code
ostringstream _os
const VarMap_varmap
PolicyMap_pmap
bool _subr

Private Attributes

string _protocol

Detailed Description

Generic code generator.

It is suitable for import filters.

This class visits a structure of Nodes and generates appropriate code.


Constructor & Destructor Documentation

CodeGenerator::CodeGenerator ( const string &  proto,
const filter::Filter &  filter,
const VarMap varmap,
PolicyMap pmap 
)

Generate code for a specific protocol and filter [target].

This construct is mainly used by derived classes to set the code target.

Parameters:
prototarget protocol.
filtertarget filter type.
varmapvarmap.
CodeGenerator::CodeGenerator ( const string &  proto,
const VarMap varmap,
PolicyMap pmap 
)

Initialize code generation for an import of a specific protocol.

Parameters:
prototarget protocol.
varmapvarmap.

Member Function Documentation

const Code & CodeGenerator::code ( )
Returns:
code generated.

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