Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

rdPtrArray.h

00001 // rdPtrArray.h
00002 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00003 // Copyright 2001, 2002, 2003 Realistic Dynamics, Inc.
00004 // All rights reserved.
00005 //
00006 // Please do not read, copy, distribute, or use without permission.
00007 // Contact: Frank C. Anderson, fca@RealisticDynamics.com
00008 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00009 #ifndef __rdPtrArray_h__
00010 #define __rdPtrArray_h__
00011 
00012 
00013 #include "rdTools.h"
00014 #include "rdObject.h"
00015 
00016 #define rdPtrArray_CAPMIN 128;
00017 
00018 //=============================================================================
00019 //=============================================================================
00032 class RDTOOLS_API rdPtrArray : public rdObject
00033 {
00034 
00035 //=============================================================================
00036 // DATA
00037 //=============================================================================
00038 protected:
00040    int _firstEmpty;
00042    static const int CAPMIN;
00044    char *_descrip;
00046    int _capacity;
00049    int _capacityIncrement;
00051    void **_array;
00052 
00053 
00054 //=============================================================================
00055 // METHODS
00056 //=============================================================================
00057 public:
00058    rdPtrArray(int aCapacity=128,const char *aName="UNKNOWN");
00059    rdPtrArray(const char *aFileName);
00060    rdPtrArray(IDOM_Element *aElement);
00061    virtual ~rdPtrArray();
00062 
00063 private:
00064    //--------------------------------------------------------------------------
00065    // CONSTRUCTION METHODS
00066    //--------------------------------------------------------------------------
00067    void allocateCapacity();
00068    void setNull();
00069 public:
00070 
00071    //--------------------------------------------------------------------------
00072    // GET AND SET
00073    //--------------------------------------------------------------------------
00074    virtual void setDescription(const char *aDescrip=NULL);
00075    virtual const char* getDescription() const;
00076    virtual bool ensureCapacity(int aCapacity);
00077    virtual int getCapacity() const;
00078    virtual void setCapacityIncrement(int aIncrement=-1);
00079    virtual int getCapacityIncrement() const;
00080 
00081    //--------------------------------------------------------------------------
00082    // RESET
00083    //--------------------------------------------------------------------------
00084    virtual void reset();
00085    virtual void reset(int aIndex);
00086 
00087    //--------------------------------------------------------------------------
00088    // STORAGE
00089    //--------------------------------------------------------------------------
00090    virtual int getFirstEmpty() const;
00091    virtual int getIndex(void *aObject) const;
00092    virtual void* set(int aIndex,void *aObject);
00093    virtual void* get(int aIndex) const;
00094    virtual void* getLast() const;
00095    virtual int append(void *aObject);
00096    virtual int append(rdPtrArray *aArray);
00097    virtual void* remove(int aIndex);
00098    virtual void* remove(void *aObject);
00099 
00100    //--------------------------------------------------------------------------
00101    // XML
00102    //--------------------------------------------------------------------------
00103    virtual void updateObject(bool aDeep=true);
00104    virtual void updateNode(bool aDeep=true);
00105 
00106 //=============================================================================
00107 }; // END of class rdPtrArray
00108 //=============================================================================
00109 //=============================================================================
00110 
00111 #endif //__rdPtrArray_h__

Generated on Wed Aug 20 02:17:06 2003 for Simulation Software by doxygen1.3