MsgCppGenerator Class Reference
[Generating NED]

Generates C++ code from a MSG file object tree. More...

#include <msgcppgenerator.h>

List of all members.

Classes

class  ClassInfo
class  EnumInfo
struct  TypeDesc

Public Types

enum  ClassType {
  UNKNOWN = 0, STRUCT, COBJECT, COWNEDOBJECT,
  CNAMEDOBJECT, FOREIGN
}
typedef std::vector< std::string > StringVector

Public Member Functions

 MsgCppGenerator (NEDErrorStore *errors, const MsgCppGeneratorOptions &options)
 ~MsgCppGenerator ()
void generate (MsgFileElement *fileElement, const char *hFile, const char *ccFile)

Protected Types

typedef std::map< std::string,
TypeDesc
TypeMap
typedef std::map< std::string,
std::string > 
Properties

Protected Member Functions

std::string prefixWithNamespace (const std::string &s)
StringVector lookupExistingClassName (const std::string &s)
StringVector lookupExistingEnumName (const std::string &s)
bool isClassDeclared (const std::string &s)
ClassType getClassType (const std::string &s)
ClassInfo extractClassInfo (NEDElement *node)
void extractClassDecl (NEDElement *node)
Properties extractPropertiesOf (NEDElement *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 (NEDElement *element)
void generateNamespaceEnd ()
std::string generatePreComment (NEDElement *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)

Protected Attributes

std::string hFilename
std::string ccFilename
std::ostream * hOutp
std::ostream * ccOutp
NEDErrorStoreerrors
std::map< std::string, ClassTypeclasstype
std::map< std::string,
std::string > 
enumtype
std::string namespacename
StringVector namespacenamevector
MsgCppGeneratorOptions opts

Static Protected Attributes

static const TypeMap PRIMITIVE_TYPES

Detailed Description

Generates C++ code from a MSG file object tree.

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


Member Typedef Documentation

typedef std::map<std::string, std::string> MsgCppGenerator::Properties [protected]
typedef std::vector<std::string> MsgCppGenerator::StringVector
typedef std::map<std::string,TypeDesc> MsgCppGenerator::TypeMap [protected]

Member Enumeration Documentation

Enumerator:
UNKNOWN 
STRUCT 
COBJECT 
COWNEDOBJECT 
CNAMEDOBJECT 
FOREIGN 

Constructor & Destructor Documentation

MsgCppGenerator::MsgCppGenerator ( NEDErrorStore errors,
const MsgCppGeneratorOptions options 
)

Constructor.

MsgCppGenerator::~MsgCppGenerator (  ) 

Destructor.


Member Function Documentation

void MsgCppGenerator::extractClassDecl ( NEDElement node  )  [protected]
ClassInfo MsgCppGenerator::extractClassInfo ( NEDElement node  )  [protected]
EnumInfo MsgCppGenerator::extractEnumInfo ( EnumElement node  )  [protected]
Properties MsgCppGenerator::extractPropertiesOf ( NEDElement node  )  [protected]
void MsgCppGenerator::generate ( MsgFileElement fileElement,
const char *  hFile,
const char *  ccFile 
)

TODO.

void MsgCppGenerator::generate ( MsgFileElement fileElement  )  [protected]

Generates C++ code from the specified message file.

Assumes object tree has already passed DTD and syntax validation.

void MsgCppGenerator::generateClass ( const ClassInfo classInfo  )  [protected]
void MsgCppGenerator::generateDescriptorClass ( const ClassInfo a  )  [protected]
void MsgCppGenerator::generateEnum ( const EnumInfo enumInfo  )  [protected]
void MsgCppGenerator::generateNamespaceBegin ( NEDElement element  )  [protected]
void MsgCppGenerator::generateNamespaceEnd (  )  [protected]
std::string MsgCppGenerator::generatePreComment ( NEDElement nedElement  )  [protected]
void MsgCppGenerator::generateStruct ( const ClassInfo classInfo  )  [protected]
void MsgCppGenerator::generateTemplates (  )  [protected]
ClassType MsgCppGenerator::getClassType ( const std::string &  s  )  [protected]
std::string MsgCppGenerator::getProperty ( const Properties p,
const char *  name,
const std::string &  defval = std::string() 
) [protected]
bool MsgCppGenerator::getPropertyAsBool ( const Properties p,
const char *  name,
bool  defval 
) [protected]
bool MsgCppGenerator::isClassDeclared ( const std::string &  s  )  [inline, protected]
StringVector MsgCppGenerator::lookupExistingClassName ( const std::string &  s  )  [protected]
StringVector MsgCppGenerator::lookupExistingEnumName ( const std::string &  s  )  [protected]
std::string MsgCppGenerator::prefixWithNamespace ( const std::string &  s  )  [protected]
void MsgCppGenerator::prepareFieldForCodeGeneration ( ClassInfo info,
ClassInfo::FieldInfo it 
) [protected]
void MsgCppGenerator::prepareForCodeGeneration ( ClassInfo classInfo  )  [protected]

Member Data Documentation

std::string MsgCppGenerator::ccFilename [protected]
std::ostream* MsgCppGenerator::ccOutp [protected]
std::map<std::string,ClassType> MsgCppGenerator::classtype [protected]
std::map<std::string,std::string> MsgCppGenerator::enumtype [protected]
std::string MsgCppGenerator::hFilename [protected]
std::ostream* MsgCppGenerator::hOutp [protected]
std::string MsgCppGenerator::namespacename [protected]
const TypeMap MsgCppGenerator::PRIMITIVE_TYPES [static, protected]

The documentation for this class was generated from the following file:
Generated on Tue Dec 2 11:16:31 2014 for OMNeT++ NEDXML by  doxygen 1.6.3