Skip to content

Commit e4493e4

Browse files
committed
to_string
1 parent ce37884 commit e4493e4

2 files changed

Lines changed: 9 additions & 20 deletions

File tree

include/osp/bsp/model/BspInstance.hpp

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ enum class RETURN_STATUS { OSP_SUCCESS,
3232
TIMEOUT,
3333
ERROR };
3434

35-
inline std::string to_string(const RETURN_STATUS status) {
35+
/**
36+
* @brief Converts the enum to a string literal.
37+
* Returns const char* to avoid std::string allocation overhead.
38+
*/
39+
inline const char *to_string(const RETURN_STATUS status) {
3640
switch (status) {
3741
case RETURN_STATUS::OSP_SUCCESS:
3842
return "SUCCESS";
@@ -47,25 +51,11 @@ inline std::string to_string(const RETURN_STATUS status) {
4751
}
4852
}
4953

54+
/**
55+
* @brief Stream operator overload using the helper function.
56+
*/
5057
inline std::ostream &operator<<(std::ostream &os, RETURN_STATUS status) {
51-
switch (status) {
52-
case RETURN_STATUS::OSP_SUCCESS:
53-
os << "SUCCESS";
54-
break;
55-
case RETURN_STATUS::BEST_FOUND:
56-
os << "BEST_FOUND";
57-
break;
58-
case RETURN_STATUS::TIMEOUT:
59-
os << "TIMEOUT";
60-
break;
61-
case RETURN_STATUS::ERROR:
62-
os << "ERROR";
63-
break;
64-
default:
65-
os << "UNKNOWN";
66-
break;
67-
}
68-
return os;
58+
return os << to_string(status);
6959
}
7060

7161
/**

include/osp/bsp/model/BspSchedule.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,6 @@ class BspSchedule : public IBspSchedule<Graph_t>, public IBspScheduleEval<Graph_
741741
}
742742

743743
for (const auto &parent : instance->getComputationalDag().parents(node)) {
744-
745744
if (node_to_superstep_assignment[parent] != step) {
746745
nodes_with_incoming_edges.insert(parent);
747746
}

0 commit comments

Comments
 (0)