Cafu Engine
PlantDescrMan.hpp
1 /*
2 Cafu Engine, http://www.cafu.de/
3 Copyright (c) Carsten Fuchs and other contributors.
4 This project is licensed under the terms of the MIT license.
5 */
6 
7 #ifndef CAFU_PLANT_DESCR_MAN_HPP_INCLUDED
8 #define CAFU_PLANT_DESCR_MAN_HPP_INCLUDED
9 
10 #include <string>
11 #include <map>
12 
13 
14 struct PlantDescriptionT;
15 
16 
17 /// The plant description manager holds and manages all plant descriptions so they can be shared
18 /// with multiple different plants.
20 {
21  public:
22 
23  /// Constructor.
24  /// @param BaseDir The base directory in which all plant descriptions are contained.
25  PlantDescrManT(const std::string& BaseDir="");
26 
27  /// Destrcutor.
29 
30  /// Gets a plant description identified by its filename.
31  /// @param DescrFileName The file name of the plant description (relative to the plant description base dir).
32  /// @return Pointer to the plant description or a dummy plant description on error.
33  PlantDescriptionT* GetPlantDescription(const std::string& DescrFileName);
34 
35  /// Changes the base directory for the plant descriptions.
36  /// @param BaseDir The new base directory.
37  void SetModDir(const std::string& BaseDir) { m_BaseDir=BaseDir; }
38 
39 
40  private:
41 
42  PlantDescrManT(const PlantDescrManT&); // Use of the Copy Constructor is not allowed.
43  void operator = (const PlantDescrManT&); // Use of the Assignment Operator is not allowed.
44 
45  std::map<std::string, PlantDescriptionT*> m_PlantDescriptions;
46 
47  std::string m_BaseDir;
48 };
49 
50 
51 #endif
void SetModDir(const std::string &BaseDir)
Changes the base directory for the plant descriptions.
Definition: PlantDescrMan.hpp:37
The plant description manager holds and manages all plant descriptions so they can be shared with mul...
Definition: PlantDescrMan.hpp:19
PlantDescrManT(const std::string &BaseDir="")
Constructor.
Definition: PlantDescrMan.cpp:13
Contains a plant description that has all the information needed to create a plant.
Definition: PlantDescription.hpp:23
PlantDescriptionT * GetPlantDescription(const std::string &DescrFileName)
Gets a plant description identified by its filename.
Definition: PlantDescrMan.cpp:28
~PlantDescrManT()
Destrcutor.
Definition: PlantDescrMan.cpp:19