nedtypeinfo.h

Go to the documentation of this file.
00001 //==========================================================================
00002 // NEDTYPEINFO.H -
00003 //
00004 //                     OMNeT++/OMNEST
00005 //            Discrete System Simulation in C++
00006 //
00007 //==========================================================================
00008 
00009 /*--------------------------------------------------------------*
00010   Copyright (C) 2002-2008 Andras Varga
00011   Copyright (C) 2006-2008 OpenSim Ltd.
00012 
00013   This file is distributed WITHOUT ANY WARRANTY. See the file
00014   `license' for details on this and other legal matters.
00015 *--------------------------------------------------------------*/
00016 
00017 
00018 #ifndef __NEDTYPEINFO_H
00019 #define __NEDTYPEINFO_H
00020 
00021 #include <map>
00022 #include <vector>
00023 #include <string>
00024 #include "nedelements.h"
00025 #include "commonutil.h"
00026 
00027 NAMESPACE_BEGIN
00028 
00029 class NEDResourceCache;
00030 
00042 class NEDXML_API NEDTypeInfo
00043 {
00044   public:
00045     enum Type {SIMPLE_MODULE, COMPOUND_MODULE, MODULEINTERFACE, CHANNEL, CHANNELINTERFACE};
00046 
00047   protected:
00048     // the resolver this type is in
00049     NEDResourceCache *resolver;
00050 
00051     Type type;
00052     std::string qualifiedName;
00053     bool isInner;  // whether it is an inner type
00054     NEDElement *tree; // points into resolver
00055 
00056     typedef std::vector<std::string> StringVector;
00057     typedef std::map<std::string,int> StringToIntMap;
00058 
00059     // inheritance. Vectors contain fully qualifies names, and include
00060     // indirect base types/interfaces as well (transitive closure).
00061     StringVector extendsnames;
00062     StringVector interfacenames;
00063 
00064     std::string enclosingTypeName;
00065 
00066     // simple module/channel C++ class to instantiate
00067     std::string implClassName;
00068 
00069   protected:
00070     void checkComplianceToInterface(NEDTypeInfo *interfaceDecl);
00071 
00072   public:
00074     NEDTypeInfo(NEDResourceCache *resolver, const char *qname, bool isInnerType, NEDElement *tree);
00075 
00077     virtual ~NEDTypeInfo();
00078 
00080     virtual const char *getName() const;
00081 
00083     virtual const char *getFullName() const;
00084 
00086     virtual NEDElement *getTree() const;
00087 
00089     NEDResourceCache *getResolver() const  {return resolver;}
00090 
00095     virtual Type getType() const {return type;}
00096 
00101     virtual std::string getPackage() const;
00102 
00106     virtual std::string info() const;
00107 
00111     virtual std::string nedSource() const;
00112 
00117     virtual int numExtendsNames() const  {return extendsnames.size();}
00118 
00123     virtual const char *extendsName(int k) const;
00124 
00131     virtual int numInterfaceNames() const  {return interfacenames.size();}
00132 
00137     virtual const char *interfaceName(int k) const;
00138 
00143     virtual bool supportsInterface(const char *qname);
00144 
00148     virtual bool isInnerType() const  {return isInner;}
00149 
00154     virtual const char *getEnclosingTypeName() const;
00155 
00160     virtual bool isNetwork() const;
00161 
00167     virtual const char *getImplementationClassName() const;
00168 
00176     virtual std::string getPackageProperty(const char *name) const;
00177 
00179     virtual std::string getCxxNamespace() const;
00180 
00182     virtual NEDTypeInfo *getSuperDecl() const;
00183 
00186     ParametersElement *getParametersElement() const;
00187     GatesElement *getGatesElement() const;
00188     SubmodulesElement *getSubmodulesElement() const;
00189     ConnectionsElement *getConnectionsElement() const;
00190 
00192     SubmoduleElement *getLocalSubmoduleElement(const char *submoduleName) const;
00193 
00195     ConnectionElement *getLocalConnectionElement(long id) const;
00196 
00198     SubmoduleElement *getSubmoduleElement(const char *submoduleName) const;
00199 
00201     ConnectionElement *getConnectionElement(long id) const;
00202 
00204     ParamElement *findLocalParamDecl(const char *name) const;
00205 
00207     ParamElement *findParamDecl(const char *name) const;
00208 
00210     GateElement *findLocalGateDecl(const char *name) const;
00211 
00213     GateElement *findGateDecl(const char *name) const;
00215 };
00216 
00217 NAMESPACE_END
00218 
00219 
00220 #endif
00221 
Generated on Tue Dec 2 11:16:31 2014 for OMNeT++ NEDXML by  doxygen 1.6.3