NedTypeInfo Class Reference

NEDXML API: NedTypeInfo Class Reference
NEDXML API
NedTypeInfo Class Reference

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 bool isNetwork () const
virtual const char * getSourceFileName () const
virtual std::string getPackage () const
virtual bool isInnerType () const
virtual const char * getEnclosingTypeName () const
virtual std::string str () const
virtual std::string getNedSource () const
virtual std::string getDocumentation () const
virtual bool isResolved () const
virtual void resolve ()
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 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
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

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.

Constructor & Destructor Documentation

◆ NedTypeInfo()

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

Constructor. It expects fully qualified name

References isInnerType().

Referenced by getSuperDecl().

◆ ~NedTypeInfo()

virtual ~NedTypeInfo ( )
virtual

Destructor

Member Function Documentation

◆ 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.

◆ isNetwork()

virtual bool isNetwork ( ) const
virtual

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

◆ 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.)

◆ isInnerType()

virtual bool isInnerType ( ) const
inlinevirtual

Returns true if this NED type is an inner type

Referenced by NedTypeInfo().

◆ 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.

◆ 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.

◆ getDocumentation()

virtual std::string getDocumentation ( ) const
virtual

Returns the NED documentation.

◆ isResolved()

virtual bool isResolved ( ) const
inlinevirtual

Returns true if this NED type has already been resolved. See resolve().

◆ resolve()

virtual void resolve ( )
virtual

Resolves all base classes and interfaces, so that the full list of gates, parameters, submodules, inner types etc. are available. Most getter methods need that information, and thus, they internally call resolve() if it has not yet been done. When this method is called, NED files containing the required types must have already been loaded.

◆ 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). Internally calls resolve() if it has not yet been done.

◆ 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. Internally calls resolve() if it has not yet been done.

◆ 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). Internally calls resolve() if it has not yet been done.

◆ 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. Internally calls resolve() if it has not yet been done.

◆ supportsInterface()

virtual bool supportsInterface ( const char * qname)
virtual

Returns true if this NED type extends/"is like" the given module interface or channel interface Internally calls resolve() if it has not yet been done.

◆ 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. Internally calls resolve() if it has not yet been done.

◆ 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. Internally calls resolve() if it has not yet been done.

◆ getCxxNamespace()

virtual std::string getCxxNamespace ( ) const
virtual

Returns the C++ namespace for this NED type. Implemented as getPackageProperty("namespace").

◆ getSuperDecl()

virtual NedTypeInfo * getSuperDecl ( ) const
virtual

Returns the NED type the first "extends" clause refers to, or nullptr. Internally calls resolve() if it has not yet been done.

References NedTypeInfo().

◆ 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