Skip to content

Commit 94ae4d7

Browse files
committed
Remove useless inlines
1 parent fc68ee9 commit 94ae4d7

File tree

3 files changed

+57
-57
lines changed

3 files changed

+57
-57
lines changed

src/dsm/headers/Graph.hpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ namespace dsm {
5151
/// @brief Reassign the street ids using the max node id
5252
/// @details The street ids are reassigned using the max node id, i.e.
5353
/// newStreetId = srcId * n + dstId, where n is the max node id.
54-
inline void m_reassignIds();
54+
void m_reassignIds();
5555
/// @brief If every node has coordinates, set the street angles
5656
/// @details The street angles are set using the node's coordinates.
57-
inline void m_setStreetAngles();
57+
void m_setStreetAngles();
5858

5959
public:
6060
Graph();
@@ -65,7 +65,7 @@ namespace dsm {
6565
/// @param streetSet A map of streets representing the graph's streets
6666
Graph(const std::unordered_map<Id, std::unique_ptr<Street>>& streetSet);
6767

68-
inline Graph(const Graph& other) {
68+
Graph(const Graph& other) {
6969
std::for_each(other.m_nodes.begin(), other.m_nodes.end(), [this](const auto& pair) {
7070
this->m_nodes.emplace(pair.first, pair.second.get());
7171
});
@@ -77,7 +77,7 @@ namespace dsm {
7777
m_adjacency = other.m_adjacency;
7878
}
7979

80-
inline Graph& operator=(const Graph& other) {
80+
Graph& operator=(const Graph& other) {
8181
std::for_each(other.m_nodes.begin(), other.m_nodes.end(), [this](const auto& pair) {
8282
this->m_nodes.insert_or_assign(pair.first,
8383
std::unique_ptr<Node>(pair.second.get()));
@@ -93,8 +93,8 @@ namespace dsm {
9393
return *this;
9494
}
9595

96-
inline Graph(Graph&&) = default;
97-
inline Graph& operator=(Graph&&) = default;
96+
Graph(Graph&&) = default;
97+
Graph& operator=(Graph&&) = default;
9898

9999
/// @brief Build the graph's adjacency matrix and computes max capacity
100100
/// @details The adjacency matrix is built using the graph's streets and nodes. N.B.: The street ids
@@ -191,23 +191,23 @@ namespace dsm {
191191

192192
/// @brief Get the graph's adjacency matrix
193193
/// @return A std::shared_ptr to the graph's adjacency matrix
194-
inline const SparseMatrix<bool>& adjMatrix() const { return m_adjacency; }
194+
const SparseMatrix<bool>& adjMatrix() const { return m_adjacency; }
195195
/// @brief Get the graph's node map
196196
/// @return A std::unordered_map containing the graph's nodes
197-
inline const std::unordered_map<Id, std::unique_ptr<Node>>& nodeSet() const {
197+
const std::unordered_map<Id, std::unique_ptr<Node>>& nodeSet() const {
198198
return m_nodes;
199199
}
200200
/// @brief Get the graph's node map
201201
/// @return A std::unordered_map containing the graph's nodes
202-
inline std::unordered_map<Id, std::unique_ptr<Node>>& nodeSet() { return m_nodes; }
202+
std::unordered_map<Id, std::unique_ptr<Node>>& nodeSet() { return m_nodes; }
203203
/// @brief Get the graph's street map
204204
/// @return A std::unordered_map containing the graph's streets
205-
inline const std::unordered_map<Id, std::unique_ptr<Street>>& streetSet() const {
205+
const std::unordered_map<Id, std::unique_ptr<Street>>& streetSet() const {
206206
return m_streets;
207207
}
208208
/// @brief Get the graph's street map
209209
/// @return A std::unordered_map containing the graph's streets
210-
inline std::unordered_map<Id, std::unique_ptr<Street>>& streetSet() {
210+
std::unordered_map<Id, std::unique_ptr<Street>>& streetSet() {
211211
return m_streets;
212212
}
213213
/// @brief Get a street from the graph

src/dsm/headers/Node.hpp

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -49,40 +49,40 @@ namespace dsm {
4949

5050
/// @brief Set the node's id
5151
/// @param id The node's id
52-
inline void setId(Id id) { m_id = id; }
52+
void setId(Id id) { m_id = id; }
5353
/// @brief Set the node's coordinates
5454
/// @param coords A std::pair containing the node's coordinates (lat, lon)
55-
inline void setCoords(std::pair<double, double> coords) {
55+
void setCoords(std::pair<double, double> coords) {
5656
m_coords = std::move(coords);
5757
}
5858
/// @brief Set the node's capacity
5959
/// @param capacity The node's capacity
60-
inline virtual void setCapacity(Size capacity) { m_capacity = capacity; }
60+
virtual void setCapacity(Size capacity) { m_capacity = capacity; }
6161
/// @brief Set the node's transport capacity
6262
/// @param capacity The node's transport capacity
63-
inline virtual void setTransportCapacity(Size capacity) {
63+
virtual void setTransportCapacity(Size capacity) {
6464
m_transportCapacity = capacity;
6565
}
6666
/// @brief Get the node's id
6767
/// @return Id The node's id
68-
inline Id id() const { return m_id; }
68+
Id id() const { return m_id; }
6969
/// @brief Get the node's coordinates
7070
/// @return std::optional<std::pair<double, double>> A std::pair containing the node's coordinates
71-
inline const std::optional<std::pair<double, double>>& coords() const {
71+
const std::optional<std::pair<double, double>>& coords() const {
7272
return m_coords;
7373
}
7474
/// @brief Get the node's capacity
7575
/// @return Size The node's capacity
76-
inline Size capacity() const { return m_capacity; }
76+
Size capacity() const { return m_capacity; }
7777
/// @brief Get the node's transport capacity
7878
/// @return Size The node's transport capacity
79-
inline Size transportCapacity() const { return m_transportCapacity; }
79+
Size transportCapacity() const { return m_transportCapacity; }
8080

81-
inline virtual bool isFull() const = 0;
81+
virtual bool isFull() const = 0;
8282

83-
inline virtual bool isIntersection() const noexcept { return false; }
84-
inline virtual bool isTrafficLight() const noexcept { return false; }
85-
inline virtual bool isRoundabout() const noexcept { return false; }
83+
virtual bool isIntersection() const noexcept { return false; }
84+
virtual bool isTrafficLight() const noexcept { return false; }
85+
virtual bool isRoundabout() const noexcept { return false; }
8686
};
8787

8888
/// @brief The Intersection class represents a node in the network.
@@ -130,35 +130,35 @@ namespace dsm {
130130
void removeAgent(Id agentId);
131131
/// @brief Set the node streets with priority
132132
/// @param streetPriorities A std::set containing the node's street priorities
133-
inline void setStreetPriorities(std::set<Id> streetPriorities) {
133+
void setStreetPriorities(std::set<Id> streetPriorities) {
134134
m_streetPriorities = std::move(streetPriorities);
135135
}
136136
/// @brief Add a street to the node street priorities
137137
/// @param streetId The street's id
138-
inline void addStreetPriority(Id streetId) { m_streetPriorities.emplace(streetId); }
138+
void addStreetPriority(Id streetId) { m_streetPriorities.emplace(streetId); }
139139

140140
/// @brief Returns true if the node is full
141141
/// @return bool True if the node is full
142-
inline bool isFull() const override { return m_agents.size() == this->m_capacity; }
142+
bool isFull() const override { return m_agents.size() == this->m_capacity; }
143143

144144
/// @brief Get the node's street priorities
145145
/// @details This function returns a std::set containing the node's street priorities.
146146
/// If a street has priority, it means that the agents that are on that street
147147
/// have priority over the agents that are on the other streets.
148148
/// @return std::set<Id> A std::set containing the node's street priorities
149-
inline virtual const std::set<Id>& streetPriorities() const {
149+
virtual const std::set<Id>& streetPriorities() const {
150150
return m_streetPriorities;
151151
};
152152
/// @brief Get the node's agent ids
153153
/// @return std::set<Id> A std::set containing the node's agent ids
154-
inline const std::multimap<int16_t, Id>& agents() { return m_agents; };
154+
const std::multimap<int16_t, Id>& agents() { return m_agents; };
155155
/// @brief Returns the number of agents that have passed through the node
156156
/// @return Size The number of agents that have passed through the node
157157
/// @details This function returns the number of agents that have passed through the node
158158
/// since the last time this function was called. It also resets the counter.
159159
Size agentCounter();
160160

161-
inline virtual bool isIntersection() const noexcept override final { return true; }
161+
virtual bool isIntersection() const noexcept override final { return true; }
162162
};
163163

164164
template <typename Delay>
@@ -208,12 +208,12 @@ namespace dsm {
208208
/// @brief Set the node's left turn ratio
209209
/// @param first The first component of the left turn ratio
210210
/// @param second The second component of the left turn ratio
211-
inline void setLeftTurnRatio(double const first, double const second) {
211+
void setLeftTurnRatio(double const first, double const second) {
212212
setLeftTurnRatio(std::make_pair(first, second));
213213
}
214214
/// @brief Set the node's left turn ratio as std::pair(ratio, ratio)
215215
/// @param ratio The left turn ratio
216-
inline void setLeftTurnRatio(double const ratio) {
216+
void setLeftTurnRatio(double const ratio) {
217217
setLeftTurnRatio(std::make_pair(ratio, ratio));
218218
}
219219
/// @brief Increase the node's counter
@@ -233,7 +233,7 @@ namespace dsm {
233233
Delay counter() const { return m_counter; }
234234
/// @brief Get the node's left turn ratio
235235
/// @return std::optional<std::pair<double, double>> The node's left turn ratio
236-
inline std::optional<std::pair<double, double>> leftTurnRatio() const {
236+
std::optional<std::pair<double, double>> leftTurnRatio() const {
237237
return m_leftTurnRatio;
238238
}
239239
/// @brief Returns true if the traffic light is green
@@ -389,14 +389,14 @@ namespace dsm {
389389
dsm::queue<Id> m_agents;
390390

391391
public:
392-
inline Roundabout() = default;
392+
Roundabout() = default;
393393
/// @brief Construct a new Roundabout object
394394
/// @param id The node's id
395-
inline explicit Roundabout(Id id) : Node{id} {};
395+
explicit Roundabout(Id id) : Node{id} {};
396396
/// @brief Construct a new Roundabout object
397397
/// @param id The node's id
398398
/// @param coords A std::pair containing the node's coordinates
399-
inline Roundabout(Id id, std::pair<double, double> coords) : Node{id, coords} {};
399+
Roundabout(Id id, std::pair<double, double> coords) : Node{id, coords} {};
400400
/// @brief Construct a new Roundabout object
401401
/// @param node An Intersection object
402402
Roundabout(const Node& node);
@@ -412,14 +412,14 @@ namespace dsm {
412412
Id dequeue();
413413
/// @brief Get the node's queue
414414
/// @return dsm::queue<Id> The node's queue
415-
inline const dsm::queue<Id>& agents() const { return m_agents; }
415+
const dsm::queue<Id>& agents() const { return m_agents; }
416416

417417
/// @brief Returns true if the node is full
418418
/// @return bool True if the node is full
419-
inline bool isFull() const override { return m_agents.size() == this->m_capacity; }
419+
bool isFull() const override { return m_agents.size() == this->m_capacity; }
420420
/// @brief Returns true if the node is a roundabout
421421
/// @return bool True if the node is a roundabout
422-
inline bool isRoundabout() const noexcept override { return true; }
422+
bool isRoundabout() const noexcept override { return true; }
423423
};
424424

425425
}; // namespace dsm

src/dsm/headers/Street.hpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -104,24 +104,24 @@ namespace dsm {
104104
void setLength(double len);
105105
/// @brief Set the street's queue
106106
/// @param queue The street's queue
107-
inline void setQueue(dsm::queue<Size> queue, size_t index) {
107+
void setQueue(dsm::queue<Size> queue, size_t index) {
108108
m_exitQueues[index] = std::move(queue);
109109
}
110110
/// @brief Set the street's node pair
111111
/// @param node1 The source node of the street
112112
/// @param node2 The destination node of the street
113-
inline void setNodePair(Id node1, Id node2) {
113+
void setNodePair(Id node1, Id node2) {
114114
m_nodePair = std::make_pair(node1, node2);
115115
}
116116
/// @brief Set the street's node pair
117117
/// @param node1 The source node of the street
118118
/// @param node2 The destination node of the street
119-
inline void setNodePair(const Node& node1, const Node& node2) {
119+
void setNodePair(const Node& node1, const Node& node2) {
120120
m_nodePair = std::make_pair(node1.id(), node2.id());
121121
}
122122
/// @brief Set the street's node pair
123123
/// @param pair The street's node pair
124-
inline void setNodePair(std::pair<Id, Id> pair) { m_nodePair = std::move(pair); }
124+
void setNodePair(std::pair<Id, Id> pair) { m_nodePair = std::move(pair); }
125125
/// @brief Set the street's speed limit
126126
/// @param speed The street's speed limit
127127
/// @throw std::invalid_argument, If the speed is negative
@@ -141,57 +141,57 @@ namespace dsm {
141141

142142
/// @brief Get the street's id
143143
/// @return Id, The street's id
144-
inline Id id() const { return m_id; }
144+
Id id() const { return m_id; }
145145
/// @brief Get the street's capacity
146146
/// @return Size, The street's capacity
147-
inline Size capacity() const { return m_capacity; }
147+
Size capacity() const { return m_capacity; }
148148
/// @brief Get the street's transport capacity
149149
/// @details The transport capacity is the maximum number of agents that can traverse the street
150150
/// in a time step.
151151
/// @return Size, The street's transport capacity
152-
inline int16_t transportCapacity() const { return m_transportCapacity; }
152+
int16_t transportCapacity() const { return m_transportCapacity; }
153153
/// @brief Get the street's length
154154
/// @return double, The street's length
155-
inline double length() const { return m_len; }
155+
double length() const { return m_len; }
156156
/// @brief Get the street's waiting agents
157157
/// @return std::set<Id>, The street's waiting agents
158-
inline const std::set<Id>& waitingAgents() const { return m_waitingAgents; }
158+
const std::set<Id>& waitingAgents() const { return m_waitingAgents; }
159159
/// @brief Get the street's queue
160160
/// @return dsm::queue<Size>, The street's queue
161-
inline const dsm::queue<Size>& queue(size_t index) const {
161+
const dsm::queue<Size>& queue(size_t index) const {
162162
return m_exitQueues[index];
163163
}
164164
/// @brief Get the street's queues
165165
/// @return std::vector<dsm::queue<Size>> The street's queues
166-
inline const std::vector<dsm::queue<Size>>& exitQueues() const {
166+
const std::vector<dsm::queue<Size>>& exitQueues() const {
167167
return m_exitQueues;
168168
}
169169
/// @brief Get the street's node pair
170170
/// @return std::pair<Id, Id>, The street's node pair
171-
inline const std::pair<Id, Id>& nodePair() const { return m_nodePair; }
171+
const std::pair<Id, Id>& nodePair() const { return m_nodePair; }
172172
/// @brief Get the number of agents on the street
173173
/// @return Size, The number of agents on the street
174174
Size nAgents() const;
175175
/// @brief Get the street's density in \f$m^{-1}\f$
176176
/// @return double, The street's density
177-
inline double density() const { return nAgents() / (m_len * m_nLanes); }
177+
double density() const { return nAgents() / (m_len * m_nLanes); }
178178
/// @brief Get the street's normalized density
179179
/// @return double, The street's normalized density
180-
inline double normDensity() const {
180+
double normDensity() const {
181181
return nAgents() / static_cast<double>(m_capacity);
182182
}
183183
/// @brief Check if the street is full
184184
/// @return bool, True if the street is full, false otherwise
185185
bool isFull() const { return nAgents() == m_capacity; }
186186
/// @brief Get the street's speed limit
187187
/// @return double, The street's speed limit
188-
inline double maxSpeed() const { return m_maxSpeed; }
188+
double maxSpeed() const { return m_maxSpeed; }
189189
/// @brief Get the street's angle
190190
/// @return double The street's angle
191-
inline double angle() const { return m_angle; }
191+
double angle() const { return m_angle; }
192192
/// @brief Get the street's number of lanes
193193
/// @return int16_t The street's number of lanes
194-
inline int16_t nLanes() const { return m_nLanes; }
194+
int16_t nLanes() const { return m_nLanes; }
195195
/// @brief Get the number of agents on all queues
196196
/// @return Size The number of agents on all queues
197197
Size nExitingAgents() const;
@@ -209,7 +209,7 @@ namespace dsm {
209209
virtual std::optional<Id> dequeue(size_t index);
210210
/// @brief Check if the street is a spire
211211
/// @return bool True if the street is a spire, false otherwise
212-
inline virtual bool isSpire() const { return false; };
212+
virtual bool isSpire() const { return false; };
213213
};
214214

215215
/// @brief The SpireStreet class represents a street which is able to count agent flows in both input and output.
@@ -264,7 +264,7 @@ namespace dsm {
264264
std::optional<Id> dequeue(size_t index) override;
265265
/// @brief Check if the street is a spire
266266
/// @return bool True if the street is a spire, false otherwise
267-
inline bool isSpire() const final { return true; };
267+
bool isSpire() const final { return true; };
268268
};
269269

270270
}; // namespace dsm

0 commit comments

Comments
 (0)