Skip to content

Commit 9086e87

Browse files
authored
Typos and docs (#367)
2 parents de34709 + 5f30395 commit 9086e87

File tree

4 files changed

+17
-18
lines changed

4 files changed

+17
-18
lines changed

src/dsf/base/Edge.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ namespace dsf {
2828
assert(!(std::abs(m_angle) > 2 * std::numbers::pi));
2929
}
3030

31-
void Edge::resetId(Id newId) { m_id = newId; }
32-
3331
void Edge::setGeometry(geometry::PolyLine geometry) {
3432
m_geometry = std::move(geometry);
3533
if (m_geometry.size() > 1) {
@@ -46,16 +44,10 @@ namespace dsf {
4644
m_weight = weight;
4745
}
4846

49-
Id Edge::id() const { return m_id; }
50-
Id Edge::source() const { return m_nodePair.first; }
51-
Id Edge::target() const { return m_nodePair.second; }
52-
std::pair<Id, Id> const& Edge::nodePair() const { return m_nodePair; }
53-
double Edge::angle() const { return m_angle; }
5447
double Edge::weight() const {
5548
return m_weight.has_value() ? *m_weight
5649
: throw std::runtime_error("Edge weight is not set.");
5750
}
58-
geometry::PolyLine const& Edge::geometry() const { return m_geometry; }
5951

6052
double Edge::deltaAngle(double const previousEdgeAngle) const {
6153
double deltaAngle{m_angle - previousEdgeAngle};

src/dsf/base/Edge.hpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,30 +32,34 @@ namespace dsf {
3232
Edge(const Edge&) = delete;
3333
virtual ~Edge() = default;
3434

35-
void resetId(Id newId);
35+
/// @brief Set the edge's geometry
36+
/// @param geometry dsf::geometry::PolyLine The edge's geometry, a vector of pairs of doubles representing the coordinates of the edge's geometry
3637
void setGeometry(geometry::PolyLine geometry);
38+
/// @brief Set the edge's weight
39+
/// @param weight The edge's weight
40+
/// @throws std::invalid_argument if the weight is less or equal to 0
3741
void setWeight(double const weight);
3842

3943
/// @brief Get the edge's id
4044
/// @return Id The edge's id
41-
Id id() const;
45+
inline auto id() const { return m_id; }
4246
/// @brief Get the edge's source node id
4347
/// @return Id The edge's source node id
44-
Id source() const;
48+
inline auto source() const { return m_nodePair.first; }
4549
/// @brief Get the edge's target node id
4650
/// @return Id The edge's target node id
47-
Id target() const;
51+
inline auto target() const { return m_nodePair.second; }
4852
/// @brief Get the edge's node pair
4953
/// @return std::pair<Id, Id> The edge's node pair, where the first element is the source node id and the second
5054
/// element is the target node id. The pair is (u, v) with the edge u -> v.
51-
std::pair<Id, Id> const& nodePair() const;
55+
inline auto const& nodePair() const { return m_nodePair; }
5256
/// @brief Get the edge's geometry
5357
/// @return dsf::geometry::PolyLine The edge's geometry, a vector of pairs of doubles representing the coordinates of the edge's geometry
54-
geometry::PolyLine const& geometry() const;
58+
inline auto const& geometry() const { return m_geometry; }
5559

5660
/// @brief Get the edge's angle, in radians, between the source and target nodes
5761
/// @return double The edge's angle, in radians
58-
double angle() const;
62+
inline auto angle() const { return m_angle; }
5963
/// @brief Get the edge's weight
6064
/// @return double The edge's weight
6165
double weight() const;

src/dsf/base/Node.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ namespace dsf {
7272
/// @brief Set the node's name
7373
/// @param name The node's name
7474
inline void setName(const std::string& name) noexcept { m_name = name; }
75-
75+
/// @brief Add an ingoing edge to the node
76+
/// @param edgeId The edge's id
77+
/// @throws std::invalid_argument if the edge already exists in the ingoing edges
7678
inline void addIngoingEdge(Id edgeId) {
7779
if (std::find(m_ingoingEdges.cbegin(), m_ingoingEdges.cend(), edgeId) !=
7880
m_ingoingEdges.cend()) {
@@ -83,7 +85,9 @@ namespace dsf {
8385
}
8486
m_ingoingEdges.push_back(edgeId);
8587
}
86-
88+
/// @brief Add an outgoing edge to the node
89+
/// @param edgeId The edge's id
90+
/// @throws std::invalid_argument if the edge already exists in the outgoing edges
8791
inline void addOutgoingEdge(Id edgeId) {
8892
if (std::find(m_outgoingEdges.cbegin(), m_outgoingEdges.cend(), edgeId) !=
8993
m_outgoingEdges.cend()) {

src/dsf/utility/queue.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
#pragma once
32

43
#include <queue>

0 commit comments

Comments
 (0)