Main Page | Class Hierarchy | Compound List | File List | Compound Members

BxUnionCases.h

00001 // ##################################################################
00002 // BinX
00003 // $Id: BxUnionCases_8h-source.html,v 1.1.1.1 2006/04/19 14:19:02 edikt2 Exp $
00004 //
00005 // Class for a collection of BxUnionCase.
00006 // ##################################################################
00007 /*
00008 
00009 //  edikt::BinX
00010 //  www.edikt.org
00011 //  support@edikt.org
00012 
00013 // Copyright (c) 2003 The University of Edinburgh.
00014 
00015 */
00016 
00017 #ifndef __BxUnionCases__
00018 #define __BxUnionCases__
00019 
00020 #include "BxUnionCase.h"
00021 
00040 class DECLSPEC BxUnionCases : public BxObject
00041 {
00042 private:
00043     BxUnionCase ** elements_;   //<array to hold the objects
00044     int     capacity_;      //<number of elements the current array can hold
00045     int     elementCount_;  //<number of elements actually in the array
00046     int     incrementSize_;    //<number of elements to increase every time
00047 
00048 public:
00049     BxUnionCases();
00050     BxUnionCases(int,int);    //<capacity and incrementSize
00051     BxUnionCases(const BxUnionCases&);
00052     virtual ~BxUnionCases();
00053 
00054     virtual char* className() const { return "BxUnionCases"; } //<Returns the null-terminated string "BxUnionCases".
00055 
00056     bool add(BxUnionCase*);   //add a created data object at the end of the array
00057     BxUnionCase * remove(int index);     //remove an element by index
00058     void clear();   //remove all elements
00059 
00060     BxUnionCase * get(int index) const;  //get the object pointer by index
00061     BxUnionCase * get(const BxDataObject& discriminant) const;
00062     BxDataObject * getArm(int index) const;
00063     BxDataObject * getArm(const BxDataObject& discriminant) const;
00064     int count() const { return elementCount_; }    
00065 
00066     BxUnionCase * operator[](int index) const;
00067 
00068 protected:
00069     bool expand();
00070     int findDiscriminantByValue(const BxDataObject& discriminant) const;
00071 };
00072 
00073 #endif
00074 

Generated on Fri May 6 13:36:18 2005 for edikt::BinX by doxygen 1.3.3