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@supagro.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();
66 
67  bool 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  { return &m_PcsOrderedUnitsByClass; };
89 
90  inline const UnitsPtrList_t* allSpatialUnits() const
91  { return &m_PcsOrderedUnitsGlobal; };
92 
94  { return &m_PcsOrderedUnitsGlobal; };
95 
96  bool isUnitsClassExist(const UnitsClass_t& UnitsClass) const;
97 
98  void streamContents(std::ostream& OStream);
99 
100  void clearAllVariables();
101 
102  void clearAllAttributes();
103 
104  void clearAllEvents();
105 
106  void clearAllData();
107 
108  void clearUnits();
109 
110 };
111 
112 
113 } } // namespaces
114 
115 
116 #endif /* __OPENFLUID_CORE_SPATIALGRAPH_HPP__ */
117 
const UnitsListByClassMap_t * allSpatialUnitsByClass() const
Definition: SpatialGraph.hpp:87
Definition: UnitsCollection.hpp:58
std::string UnitsClass_t
Definition: TypeDefs.hpp:71
std::list< SpatialUnit * > UnitsPtrList_t
Definition: SpatialUnit.hpp:70
UnitsPtrList_t * allSpatialUnits()
Definition: SpatialGraph.hpp:93
const UnitsPtrList_t * allSpatialUnits() const
Definition: SpatialGraph.hpp:90
Definition: SpatialGraph.hpp:52
Definition: SpatialUnit.hpp:107
Definition: ApplicationException.hpp:47
#define OPENFLUID_API
Definition: dllexport.hpp:87
unsigned int UnitID_t
Definition: TypeDefs.hpp:61
std::map< UnitsClass_t, UnitsCollection > UnitsListByClassMap_t
Definition: SpatialUnit.hpp:64