OMNeT++ NEDXML  5.4.1
MsgCompilerOld Class Reference

#include <msgcompilerold.h>

Description

Generates C++ code from a MSG file. Covers the MSG language of OMNeT++ 4.x, and 5.x up to 5.2.

Assumes object tree has already passed all validation stages (DTD, syntax, semantic).

Classes

class  ClassInfo
 
class  EnumInfo
 
struct  TypeDesc
 

Public Types

typedef std::vector< std::string > StringVector
 

Public Member Functions

 MsgCompilerOld (ErrorStore *errors, const MsgCompilerOptionsOld &options)
 
 ~MsgCompilerOld ()
 
void generate (MsgFileElement *fileElement, const char *hFile, const char *ccFile)
 

Protected Types

typedef std::map< std::string, TypeDescTypeDescMap
 
typedef std::set< std::string > WordSet
 
typedef std::map< std::string, std::string > Properties
 

Protected Member Functions

void initDescriptors ()
 
std::string prefixWithNamespace (const std::string &s)
 
StringVector lookupExistingClassName (const std::string &s)
 
StringVector lookupExistingEnumName (const std::string &s)
 
bool isClassDeclared (const std::string &classqname)
 
void addClassType (const std::string &classqname, ClassType type, ASTNode *context)
 
ClassType getClassType (const std::string &classqname)
 
ClassInfo extractClassInfo (ASTNode *node)
 
void extractClassDecl (ASTNode *node)
 
Properties extractPropertiesOf (ASTNode *node)
 
void prepareFieldForCodeGeneration (ClassInfo &info, ClassInfo::FieldInfo *it)
 
void prepareForCodeGeneration (ClassInfo &classInfo)
 
EnumInfo extractEnumInfo (EnumElement *node)
 
void generateClass (const ClassInfo &classInfo)
 
void generateStruct (const ClassInfo &classInfo)
 
void generateDescriptorClass (const ClassInfo &a)
 
void generateEnum (const EnumInfo &enumInfo)
 
void generateNamespaceBegin (ASTNode *element)
 
void generateNamespaceEnd ()
 
std::string generatePreComment (ASTNode *nedElement)
 
void generateTemplates ()
 
bool getPropertyAsBool (const Properties &p, const char *name, bool defval)
 
std::string getProperty (const Properties &p, const char *name, const std::string &defval=std::string())
 
void generate (MsgFileElement *fileElement)
 
std::string makeFuncall (const std::string &var, const std::string &funcTemplate, bool withIndex=false, const std::string &value="")
 

Protected Attributes

TypeDescMap PRIMITIVE_TYPES
 
WordSet RESERVED_WORDS
 
std::string hFilename
 
std::string ccFilename
 
std::ostream * hOutp
 
std::ostream * ccOutp
 
ErrorStoreerrors
 
std::map< std::string, ClassTypeclassType
 
std::map< std::string, std::string > enumType
 
std::string namespaceName
 
StringVector namespaceNameVector
 
MsgCompilerOptionsOld opts
 

Static Protected Attributes

static TypeDesc _PRIMITIVE_TYPES []
 
static const char * _RESERVED_WORDS []
 

Member Typedef Documentation

typedef std::vector<std::string> StringVector
typedef std::map<std::string,TypeDesc> TypeDescMap
protected
typedef std::set<std::string> WordSet
protected
typedef std::map<std::string, std::string> Properties
protected

Member Enumeration Documentation

enum ClassType
Enumerator
UNKNOWN 
STRUCT 
NONCOBJECT 
COBJECT 
COWNEDOBJECT 
CNAMEDOBJECT 

Constructor & Destructor Documentation

MsgCompilerOld ( ErrorStore errors,
const MsgCompilerOptionsOld options 
)

Constructor.

Destructor.

Member Function Documentation

void initDescriptors ( )
protected
std::string prefixWithNamespace ( const std::string &  s)
protected
StringVector lookupExistingClassName ( const std::string &  s)
protected
StringVector lookupExistingEnumName ( const std::string &  s)
protected
bool isClassDeclared ( const std::string &  classqname)
inlineprotected
void addClassType ( const std::string &  classqname,
ClassType  type,
ASTNode context 
)
protected
ClassType getClassType ( const std::string &  classqname)
protected
ClassInfo extractClassInfo ( ASTNode node)
protected
void extractClassDecl ( ASTNode node)
protected
Properties extractPropertiesOf ( ASTNode node)
protected
void prepareFieldForCodeGeneration ( ClassInfo info,
ClassInfo::FieldInfo it 
)
protected
void prepareForCodeGeneration ( ClassInfo classInfo)
protected
EnumInfo extractEnumInfo ( EnumElement *  node)
protected
void generateClass ( const ClassInfo classInfo)
protected
void generateStruct ( const ClassInfo classInfo)
protected
void generateDescriptorClass ( const ClassInfo a)
protected
void generateEnum ( const EnumInfo enumInfo)
protected
void generateNamespaceBegin ( ASTNode element)
protected
void generateNamespaceEnd ( )
protected
std::string generatePreComment ( ASTNode nedElement)
protected
void generateTemplates ( )
protected
bool getPropertyAsBool ( const Properties p,
const char *  name,
bool  defval 
)
protected
std::string getProperty ( const Properties p,
const char *  name,
const std::string &  defval = std::string() 
)
protected
void generate ( MsgFileElement *  fileElement)
protected
std::string makeFuncall ( const std::string &  var,
const std::string &  funcTemplate,
bool  withIndex = false,
const std::string &  value = "" 
)
protected
void generate ( MsgFileElement *  fileElement,
const char *  hFile,
const char *  ccFile 
)

Generates C++ code from the specified message file. Assumes that the object tree has already passed DTD and syntax validation.

Member Data Documentation

TypeDesc _PRIMITIVE_TYPES[]
staticprotected
TypeDescMap PRIMITIVE_TYPES
protected
const char* _RESERVED_WORDS[]
staticprotected
WordSet RESERVED_WORDS
protected
std::string hFilename
protected
std::string ccFilename
protected
std::ostream* hOutp
protected
std::ostream* ccOutp
protected
ErrorStore* errors
protected
std::map<std::string,ClassType> classType
protected
std::map<std::string,std::string> enumType
protected
std::string namespaceName
protected
StringVector namespaceNameVector
protected
MsgCompilerOptionsOld opts
protected

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