diff --git a/libs/elevator/include/elevator/elevator_state.hpp b/libs/elevator/include/elevator/elevator_state.hpp index d3ac8f3..862dfef 100644 --- a/libs/elevator/include/elevator/elevator_state.hpp +++ b/libs/elevator/include/elevator/elevator_state.hpp @@ -24,7 +24,7 @@ class ElevatorState { uint64_t Version() const; common::BoolTable Requests() const; common::Inertia Inertia() const; - bool Valid() const; + [[nodiscard]] bool Valid() const; // Setters void SetId(int id); @@ -45,7 +45,7 @@ class ElevatorState { void OnUpdate(const ElevatorState& state); void IncrementVersion() { version_++; } void OnWatchdogTimeout(); - bool Usable() const; + [[nodiscard]] bool Usable() const; private: int id_{-1}; diff --git a/libs/network/include/network/udp_bcast.hpp b/libs/network/include/network/udp_bcast.hpp index 5078f98..af2464c 100644 --- a/libs/network/include/network/udp_bcast.hpp +++ b/libs/network/include/network/udp_bcast.hpp @@ -18,7 +18,7 @@ class NetworkPacket { elev::ordersync::CabOrderTable* cab_button_orders); int Id() const { return id_; } - bool Valid() const; + [[nodiscard]] bool Valid() const; elev::ordersync::OrderTable* Orders() { return &orders_; } const elev::ordersync::OrderTable* Orders() const { return &orders_; } elev::elevator::ElevatorState* State() { return &state_; } @@ -39,7 +39,7 @@ class UdpBroadcaster { UdpBroadcaster(uint16_t port, const std::string& bcast_ip); ~UdpBroadcaster(); - bool SendPacket(NetworkPacket* packet); + [[nodiscard]] bool SendPacket(NetworkPacket* packet); private: int socket_fd_{-1}; @@ -52,7 +52,7 @@ class UdpReciever { ~UdpReciever(); void Close(); - bool RecievePacket(NetworkPacket* packet); + [[nodiscard]] bool RecievePacket(NetworkPacket* packet); private: int socket_fd_{-1}; diff --git a/libs/ordersync/include/ordersync/ordersync.hpp b/libs/ordersync/include/ordersync/ordersync.hpp index 658d4c4..fb269dd 100644 --- a/libs/ordersync/include/ordersync/ordersync.hpp +++ b/libs/ordersync/include/ordersync/ordersync.hpp @@ -23,8 +23,8 @@ class Order { OrderStatus Status() const { return status_; } int AssignedId() const { return assigned_id_; } uint32_t ObservedMask() const { return observed_mask_; } - bool ObservedBy(int elev_id) const; - bool Valid() const; + [[nodiscard]] bool ObservedBy(int elev_id) const; + [[nodiscard]] bool Valid() const; // State machine void OnUpdate(const Order& rcv); @@ -55,7 +55,7 @@ class OrderTable { ordersync::Order* Order(int floor, int btn); const ordersync::Order* Order(int floor, int btn) const; BoolTable ToBoolTable(int elev_id) const; - bool Valid() const; + [[nodiscard]] bool Valid() const; private: std::array, kFloors> table_{};