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 ASTNode * | getTree () const |
NedResourceCache * | getResolver () 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 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 NedTypeInfo * | getSuperDecl () 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) |
void | resolveIfNeeded () const |
Protected Attributes | |
NedResourceCache * | resolver |
Type | type |
std::string | qualifiedName |
bool | isInner |
ASTNode * | tree |
bool | resolved = false |
bool | resolving = false |
StringVector | extendsNames |
StringVector | interfaceNames |
std::string | enclosingTypeName |
std::string | implClassName |
NameToElementMap | localInnerTypeDecls |
NameToElementMap | localParamDecls |
NameToElementMap | localGateDecls |
NameToElementMap | localSubmoduleDecls |
NameToElementMap | localConnectionDecls |
NameToElementMap | allLocalDecls |
|
protected |
|
protected |
enum Type |
NedTypeInfo | ( | NedResourceCache * | resolver, |
const char * | qname, | ||
bool | isInnerType, | ||
ASTNode * | tree | ||
) |
Constructor. It expects fully qualified name
|
virtual |
Destructor
|
protected |
|
protected |
|
protected |
|
protected |
|
inlineprotected |
|
virtual |
Returns the simple name of the NED type
|
virtual |
Returns the fully qualified name of the NED type
|
inline |
The NED type resolver this type is registered in
|
inlinevirtual |
Returns the type of this declaration: simple module, compound module, channel, etc.
|
virtual |
Returns true if this NED type has a local (non-inherited) @network (or @network(true)) property.
|
virtual |
Returns the path of the source file this NED type was loaded from.
|
virtual |
Returns the package name (from the package declaration of the containing NED file.)
|
inlinevirtual |
Returns true if this NED type is an inner type
|
virtual |
If this type is an inner type, returns fully qualified name of its enclosing type, otherwise returns nullptr.
|
virtual |
Returns a one-line summary (base class, implemented interfaces, etc)
|
virtual |
Returns the NED declaration.
|
inlinevirtual |
Returns true if this NED type has already been resolved. See 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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
virtual |
Returns the C++ namespace for this NED type. Implemented as getPackageProperty("namespace").
|
virtual |
Returns the NED type the first "extends" clause refers to, or nullptr. Internally calls resolve() if it has not yet been done.
TypesElement* getTypesElement | ( | ) | const |
ParametersElement* getParametersElement | ( | ) | const |
GatesElement* getGatesElement | ( | ) | const |
SubmodulesElement* getSubmodulesElement | ( | ) | const |
ConnectionsElement* getConnectionsElement | ( | ) | const |
SubmoduleElement* getLocalSubmoduleElement | ( | const char * | submoduleName | ) | const |
Returns the submodule element with the given name from the local type, or nullptr if not found
ConnectionElement* getLocalConnectionElement | ( | long | id | ) | const |
Returns the connection element with the given id from the local type, or nullptr if not found
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
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
ParamElement* findLocalParamDecl | ( | const char * | name | ) | const |
Searches local type; nullptr if not found
ParamElement* findParamDecl | ( | const char * | name | ) | const |
Searches local type and "extends" types; nullptr if not found
GateElement* findLocalGateDecl | ( | const char * | name | ) | const |
Searches local type; nullptr if not found
GateElement* findGateDecl | ( | const char * | name | ) | const |
Searches local type and "extends" types; nullptr if not found
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |