All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CoreRepository.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 #ifndef __COREREPOSITORY_HPP__
35 #define __COREREPOSITORY_HPP__
36 
37 
38 #include <openfluid/dllexport.hpp>
39 #include <openfluid/core/Unit.hpp>
40 
41 
42 namespace openfluid { namespace core {
43 
44 class Unit;
45 class UnitsCollection;
46 
47 
49 {
50  private:
51 
52  UnitsListByClassMap_t m_PcsOrderedUnitsByClass;
53 
54  UnitsPtrList_t m_PcsOrderedUnitsGlobal;
55 
56  static bool removeUnitFromList(UnitsPtrList_t* UnitsList,
57  const UnitID_t& UnitID);
58 
59  public:
60 
62 
63  bool addUnit(const Unit aUnit);
64 
65  bool deleteUnit(Unit* aUnit);
66 
67  bool removeFromToConnection(Unit* FromUnit,
68  Unit* ToUnit);
69 
70  bool removeChildParentConnection(Unit* ChildUnit,
71  Unit* ParentUnit);
72 
73  bool sortUnitsByProcessOrder();
74 
75  Unit* getUnit(UnitClass_t UnitClass, UnitID_t UnitID);
76 
77  UnitsCollection* getUnits(UnitClass_t UnitClass);
78 
79  const UnitsCollection* getUnits(UnitClass_t UnitClass) const;
80 
81  inline const UnitsListByClassMap_t* getUnitsByClass() const { return &m_PcsOrderedUnitsByClass; };
82 
83  inline const UnitsPtrList_t* getUnitsGlobally() const { return &m_PcsOrderedUnitsGlobal; };
84 
85  inline UnitsPtrList_t* getUnitsGlobally() { return &m_PcsOrderedUnitsGlobal; };
86 
87  bool isUnitsClassExist(UnitClass_t UnitClass) const;
88 
89  void streamContents(std::ostream& OStream);
90 
91  void clearAllVariables();
92 
93  void clearAllAttributes();
94 
95  void clearAllEvents();
96 
97  void clearAllData();
98 
99  void clearUnits();
100 
101 };
102 
103 
104 } } // namespaces
105 
106 
107 #endif /* COREREPOSITORY_HPP_ */
108 
std::list< Unit * > UnitsPtrList_t
Definition: Unit.hpp:72
UnitsPtrList_t * getUnitsGlobally()
Definition: CoreRepository.hpp:85
Definition: UnitsColl.hpp:56
std::map< UnitClass_t, UnitsCollection > UnitsListByClassMap_t
Definition: Unit.hpp:65
std::string UnitClass_t
Definition: TypeDefs.hpp:69
const UnitsListByClassMap_t * getUnitsByClass() const
Definition: CoreRepository.hpp:81
const UnitsPtrList_t * getUnitsGlobally() const
Definition: CoreRepository.hpp:83
unsigned int UnitID_t
Definition: TypeDefs.hpp:59
Definition: CoreRepository.hpp:48
Definition: Unit.hpp:107
#define DLLEXPORT
Definition: dllexport.hpp:51