core/CoreRepository.hpp
Go to the documentation of this file.
00001 /*
00002 
00003   This file is part of OpenFLUID software
00004   Copyright(c) 2007, INRA - Montpellier SupAgro
00005 
00006 
00007  == GNU General Public License Usage ==
00008 
00009   OpenFLUID is free software: you can redistribute it and/or modify
00010   it under the terms of the GNU General Public License as published by
00011   the Free Software Foundation, either version 3 of the License, or
00012   (at your option) any later version.
00013 
00014   OpenFLUID is distributed in the hope that it will be useful,
00015   but WITHOUT ANY WARRANTY; without even the implied warranty of
00016   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017   GNU General Public License for more details.
00018 
00019   You should have received a copy of the GNU General Public License
00020   along with OpenFLUID. If not, see <http://www.gnu.org/licenses/>.
00021 
00022 
00023  == Other Usage ==
00024 
00025   Other Usage means a use of OpenFLUID that is inconsistent with the GPL
00026   license, and requires a written agreement between You and INRA.
00027   Licensees for Other Usage of OpenFLUID may use this file in accordance
00028   with the terms contained in the written agreement between You and INRA.
00029   
00030 */
00031 
00032 
00033 
00034 #ifndef __COREREPOSITORY_HPP__
00035 #define __COREREPOSITORY_HPP__
00036 
00037 
00038 #include <openfluid/dllexport.hpp>
00039 #include <openfluid/core/Unit.hpp>
00040 
00041 
00042 namespace openfluid { namespace core {
00043 
00044 class Unit;
00045 class UnitsCollection;
00046 
00047 
00048 class DLLEXPORT CoreRepository
00049 {
00050   private:
00051 
00052     UnitsListByClassMap_t m_PcsOrderedUnitsByClass;
00053 
00054     UnitsPtrList_t m_PcsOrderedUnitsGlobal;
00055 
00056     static bool removeUnitFromList(UnitsPtrList_t* UnitsList,
00057                                    const UnitID_t& UnitID);
00058 
00059   public:
00060 
00061     CoreRepository();
00062 
00063     bool addUnit(const Unit aUnit);
00064 
00065     bool deleteUnit(Unit* aUnit);
00066 
00067     bool removeFromToConnection(Unit* FromUnit,
00068                                 Unit* ToUnit);
00069 
00070     bool removeChildParentConnection(Unit* ChildUnit,
00071                                      Unit* ParentUnit);
00072 
00073     bool sortUnitsByProcessOrder();
00074 
00075     Unit* getUnit(UnitClass_t UnitClass, UnitID_t UnitID);
00076 
00077     UnitsCollection* getUnits(UnitClass_t UnitClass);
00078 
00079     const UnitsCollection* getUnits(UnitClass_t UnitClass) const;
00080 
00081     inline const UnitsListByClassMap_t* getUnitsByClass() const { return &m_PcsOrderedUnitsByClass; };
00082 
00083     inline const UnitsPtrList_t* getUnitsGlobally() const { return &m_PcsOrderedUnitsGlobal; };
00084 
00085     inline UnitsPtrList_t* getUnitsGlobally() { return &m_PcsOrderedUnitsGlobal; };
00086 
00087     bool isUnitsClassExist(UnitClass_t UnitClass) const;
00088 
00089     void streamContents(std::ostream& OStream);
00090 
00091     void clearAllVariables();
00092 
00093     void clearAllAttributes();
00094 
00095     void clearAllEvents();
00096 
00097     void clearAllData();
00098 
00099     void clearUnits();
00100 
00101 };
00102 
00103 
00104 } } // namespaces
00105 
00106 
00107 #endif /* COREREPOSITORY_HPP_ */
00108 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines