| 1 | 
  | 
/* | 
| 2 | 
< | 
 * Copyright (C) 2000-2004  Object Oriented Parallel Simulation Engine (OOPSE) project | 
| 3 | 
< | 
 *  | 
| 4 | 
< | 
 * Contact: oopse@oopse.org | 
| 5 | 
< | 
 *  | 
| 6 | 
< | 
 * This program is free software; you can redistribute it and/or | 
| 7 | 
< | 
 * modify it under the terms of the GNU Lesser General Public License | 
| 8 | 
< | 
 * as published by the Free Software Foundation; either version 2.1 | 
| 9 | 
< | 
 * of the License, or (at your option) any later version. | 
| 10 | 
< | 
 * All we ask is that proper credit is given for our work, which includes | 
| 11 | 
< | 
 * - but is not limited to - adding the above copyright notice to the beginning | 
| 12 | 
< | 
 * of your source code files, and to any copyright notice that you may distribute | 
| 13 | 
< | 
 * with programs based on this work. | 
| 14 | 
< | 
 *  | 
| 15 | 
< | 
 * This program is distributed in the hope that it will be useful, | 
| 16 | 
< | 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| 17 | 
< | 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
| 18 | 
< | 
 * GNU Lesser General Public License for more details. | 
| 19 | 
< | 
 *  | 
| 20 | 
< | 
 * You should have received a copy of the GNU Lesser General Public License | 
| 21 | 
< | 
 * along with this program; if not, write to the Free Software | 
| 22 | 
< | 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. | 
| 2 | 
> | 
 * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. | 
| 3 | 
  | 
 * | 
| 4 | 
+ | 
 * The University of Notre Dame grants you ("Licensee") a | 
| 5 | 
+ | 
 * non-exclusive, royalty free, license to use, modify and | 
| 6 | 
+ | 
 * redistribute this software in source and binary code form, provided | 
| 7 | 
+ | 
 * that the following conditions are met: | 
| 8 | 
+ | 
 * | 
| 9 | 
+ | 
 * 1. Redistributions of source code must retain the above copyright | 
| 10 | 
+ | 
 *    notice, this list of conditions and the following disclaimer. | 
| 11 | 
+ | 
 * | 
| 12 | 
+ | 
 * 2. Redistributions in binary form must reproduce the above copyright | 
| 13 | 
+ | 
 *    notice, this list of conditions and the following disclaimer in the | 
| 14 | 
+ | 
 *    documentation and/or other materials provided with the | 
| 15 | 
+ | 
 *    distribution. | 
| 16 | 
+ | 
 * | 
| 17 | 
+ | 
 * This software is provided "AS IS," without a warranty of any | 
| 18 | 
+ | 
 * kind. All express or implied conditions, representations and | 
| 19 | 
+ | 
 * warranties, including any implied warranty of merchantability, | 
| 20 | 
+ | 
 * fitness for a particular purpose or non-infringement, are hereby | 
| 21 | 
+ | 
 * excluded.  The University of Notre Dame and its licensors shall not | 
| 22 | 
+ | 
 * be liable for any damages suffered by licensee as a result of | 
| 23 | 
+ | 
 * using, modifying or distributing the software or its | 
| 24 | 
+ | 
 * derivatives. In no event will the University of Notre Dame or its | 
| 25 | 
+ | 
 * licensors be liable for any lost revenue, profit or data, or for | 
| 26 | 
+ | 
 * direct, indirect, special, consequential, incidental or punitive | 
| 27 | 
+ | 
 * damages, however caused and regardless of the theory of liability, | 
| 28 | 
+ | 
 * arising out of the use of or inability to use software, even if the | 
| 29 | 
+ | 
 * University of Notre Dame has been advised of the possibility of | 
| 30 | 
+ | 
 * such damages. | 
| 31 | 
+ | 
 * | 
| 32 | 
+ | 
 * SUPPORT OPEN SCIENCE!  If you use OpenMD or its source code in your | 
| 33 | 
+ | 
 * research, please cite the appropriate papers when you publish your | 
| 34 | 
+ | 
 * work.  Good starting points are: | 
| 35 | 
+ | 
 *                                                                       | 
| 36 | 
+ | 
 * [1]  Meineke, et al., J. Comp. Chem. 26, 252-271 (2005).              | 
| 37 | 
+ | 
 * [2]  Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006).           | 
| 38 | 
+ | 
 * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008).           | 
| 39 | 
+ | 
 * [4]  Kuang & Gezelter,  J. Chem. Phys. 133, 164101 (2010). | 
| 40 | 
+ | 
 * [5]  Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). | 
| 41 | 
  | 
 */ | 
| 42 | 
< | 
 | 
| 42 | 
> | 
  | 
| 43 | 
  | 
/** | 
| 44 | 
  | 
 * @file GenericData.hpp | 
| 45 | 
  | 
 * @brief | 
| 55 | 
  | 
#include <list> | 
| 56 | 
  | 
#include <string> | 
| 57 | 
  | 
#include <vector> | 
| 58 | 
< | 
namespace oopse{ | 
| 58 | 
> | 
#include "config.h" | 
| 59 | 
> | 
namespace OpenMD{ | 
| 60 | 
  | 
 | 
| 61 | 
< | 
    /** | 
| 62 | 
< | 
     * @ class GenericData GenericData.hpp "utils/GenericData.hpp" | 
| 63 | 
< | 
     * @brief Base class for generic data which is associated with an id | 
| 64 | 
< | 
     */ | 
| 65 | 
< | 
    class GenericData{ | 
| 66 | 
< | 
        public: | 
| 67 | 
< | 
            GenericData() :  id_("UndefinedGenericData"){} | 
| 61 | 
> | 
  /** | 
| 62 | 
> | 
   * @ class GenericData GenericData.hpp "utils/GenericData.hpp" | 
| 63 | 
> | 
   * @brief Base class for generic data which is associated with an id | 
| 64 | 
> | 
   */ | 
| 65 | 
> | 
  class GenericData{ | 
| 66 | 
> | 
  public: | 
| 67 | 
> | 
    GenericData() :  id_("UndefinedGenericData"){} | 
| 68 | 
  | 
 | 
| 69 | 
< | 
            GenericData(const std::string& id) {  setID(id);  } | 
| 69 | 
> | 
    GenericData(const std::string& id) {  setID(id);  } | 
| 70 | 
  | 
 | 
| 71 | 
< | 
            /** virtual destructor */ | 
| 72 | 
< | 
            virtual ~GenericData() {} | 
| 71 | 
> | 
    /** virtual destructor */ | 
| 72 | 
> | 
    virtual ~GenericData() {} | 
| 73 | 
  | 
 | 
| 74 | 
  | 
 | 
| 75 | 
< | 
            /** | 
| 76 | 
< | 
             *  Returns the id of this generic data | 
| 77 | 
< | 
             * | 
| 78 | 
< | 
             * @return the id of this generic data | 
| 79 | 
< | 
             * | 
| 80 | 
< | 
             * @see #setID | 
| 81 | 
< | 
             */ | 
| 82 | 
< | 
            const std::string getID() const { return id_;  } | 
| 75 | 
> | 
    /** | 
| 76 | 
> | 
     *  Returns the id of this generic data | 
| 77 | 
> | 
     * | 
| 78 | 
> | 
     * @return the id of this generic data | 
| 79 | 
> | 
     * | 
| 80 | 
> | 
     * @see #setID | 
| 81 | 
> | 
     */ | 
| 82 | 
> | 
    const std::string getID() const { return id_;  } | 
| 83 | 
  | 
 | 
| 84 | 
< | 
            /** | 
| 85 | 
< | 
             *  Sets the id of this generic data | 
| 86 | 
< | 
             * | 
| 87 | 
< | 
             * @param id the id to be set | 
| 88 | 
< | 
             * | 
| 89 | 
< | 
             * @see #getID | 
| 90 | 
< | 
             */ | 
| 91 | 
< | 
            void setID(const std::string& id) { id_ = id;  } | 
| 84 | 
> | 
    /** | 
| 85 | 
> | 
     *  Sets the id of this generic data | 
| 86 | 
> | 
     * | 
| 87 | 
> | 
     * @param id the id to be set | 
| 88 | 
> | 
     * | 
| 89 | 
> | 
     * @see #getID | 
| 90 | 
> | 
     */ | 
| 91 | 
> | 
    void setID(const std::string& id) { id_ = id;  } | 
| 92 | 
  | 
 | 
| 93 | 
  | 
             | 
| 94 | 
< | 
        private: | 
| 95 | 
< | 
            GenericData(const GenericData&); | 
| 96 | 
< | 
            GenericData& operator=(GenericData&); | 
| 97 | 
< | 
            std::string id_; | 
| 94 | 
> | 
  private: | 
| 95 | 
> | 
    GenericData(const GenericData&); | 
| 96 | 
> | 
    GenericData& operator=(GenericData&); | 
| 97 | 
> | 
    std::string id_; | 
| 98 | 
  | 
 | 
| 99 | 
< | 
    }; | 
| 99 | 
> | 
  }; | 
| 100 | 
  | 
 | 
| 101 | 
< | 
    /** | 
| 102 | 
< | 
     * @class SimpleTypeData | 
| 103 | 
< | 
     * @brief SimpleTypeData class is a POD  repository class  | 
| 104 | 
< | 
     * @warning ElemDataType must be copy constructible, and copy assignable | 
| 105 | 
< | 
     */ | 
| 106 | 
< | 
    template<typename ElemDataType> class SimpleTypeData : public GenericData{ | 
| 101 | 
> | 
  /** | 
| 102 | 
> | 
   * @class SimpleTypeData | 
| 103 | 
> | 
   * @brief SimpleTypeData class is a POD  repository class  | 
| 104 | 
> | 
   * @warning ElemDataType must be copy constructible, and copy assignable | 
| 105 | 
> | 
   */ | 
| 106 | 
> | 
  template<typename ElemDataType> class SimpleTypeData : public GenericData{ | 
| 107 | 
  | 
 | 
| 108 | 
< | 
        public: | 
| 109 | 
< | 
            SimpleTypeData() :  GenericData(), data_(ElemDataType()) {} | 
| 110 | 
< | 
            SimpleTypeData(const std::string& id) : GenericData(id), data_(ElemDataType()) {} | 
| 108 | 
> | 
  public: | 
| 109 | 
> | 
    SimpleTypeData() :  GenericData(), data_(ElemDataType()) {} | 
| 110 | 
> | 
    SimpleTypeData(const std::string& id) : GenericData(id), data_(ElemDataType()) {} | 
| 111 | 
> | 
    SimpleTypeData(const std::string&id , const ElemDataType& data) : GenericData(id), data_(data) {} | 
| 112 | 
> | 
    template<typename T> | 
| 113 | 
> | 
    SimpleTypeData(const SimpleTypeData<T>& s) { | 
| 114 | 
> | 
      data_ = s.getData(); | 
| 115 | 
> | 
    } | 
| 116 | 
  | 
 | 
| 117 | 
< | 
            template<typename T> | 
| 118 | 
< | 
            SimpleTypeData(const SimpleTypeData<T>& s) { | 
| 119 | 
< | 
                data_ = s.getData(); | 
| 97 | 
< | 
            } | 
| 98 | 
< | 
 | 
| 99 | 
< | 
            SimpleTypeData<ElemDataType>& operator =(const SimpleTypeData<ElemDataType>& s) { | 
| 100 | 
< | 
                if (this == &s) | 
| 101 | 
< | 
                    return *this; | 
| 117 | 
> | 
    SimpleTypeData<ElemDataType>& operator =(const SimpleTypeData<ElemDataType>& s) { | 
| 118 | 
> | 
      if (this == &s) | 
| 119 | 
> | 
        return *this; | 
| 120 | 
  | 
                 | 
| 121 | 
< | 
                data_ = s.getData(); | 
| 122 | 
< | 
                return *this;                 | 
| 123 | 
< | 
            } | 
| 121 | 
> | 
      data_ = s.getData(); | 
| 122 | 
> | 
      return *this;                 | 
| 123 | 
> | 
    } | 
| 124 | 
  | 
             | 
| 125 | 
< | 
            template<typename T> | 
| 126 | 
< | 
            SimpleTypeData<ElemDataType>& operator =(const SimpleTypeData<T>& s) {                 | 
| 127 | 
< | 
                data_ = s.getData(); | 
| 128 | 
< | 
                return *this; | 
| 129 | 
< | 
            } | 
| 125 | 
> | 
    template<typename T> | 
| 126 | 
> | 
    SimpleTypeData<ElemDataType>& operator =(const SimpleTypeData<T>& s) {                 | 
| 127 | 
> | 
      data_ = s.getData(); | 
| 128 | 
> | 
      return *this; | 
| 129 | 
> | 
    } | 
| 130 | 
  | 
             | 
| 131 | 
< | 
            /** Returns POD data */      | 
| 132 | 
< | 
            const ElemDataType& getData() const {return data_;} | 
| 133 | 
< | 
            ElemDataType& getData()  {return data_;} | 
| 134 | 
< | 
            /** | 
| 135 | 
< | 
            * Sets POD data | 
| 136 | 
< | 
            * @data POD data to be set | 
| 137 | 
< | 
            */ | 
| 138 | 
< | 
            void setData(const ElemDataType& data) { data_ = data;  } | 
| 131 | 
> | 
    /** Returns POD data */      | 
| 132 | 
> | 
    const ElemDataType& getData() const {return data_;} | 
| 133 | 
> | 
    ElemDataType& getData()  {return data_;} | 
| 134 | 
> | 
    /** | 
| 135 | 
> | 
     * Sets POD data | 
| 136 | 
> | 
     * @data POD data to be set | 
| 137 | 
> | 
     */ | 
| 138 | 
> | 
    void setData(const ElemDataType& data) { data_ = data;  } | 
| 139 | 
  | 
 | 
| 140 | 
< | 
        private: | 
| 141 | 
< | 
            ElemDataType data_; | 
| 142 | 
< | 
    }; | 
| 140 | 
> | 
  private: | 
| 141 | 
> | 
    ElemDataType data_; | 
| 142 | 
> | 
  }; | 
| 143 | 
  | 
 | 
| 144 | 
< | 
    /** BoolGenericData is a generic data type contains a bool variable */ | 
| 145 | 
< | 
    typedef SimpleTypeData<bool> BoolGenericData; | 
| 144 | 
> | 
  /** BoolGenericData is a generic data type contains a bool variable */ | 
| 145 | 
> | 
  typedef SimpleTypeData<bool> BoolGenericData; | 
| 146 | 
  | 
 | 
| 147 | 
< | 
    /** IntGenericData is a generic data type contains an integer variable */ | 
| 148 | 
< | 
    typedef SimpleTypeData<int> IntGenericData; | 
| 147 | 
> | 
  /** IntGenericData is a generic data type contains an integer variable */ | 
| 148 | 
> | 
  typedef SimpleTypeData<int> IntGenericData; | 
| 149 | 
  | 
 | 
| 150 | 
< | 
    /** FloatGenericData is a generic data type contains a float variable */ | 
| 151 | 
< | 
    typedef SimpleTypeData<float> FloatGenericData; | 
| 150 | 
> | 
  /** FloatGenericData is a generic data type contains a float variable */ | 
| 151 | 
> | 
  typedef SimpleTypeData<float> FloatGenericData; | 
| 152 | 
  | 
 | 
| 153 | 
< | 
    /** DoubleGenericData is a generic data type contains a double variable */ | 
| 154 | 
< | 
    typedef SimpleTypeData<double> DoubleGenericData; | 
| 153 | 
> | 
  /** DoubleGenericData is a generic data type contains a RealType variable */ | 
| 154 | 
> | 
  typedef SimpleTypeData<RealType> DoubleGenericData; | 
| 155 | 
  | 
   | 
| 156 | 
< | 
    /** | 
| 157 | 
< | 
     * @typedef StringGenericData | 
| 158 | 
< | 
     * A generic data type contains a string variable | 
| 159 | 
< | 
     * | 
| 160 | 
< | 
     * @code | 
| 161 | 
< | 
     *   StringGenericData* s = new StringGenericData("MyStringGenericData"); | 
| 162 | 
< | 
     *   PropertyMap propMap; | 
| 163 | 
< | 
     *   GenericData* gdata; | 
| 164 | 
< | 
     * | 
| 165 | 
< | 
     *   s->setData("OOPSE"); | 
| 166 | 
< | 
     *   propMap->addProperty(s); | 
| 167 | 
< | 
     *    | 
| 168 | 
< | 
     *   gdata = propMap->getProperty("MyStringGenericData"); | 
| 169 | 
< | 
     *   if (gdata != NULL){ | 
| 170 | 
< | 
     *     s = dynamic_cast<StringGenericData*>(gdata); | 
| 171 | 
< | 
     *     if (s != NULL) | 
| 172 | 
< | 
     *       std::cout << s->getData() << std::endl; | 
| 173 | 
< | 
     *   } | 
| 174 | 
< | 
     * | 
| 175 | 
< | 
     * @endcode | 
| 176 | 
< | 
     */   | 
| 177 | 
< | 
    typedef SimpleTypeData<std::string> StringGenericData; | 
| 156 | 
> | 
  /** | 
| 157 | 
> | 
   * @typedef StringGenericData | 
| 158 | 
> | 
   * A generic data type contains a  std::string variable | 
| 159 | 
> | 
   * | 
| 160 | 
> | 
   * @code | 
| 161 | 
> | 
   *   StringGenericData* s = new StringGenericData("MyStringGenericData"); | 
| 162 | 
> | 
   *   PropertyMap propMap; | 
| 163 | 
> | 
   *   GenericData* gdata; | 
| 164 | 
> | 
   * | 
| 165 | 
> | 
   *   s->setData("OpenMD"); | 
| 166 | 
> | 
   *   propMap->addProperty(s); | 
| 167 | 
> | 
   *    | 
| 168 | 
> | 
   *   gdata = propMap->getPropertyByName("MyStringGenericData"); | 
| 169 | 
> | 
   *   if (gdata != NULL){ | 
| 170 | 
> | 
   *     s = dynamic_cast<StringGenericData*>(gdata); | 
| 171 | 
> | 
   *     if (s != NULL) | 
| 172 | 
> | 
   *       std::cout << s->getData() << std::endl; | 
| 173 | 
> | 
   *   } | 
| 174 | 
> | 
   * | 
| 175 | 
> | 
   * @endcode | 
| 176 | 
> | 
   */   | 
| 177 | 
> | 
  typedef SimpleTypeData<std::string> StringGenericData; | 
| 178 | 
  | 
 | 
| 179 | 
< | 
    /** | 
| 180 | 
< | 
    * @class STLContainerTypeData  | 
| 181 | 
< | 
    * @brief STL container type generic data which is associated with an id | 
| 182 | 
< | 
    * | 
| 183 | 
< | 
    * @template ContainerType | 
| 184 | 
< | 
    * @template ElemDataType | 
| 185 | 
< | 
    */ | 
| 186 | 
< | 
    template <template<typename ELEM, typename = std::allocator<ELEM> > class ContainerType, | 
| 187 | 
< | 
                     typename ElemDataType >  | 
| 188 | 
< | 
    class STLContainerTypeData : public GenericData, public ContainerType<ElemDataType>{ | 
| 189 | 
< | 
        public: | 
| 172 | 
< | 
            typedef STLContainerTypeData<ContainerType, ElemDataType> SelfType; | 
| 173 | 
< | 
            typedef ContainerType<ElemDataType> STLContainerType; | 
| 179 | 
> | 
  /** | 
| 180 | 
> | 
   * @class STLContainerTypeData  | 
| 181 | 
> | 
   * @brief STL container type generic data which is associated with an id | 
| 182 | 
> | 
   * | 
| 183 | 
> | 
   * @template ContainerType | 
| 184 | 
> | 
   * @template ElemDataType | 
| 185 | 
> | 
   */ | 
| 186 | 
> | 
  template <typename ElemDataType >  | 
| 187 | 
> | 
  class VectorTypeData : public GenericData { | 
| 188 | 
> | 
  public: | 
| 189 | 
> | 
    typedef VectorTypeData<ElemDataType> SelfType; | 
| 190 | 
  | 
 | 
| 191 | 
< | 
            STLContainerTypeData(const std::string& id)  | 
| 192 | 
< | 
                : GenericData(id),  ContainerType<ElemDataType> () {} | 
| 191 | 
> | 
    VectorTypeData(const std::string& id)  | 
| 192 | 
> | 
      : GenericData(id){} | 
| 193 | 
  | 
             | 
| 194 | 
< | 
            STLContainerTypeData(const SelfType& s) : SelfType(s){} | 
| 194 | 
> | 
    VectorTypeData(const SelfType& s) : data_(s){} | 
| 195 | 
  | 
 | 
| 196 | 
< | 
            SelfType& operator =(const SelfType& s){ | 
| 197 | 
< | 
                if (this == &s) | 
| 198 | 
< | 
                    return *this; | 
| 196 | 
> | 
    SelfType& operator =(const SelfType& s){ | 
| 197 | 
> | 
      if (this == &s) | 
| 198 | 
> | 
        return *this; | 
| 199 | 
  | 
 | 
| 200 | 
< | 
                STLContainerType::operator=(s); | 
| 201 | 
< | 
                return *this; | 
| 202 | 
< | 
            } | 
| 203 | 
< | 
    }; | 
| 200 | 
> | 
      this->data_ = s.data_; | 
| 201 | 
> | 
      return *this; | 
| 202 | 
> | 
    } | 
| 203 | 
> | 
             | 
| 204 | 
> | 
  private: | 
| 205 | 
> | 
    std::vector<ElemDataType> data_; | 
| 206 | 
> | 
  }; | 
| 207 | 
  | 
 | 
| 208 | 
< | 
    /** | 
| 209 | 
< | 
     * @typedef IntVectorGenericData | 
| 210 | 
< | 
     * A generic data type contains a vector<int> variable. | 
| 211 | 
< | 
     */   | 
| 212 | 
< | 
    typedef STLContainerTypeData<std::vector, int> IntVectorGenericData; | 
| 208 | 
> | 
  /** | 
| 209 | 
> | 
   * @typedef IntVectorGenericData | 
| 210 | 
> | 
   * A generic data type contains a  std::vector<int> variable. | 
| 211 | 
> | 
   */   | 
| 212 | 
> | 
  typedef VectorTypeData<int> IntVectorGenericData; | 
| 213 | 
  | 
 | 
| 214 | 
< | 
    /** | 
| 215 | 
< | 
     * @typedef IntVectorGenericData | 
| 216 | 
< | 
     * A generic data type contains a vector<float> variable. | 
| 217 | 
< | 
     */   | 
| 218 | 
< | 
    typedef STLContainerTypeData<std::vector, float> FloatVectorGenericData; | 
| 214 | 
> | 
  /** | 
| 215 | 
> | 
   * @typedef IntVectorGenericData | 
| 216 | 
> | 
   * A generic data type contains a  std::vector<float> variable. | 
| 217 | 
> | 
   */   | 
| 218 | 
> | 
  typedef VectorTypeData<float> FloatVectorGenericData; | 
| 219 | 
  | 
 | 
| 220 | 
< | 
    /** | 
| 221 | 
< | 
     * @typedef IntVectorGenericData | 
| 222 | 
< | 
     * A generic data type contains a vector<double> variable. | 
| 223 | 
< | 
     */   | 
| 224 | 
< | 
    typedef STLContainerTypeData<std::vector, double> DoubleVectorGenericData; | 
| 220 | 
> | 
  /** | 
| 221 | 
> | 
   * @typedef IntVectorGenericData | 
| 222 | 
> | 
   * A generic data type contains a  std::vector<RealType> variable. | 
| 223 | 
> | 
   */   | 
| 224 | 
> | 
  typedef VectorTypeData<RealType> DoubleVectorGenericData; | 
| 225 | 
  | 
 | 
| 226 | 
< | 
    /**  | 
| 227 | 
< | 
     * @typedef StringVectorGenericData | 
| 228 | 
< | 
     *  A generic data type contains a vector<string> variable. | 
| 229 | 
< | 
     * | 
| 230 | 
< | 
     * @code | 
| 231 | 
< | 
     *  StringVectorGenericData* sv = new StringVectorGenericData("MyStringVector"); | 
| 232 | 
< | 
     *  GenericData* gdata; | 
| 233 | 
< | 
     *  PropertyMap propMap; | 
| 234 | 
< | 
     *  std::vector<std::string>::iterator iter; | 
| 235 | 
< | 
     *   | 
| 236 | 
< | 
     *  sv->push_back("Hello World"); | 
| 237 | 
< | 
     *  sv->push_back("OOPSE"); | 
| 238 | 
< | 
     * | 
| 239 | 
< | 
     *  propMap.addProperty(sv); | 
| 240 | 
< | 
     *   | 
| 241 | 
< | 
     *  gdata = propMap.getProperty("MyStringVector"); | 
| 242 | 
< | 
     * | 
| 243 | 
< | 
     *  if (gdata != NULL){ | 
| 244 | 
< | 
     *  | 
| 245 | 
< | 
     *    sv = dynamic_cast<StringVectorGenericData*>(gdata); | 
| 246 | 
< | 
     * | 
| 247 | 
< | 
     *    if (sv != NULL){ | 
| 248 | 
< | 
     *      for (iter = sv->begin(); iter != sv->end(); ++ iter) | 
| 249 | 
< | 
     *        std::cout << *iter << std::endl; | 
| 250 | 
< | 
     *    } | 
| 251 | 
< | 
     *  } | 
| 252 | 
< | 
     * @endcode | 
| 253 | 
< | 
     */   | 
| 254 | 
< | 
    typedef STLContainerTypeData<std::vector, std::string> StringVectorGenericData; | 
| 236 | 
< | 
 | 
| 237 | 
< | 
    /** | 
| 238 | 
< | 
     * @typedef IntVectorGenericData | 
| 239 | 
< | 
     * A generic data type contains a  list<vector<string> >  variable. | 
| 240 | 
< | 
     */   | 
| 241 | 
< | 
    typedef STLContainerTypeData<std::list, std::vector<int> > IntVectorListGenericData; | 
| 226 | 
> | 
  /**  | 
| 227 | 
> | 
   * @typedef StringVectorGenericData | 
| 228 | 
> | 
   *  A generic data type contains a  std::vector<string> variable. | 
| 229 | 
> | 
   * | 
| 230 | 
> | 
   * @code | 
| 231 | 
> | 
   *  StringVectorGenericData* sv = new StringVectorGenericData("MyStringVector"); | 
| 232 | 
> | 
   *  GenericData* gdata; | 
| 233 | 
> | 
   *  PropertyMap propMap; | 
| 234 | 
> | 
   *  std::vector<std::string>::iterator iter; | 
| 235 | 
> | 
   *   | 
| 236 | 
> | 
   *  sv->push_back("Hello World"); | 
| 237 | 
> | 
   *  sv->push_back("OpenMD"); | 
| 238 | 
> | 
   * | 
| 239 | 
> | 
   *  propMap.addProperty(sv); | 
| 240 | 
> | 
   *   | 
| 241 | 
> | 
   *  gdata = propMap.getPropertyByName("MyStringVector"); | 
| 242 | 
> | 
   * | 
| 243 | 
> | 
   *  if (gdata != NULL){ | 
| 244 | 
> | 
   *  | 
| 245 | 
> | 
   *    sv = dynamic_cast<StringVectorGenericData*>(gdata); | 
| 246 | 
> | 
   * | 
| 247 | 
> | 
   *    if (sv != NULL){ | 
| 248 | 
> | 
   *      for (iter = sv->begin(); iter != sv->end(); ++ iter) | 
| 249 | 
> | 
   *        std::cout << *iter << std::endl; | 
| 250 | 
> | 
   *    } | 
| 251 | 
> | 
   *  } | 
| 252 | 
> | 
   * @endcode | 
| 253 | 
> | 
   */   | 
| 254 | 
> | 
  typedef VectorTypeData<std::string> StringVectorGenericData; | 
| 255 | 
  | 
   | 
| 243 | 
– | 
#define CHIVALUE_ID "CHIVALUE" | 
| 244 | 
– | 
#define INTEGRALOFCHIDT_ID "INTEGRALOFCHIDT" | 
| 245 | 
– | 
#define ETAVALUE_ID "ETAVALUE" | 
| 256 | 
  | 
 | 
| 257 | 
< | 
} // namespace oopse | 
| 257 | 
> | 
} // namespace OpenMD | 
| 258 | 
  | 
#endif //UTIL _GENERICDATA_HPP |