Documentation for OpenFLUID 2.2.0
DatastoreDescriptor.hpp
Go to the documentation of this file.
1 /*
2 
3  This file is part of OpenFLUID software
4  Copyright(c) 2007, INRA - Montpellier SupAgro
5 
6 
7  == GNU General Public License Usage ==
8 
9  OpenFLUID is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  OpenFLUID is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with OpenFLUID. If not, see <http://www.gnu.org/licenses/>.
21 
22 
23  == Other Usage ==
24 
25  Other Usage means a use of OpenFLUID that is inconsistent with the GPL
26  license, and requires a written agreement between You and INRA.
27  Licensees for Other Usage of OpenFLUID may use this file in accordance
28  with the terms contained in the written agreement between You and INRA.
29 
30 */
31 
32 
33 /**
34  @file DatastoreDescriptor.hpp
35 
36  @author Jean-Christophe FABRE <jean-christophe.fabre@inra.fr>
37  @author Aline LIBRES <aline.libres@gmail.com>
38 */
39 
40 
41 #ifndef __OPENFLUID_FLUIDX_DATASTOREDESCRIPTOR_HPP__
42 #define __OPENFLUID_FLUIDX_DATASTOREDESCRIPTOR_HPP__
43 
44 
45 #include <list>
46 
47 #include <openfluid/dllexport.hpp>
49 
50 
51 namespace openfluid { namespace fluidx {
52 
53 
55 {
56  public:
57 
58  typedef std::list<DatastoreItemDescriptor*> DatastoreDescription_t;
59 
60 
61  private:
62 
63  DatastoreDescription_t m_DatastoreDescription;
64 
65 
66  public:
67 
68  DatastoreDescriptor() = default;
69 
71  { }
72 
74 
75  const DatastoreDescription_t& items() const;
76 
78 
79  bool isItemExist(const std::string& ItemID) const;
80 
82 
85 
86  /**
87  Move the Item located at the given From position to the To position (positions starts at index 0)
88  @param From
89  @param To
90  @throw openfluid::base::FrameworkException a position is out of range
91  */
92  void moveItem(unsigned int From, unsigned int To);
93 
94  /**
95  Insert an Item before the given position (positions starts at index 0)
96  @param[in] Item the DatastoreItemDescriptor to insert
97  @param[in] Position the position, should be between zero and list size - 1.
98  To insert an Item at the end of the list, use appendItem instead.
99  @throw openfluid::base::FrameworkException if Position is out of range
100  */
101  void insertItem(openfluid::fluidx::DatastoreItemDescriptor* Item, unsigned int Position);
102 
103  /**
104  Remove from the list the Item located at the given Position (positions starts at index 0).
105  This doesn't delete the DatastoreItemDescriptor pointer.
106  @param[in] Position the position
107  @throw openfluid::base::FrameworkException if Position is out of range
108  */
109  void removeItem(unsigned int Position);
110 
111  std::list<std::string> getItemsIDs() const;
112 
113  /**
114  @brief Gets the item of the datastore matching the given ID.
115 
116  @param ItemID ID of the expected item.
117  @return The item with the given ID, or 0 if not found.
118  */
120 
121 };
122 
123 
124 } } // namespaces
125 
126 
127 #endif /* __OPENFLUID_FLUIDX_DATASTOREDESCRIPTOR_HPP__ */
UnstructuredType
Definition: UnstructuredValue.hpp:58
Definition: DatastoreDescriptor.hpp:55
const DatastoreDescription_t & items() const
std::list< std::string > getItemsIDs() const
DatastoreDescription_t getItems(const openfluid::core::UnitsClass_t &UnitClass) const
~DatastoreDescriptor()
Definition: DatastoreDescriptor.hpp:70
openfluid::fluidx::DatastoreItemDescriptor * item(const std::string &ItemID)
Gets the item of the datastore matching the given ID.
void moveItem(unsigned int From, unsigned int To)
DatastoreDescription_t getItems(const openfluid::core::UnitsClass_t &UnitClass, openfluid::core::UnstructuredValue::UnstructuredType Type) const
bool appendItem(DatastoreItemDescriptor *Item)
bool isItemExist(const std::string &ItemID) const
void insertItem(openfluid::fluidx::DatastoreItemDescriptor *Item, unsigned int Position)
std::list< DatastoreItemDescriptor * > DatastoreDescription_t
Definition: DatastoreDescriptor.hpp:58
DatastoreDescription_t & items()
void removeItem(unsigned int Position)
Definition: DatastoreItemDescriptor.hpp:56
#define OPENFLUID_API
Definition: dllexport.hpp:86
std::string UnitsClass_t
Definition: TypeDefs.hpp:98
Definition: ApplicationException.hpp:47