00001 /**** 00002 Hierarchical Data Objects 00003 Copyright (C) 2005-2010 Werner Van Belle 00004 http://flow.yellowcouch.org/data/ 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 ****/ 00020 #ifndef __loaded__array_storage_h__ 00021 #define __loaded__array_storage_h__ 00022 using namespace std; 00023 #line 1 "array-storage.h++" 00024 //--------------------------------------------------------------- 00025 // Array storage 00026 //--------------------------------------------------------------- 00030 template <class T> class ArrayStorage 00031 { 00032 public: 00033 int refcount; // the number of times this data chunk is accessed 00034 T *data; // the actual data 00035 ArrayStorage() 00036 { 00037 refcount = 1; 00038 data = NULL; 00039 } 00040 virtual ~ArrayStorage() 00041 { 00042 } 00043 }; 00044 00048 template <class T> class NormalArrayStorage: public ArrayStorage<T> 00049 { 00050 public: 00051 virtual ~NormalArrayStorage() 00052 { 00053 delete[] ArrayStorage<T>::data; 00054 ArrayStorage<T>::data = NULL; 00055 } 00056 NormalArrayStorage<T>(int size) 00057 { 00058 ArrayStorage<T>::data = new T[size]; 00059 } 00060 }; 00061 00065 template <class T> class SpecialStorage: public ArrayStorage<T> 00066 { 00067 }; 00068 #endif // __loaded__array_storage_h__