NDEVR
API Documentation
StreetInfo.h
1#pragma once
2#include <NDEVR/Model.h>
3namespace NDEVR
4{
9 class StreetName : public Model
10 {
11 public:
18 StreetName(const Model& model)
19 : Model(model)
20 {
21
23 {
24 //setup model for first time
26 }
27 }
28
36
41 {
43 }
44
49 static constexpr const char* ValidRegex() { return "*."; } // TODO
54 static constexpr const char* TypeName() { return "street_name"; }
55 };
56
60 class SurfaceType : public Model
61 {
62 public:
69 SurfaceType(const Model& model)
70 : Model(model)
71 {
72
74 {
75 //setup model for first time
77 }
78 }
79
87
95
100 static constexpr const char* ValidRegex() { return "sad"; } // TODO
105 static constexpr const char* TypeName() { return "surface_type"; }
106 };
107
111 class SurfaceCondition : public Model
112 {
113 public:
121 : Model(model)
122 {
123
124 if (!is<NDPN::type>(TypeName()))
125 {
126 //setup model for first time
128 }
129 }
130
134 void setSurfaceCondition(const String& condition)
135 {
136 set(NDPO::uncompressed_data, condition);
137 }
138
146
151 static constexpr const char* ValidRegex() { return "sad";/*TODO*/ }
156 static constexpr const char* TypeName() { return "surface_condition"; }
157
158 };
159
163 class SpeedLimit : public Model
164 {
165 public:
172 SpeedLimit(const Model& model)
173 : Model(model)
174 {
175 if (!is<NDPN::type>(TypeName()))
176 {
177 //setup model for first time
179 }
180 }
181
185 void setSpeedLimit(const String& speed_limit)
186 {
187 set(NDPO::uncompressed_data, speed_limit);
188 }
189
197
201 static constexpr const char* TypeName() { return "speed_limit"; }
202 };
203
207 class StreetInfo : public Model
208 {
209 public:
219 StreetInfo(const Model& model)
220 : Model(model)
221 {
222 if (!is<NDPN::type>(TypeName()))
223 {
224 //setup model for first time
227 }
228 }
229
234 {
235 return StreetName(getChild(0));
236 }
237
242 {
243 return SurfaceType(getChild(1));
244 }
245
253
260 {
261 return SpeedLimit(getChild(3));
262 }
263
268 static constexpr const char* TypeName() { return "street_info"; }
269 };
270}
void set(t_property_type property, const t_type &value)
Sets a property value in the database.
constexpr decltype(auto) get() const
Retrieves a property value using a compile-time property constant, cast to the requested type.
bool is(t_property_type property, const StringView &value) const
Checks whether a string property matches the given StringView value.
Model()
Default constructor. Creates an uninitialized Model.
Definition Model.h:365
Model getChild(uint04 child) const
Returns the child model at the given child slot index.
void createChildren(uint04 child_size)
Creates multiple children at once.
Used to describe the speed limit of a road and used with StreetInfo object.
Definition StreetInfo.h:164
static constexpr const char * TypeName()
Returns the type identifier string for SpeedLimit models.
Definition StreetInfo.h:201
StringView getSpeedLimit() const
Returns the speed limit value as a string.
Definition StreetInfo.h:193
void setSpeedLimit(const String &speed_limit)
Sets the speed limit value as a string.
Definition StreetInfo.h:185
SpeedLimit(const Model &model)
Constructs a SpeedLimit from an existing Model.
Definition StreetInfo.h:172
StreetInfo(const Model &model)
Constructs a StreetInfo from an existing Model.
Definition StreetInfo.h:219
SurfaceType surfaceType()
Returns the surface type sub-model.
Definition StreetInfo.h:241
static constexpr const char * TypeName()
Returns the type identifier string for StreetInfo models.
Definition StreetInfo.h:268
SurfaceCondition surfaceCondition()
Returns the surface condition sub-model.
Definition StreetInfo.h:249
SpeedLimit speedLimit()
Returns the speed limit sub-model.
Definition StreetInfo.h:259
StreetName streetName()
Returns the street name sub-model.
Definition StreetInfo.h:233
A Model which contains information about the name of a street, road, highway, etc.
Definition StreetInfo.h:10
StreetName(const Model &model)
Constructs a StreetName from an existing Model.
Definition StreetInfo.h:18
StringView getStreet() const
Returns the street name string.
Definition StreetInfo.h:40
static constexpr const char * ValidRegex()
Returns a regex pattern for validating street names.
Definition StreetInfo.h:49
static constexpr const char * TypeName()
Returns the type identifier string for StreetName models.
Definition StreetInfo.h:54
void setStreet(const String &type)
Sets the street name string.
Definition StreetInfo.h:32
The core String View class for the NDEVR API.
Definition StringView.h:58
The core String class for the NDEVR API.
Definition String.h:95
Used to describe the condition of a surface for a StreetInfo object.
Definition StreetInfo.h:112
StringView getSurfaceCondition() const
Returns the surface condition description string.
Definition StreetInfo.h:142
static constexpr const char * ValidRegex()
Returns a regex pattern for validating surface condition values.
Definition StreetInfo.h:151
static constexpr const char * TypeName()
Returns the type identifier string for SurfaceCondition models.
Definition StreetInfo.h:156
SurfaceCondition(const Model &model)
Constructs a SurfaceCondition from an existing Model.
Definition StreetInfo.h:120
void setSurfaceCondition(const String &condition)
Sets the surface condition description string.
Definition StreetInfo.h:134
Used to describe the type of surface for a StreetInfo object.
Definition StreetInfo.h:61
SurfaceType(const Model &model)
Constructs a SurfaceType from an existing Model.
Definition StreetInfo.h:69
void setSurface(const String &type)
Sets the surface type description string.
Definition StreetInfo.h:83
static constexpr const char * TypeName()
Returns the type identifier string for SurfaceType models.
Definition StreetInfo.h:105
static constexpr const char * ValidRegex()
Returns a regex pattern for validating surface type values.
Definition StreetInfo.h:100
StringView getSurface() const
Returns the surface type description string.
Definition StreetInfo.h:91
The primary namespace for the NDEVR SDK.
@ type
The type identifier string for this model node.
Definition Model.h:58
@ uncompressed_data
Uncompressed binary data storage.