All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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  UnitsCollection* spatialUnits(const UnitsClass_t& UnitsClass);
82 
83  const UnitsCollection* spatialUnits(const UnitsClass_t& UnitsClass) const;
84 
86  { return &m_PcsOrderedUnitsByClass; };
87 
88  inline const UnitsPtrList_t* allSpatialUnits() const
89  { return &m_PcsOrderedUnitsGlobal; };
90 
92  { return &m_PcsOrderedUnitsGlobal; };
93 
94  bool isUnitsClassExist(const UnitsClass_t& UnitsClass) const;
95 
96  void streamContents(std::ostream& OStream);
97 
98  void clearAllVariables();
99 
100  void clearAllAttributes();
101 
102  void clearAllEvents();
103 
104  void clearAllData();
105 
106  void clearUnits();
107 
108 };
109 
110 
111 } } // namespaces
112 
113 
114 #endif /* __OPENFLUID_CORE_SPATIALGRAPH_HPP__ */
115 
unsigned int UnitID_t
Definition: TypeDefs.hpp:61
std::list< SpatialUnit * > UnitsPtrList_t
Definition: SpatialUnit.hpp:67
std::string UnitsClass_t
Definition: TypeDefs.hpp:71
Definition: SpatialUnit.hpp:104
const UnitsPtrList_t * allSpatialUnits() const
Definition: SpatialGraph.hpp:88
UnitsPtrList_t * allSpatialUnits()
Definition: SpatialGraph.hpp:91
Definition: SpatialGraph.hpp:52
const UnitsListByClassMap_t * allSpatialUnitsByClass() const
Definition: SpatialGraph.hpp:85
std::map< UnitsClass_t, UnitsCollection > UnitsListByClassMap_t
Definition: SpatialUnit.hpp:61
#define OPENFLUID_API
Definition: dllexport.hpp:87
Definition: UnitsCollection.hpp:58