libosmscout 1.1.1
Loading...
Searching...
No Matches
RouteData.h
Go to the documentation of this file.
1#ifndef OSMSCOUT_ROUTEDATA_H
2#define OSMSCOUT_ROUTEDATA_H
3
4/*
5 This source is part of the libosmscout library
6 Copyright (C) 2012 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#include <list>
24#include <vector>
25
26#include <osmscout/Path.h>
29
30namespace osmscout {
31
36 {
37 public:
39 {
40 private:
41 DatabaseId database;
42 Id currentNodeId;
43 size_t currentNodeIndex;
44 std::vector<ObjectFileRef> objects;
45 ObjectFileRef pathObject;
46 size_t targetNodeIndex;
47
48 public:
50 Id currentNodeId,
51 size_t currentNodeIndex,
52 const ObjectFileRef& pathObject,
53 size_t targetNodeIndex);
54
55 void SetObjects(const std::vector<ObjectFileRef>& objects);
56
58 {
59 return currentNodeId;
60 }
61
63 {
64 return DBFileOffset(GetDatabaseId(),GetPathObject().GetFileOffset());
65 }
66
68 {
69 return database;
70 }
71
72 size_t GetCurrentNodeIndex() const
73 {
74 return currentNodeIndex;
75 }
76
77 ObjectFileRef GetPathObject() const
78 {
79 return pathObject;
80 }
81
82 size_t GetTargetNodeIndex() const
83 {
84 return targetNodeIndex;
85 }
86
87 const std::vector<ObjectFileRef>& GetObjects() const
88 {
89 return objects;
90 }
91 };
92
93 private:
94 std::list<RouteEntry> entries;
95
96 public:
97 void Clear();
98
99 bool IsEmpty() const
100 {
101 return entries.empty();
102 }
103
104 void AddEntry(DatabaseId database,
105 Id currentNodeId,
106 size_t currentNodeIndex,
107 const ObjectFileRef& pathObject,
108 size_t targetNodeIndex);
109
110 std::list<RouteEntry>& Entries()
111 {
112 return entries;
113 }
114
115 const std::list<RouteEntry>& Entries() const
116 {
117 return entries;
118 }
119
120 void Append(RouteData routePart)
121 {
122 entries.splice(entries.end(),routePart.Entries());
123 }
124
125 void PopEntry()
126 {
127 entries.pop_back();
128 }
129 };
130}
131
132#endif
#define OSMSCOUT_API
Definition CoreImportExport.h:45
DatabaseId GetDatabaseId() const
Definition RouteData.h:67
void SetObjects(const std::vector< ObjectFileRef > &objects)
size_t GetTargetNodeIndex() const
Definition RouteData.h:82
RouteEntry(DatabaseId database, Id currentNodeId, size_t currentNodeIndex, const ObjectFileRef &pathObject, size_t targetNodeIndex)
ObjectFileRef GetPathObject() const
Definition RouteData.h:77
const std::vector< ObjectFileRef > & GetObjects() const
Definition RouteData.h:87
size_t GetCurrentNodeIndex() const
Definition RouteData.h:72
Id GetCurrentNodeId() const
Definition RouteData.h:57
DBFileOffset GetDBFileOffset() const
Definition RouteData.h:62
Definition RouteData.h:36
void AddEntry(DatabaseId database, Id currentNodeId, size_t currentNodeIndex, const ObjectFileRef &pathObject, size_t targetNodeIndex)
bool IsEmpty() const
Definition RouteData.h:99
void Append(RouteData routePart)
Definition RouteData.h:120
std::list< RouteEntry > & Entries()
Definition RouteData.h:110
const std::list< RouteEntry > & Entries() const
Definition RouteData.h:115
void PopEntry()
Definition RouteData.h:125
uint64_t Id
Definition OSMScoutTypes.h:40
Definition Area.h:39
uint32_t DatabaseId
Definition DBFileOffset.h:30
Definition DBFileOffset.h:93