libosmscout  1.1.1
BasemapDatabase.h
Go to the documentation of this file.
1 #ifndef OSMSCOUT_BASEMAPDATABASE_H
2 #define OSMSCOUT_BASEMAPDATABASE_H
3 
4 /*
5  This source is part of the libosmscout library
6  Copyright (C) 2017 Tim Teulings
7 
8  This library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Lesser General Public
10  License as published by the Free Software Foundation; either
11  version 2.1 of the License, or (at your option) any later version.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public
19  License along with this library; if not, write to the Free Software
20  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22 
23 // Type and style sheet configuration
24 #include <osmscout/OSMScoutTypes.h>
25 #include <osmscout/TypeConfig.h>
26 
27 // Water index
28 #include <osmscout/WaterIndex.h>
29 
31 
32 namespace osmscout {
33 
38  class OSMSCOUT_API BasemapDatabaseParameter CLASS_FINAL
39  {
40  private:
41  bool dataMMap{true};
42 
43  public:
44  BasemapDatabaseParameter() = default;
45 
46  void SetDataMMap(bool mmap);
47  bool GetDataMMap() const;
48  };
49 
63  class OSMSCOUT_API BasemapDatabase CLASS_FINAL
64  {
65  private:
66  BasemapDatabaseParameter parameter;
67 
68  std::string path;
69  bool isOpen;
70 
71  mutable WaterIndexRef waterIndex;
72  mutable std::mutex waterIndexMutex;
73 
74  public:
75  explicit BasemapDatabase(const BasemapDatabaseParameter& parameter);
76  virtual ~BasemapDatabase();
77 
78  bool Open(const std::string& path);
79  bool IsOpen() const;
80  void Close();
81 
82  std::string GetPath() const;
83 
84  WaterIndexRef GetWaterIndex() const;
85  };
86 
88  using BasemapDatabaseRef = std::shared_ptr<BasemapDatabase>;
89 }
90 
91 #endif
Definition: Area.h:38
#define CLASS_FINAL
Definition: Compiler.h:26
#define OSMSCOUT_API
Definition: CoreImportExport.h:45
std::shared_ptr< BasemapDatabase > BasemapDatabaseRef
Reference counted reference to an Database instance.
Definition: BasemapDatabase.h:88
std::shared_ptr< WaterIndex > WaterIndexRef
Definition: WaterIndex.h:106