pl-nk v0.4.5
Plonk|Plink|Plank are a set of cross-platform C/C++ frameworks for audio software development
plonk_ObjectArray2D.h
00001 /*
00002  -------------------------------------------------------------------------------
00003  This file is part of the Plink, Plonk, Plank libraries
00004   by Martin Robinson
00005  
00006  http://code.google.com/p/pl-nk/
00007  
00008  Copyright University of the West of England, Bristol 2011-14
00009  All rights reserved.
00010  
00011  Redistribution and use in source and binary forms, with or without
00012  modification, are permitted provided that the following conditions are met:
00013  
00014  * Redistributions of source code must retain the above copyright
00015    notice, this list of conditions and the following disclaimer.
00016  * Redistributions in binary form must reproduce the above copyright
00017    notice, this list of conditions and the following disclaimer in the
00018    documentation and/or other materials provided with the distribution.
00019  * Neither the name of University of the West of England, Bristol nor 
00020    the names of its contributors may be used to endorse or promote products
00021    derived from this software without specific prior written permission.
00022  
00023  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00024  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00025  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
00026  DISCLAIMED. IN NO EVENT SHALL UNIVERSITY OF THE WEST OF ENGLAND, BRISTOL BE 
00027  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
00028  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 
00029  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
00030  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
00031  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
00032  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
00033  
00034  This software makes use of third party libraries. For more information see:
00035  doc/license.txt included in the distribution.
00036  -------------------------------------------------------------------------------
00037  */
00038 
00039 #ifndef PLONK_OBJECTARRAY2D_H
00040 #define PLONK_OBJECTARRAY2D_H
00041 
00042 #include "../core/plonk_CoreForwardDeclarations.h"
00043 #include "plonk_ContainerForwardDeclarations.h"
00044 #include "plonk_DynamicContainer.h"
00045 
00047 template<class ArrayType, class RowType>
00048 class ObjectArray2DBase : public ObjectArray<RowType>
00049 {
00050 public:
00051     typedef ObjectArrayInternal<RowType>                Internal;
00052     typedef ObjectArray<RowType>                        Base;    
00053     typedef WeakPointerContainer<ObjectArray2DBase>     Weak;
00054     
00055     typedef ObjectArray<ArrayType>                      ObjectArrayType;
00056     typedef ObjectArray<ObjectArrayType>                ObjectArray2DType;
00057     typedef typename Base::InitialObject                InitialObject;
00058     
00059         ObjectArray2DBase (const int rows = 0) throw()
00060         :       ObjectArray<RowType> (rows < 0 ? 0 : rows, false) 
00061         {
00062         }
00063     
00064         ObjectArray2DBase (RowType const& single) throw()
00065         :       ObjectArray<RowType> (single)
00066         {
00067         }
00068     
00069     explicit ObjectArray2DBase (Internal* internalToUse) throw() 
00070         :       ObjectArray<RowType> (internalToUse)
00071         {
00072         } 
00073     
00076     ObjectArray2DBase (ObjectArray2DBase const& copy) throw()
00077     :   Base (static_cast<Base const&> (copy))
00078     {
00079     }
00080     
00081     ObjectArray2DBase (Dynamic const& other) throw()
00082     :   Base (other.as<ObjectArray2DBase>().getInternal())
00083     {
00084     }    
00085     
00087     ObjectArray2DBase& operator= (ObjectArray2DBase const& other) throw()
00088         {
00089                 if (this != &other)
00090             this->setInternal (other.getInternal());//this->setInternal (other.containerCopy().getInternal());
00091         
00092         return *this;
00093         }
00094 
00095         ObjectArray2DBase (InitialObject const &i00,
00096                                            InitialObject const &i01,
00097                                            InitialObject const &i02,
00098                                            InitialObject const &i03 = InitialObject()) throw()
00099         :       Base (i00, i01, i02, i03) 
00100         {
00101         }
00102     
00103         ObjectArray2DBase (RowType const &i00,
00104                                            RowType const &i01,
00105                                            RowType const &i02,
00106                                            RowType const &i03,
00107                                            RowType const &i04,
00108                                            RowType const &i05 = RowType(),
00109                                            RowType const &i06 = RowType(),
00110                                            RowType const &i07 = RowType()) throw()
00111         :       Base (i00, i01, i02, i03,
00112               i04, i05, i06, i07)
00113         {
00114         }
00115     
00116         ObjectArray2DBase (RowType const &i00,
00117                                            RowType const &i01,
00118                                            RowType const &i02,
00119                                            RowType const &i03,
00120                                            RowType const &i04,
00121                                            RowType const &i05,
00122                                            RowType const &i06,
00123                                            RowType const &i07,
00124                                            RowType const &i08,
00125                                            RowType const &i09 = RowType(),
00126                                            RowType const &i10 = RowType(),
00127                                            RowType const &i11 = RowType(),
00128                                            RowType const &i12 = RowType(),
00129                                            RowType const &i13 = RowType(),
00130                                            RowType const &i14 = RowType(),
00131                                            RowType const &i15 = RowType()) throw()
00132         :       Base (i00, i01, i02, i03,
00133               i04, i05, i06, i07,
00134               i08, i09, i10, i11,
00135               i12, i13, i14, i15)
00136         {
00137         }
00138     
00139         ObjectArray2DBase (RowType const &i00,
00140                                            RowType const &i01,
00141                                            RowType const &i02,
00142                                            RowType const &i03,
00143                                            RowType const &i04,
00144                                            RowType const &i05,
00145                                            RowType const &i06,
00146                                            RowType const &i07,
00147                                            RowType const &i08,
00148                                            RowType const &i09,
00149                                            RowType const &i10,
00150                                            RowType const &i11,
00151                                            RowType const &i12,
00152                                            RowType const &i13,
00153                                            RowType const &i14,
00154                                            RowType const &i15,
00155                                            RowType const &i16,
00156                                            RowType const &i17 = RowType(),
00157                                            RowType const &i18 = RowType(),
00158                                            RowType const &i19 = RowType(),
00159                                            RowType const &i20 = RowType(),
00160                                            RowType const &i21 = RowType(),
00161                                            RowType const &i22 = RowType(),
00162                                            RowType const &i23 = RowType(),
00163                                            RowType const &i24 = RowType(),
00164                                            RowType const &i25 = RowType(),
00165                                            RowType const &i26 = RowType(),
00166                                            RowType const &i27 = RowType(),
00167                                            RowType const &i28 = RowType(),
00168                                            RowType const &i29 = RowType(),
00169                                            RowType const &i30 = RowType(),
00170                                            RowType const &i31 = RowType()) throw()
00171         :       Base (i00, i01, i02, i03,
00172               i04, i05, i06, i07,
00173               i08, i09, i10, i11,
00174               i12, i13, i14, i15,
00175               i16, i17, i18, i19,
00176               i20, i21, i22, i23,
00177               i24, i25, i26, i27,
00178               i28, i29, i30, i31)
00179         {
00180         }
00181 
00182 //private:
00183 //      static int countValidInitialisers (RowType const& i03) throw()
00184 //      {
00185 //              int size = 3;
00186 //              if (i03.length() > 0) size++; else return size;
00187 //              return size;
00188 //      }       
00189 //    
00190 //public:
00191 //      ObjectArray2DBase (RowType const &i00,
00192 //                                         RowType const &i01,
00193 //                                         RowType const &i02,
00194 //                                         RowType const &i03 = RowType()) throw()
00195 //      :       ObjectArray<RowType> (countValidInitialisers (i03), false) 
00196 //      {
00197 //              RowType *thisArray = this->getArray();
00198 //              
00199 //              if (i00.length() > 0) thisArray[ 0] = i00; else return;
00200 //              if (i01.length() > 0) thisArray[ 1] = i01; else return;
00201 //              if (i02.length() > 0) thisArray[ 2] = i02; else return;
00202 //              if (i03.length() > 0) thisArray[ 3] = i03; else return;
00203 //      }
00204 //    
00205 //private:
00206 //      static int countValidInitialisers (RowType const &i05,
00207 //                                                                         RowType const &i06,
00208 //                                                                         RowType const &i07) throw()
00209 //      {
00210 //              int size = 5;
00211 //              
00212 //              if (i05.length() > 0) size++; else return size;
00213 //              if (i06.length() > 0) size++; else return size;
00214 //              if (i07.length() > 0) size++; else return size;
00215 //              
00216 //              return size;
00217 //      }
00218 //    
00219 //public:
00220 //      ObjectArray2DBase (RowType const &i00,
00221 //                                         RowType const &i01,
00222 //                                         RowType const &i02,
00223 //                                         RowType const &i03,
00224 //                                         RowType const &i04,
00225 //                                         RowType const &i05 = RowType(),
00226 //                                         RowType const &i06 = RowType(),
00227 //                                         RowType const &i07 = RowType()) throw()
00228 //      :       ObjectArray<RowType> (countValidInitialisers (i05, i06, i07), false)
00229 //      {
00230 //              RowType *thisArray = this->getArray();
00231 //              
00232 //              if (i00.length() > 0) thisArray[ 0] = i00; else return;
00233 //              if (i01.length() > 0) thisArray[ 1] = i01; else return;
00234 //              if (i02.length() > 0) thisArray[ 2] = i02; else return;
00235 //              if (i03.length() > 0) thisArray[ 3] = i03; else return;
00236 //              if (i04.length() > 0) thisArray[ 4] = i04; else return;
00237 //              if (i05.length() > 0) thisArray[ 5] = i05; else return;
00238 //              if (i06.length() > 0) thisArray[ 6] = i06; else return;
00239 //              if (i07.length() > 0) thisArray[ 7] = i07; else return;
00240 //      }
00241 //    
00242 //private:
00243 //      static int countValidInitialisers(RowType const &i09,
00244 //                                                                        RowType const &i10,
00245 //                                                                        RowType const &i11,
00246 //                                                                        RowType const &i12,
00247 //                                                                        RowType const &i13,
00248 //                                                                        RowType const &i14,
00249 //                                                                        RowType const &i15) throw()
00250 //      {
00251 //              int size = 9;
00252 //              
00253 //              if (i09.length() > 0) size++; else return size;
00254 //              if (i10.length() > 0) size++; else return size;
00255 //              if (i11.length() > 0) size++; else return size;
00256 //              if (i12.length() > 0) size++; else return size;
00257 //              if (i13.length() > 0) size++; else return size;
00258 //              if (i14.length() > 0) size++; else return size;
00259 //              if (i15.length() > 0) size++; else return size;
00260 //              
00261 //              return size;
00262 //      }
00263 //    
00264 //public:
00265 //      ObjectArray2DBase (RowType const &i00,
00266 //                                         RowType const &i01,
00267 //                                         RowType const &i02,
00268 //                                         RowType const &i03,
00269 //                                         RowType const &i04,
00270 //                                         RowType const &i05,
00271 //                                         RowType const &i06,
00272 //                                         RowType const &i07,
00273 //                                         RowType const &i08,
00274 //                                         RowType const &i09 = RowType(),
00275 //                                         RowType const &i10 = RowType(),
00276 //                                         RowType const &i11 = RowType(),
00277 //                                         RowType const &i12 = RowType(),
00278 //                                         RowType const &i13 = RowType(),
00279 //                                         RowType const &i14 = RowType(),
00280 //                                         RowType const &i15 = RowType()) throw()
00281 //      :       ObjectArray<RowType> (countValidInitialisers (     i09, i10, i11, 
00282 //                                                                                                        i12, i13, i14, i15), 
00283 //                                                        false)
00284 //      {
00285 //              RowType *thisArray = this->getArray();
00286 //              
00287 //              if (i00.length() > 0) thisArray[ 0] = i00; else return;
00288 //              if (i01.length() > 0) thisArray[ 1] = i01; else return;
00289 //              if (i02.length() > 0) thisArray[ 2] = i02; else return;
00290 //              if (i03.length() > 0) thisArray[ 3] = i03; else return;
00291 //              if (i04.length() > 0) thisArray[ 4] = i04; else return;
00292 //              if (i05.length() > 0) thisArray[ 5] = i05; else return;
00293 //              if (i06.length() > 0) thisArray[ 6] = i06; else return;
00294 //              if (i07.length() > 0) thisArray[ 7] = i07; else return;
00295 //              if (i08.length() > 0) thisArray[ 8] = i08; else return;
00296 //              if (i09.length() > 0) thisArray[ 9] = i09; else return;
00297 //              if (i10.length() > 0) thisArray[10] = i10; else return;
00298 //              if (i11.length() > 0) thisArray[11] = i11; else return;
00299 //              if (i12.length() > 0) thisArray[12] = i12; else return;
00300 //              if (i13.length() > 0) thisArray[13] = i13; else return;
00301 //              if (i14.length() > 0) thisArray[14] = i14; else return;
00302 //              if (i15.length() > 0) thisArray[15] = i15; else return;
00303 //      }
00304 //    
00305 //private:
00306 //      static int countValidInitialisers (RowType const &i17,
00307 //                                                                         RowType const &i18,
00308 //                                                                         RowType const &i19,
00309 //                                                                         RowType const &i20,
00310 //                                                                         RowType const &i21,
00311 //                                                                         RowType const &i22,
00312 //                                                                         RowType const &i23,
00313 //                                                                         RowType const &i24,
00314 //                                                                         RowType const &i25,
00315 //                                                                         RowType const &i26,
00316 //                                                                         RowType const &i27,
00317 //                                                                         RowType const &i28,
00318 //                                                                         RowType const &i29,
00319 //                                                                         RowType const &i30,
00320 //                                                                         RowType const &i31) throw()
00321 //      {
00322 //              int size = 17;
00323 //              
00324 //              if (i17.length() > 0) size++; else return size;
00325 //              if (i18.length() > 0) size++; else return size;
00326 //              if (i19.length() > 0) size++; else return size;
00327 //              if (i20.length() > 0) size++; else return size;
00328 //              if (i21.length() > 0) size++; else return size;
00329 //              if (i22.length() > 0) size++; else return size;
00330 //              if (i23.length() > 0) size++; else return size;
00331 //              if (i24.length() > 0) size++; else return size;
00332 //              if (i25.length() > 0) size++; else return size;
00333 //              if (i26.length() > 0) size++; else return size;
00334 //              if (i27.length() > 0) size++; else return size;
00335 //              if (i28.length() > 0) size++; else return size;
00336 //              if (i29.length() > 0) size++; else return size;
00337 //              if (i30.length() > 0) size++; else return size;
00338 //              if (i31.length() > 0) size++; else return size;
00339 //              
00340 //              return size;
00341 //      }
00342 //    
00343 //public:
00344 //      ObjectArray2DBase (RowType const &i00,
00345 //                                         RowType const &i01,
00346 //                                         RowType const &i02,
00347 //                                         RowType const &i03,
00348 //                                         RowType const &i04,
00349 //                                         RowType const &i05,
00350 //                                         RowType const &i06,
00351 //                                         RowType const &i07,
00352 //                                         RowType const &i08,
00353 //                                         RowType const &i09,
00354 //                                         RowType const &i10,
00355 //                                         RowType const &i11,
00356 //                                         RowType const &i12,
00357 //                                         RowType const &i13,
00358 //                                         RowType const &i14,
00359 //                                         RowType const &i15,
00360 //                                         RowType const &i16,
00361 //                                         RowType const &i17 = RowType(),
00362 //                                         RowType const &i18 = RowType(),
00363 //                                         RowType const &i19 = RowType(),
00364 //                                         RowType const &i20 = RowType(),
00365 //                                         RowType const &i21 = RowType(),
00366 //                                         RowType const &i22 = RowType(),
00367 //                                         RowType const &i23 = RowType(),
00368 //                                         RowType const &i24 = RowType(),
00369 //                                         RowType const &i25 = RowType(),
00370 //                                         RowType const &i26 = RowType(),
00371 //                                         RowType const &i27 = RowType(),
00372 //                                         RowType const &i28 = RowType(),
00373 //                                         RowType const &i29 = RowType(),
00374 //                                         RowType const &i30 = RowType(),
00375 //                                         RowType const &i31 = RowType()) throw()
00376 //      :       ObjectArray<RowType> (countValidInitialisers (     i17, i18, i19,
00377 //                                                                                                        i20, i21, i22, i23,
00378 //                                                                                                        i24, i25, i26, i27,
00379 //                                                                                                        i28, i29, i30, i31), 
00380 //                                                        false)
00381 //      {
00382 //              RowType *thisArray = this->getArray();
00383 //              
00384 //              if (i00.length() > 0) thisArray[ 0] = i00; else return;
00385 //              if (i01.length() > 0) thisArray[ 1] = i01; else return;
00386 //              if (i02.length() > 0) thisArray[ 2] = i02; else return;
00387 //              if (i03.length() > 0) thisArray[ 3] = i03; else return;
00388 //              if (i04.length() > 0) thisArray[ 4] = i04; else return;
00389 //              if (i05.length() > 0) thisArray[ 5] = i05; else return;
00390 //              if (i06.length() > 0) thisArray[ 6] = i06; else return;
00391 //              if (i07.length() > 0) thisArray[ 7] = i07; else return;
00392 //              if (i08.length() > 0) thisArray[ 8] = i08; else return;
00393 //              if (i09.length() > 0) thisArray[ 9] = i09; else return;
00394 //              if (i10.length() > 0) thisArray[10] = i10; else return;
00395 //              if (i11.length() > 0) thisArray[11] = i11; else return;
00396 //              if (i12.length() > 0) thisArray[12] = i12; else return;
00397 //              if (i13.length() > 0) thisArray[13] = i13; else return;
00398 //              if (i14.length() > 0) thisArray[14] = i14; else return;
00399 //              if (i15.length() > 0) thisArray[15] = i15; else return;
00400 //              if (i16.length() > 0) thisArray[16] = i16; else return;
00401 //              if (i17.length() > 0) thisArray[17] = i17; else return;
00402 //              if (i18.length() > 0) thisArray[18] = i18; else return;
00403 //              if (i19.length() > 0) thisArray[19] = i19; else return;
00404 //              if (i20.length() > 0) thisArray[20] = i20; else return;
00405 //              if (i21.length() > 0) thisArray[21] = i21; else return;
00406 //              if (i22.length() > 0) thisArray[22] = i22; else return;
00407 //              if (i23.length() > 0) thisArray[23] = i23; else return;
00408 //              if (i24.length() > 0) thisArray[24] = i24; else return;
00409 //              if (i25.length() > 0) thisArray[25] = i25; else return;
00410 //              if (i26.length() > 0) thisArray[26] = i26; else return;
00411 //              if (i27.length() > 0) thisArray[27] = i27; else return;
00412 //              if (i28.length() > 0) thisArray[28] = i28; else return;
00413 //              if (i29.length() > 0) thisArray[29] = i29; else return;
00414 //              if (i30.length() > 0) thisArray[30] = i30; else return;
00415 //              if (i31.length() > 0) thisArray[31] = i31; else return;
00416 //      }
00417     
00418         ObjectArrayAssignmentDefinition(ObjectArray2DBase, RowType);
00419         
00420         ObjectArray2DBase (ObjectArray2DBase<ArrayType,RowType> const& array0, 
00421                                            ObjectArray2DBase<ArrayType,RowType> const& array1) throw()
00422         :       ObjectArray< RowType > (array0, array1)
00423         {
00424         }
00425     
00427         bool contains (ArrayType const& item) const throw()
00428         {
00429                 const int numRows = this->length();
00430                 for (int i = 0; i < numRows; ++i)
00431                 {
00432                         if (this->atUnchecked (i).ObjectArray<ArrayType>::contains (item))
00433                                 return true;
00434                 }
00435                 
00436                 return false;
00437         }
00438         
00443         void indexOf (ArrayType const& item, int& row, int& column) const throw()
00444         {
00445                 const int numRows = this->length();
00446                 for (int i = row < 0 ? 0 : row; i < numRows; ++i)
00447                 {
00448                         int c = this->atUnchecked (i).ObjectArray<ArrayType>::indexOf (item, column);
00449                         if (c >= 0)
00450                         {
00451                                 row = i;
00452                                 column = c;
00453                                 return;
00454                         }
00455                 }
00456                 
00457                 row = -1;
00458                 column = -1;
00459         }
00460         
00462         bool isMatrix() const throw()
00463         {
00464                 const int numRows = this->length();
00465                 if (numRows < 2) return false;
00466                 
00467                 int numColumns = this->atUnchecked (0).length();
00468                 if (numColumns < 2) return false;
00469                 
00470                 int prevNumColumns = numColumns;
00471                 for (int row = 1; row < numRows; ++row)
00472                 {
00473                         numColumns = this->atUnchecked (row).length();
00474                         if (numColumns != prevNumColumns)
00475                                 return false;
00476                         
00477                         prevNumColumns = numColumns;
00478                 }
00479                 
00480                 return true;
00481         }
00482         
00484         int numRows() const throw()
00485         {
00486                 return this->size();
00487         }
00488         
00492         int numColumns() const throw()
00493         {
00494                 const int numRows = this->length();
00495                 if (numRows < 1) return 0;
00496                 
00497                 int numColumns = this->atUnchecked(0).length();
00498                 
00499                 int maxNumColumns = numColumns;
00500                 for (int row = 1; row < numRows; ++row)
00501                 {
00502                         numColumns = this->atUnchecked (row).length();
00503                         if (numColumns > maxNumColumns)
00504                                 maxNumColumns = numColumns;
00505                 }
00506                 
00507                 return maxNumColumns;
00508         }
00509     
00511         RowType flatten() const throw()
00512         {
00513                 RowType result;
00514                 const int numRows = this->length();
00515                 for (int i = 0; i < numRows; ++i)
00516                 {
00517                         const RowType& item = this->atUnchecked (i);
00518                         result <<= item;
00519                 }                       
00520                 
00521                 return result;
00522         }
00523     
00524     RowType columnWrapAt (const int index) throw()
00525     {
00526         const int numRows = this->length();
00527         RowType result (RowType::withSize (numRows));
00528         
00529         for (int i = 0; i < numRows; ++i)
00530                 {
00531                         const RowType& row = this->atUnchecked (i);
00532                         result.put (i, row.wrapAt (index));
00533                 }                       
00534         
00535         return result;
00536     }
00537     
00552     ObjectArrayType interleave() throw()
00553     {
00554         int i, j;
00555         int actualSize = 0;
00556         const int numRows = this->numRows();
00557         
00558         ObjectArrayType result = ObjectArrayType::withSize (numRows * this->numColumns());
00559         const RowType* const rows = this->getArray();
00560         
00561         for (i = 0; i < numRows; ++i)
00562         {
00563             const ArrayType* const sourceArray = rows[i].getArray();
00564             const int numColumns = rows[i].length();
00565             ArrayType* resultArray = result.getArray() + i;
00566             
00567             for (j = 0; j < numColumns; ++j, resultArray += numRows, ++actualSize)
00568                 *resultArray = sourceArray[j];
00569         }
00570         
00571         result.setSize (actualSize, true); // shrink the size if needed
00572         
00573         return result;
00574     }
00575         
00576         
00577         //ObjectArrayConcatOperatorsDefine(ObjectArray2DBase, ArrayType);
00578 };
00579 
00580 
00581 //------------------------------------------------------------------------------
00582 
00583 
00584 
00585 template<class ArrayType, class RowType>
00586 class ObjectArray2D : public ObjectArray2DBase<ArrayType,RowType>
00587 {
00588 public:
00589     typedef ObjectArrayInternal<RowType>            Internal; 
00590     typedef ObjectArray2DBase<ArrayType,RowType>    Base;    
00591     typedef WeakPointerContainer<ObjectArray2D>     Weak;
00592     
00593     typedef ObjectArray<ArrayType>                  ObjectArrayType;
00594     typedef ObjectArray<ObjectArrayType>            ObjectArray2DType;
00595     typedef typename Base::InitialObject            InitialObject;
00596 
00597         
00598     explicit ObjectArray2D (Internal* internalToUse) throw() 
00599         :       Base (internalToUse)
00600         {
00601         } 
00602     
00605     ObjectArray2D (ObjectArray2D const& copy) throw()
00606     :   Base (static_cast<Base const&> (copy))
00607     {
00608     }
00609     
00610     ObjectArray2D (Dynamic const& other) throw()
00611     :   Base (other.as<ObjectArray2D>().getInternal())
00612     {
00613     }    
00614     
00616     ObjectArray2D& operator= (ObjectArray2D const& other) throw()
00617         {
00618                 if (this != &other)
00619             this->setInternal (other.getInternal());//this->setInternal (other.containerCopy().getInternal());
00620         
00621         return *this;
00622         }
00623     
00627     static ObjectArray2D fromWeak (Weak const& weak) throw()
00628     {
00629         return weak.fromWeak();
00630     }    
00631         
00632     static const ObjectArray2D& getNull() throw()
00633         {
00634                 static ObjectArray2D null;
00635                 return null;
00636         }                       
00637     
00638     ObjectArray2D (const int rows = 0) throw()
00639         :       Base (rows < 0 ? 0 : rows)
00640         {
00641         }
00642     
00643         ObjectArray2D (const int rows, const int columns) throw()
00644         :       Base (rows < 0 ? 0 : rows)
00645         {
00646                 if (columns > 0 && rows > 0)
00647                 {
00648                         for (int i = 0; i < rows; i++)
00649                         {
00650                                 this->put (i, RowType (columns, false));
00651                         }
00652                 }
00653         }
00654     
00655         ObjectArray2D (RowType const& single) throw()
00656         :       Base (single)
00657         {
00658         }
00659     
00660         ObjectArray2D (InitialObject const &i00,
00661                                    InitialObject const &i01,
00662                                    InitialObject const &i02 = InitialObject(),
00663                                    InitialObject const &i03 = InitialObject()) throw()
00664         :       Base (i00, i01, i02, i03) 
00665         {
00666         }
00667     
00668         ObjectArray2D (InitialObject const &i00,
00669                                    InitialObject const &i01,
00670                                    InitialObject const &i02,
00671                                    InitialObject const &i03,
00672                                    InitialObject const &i04,
00673                                    InitialObject const &i05 = InitialObject(),
00674                                    InitialObject const &i06 = InitialObject(),
00675                                    InitialObject const &i07 = InitialObject()) throw()
00676         :       Base (i00, i01, i02, i03,
00677               i04, i05, i06, i07) 
00678         {
00679         }
00680     
00681         ObjectArray2D (InitialObject const &i00,
00682                                    InitialObject const &i01,
00683                                    InitialObject const &i02,
00684                                    InitialObject const &i03,
00685                                    InitialObject const &i04,
00686                                    InitialObject const &i05,
00687                                    InitialObject const &i06,
00688                                    InitialObject const &i07,
00689                                    InitialObject const &i08,
00690                                    InitialObject const &i09 = InitialObject(),
00691                                    InitialObject const &i10 = InitialObject(),
00692                                    InitialObject const &i11 = InitialObject(),
00693                                    InitialObject const &i12 = InitialObject(),
00694                                    InitialObject const &i13 = InitialObject(),
00695                                    InitialObject const &i14 = InitialObject(),
00696                                    InitialObject const &i15 = InitialObject()) throw()
00697         :       Base (i00, i01, i02, i03,
00698               i04, i05, i06, i07,
00699               i08, i09, i10, i11, 
00700               i12, i13, i14, i15)
00701         {
00702         }
00703     
00704         ObjectArray2D (InitialObject const &i00,
00705                                    InitialObject const &i01,
00706                                    InitialObject const &i02,
00707                                    InitialObject const &i03,
00708                                    InitialObject const &i04,
00709                                    InitialObject const &i05,
00710                                    InitialObject const &i06,
00711                                    InitialObject const &i07,
00712                                    InitialObject const &i08,
00713                                    InitialObject const &i09,
00714                                    InitialObject const &i10,
00715                                    InitialObject const &i11,
00716                                    InitialObject const &i12,
00717                                    InitialObject const &i13,
00718                                    InitialObject const &i14,
00719                                    InitialObject const &i15,
00720                                    InitialObject const &i16,
00721                                    InitialObject const &i17 = InitialObject(),
00722                                    InitialObject const &i18 = InitialObject(),
00723                                    InitialObject const &i19 = InitialObject(),
00724                                    InitialObject const &i20 = InitialObject(),
00725                                    InitialObject const &i21 = InitialObject(),
00726                                    InitialObject const &i22 = InitialObject(),
00727                                    InitialObject const &i23 = InitialObject(),
00728                                    InitialObject const &i24 = InitialObject(),
00729                                    InitialObject const &i25 = InitialObject(),
00730                                    InitialObject const &i26 = InitialObject(),
00731                                    InitialObject const &i27 = InitialObject(),
00732                                    InitialObject const &i28 = InitialObject(),
00733                                    InitialObject const &i29 = InitialObject(),
00734                                    InitialObject const &i30 = InitialObject(),
00735                                    InitialObject const &i31 = InitialObject()) throw()
00736         :       Base (i00, i01, i02, i03,
00737               i04, i05, i06, i07,
00738               i08, i09, i10, i11, 
00739               i12, i13, i14, i15, 
00740               i16, i17, i18, i19,
00741               i20, i21, i22, i23,
00742               i24, i25, i26, i27,
00743               i28, i29, i30, i31)
00744         {
00745         }
00746     
00747         ObjectArrayAssignmentDefinition(ObjectArray2D, RowType);
00748     
00749         ObjectArray2D (ObjectArray2D<ArrayType,RowType> const& array0, 
00750                                    ObjectArray2D<ArrayType,RowType> const& array1) throw()
00751         :       Base (array0, array1)
00752         {
00753         }
00754     
00755     PLONK_OBJECTARROWOPERATOR(ObjectArray2D);
00756 
00757 };
00758 
00759 
00760 
00761 #endif // PLONK_OBJECTARRAY2D_H
 All Classes Functions Typedefs Enumerations Enumerator Properties