diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index 247cc0d0..6f2ff3cd 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -41,11 +41,11 @@ jobs: with: python-version: 3.11 - # Install clang + libc++ (needed for C++17 build with Bazel) - - name: Install clang and libc++ + # Install clang + libstdc++ (needed for C++17 build with Bazel) + - name: Install clang and libstdc++ run: | sudo apt-get update - sudo apt-get install -y clang libc++-dev libc++abi-dev + sudo apt-get install -y clang libstdc++-14-dev # Mount Bazel cache - name: Mount bazel caches diff --git a/libs/api/include/rtbot/OperatorJson.h b/libs/api/include/rtbot/OperatorJson.h index 8936156c..17da8241 100644 --- a/libs/api/include/rtbot/OperatorJson.h +++ b/libs/api/include/rtbot/OperatorJson.h @@ -285,7 +285,7 @@ class OperatorJson { } else if (type == "Add") { j["value"] = std::dynamic_pointer_cast(op)->get_value(); } else if (type == "Ignore") { - j["value"] = std::dynamic_pointer_cast(op)->get_count(); + j["count"] = std::dynamic_pointer_cast(op)->get_count(); } else if (type == "Linear") { j["coefficients"] = std::dynamic_pointer_cast(op)->get_coefficients(); } else if (type == "PeakDetector") { diff --git a/libs/api/src/bindings.cpp b/libs/api/src/bindings.cpp index 7451fb65..bc721086 100644 --- a/libs/api/src/bindings.cpp +++ b/libs/api/src/bindings.cpp @@ -20,9 +20,13 @@ using json = nlohmann::json; void to_json(json& j, const ProgramMsgBatch& batch) { j = json::object(); - for (const auto& [op_id, op_batch] : batch) { + for (const auto& op_kv : batch) { + const auto& op_id = op_kv.first; + const auto& op_batch = op_kv.second; j[op_id] = json::object(); - for (const auto& [port_name, msgs] : op_batch) { + for (const auto& port_kv : op_batch) { + const auto& port_name = port_kv.first; + const auto& msgs = port_kv.second; j[op_id][port_name] = json::array(); for (const auto& msg : msgs) { if (auto* num_msg = dynamic_cast*>(msg.get())) { diff --git a/libs/core/include/rtbot/Input.h b/libs/core/include/rtbot/Input.h index 8607cf01..b2f2b3d1 100644 --- a/libs/core/include/rtbot/Input.h +++ b/libs/core/include/rtbot/Input.h @@ -20,7 +20,7 @@ class Input : public Operator { if (!PortType::is_valid_port_type(type)) { throw std::runtime_error("Unknown port type: " + type); } - PortType::add_port(*this, type, true, true); + PortType::add_port(*this, type, true, false, true); last_sent_times_.push_back(0); port_type_names_.push_back(type); } diff --git a/libs/core/include/rtbot/Join.h b/libs/core/include/rtbot/Join.h index 39d90f13..50f80a05 100644 --- a/libs/core/include/rtbot/Join.h +++ b/libs/core/include/rtbot/Join.h @@ -30,7 +30,7 @@ class Join : public Operator { throw std::runtime_error("Unknown port type: " + type); } - PortType::add_port(*this, type, true, false); // input only + PortType::add_port(*this, type, true, false, false); // input only data_time_tracker_[num_data_ports() - 1] = std::set(); port_type_names_.push_back(type); } @@ -40,7 +40,7 @@ class Join : public Operator { if (!PortType::is_valid_port_type(type)) { throw std::runtime_error("Unknown port type: " + type); } - PortType::add_port(*this, type, false, true); // output only + PortType::add_port(*this, type, false, false, true); // output only } } @@ -55,7 +55,7 @@ class Join : public Operator { throw std::runtime_error("Unknown port type: " + type); } - PortType::add_port(*this, type, true, true); + PortType::add_port(*this, type, true, false, true); data_time_tracker_[num_data_ports() - 1] = std::set(); port_type_names_.push_back(type); } @@ -70,7 +70,7 @@ class Join : public Operator { std::string port_type = PortType::get_port_type(); for (size_t i = 0; i < num_ports; ++i) { - PortType::add_port(*this, port_type, true, true); + PortType::add_port(*this, port_type, true, false, true); data_time_tracker_[i] = std::set(); port_type_names_.push_back(port_type); } diff --git a/libs/core/include/rtbot/Output.h b/libs/core/include/rtbot/Output.h index d2363b46..b9ebdb8d 100644 --- a/libs/core/include/rtbot/Output.h +++ b/libs/core/include/rtbot/Output.h @@ -26,7 +26,7 @@ class Output : public Operator { port_type_names_.push_back(type); // Add input port and matching output port - PortType::add_port(*this, type, true, true); // input port + PortType::add_port(*this, type, true, false, true); // input port } } diff --git a/libs/core/include/rtbot/Pipeline.h b/libs/core/include/rtbot/Pipeline.h index 934cd195..59219d85 100644 --- a/libs/core/include/rtbot/Pipeline.h +++ b/libs/core/include/rtbot/Pipeline.h @@ -32,7 +32,7 @@ class Pipeline : public Operator { throw std::runtime_error("Unknown input port type: " + type); } // Add data input port - PortType::add_port(*this, type, true, false); + PortType::add_port(*this, type, true, false, false); input_port_types_.push_back(type); } @@ -42,7 +42,7 @@ class Pipeline : public Operator { throw std::runtime_error("Unknown output port type: " + type); } // Add output port - PortType::add_port(*this, type, false, true); + PortType::add_port(*this, type, false, false, true); output_port_types_.push_back(type); } } diff --git a/libs/core/include/rtbot/PortType.h b/libs/core/include/rtbot/PortType.h index 55adeafe..d99ccf86 100644 --- a/libs/core/include/rtbot/PortType.h +++ b/libs/core/include/rtbot/PortType.h @@ -70,29 +70,30 @@ class PortType { // Helper method to add port of specified type to an operator template - static void add_port(OperatorType& op, const std::string& port_type, bool is_data = true, bool add_output = false) { + static void add_port(OperatorType& op, const std::string& port_type, bool is_data = true, bool is_control = false, + bool add_output = false) { if (port_type == NUMBER) { if (is_data) op.template add_data_port(); - else + else if (is_control) op.template add_control_port(); if (add_output) op.template add_output_port(); } else if (port_type == BOOLEAN) { if (is_data) op.template add_data_port(); - else + else if (is_control) op.template add_control_port(); if (add_output) op.template add_output_port(); } else if (port_type == VECTOR_NUMBER) { if (is_data) op.template add_data_port(); - else + else if (is_control) op.template add_control_port(); if (add_output) op.template add_output_port(); } else if (port_type == VECTOR_BOOLEAN) { if (is_data) op.template add_data_port(); - else + else if (is_control) op.template add_control_port(); if (add_output) op.template add_output_port(); } else {