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_creator_h__ 00021 #define __loaded__array_creator_h__ 00022 using namespace std; 00023 #line 1 "array-creator.h++" 00024 #include "array.h" 00025 #include "numbers.h" 00026 00027 //=============================================================== 00028 // Array Creation 00029 //=============================================================== 00030 class NoElement{}; 00031 00032 // this class keeps the next index in the first index 00033 // we do this because the parse can only pass along Data 00034 // types, so we need a good method in which we don't continuously 00035 // relocate the entire array. 00036 class Creator 00037 { 00038 typedef Array<1,Data> Content; 00039 Content content; 00040 void init(); 00041 void ensure_size(int S); 00042 private: 00043 template<int D, class T> Data createAndFillTarget(Size<8> s); 00044 void updateSize(Size<8>& size, int last_depth, int depth = 0); 00045 public: 00046 Creator() : content(1) { content[0]=Unsigned4(1); }; 00047 Creator(Data data) : content(Array<1,Data>(data)) {}; 00048 Array<1,Data> getContentData(); 00049 operator Data() {return content;}; 00050 Data convertTo(Unsigned4 dimension, Symbol type); 00051 void append(Data& e); 00052 }; 00053 #endif // __loaded__array_creator_h__