00001 // ################################################################## 00002 // Binx 00003 // $Id: BxDataObjectStack_8h-source.html,v 1.1.1.1 2006/04/19 14:19:02 edikt2 Exp $ 00004 // 00005 // Class for keeping a list of data object pointers on the stack 00006 // ################################################################## 00007 /* 00008 00009 // edikt::BinX 00010 // www.edikt.org 00011 // support@edikt.org 00012 00013 // Copyright (c) 2004 The University of Edinburgh. 00014 00015 */ 00016 00017 #ifndef __BxDataObjectStack__ 00018 #define __BxDataObjectStack__ 00019 00020 #include "BxDataObject.h" 00021 00022 /* 00023 * It implements a simple stack data structure which is used to store 00024 * pointers of BxDataObject instances. The pointers are maintained 00025 * in an array which is originally allocated with 10 elements, and can 00026 * be automatically enlarged if required. The pointers maintained 00027 * in the stack are not deleted in any case, so the user is responsible 00028 * for memory management. 00029 * <BR><B>since:</B> version 1.1 00030 */ 00031 class DECLSPEC PointerStack 00032 { 00033 public: 00034 PointerStack(); 00035 ~PointerStack(); 00036 00037 void push(BxDataObject*); 00038 BxDataObject* pop(); 00039 BxDataObject* top(int index=0) const; //get 00040 int count () const; 00041 00042 private: 00043 void expand(); 00044 00045 private: 00046 BxDataObject** pPointers_; 00047 BxDataObject* pCurrentPointer_; 00048 int nPointers_; 00049 int position_; 00050 }; 00051 00052 #endif 00053
1.3.3