cregistrationlist.h

00001 //==========================================================================
00002 //  CREGISTRATIONLIST.H - part of
00003 //                     OMNeT++/OMNEST
00004 //            Discrete System Simulation in C++
00005 //
00006 //
00007 //  cRegistrationList class
00008 //
00009 //==========================================================================
00010 
00011 /*--------------------------------------------------------------*
00012   Copyright (C) 1992-2008 Andras Varga
00013   Copyright (C) 2006-2008 OpenSim Ltd.
00014 
00015   This file is distributed WITHOUT ANY WARRANTY. See the file
00016   `license' for details on this and other legal matters.
00017 *--------------------------------------------------------------*/
00018 
00019 #ifndef __CREGISTRATIONLIST_H
00020 #define __CREGISTRATIONLIST_H
00021 
00022 #include <vector>
00023 #include <map>
00024 #include "simkerneldefs.h"
00025 #include "cnamedobject.h"
00026 
00027 NAMESPACE_BEGIN
00028 
00029 class cOwnedObject;
00030 
00036 class SIM_API cRegistrationList : public cNamedObject, noncopyable
00037 {
00038   private:
00039     typedef std::map<std::string, cOwnedObject*> StringObjectMap;
00040     std::vector<cOwnedObject *> vec;  // for fast iteration
00041     StringObjectMap nameMap;   // for lookup by getName()
00042     StringObjectMap fullnameMap;  // for lookup by getFullName()
00043 
00044   public:
00045     cRegistrationList(const char *name) : cNamedObject(name, false) {}
00046     virtual ~cRegistrationList();
00047 
00050     virtual std::string info() const;
00051     virtual void forEachChild(cVisitor *v);
00053 
00057     virtual void add(cOwnedObject *obj);
00058 
00062     virtual int size() const {return vec.size();}
00063 
00067     virtual cOwnedObject *get(int i) const;
00068 
00073     virtual cOwnedObject *find(const char *name) const;
00074 
00079     virtual cOwnedObject *lookup(const char *qualifiedName) const;
00080 
00085     virtual void sort();
00086 
00087 };
00088 
00095 class SIM_API cGlobalRegistrationList
00096 {
00097   private:
00098     cRegistrationList *inst;
00099     const char *tmpname;
00100   public:
00101     cGlobalRegistrationList();
00102     cGlobalRegistrationList(const char *name);
00103     ~cGlobalRegistrationList();
00104     cRegistrationList *getInstance();
00105     void clear();
00106 };
00107 
00108 NAMESPACE_END
00109 
00110 
00111 #endif
00112 
Generated on Tue Dec 2 11:16:27 2014 for OMNeT++ Simulation Library by  doxygen 1.6.3