Manual for OpenFLUID 2.1.11

SpatialGraph.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  @file SpatialGraph.hpp
34 
35  @author Jean-Christophe Fabre <jean-christophe.fabre@inra.fr>
36 */
37 
38 #ifndef __OPENFLUID_CORE_SPATIALGRAPH_HPP__
39 #define __OPENFLUID_CORE_SPATIALGRAPH_HPP__
40 
41 
43 #include <openfluid/dllexport.hpp>
44 
45 
46 namespace openfluid { namespace core {
47 
48 class SpatialUnit;
49 class UnitsCollection;
50 
51 
53 {
54  private:
55 
56  UnitsListByClassMap_t m_PcsOrderedUnitsByClass;
57 
58  UnitsPtrList_t m_PcsOrderedUnitsGlobal;
59 
60  static bool removeUnitFromList(UnitsPtrList_t* UnitsList,
61  const UnitID_t& UnitID);
62 
63  public:
64 
65  SpatialGraph() = default;
66 
67  SpatialUnit* addUnit(const SpatialUnit& aUnit);
68 
69  bool deleteUnit(SpatialUnit* aUnit);
70 
71  bool removeFromToConnection(SpatialUnit* FromUnit,
72  SpatialUnit* ToUnit);
73 
74  bool removeChildParentConnection(SpatialUnit* ChildUnit,
75  SpatialUnit* ParentUnit);
76 
77  bool sortUnitsByProcessOrder();
78 
79  SpatialUnit* spatialUnit(const UnitsClass_t& UnitsClass, UnitID_t UnitID);
80 
81  const SpatialUnit* spatialUnit(const UnitsClass_t& UnitsClass, UnitID_t UnitID) const;
82 
83  UnitsCollection* spatialUnits(const UnitsClass_t& UnitsClass);
84 
85  const UnitsCollection* spatialUnits(const UnitsClass_t& UnitsClass) const;
86 
88  {
89  return &m_PcsOrderedUnitsByClass;
90  };
91 
92  inline const UnitsPtrList_t* allSpatialUnits() const
93  {
94  return &m_PcsOrderedUnitsGlobal;
95  };
96 
98  {
99  return &m_PcsOrderedUnitsGlobal;
100  };
101 
102  bool isUnitsClassExist(const UnitsClass_t& UnitsClass) const;
103 
104  void streamContents(std::ostream& OStream);
105 
106  void clearAllVariables();
107 
108  void clearAllAttributes();
109 
110  void clearAllEvents();
111 
112  void clearAllData();
113 
114  void clearUnits();
115 
116 };
117 
118 
119 } } // namespaces
120 
121 
122 #endif /* __OPENFLUID_CORE_SPATIALGRAPH_HPP__ */
123 
openfluid::core::SpatialUnit
Definition: SpatialUnit.hpp:110
OPENFLUID_API
#define OPENFLUID_API
Definition: dllexport.hpp:86
openfluid::core::SpatialGraph::allSpatialUnits
UnitsPtrList_t * allSpatialUnits()
Definition: SpatialGraph.hpp:97
openfluid::core::UnitID_t
unsigned int UnitID_t
Definition: TypeDefs.hpp:70
openfluid
Definition: ApplicationException.hpp:47
openfluid::core::UnitsPtrList_t
std::list< SpatialUnit * > UnitsPtrList_t
Definition: SpatialUnit.hpp:77
openfluid::core::UnitsListByClassMap_t
std::map< UnitsClass_t, UnitsCollection > UnitsListByClassMap_t
Definition: SpatialUnit.hpp:62
openfluid::core::SpatialGraph::allSpatialUnits
const UnitsPtrList_t * allSpatialUnits() const
Definition: SpatialGraph.hpp:92
openfluid::core::UnitsClass_t
std::string UnitsClass_t
Definition: TypeDefs.hpp:98
openfluid::core::SpatialGraph
Definition: SpatialGraph.hpp:52
openfluid::core::SpatialGraph::allSpatialUnitsByClass
const UnitsListByClassMap_t * allSpatialUnitsByClass() const
Definition: SpatialGraph.hpp:87
dllexport.hpp
SpatialUnit.hpp
openfluid::core::UnitsCollection
Definition: UnitsCollection.hpp:59