ns3::rapidnet_compiler::RapidNetContext Class Reference
[RapidNet Compiler]

Rewrites from the EcaContext to C++ code for RapidNet. More...

#include <rapidnet-context.h>

Inheritance diagram for ns3::rapidnet_compiler::RapidNetContext:

Inheritance graph
[legend]
Collaboration diagram for ns3::rapidnet_compiler::RapidNetContext:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 RapidNetContext (string name, string appBase=DEFAULT_RN_APP_BASE)
 ~RapidNetContext ()
void Rewrite (Ptr< EcaContext > ectxt, Ptr< TableStore > tableStore)

Protected Member Functions

void GenerateHeader ()
void ReadAggregateIfAny (EcaRule *rule)
void GenerateClass ()
void PrepareAllTupleNames ()
void PrepareTables (Ptr< TableStore > tableStore)
void GenerateClassDetails ()
void GenerateInitDatabase ()
void GenerateInitAggregators ()
void GenerateDemuxRecv ()
void GenerateAllRuleMethods ()
void GenerateRuleMethod (EcaRule *rule)
void GenerateVerifyBlock (EcaRule *rule)
void GenerateAllJoins (EcaRule *rule)
void GenerateAllAssignments (EcaRule *rule)
void GenerateAssignment (ParseAssign *assign)
void GeneratePeriodicMethod (EcaRule *rule)
string FormatArgsAsString (ParseFunctor *func, bool aggWrap, bool withNewLines=false, int indent=0)
string FormatArgsAsString (ParseFunction *func, bool withNewLines=false, int indent=0)
string FormatExpression (ParseExpr *expr, int indent)
string LookupOrQuote (string lhs)
void GenerateAllSelects (EcaRule *rule)
void GenerateSelect (ParseSelect *select)
void GenerateAction (EcaRule *rule)
void GenerateSignEncryptBlock (EcaRule *rule, string actionMethod)
string Lookup (string lhs)
void CloseAll ()

Protected Attributes

string m_classname
string m_filename
string m_foldername
string m_appBase
string m_baseFilename
Ptr< EcaContextm_ectxt
map< string, RapidNetTablem_tables
map< string, string > m_allTupleNames
FILE * hFile
RapidNetTuple m_result
stringstream m_periodicSchedule
stringstream m_memberVarInit
map< string, string > m_memberVarDeclMap
map< string, string > m_ruleName2AggrVarMap


Detailed Description

Rewrites from the EcaContext to C++ code for RapidNet.

This class translates the intermediate ECA representation into C++ code that runs on the RapidNet library.

See also:
EcaContext

Constructor & Destructor Documentation

ns3::rapidnet_compiler::RapidNetContext::RapidNetContext ( string  name,
string  appBase = DEFAULT_RN_APP_BASE 
)

Initializes file streams for header and class files

ns3::rapidnet_compiler::RapidNetContext::~RapidNetContext (  ) 

Closes the file streams


Member Function Documentation

void ns3::rapidnet_compiler::RapidNetContext::CloseAll (  )  [protected]

Close all streams

string ns3::rapidnet_compiler::RapidNetContext::FormatArgsAsString ( ParseFunction *  func,
bool  withNewLines = false,
int  indent = 0 
) [protected]

Formats the argument list of a function as string.

string ns3::rapidnet_compiler::RapidNetContext::FormatArgsAsString ( ParseFunctor *  func,
bool  aggWrap,
bool  withNewLines = false,
int  indent = 0 
) [protected]

Formats the argument list of a functor as string.

string ns3::rapidnet_compiler::RapidNetContext::FormatExpression ( ParseExpr expr,
int  indent 
) [protected]

A recursive method to generate the code for arbitrarily complex math expression.

void ns3::rapidnet_compiler::RapidNetContext::GenerateAction ( EcaRule rule  )  [protected]

Generates code for action (includes project).

void ns3::rapidnet_compiler::RapidNetContext::GenerateAllAssignments ( EcaRule rule  )  [protected]

Generates the code for all assignments.

void ns3::rapidnet_compiler::RapidNetContext::GenerateAllJoins ( EcaRule rule  )  [protected]

Generates the code for all joins.

void ns3::rapidnet_compiler::RapidNetContext::GenerateAllRuleMethods (  )  [protected]

Generates the definitions for all non-watchStub rule methods.

void ns3::rapidnet_compiler::RapidNetContext::GenerateAllSelects ( EcaRule rule  )  [protected]

Generates code for all selects.

void ns3::rapidnet_compiler::RapidNetContext::GenerateAssignment ( ParseAssign *  assign  )  [protected]

Generates the code for a single assignment.

void ns3::rapidnet_compiler::RapidNetContext::GenerateClass (  )  [protected]

Generates the definition or class file for the NS3P2 application class.

void ns3::rapidnet_compiler::RapidNetContext::GenerateClassDetails (  )  [protected]

Generates the class file's details - header includes, namespace usages, type-id, constructor, destructor, start/stop app, etc.

void ns3::rapidnet_compiler::RapidNetContext::GenerateDemuxRecv (  )  [protected]

Generates the DemuxRecv method

void ns3::rapidnet_compiler::RapidNetContext::GenerateHeader (  )  [protected]

Generates the header file for the NS3P2 application class.

void ns3::rapidnet_compiler::RapidNetContext::GenerateInitAggregators (  )  [protected]

Generates aggregator initialization code in InitDatabase.

void ns3::rapidnet_compiler::RapidNetContext::GenerateInitDatabase (  )  [protected]

Generates the InitDatabase method

void ns3::rapidnet_compiler::RapidNetContext::GeneratePeriodicMethod ( EcaRule rule  )  [protected]

Generates the code for a periodic method/rule.

void ns3::rapidnet_compiler::RapidNetContext::GenerateRuleMethod ( EcaRule rule  )  [protected]

Generates the method definition for the given rule

void ns3::rapidnet_compiler::RapidNetContext::GenerateSelect ( ParseSelect *  select  )  [protected]

Generates code for the given select.

void ns3::rapidnet_compiler::RapidNetContext::GenerateSignEncryptBlock ( EcaRule rule,
string  actionMethod 
) [protected]

Generate the Sign and Encrypt for SeNDlog.

void ns3::rapidnet_compiler::RapidNetContext::GenerateVerifyBlock ( EcaRule rule  )  [protected]

Generate the verify block in the rule.

string ns3::rapidnet_compiler::RapidNetContext::Lookup ( string  lhs  )  [protected]

Looks up the given variable in the results. Throws an error if not found.

string ns3::rapidnet_compiler::RapidNetContext::LookupOrQuote ( string  lhs  )  [protected]

In assignments, the lhs could either be a new attribute in the tuple or an exisiting one. This method looksup the result and returns the corresponding attribute name if it is found or a quoted string if not.

void ns3::rapidnet_compiler::RapidNetContext::PrepareAllTupleNames (  )  [protected]

Runs through all the rules and finds out all tuple names by looking at only the event and action functor names. This is used for declaring them as constant strings in the header file.

void ns3::rapidnet_compiler::RapidNetContext::PrepareTables ( Ptr< TableStore tableStore  )  [protected]

Runs through the tableStore and identifies the names and keys of the materialized tables.

void ns3::rapidnet_compiler::RapidNetContext::ReadAggregateIfAny ( EcaRule rule  )  [protected]

Reads aggregates if any and sets up variables accordingly.

void ns3::rapidnet_compiler::RapidNetContext::Rewrite ( Ptr< EcaContext ectxt,
Ptr< TableStore tableStore 
)

Initializer for the NS3P2_Context object. This method should be invoked before any other generator methods.


Member Data Documentation

FILE objects for header file and class file

Map (essentially a list - the value is same as key) for all tuples being used.

The base class for the generated application.

The file name without extension of the base application.

The class name for the generated application.

Stores a link to the EcaContext.

The file name without extension.

The folder name with trailing slash.

Maps member variables (periodic events, aggreator instances, etc) to their declaration string.

String streams to record the member variable initialization commands.

String streams to record the schedule and cancel commands for the periodic events. This is computed when we run through the rules and used when the class file is generated.

Stores the intermediate result tuple between joins, assignments, selects and projects.

Maps the rule name to the aggregator, if any.

Map of all materialized tables against their respective names.


The documentation for this class was generated from the following file:

Generated on Fri Apr 9 15:01:12 2010 for NS-3 by  doxygen 1.5.8