![]() |
GURLS++
2.0.00
C++ Implementation of GURLS Matlab Toolbox
|
00001 /* 00002 * The GURLS Package in C++ 00003 * 00004 * Copyright (C) 2011-1013, IIT@MIT Lab 00005 * All rights reserved. 00006 * 00007 * author: M. Santoro 00008 * email: msantoro@mit.edu 00009 * website: http://cbcl.mit.edu/IIT@MIT/IIT@MIT.html 00010 * 00011 * Redistribution and use in source and binary forms, with or without 00012 * modification, are permitted provided that the following conditions 00013 * are met: 00014 * 00015 * * Redistributions of source code must retain the above 00016 * copyright notice, this list of conditions and the following 00017 * disclaimer. 00018 * * Redistributions in binary form must reproduce the above 00019 * copyright notice, this list of conditions and the following 00020 * disclaimer in the documentation and/or other materials 00021 * provided with the distribution. 00022 * * Neither the name(s) of the copyright holders nor the names 00023 * of its contributors or of the Massacusetts Institute of 00024 * Technology or of the Italian Institute of Technology may be 00025 * used to endorse or promote products derived from this software 00026 * without specific prior written permission. 00027 * 00028 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00029 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00030 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00031 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00032 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00033 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00034 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00035 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00036 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00037 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00038 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00039 * POSSIBILITY OF SUCH DAMAGE. 00040 */ 00041 00042 #ifndef _GURLS_OPTARRAY_H_ 00043 #define _GURLS_OPTARRAY_H_ 00044 00045 #include "gurls++/options.h" 00046 00047 #include <vector> 00048 00049 namespace gurls 00050 { 00051 00052 class GurlsOptionsList; 00053 00058 class GURLS_EXPORT OptArray: public GurlsOption 00059 { 00060 public: 00061 00062 typedef std::vector<GurlsOption*> ValueType; 00063 00064 protected: 00065 00066 ValueType *value; 00067 00068 00069 public: 00070 00074 OptArray(); 00075 00079 OptArray(const OptArray& other); 00080 00084 ~OptArray(); 00085 00089 const ValueType& getValue() const; 00090 00094 void push_back(GurlsOption *opt); 00095 00102 void erase(unsigned long index, bool deleteMembers = true); 00103 00107 void clear(); 00108 00112 void reserve(unsigned long size); 00113 00117 virtual bool isA(OptTypes id) const; 00118 00122 static OptArray* dynacast(GurlsOption* opt); 00123 00127 static const OptArray* dynacast(const GurlsOption* opt); 00128 00132 unsigned long size() const; 00133 00137 GurlsOption* operator[] (unsigned long i) const; 00138 00142 friend GURLS_EXPORT std::ostream& operator<<(std::ostream& os, const OptArray& opt); 00143 00147 virtual std::ostream& operator<<(std::ostream& os) const; 00148 00152 void save(const std::string& fileName) const; 00153 00157 void load(const std::string& fileName); 00158 00159 }; 00160 00161 } 00162 00163 #endif //_GURLS_OPTARRAY_H_