-
Notifications
You must be signed in to change notification settings - Fork 4
Make RoadJunction's transportCapacity attribute a real number #281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| #pragma once | ||
|
|
||
| #include "Node.hpp" | ||
|
|
||
| #include "../utility/Typedef.hpp" | ||
|
|
||
| namespace dsm { | ||
| class RoadJunction : public Node { | ||
| Size m_capacity; | ||
| double m_transportCapacity; | ||
|
|
||
| public: | ||
| explicit RoadJunction(Id id); | ||
| RoadJunction(Id id, std::pair<double, double> coords); | ||
| RoadJunction(RoadJunction const& other); | ||
|
|
||
| RoadJunction& operator=(RoadJunction const& other) { | ||
| if (this != &other) { | ||
| Node::operator=(other); | ||
Check noticeCode scanning / Cppcheck (reported by Codacy) MISRA 17.7 rule Note
MISRA 17.7 rule
|
||
| m_capacity = other.m_capacity; | ||
| m_transportCapacity = other.m_transportCapacity; | ||
| } | ||
| return *this; | ||
| } | ||
|
|
||
| /// @brief Set the junction's capacity | ||
| /// @param capacity The junction's capacity | ||
| virtual void setCapacity(Size capacity); | ||
| /// @brief Set the junction's transport capacity | ||
| /// @param capacity The junction's transport capacity | ||
| void setTransportCapacity(double capacity); | ||
|
|
||
| /// @brief Get the junction's capacity | ||
| /// @return Size The junction's capacity | ||
| Size capacity() const; | ||
| /// @brief Get the junction's transport capacity | ||
| /// @return Size The junction's transport capacity | ||
| double transportCapacity() const; | ||
|
|
||
| virtual double density() const; | ||
| virtual bool isFull() const; | ||
|
|
||
| virtual bool isIntersection() const noexcept; | ||
| virtual bool isTrafficLight() const noexcept; | ||
| virtual bool isRoundabout() const noexcept; | ||
| }; | ||
| } // namespace dsm | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| #include "../headers/RoadJunction.hpp" | ||
|
|
||
| namespace dsm { | ||
| RoadJunction::RoadJunction(Id id) : Node(id), m_capacity{1}, m_transportCapacity{1.} {} | ||
Check noticeCode scanning / Cppcheck (reported by Codacy) MISRA 12.3 rule Note
MISRA 12.3 rule
|
||
| RoadJunction::RoadJunction(Id id, std::pair<double, double> coords) | ||
| : Node(id, coords), m_capacity{1}, m_transportCapacity{1.} {} | ||
Check noticeCode scanning / Cppcheck (reported by Codacy) MISRA 12.3 rule Note
MISRA 12.3 rule
|
||
| RoadJunction::RoadJunction(RoadJunction const& other) | ||
| : Node(other), | ||
| m_capacity{other.m_capacity}, | ||
Check noticeCode scanning / Cppcheck (reported by Codacy) MISRA 12.3 rule Note
MISRA 12.3 rule
|
||
| m_transportCapacity{other.m_transportCapacity} {} | ||
|
|
||
| void RoadJunction::setCapacity(Size capacity) { m_capacity = capacity; } | ||
| void RoadJunction::setTransportCapacity(double capacity) { | ||
| assert(capacity > 0.); | ||
| m_transportCapacity = capacity; | ||
| } | ||
|
|
||
| Size RoadJunction::capacity() const { return m_capacity; } | ||
| double RoadJunction::transportCapacity() const { return m_transportCapacity; } | ||
| double RoadJunction::density() const { return 0.; } | ||
| bool RoadJunction::isFull() const { return true; } | ||
|
|
||
| bool RoadJunction::isIntersection() const noexcept { return false; } | ||
| bool RoadJunction::isTrafficLight() const noexcept { return false; } | ||
| bool RoadJunction::isRoundabout() const noexcept { return false; } | ||
| } // namespace dsm | ||
Check notice
Code scanning / Cppcheck (reported by Codacy)
Member variable 'Intersection::m_agentCounter' is not initialized in the constructor. Note