OMNeT++ NEDXML  6.0.3
NedTypeInfo Class Reference

#include <nedtypeinfo.h>

Description

Stores information on a NED type.

This class wraps an ASTNode tree of a NED declaration (module, channel, module interface or channel interface). May be extended by subclassing.

Represents NED declarations of modules, module interfaces, channels and channel interfaces. All instances are created and managed by NedResourceCache.

Public Types

enum  Type {
  SIMPLE_MODULE, COMPOUND_MODULE, MODULEINTERFACE, CHANNEL,
  CHANNELINTERFACE
}
 

Public Member Functions

 NedTypeInfo (NedResourceCache *resolver, const char *qname, bool isInnerType, ASTNode *tree)
 
virtual ~NedTypeInfo ()
 
virtual const char * getName () const
 
virtual const char * getFullName () const
 
virtual ASTNodegetTree () const
 
NedResourceCachegetResolver () const
 
virtual Type getType () const
 
virtual const char * getSourceFileName () const
 
virtual std::string getPackage () const
 
virtual std::string str () const
 
virtual std::string getNedSource () const
 
virtual int numExtendsNames () const
 
virtual const char * getExtendsName (int k) const
 
virtual int numInterfaceNames () const
 
virtual const char * getInterfaceName (int k) const
 
virtual bool supportsInterface (const char *qname)
 
virtual bool isInnerType () const
 
virtual const char * getEnclosingTypeName () const
 
virtual bool isNetwork () const
 
virtual const char * getImplementationClassName () const
 
virtual std::string getPackageProperty (const char *name) const
 
virtual std::string getCxxNamespace () const
 
virtual NedTypeInfogetSuperDecl () const
 
Convenience method to query the tree
TypesElement * getTypesElement () const
 
ParametersElement * getParametersElement () const
 
GatesElement * getGatesElement () const
 
SubmodulesElement * getSubmodulesElement () const
 
ConnectionsElement * getConnectionsElement () const
 
SubmoduleElement * getLocalSubmoduleElement (const char *submoduleName) const
 
ConnectionElement * getLocalConnectionElement (long id) const
 
SubmoduleElement * getSubmoduleElement (const char *submoduleName) const
 
ConnectionElement * getConnectionElement (long id) const
 
ParamElement * findLocalParamDecl (const char *name) const
 
ParamElement * findParamDecl (const char *name) const
 
GateElement * findLocalGateDecl (const char *name) const
 
GateElement * findGateDecl (const char *name) const
 

Protected Types

typedef std::vector< std::string > StringVector
 
typedef std::map< std::string, ASTNode * > NameToElementMap
 

Protected Member Functions

void checkComplianceToInterface (NedTypeInfo *interfaceDecl)
 
void collectLocalDeclarations ()
 
void addToElementMap (NameToElementMap &elementMap, ASTNode *node)
 
void mergeElementMap (NameToElementMap &destMap, const NameToElementMap &elementMap)
 

Protected Attributes

NedResourceCacheresolver
 
Type type
 
std::string qualifiedName
 
bool isInner
 
ASTNodetree
 
StringVector extendsNames
 
StringVector interfaceNames
 
std::string enclosingTypeName
 
std::string implClassName
 
NameToElementMap localInnerTypeDecls
 
NameToElementMap localParamDecls
 
NameToElementMap localGateDecls
 
NameToElementMap localSubmoduleDecls
 
NameToElementMap localConnectionDecls
 
NameToElementMap allLocalDecls
 

Member Typedef Documentation

◆ StringVector

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

◆ NameToElementMap

typedef std::map<std::string,ASTNode*> NameToElementMap
protected

Member Enumeration Documentation

◆ Type

enum Type
Enumerator
SIMPLE_MODULE 
COMPOUND_MODULE 
MODULEINTERFACE 
CHANNEL 
CHANNELINTERFACE 

Constructor & Destructor Documentation

◆ NedTypeInfo()

NedTypeInfo ( NedResourceCache resolver,
const char *  qname,
bool  isInnerType,
ASTNode tree 
)

Constructor. It expects fully qualified name

◆ ~NedTypeInfo()

virtual ~NedTypeInfo ( )
virtual

Destructor

Member Function Documentation

◆ checkComplianceToInterface()

void checkComplianceToInterface ( NedTypeInfo interfaceDecl)
protected

◆ collectLocalDeclarations()

void collectLocalDeclarations ( )
protected

◆ addToElementMap()

void addToElementMap ( NameToElementMap elementMap,
ASTNode node 
)
protected

◆ mergeElementMap()

void mergeElementMap ( NameToElementMap destMap,
const NameToElementMap elementMap 
)
protected

◆ getName()

virtual const char* getName ( ) const
virtual

Returns the simple name of the NED type

◆ getFullName()

virtual const char* getFullName ( ) const
virtual

Returns the fully qualified name of the NED type

◆ getTree()

virtual ASTNode* getTree ( ) const
virtual

Returns the raw ASTNode tree representing the component

◆ getResolver()

NedResourceCache* getResolver ( ) const
inline

The NED type resolver this type is registered in

◆ getType()

virtual Type getType ( ) const
inlinevirtual

Returns the type of this declaration: simple module, compound module, channel, etc.

◆ getSourceFileName()

virtual const char* getSourceFileName ( ) const
virtual

Returns the path of the source file this NED type was loaded from.

◆ getPackage()

virtual std::string getPackage ( ) const
virtual

Returns the package name (from the package declaration of the containing NED file.)

◆ str()

virtual std::string str ( ) const
virtual

Returns a one-line summary (base class, implemented interfaces, etc)

◆ getNedSource()

virtual std::string getNedSource ( ) const
virtual

Returns the NED declaration.

◆ numExtendsNames()

virtual int numExtendsNames ( ) const
inlinevirtual

Returns the number of "extends" names. This includes indirect base types as well (i.e. base types of base types, etc).

◆ getExtendsName()

virtual const char* getExtendsName ( int  k) const
virtual

Returns the name of the kth "extends" name (k=0..numExtendsNames()-1), resolved to fully qualified name.

◆ numInterfaceNames()

virtual int numInterfaceNames ( ) const
inlinevirtual

Returns the number of interfaces. This includes indirectly implemented interfaces as well. (That is, the list contains interfaces implemented by this type and all its base types, plus base types of all those interfaces).

◆ getInterfaceName()

virtual const char* getInterfaceName ( int  k) const
virtual

Returns the name of the kth interface (k=0..numInterfaceNames()-1), resolved to fully qualified name.

◆ supportsInterface()

virtual bool supportsInterface ( const char *  qname)
virtual

Returns true if this NED type extends/"is like" the given module interface or channel interface

◆ isInnerType()

virtual bool isInnerType ( ) const
inlinevirtual

Returns true if this NED type is an inner type

◆ getEnclosingTypeName()

virtual const char* getEnclosingTypeName ( ) const
virtual

If this type is an inner type, returns fully qualified name of its enclosing type, otherwise returns nullptr.

◆ isNetwork()

virtual bool isNetwork ( ) const
virtual

Returns true if this NED type has a local (non-inherited) @network (or @network(true)) property.

◆ getImplementationClassName()

virtual const char* getImplementationClassName ( ) const
virtual

For modules and channels, it returns the name of the C++ class that has to be instantiated (for compound modules this defaults to "cModule"); for interface types it returns nullptr.

◆ getPackageProperty()

virtual std::string getPackageProperty ( const char *  name) const
virtual

Find a property with the given name in the type's NED file, then in the package.ned file of the NED file, then in parent package.ned files up to the root (the NED source folder this NED file is in). Returns the simple value of the property (1st value of default key), or empty string if not found.

◆ getCxxNamespace()

virtual std::string getCxxNamespace ( ) const
virtual

The C++ namespace for this NED type; implemented as getPackageProperty("namespace").

◆ getSuperDecl()

virtual NedTypeInfo* getSuperDecl ( ) const
virtual

Returns the first "extends" clause, or nullptr

◆ getTypesElement()

TypesElement* getTypesElement ( ) const

◆ getParametersElement()

ParametersElement* getParametersElement ( ) const

◆ getGatesElement()

GatesElement* getGatesElement ( ) const

◆ getSubmodulesElement()

SubmodulesElement* getSubmodulesElement ( ) const

◆ getConnectionsElement()

ConnectionsElement* getConnectionsElement ( ) const

◆ getLocalSubmoduleElement()

SubmoduleElement* getLocalSubmoduleElement ( const char *  submoduleName) const

Returns the submodule element with the given name from the local type, or nullptr if not found

◆ getLocalConnectionElement()

ConnectionElement* getLocalConnectionElement ( long  id) const

Returns the connection element with the given id from the local type, or nullptr if not found

◆ getSubmoduleElement()

SubmoduleElement* getSubmoduleElement ( const char *  submoduleName) const

Returns the submodule element with the given name from the local type and "extends" types, or nullptr if not found

◆ getConnectionElement()

ConnectionElement* getConnectionElement ( long  id) const

Returns the connection element with the given id from the local type and "extends" types, or nullptr if not found

◆ findLocalParamDecl()

ParamElement* findLocalParamDecl ( const char *  name) const

Searches local type; nullptr if not found

◆ findParamDecl()

ParamElement* findParamDecl ( const char *  name) const

Searches local type and "extends" types; nullptr if not found

◆ findLocalGateDecl()

GateElement* findLocalGateDecl ( const char *  name) const

Searches local type; nullptr if not found

◆ findGateDecl()

GateElement* findGateDecl ( const char *  name) const

Searches local type and "extends" types; nullptr if not found

Member Data Documentation

◆ resolver

NedResourceCache* resolver
protected

◆ type

Type type
protected

◆ qualifiedName

std::string qualifiedName
protected

◆ isInner

bool isInner
protected

◆ tree

ASTNode* tree
protected

◆ extendsNames

StringVector extendsNames
protected

◆ interfaceNames

StringVector interfaceNames
protected

◆ enclosingTypeName

std::string enclosingTypeName
protected

◆ implClassName

std::string implClassName
protected

◆ localInnerTypeDecls

NameToElementMap localInnerTypeDecls
protected

◆ localParamDecls

NameToElementMap localParamDecls
protected

◆ localGateDecls

NameToElementMap localGateDecls
protected

◆ localSubmoduleDecls

NameToElementMap localSubmoduleDecls
protected

◆ localConnectionDecls

NameToElementMap localConnectionDecls
protected

◆ allLocalDecls

NameToElementMap allLocalDecls
protected

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