Main Page | Modules | Class Hierarchy | Class List | File List | Class Members | Related Pages

cdefaultlist.h

00001 //==========================================================================
00002 //  CDEFAULTLIST.H - part of
00003 //
00004 //                     OMNeT++/OMNEST
00005 //            Discrete System Simulation in C++
00006 //
00007 //
00008 //  Declaration of the following classes:
00009 //    cDefaultList : holds a set of cObjects
00010 //
00011 //==========================================================================
00012 
00013 /*--------------------------------------------------------------*
00014   Copyright (C) 1992-2005 Andras Varga
00015 
00016   This file is distributed WITHOUT ANY WARRANTY. See the file
00017   `license' for details on this and other legal matters.
00018 *--------------------------------------------------------------*/
00019 
00020 #ifndef __CDEFAULTLIST_H
00021 #define __CDEFAULTLIST_H
00022 
00023 #include "cobject.h"
00024 
00025 
00033 class SIM_API cDefaultList : public cObject
00034 {
00035   private:
00036     friend class cObject;
00037     cObject **vect;   // vector of objects
00038     int size;         // size of vector
00039     int count;        // number of elements stored
00040 
00041   private:
00042     void construct();
00043     void doInsert(cObject *obj);
00044     virtual void ownedObjectDeleted(cObject *obj);
00045     virtual void yieldOwnership(cObject *obj, cObject *newOwner);
00046 
00047   public:
00048     // internal: called from module creation code in ctypes.cc
00049     void takeAllObjectsFrom(cDefaultList& other);
00050 
00051   protected:
00054 
00058     void take(cObject *obj);
00059 
00063     void drop(cObject *obj);
00064 
00065   public:
00068 
00072     cDefaultList(const cDefaultList& list);
00073 
00077     explicit cDefaultList(const char *name=NULL);
00078 
00082     virtual ~cDefaultList();
00083 
00087     cDefaultList& operator=(const cDefaultList& list);
00089 
00092 
00096     virtual cObject *dup() const  {return new cDefaultList(*this);}
00097 
00101     virtual bool isSoftOwner()  {return true;}
00102 
00107     virtual std::string info() const;
00108 
00113     virtual void forEachChild(cVisitor *v);
00114 
00119     virtual void netPack(cCommBuffer *buffer);
00120 
00125     virtual void netUnpack(cCommBuffer *buffer);
00127 
00129     // Note: we need long method names here because cModule subclasses from this class
00131 
00135     int defaultListItems() const {return count;}
00136 
00143     cObject *defaultListGet(int k);
00144 
00148     // Note: we need a long name here because cModule subclasses from this
00149     bool defaultListContains(cObject *obj) const;
00151 };
00152 
00153 #endif
00154 

Generated on Fri Apr 1 12:25:32 2005 for OMNeT++/OMNEST Simulation Library by  doxygen 1.3.9.1