Skip to content

Commit e3a1e9f

Browse files
committed
Add name attribute to Street class
1 parent 362e2c5 commit e3a1e9f

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

src/dsm/dsm.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
static constexpr uint8_t DSM_VERSION_MAJOR = 2;
88
static constexpr uint8_t DSM_VERSION_MINOR = 1;
9-
static constexpr uint8_t DSM_VERSION_PATCH = 7;
9+
static constexpr uint8_t DSM_VERSION_PATCH = 8;
1010

1111
#define DSM_VERSION \
1212
std::format("{}.{}.{}", DSM_VERSION_MAJOR, DSM_VERSION_MINOR, DSM_VERSION_PATCH)

src/dsm/headers/Street.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ namespace dsm {
1010
m_id{id},
1111
m_capacity{street.capacity()},
1212
m_transportCapacity{street.transportCapacity()},
13-
m_nLanes{street.nLanes()} {
13+
m_nLanes{street.nLanes()},
14+
m_name{street.name()} {
1415
for (auto i{0}; i < street.nLanes(); ++i) {
1516
m_exitQueues.push_back(dsm::queue<Size>());
1617
}
@@ -58,13 +59,15 @@ namespace dsm {
5859
double len,
5960
double maxSpeed,
6061
std::pair<Id, Id> nodePair,
61-
int16_t nLanes)
62+
int16_t nLanes,
63+
std::string const& name)
6264
: m_nodePair{std::move(nodePair)},
6365
m_len{len},
6466
m_angle{0.},
6567
m_id{id},
6668
m_capacity{capacity},
67-
m_transportCapacity{1}
69+
m_transportCapacity{1},
70+
m_name{name}
6871

6972
{
7073
this->setMaxSpeed(maxSpeed);

src/dsm/headers/Street.hpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <set>
1919
#include <format>
2020
#include <cassert>
21+
#include <string>
2122

2223
#include "Agent.hpp"
2324
#include "Node.hpp"
@@ -39,6 +40,7 @@ namespace dsm {
3940
double m_maxSpeed;
4041
double m_angle;
4142
Id m_id;
43+
std::string m_name;
4244
Size m_capacity;
4345
int16_t m_transportCapacity;
4446
int16_t m_nLanes;
@@ -78,12 +80,14 @@ namespace dsm {
7880
/// @param lanes The street's number of lanes
7981
/// @param maxSpeed The street's speed limit
8082
/// @param nodePair The street's node pair
83+
/// @param name The street's name (default is "")
8184
Street(Id id,
8285
Size capacity,
8386
double len,
8487
double maxSpeed,
8588
std::pair<Id, Id> nodePair,
86-
int16_t nLanes);
89+
int16_t nLanes,
90+
std::string const& name = std::string());
8791

8892
virtual ~Street() = default;
8993

@@ -182,6 +186,9 @@ namespace dsm {
182186
/// @brief Get the street's number of lanes
183187
/// @return int16_t The street's number of lanes
184188
int16_t nLanes() const { return m_nLanes; }
189+
/// @brief Get the street's name
190+
/// @return std::string_view The street's name
191+
std::string_view name() const { return m_name; }
185192
/// @brief Get the number of agents on all queues
186193
/// @return Size The number of agents on all queues
187194
Size nExitingAgents() const;

0 commit comments

Comments
 (0)