Skip to content

Commit 0b117c8

Browse files
RB-392 c++17 unique_ptr copied (#92)
* fix(rtbot): c++17 unique_ptr copied * fix(rtbot) github action libstdc++ libstdc++-14-dev
1 parent 222b41e commit 0b117c8

File tree

8 files changed

+24
-19
lines changed

8 files changed

+24
-19
lines changed

.github/workflows/preview.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ jobs:
4141
with:
4242
python-version: 3.11
4343

44-
# Install clang + libc++ (needed for C++17 build with Bazel)
45-
- name: Install clang and libc++
44+
# Install clang + libstdc++ (needed for C++17 build with Bazel)
45+
- name: Install clang and libstdc++
4646
run: |
4747
sudo apt-get update
48-
sudo apt-get install -y clang libc++-dev libc++abi-dev
48+
sudo apt-get install -y clang libstdc++-14-dev
4949
5050
# Mount Bazel cache
5151
- name: Mount bazel caches

libs/api/include/rtbot/OperatorJson.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ class OperatorJson {
285285
} else if (type == "Add") {
286286
j["value"] = std::dynamic_pointer_cast<Add>(op)->get_value();
287287
} else if (type == "Ignore") {
288-
j["value"] = std::dynamic_pointer_cast<Ignore>(op)->get_count();
288+
j["count"] = std::dynamic_pointer_cast<Ignore>(op)->get_count();
289289
} else if (type == "Linear") {
290290
j["coefficients"] = std::dynamic_pointer_cast<Linear>(op)->get_coefficients();
291291
} else if (type == "PeakDetector") {

libs/api/src/bindings.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,13 @@ using json = nlohmann::json;
2020

2121
void to_json(json& j, const ProgramMsgBatch& batch) {
2222
j = json::object();
23-
for (const auto& [op_id, op_batch] : batch) {
23+
for (const auto& op_kv : batch) {
24+
const auto& op_id = op_kv.first;
25+
const auto& op_batch = op_kv.second;
2426
j[op_id] = json::object();
25-
for (const auto& [port_name, msgs] : op_batch) {
27+
for (const auto& port_kv : op_batch) {
28+
const auto& port_name = port_kv.first;
29+
const auto& msgs = port_kv.second;
2630
j[op_id][port_name] = json::array();
2731
for (const auto& msg : msgs) {
2832
if (auto* num_msg = dynamic_cast<const Message<NumberData>*>(msg.get())) {

libs/core/include/rtbot/Input.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Input : public Operator {
2020
if (!PortType::is_valid_port_type(type)) {
2121
throw std::runtime_error("Unknown port type: " + type);
2222
}
23-
PortType::add_port(*this, type, true, true);
23+
PortType::add_port(*this, type, true, false, true);
2424
last_sent_times_.push_back(0);
2525
port_type_names_.push_back(type);
2626
}

libs/core/include/rtbot/Join.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Join : public Operator {
3030
throw std::runtime_error("Unknown port type: " + type);
3131
}
3232

33-
PortType::add_port(*this, type, true, false); // input only
33+
PortType::add_port(*this, type, true, false, false); // input only
3434
data_time_tracker_[num_data_ports() - 1] = std::set<timestamp_t>();
3535
port_type_names_.push_back(type);
3636
}
@@ -40,7 +40,7 @@ class Join : public Operator {
4040
if (!PortType::is_valid_port_type(type)) {
4141
throw std::runtime_error("Unknown port type: " + type);
4242
}
43-
PortType::add_port(*this, type, false, true); // output only
43+
PortType::add_port(*this, type, false, false, true); // output only
4444
}
4545
}
4646

@@ -55,7 +55,7 @@ class Join : public Operator {
5555
throw std::runtime_error("Unknown port type: " + type);
5656
}
5757

58-
PortType::add_port(*this, type, true, true);
58+
PortType::add_port(*this, type, true, false, true);
5959
data_time_tracker_[num_data_ports() - 1] = std::set<timestamp_t>();
6060
port_type_names_.push_back(type);
6161
}
@@ -70,7 +70,7 @@ class Join : public Operator {
7070

7171
std::string port_type = PortType::get_port_type<T>();
7272
for (size_t i = 0; i < num_ports; ++i) {
73-
PortType::add_port(*this, port_type, true, true);
73+
PortType::add_port(*this, port_type, true, false, true);
7474
data_time_tracker_[i] = std::set<timestamp_t>();
7575
port_type_names_.push_back(port_type);
7676
}

libs/core/include/rtbot/Output.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Output : public Operator {
2626
port_type_names_.push_back(type);
2727

2828
// Add input port and matching output port
29-
PortType::add_port(*this, type, true, true); // input port
29+
PortType::add_port(*this, type, true, false, true); // input port
3030
}
3131
}
3232

libs/core/include/rtbot/Pipeline.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Pipeline : public Operator {
3232
throw std::runtime_error("Unknown input port type: " + type);
3333
}
3434
// Add data input port
35-
PortType::add_port(*this, type, true, false);
35+
PortType::add_port(*this, type, true, false, false);
3636
input_port_types_.push_back(type);
3737
}
3838

@@ -42,7 +42,7 @@ class Pipeline : public Operator {
4242
throw std::runtime_error("Unknown output port type: " + type);
4343
}
4444
// Add output port
45-
PortType::add_port(*this, type, false, true);
45+
PortType::add_port(*this, type, false, false, true);
4646
output_port_types_.push_back(type);
4747
}
4848
}

libs/core/include/rtbot/PortType.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,29 +70,30 @@ class PortType {
7070

7171
// Helper method to add port of specified type to an operator
7272
template <typename OperatorType>
73-
static void add_port(OperatorType& op, const std::string& port_type, bool is_data = true, bool add_output = false) {
73+
static void add_port(OperatorType& op, const std::string& port_type, bool is_data = true, bool is_control = false,
74+
bool add_output = false) {
7475
if (port_type == NUMBER) {
7576
if (is_data)
7677
op.template add_data_port<NumberData>();
77-
else
78+
else if (is_control)
7879
op.template add_control_port<NumberData>();
7980
if (add_output) op.template add_output_port<NumberData>();
8081
} else if (port_type == BOOLEAN) {
8182
if (is_data)
8283
op.template add_data_port<BooleanData>();
83-
else
84+
else if (is_control)
8485
op.template add_control_port<BooleanData>();
8586
if (add_output) op.template add_output_port<BooleanData>();
8687
} else if (port_type == VECTOR_NUMBER) {
8788
if (is_data)
8889
op.template add_data_port<VectorNumberData>();
89-
else
90+
else if (is_control)
9091
op.template add_control_port<VectorNumberData>();
9192
if (add_output) op.template add_output_port<VectorNumberData>();
9293
} else if (port_type == VECTOR_BOOLEAN) {
9394
if (is_data)
9495
op.template add_data_port<VectorBooleanData>();
95-
else
96+
else if (is_control)
9697
op.template add_control_port<VectorBooleanData>();
9798
if (add_output) op.template add_output_port<VectorBooleanData>();
9899
} else {

0 commit comments

Comments
 (0)