k3d::bool_t test_type(const k3d::string_t& TestToken, const k3d::string_t& TestType, const k3d::string_t& Data, k3d::string_t& DataType) { if(Data.substr(0, TestToken.size()) != TestToken) return false; DataType = TestType; k3d::log() << info << "Identified data as " << DataType << " using " << get_factory().name() << std::endl; return true; }
bool read_file(const k3d::filesystem::path& Path, k3d::bitmap& Bitmap) { try { k3d::log() << info << "Reading " << Path.native_console_string() << " using " << get_factory().name() << std::endl; boost::gil::read_and_convert_image(Path.native_filesystem_string(), Bitmap, boost::gil::jpeg_tag()); return true; } catch(std::exception& e) { k3d::log() << error << k3d_file_reference << ": caught exception: " << e.what() << std::endl; return false; } catch(...) { k3d::log() << error << k3d_file_reference << ": caught unknown exception" << std::endl; return false; } }
Bridge2to1Handles create_bridge_from_2_to_1( rclcpp::node::Node::SharedPtr ros2_node, ros::NodeHandle ros1_node, const std::string & ros2_type_name, const std::string & ros2_topic_name, size_t subscriber_queue_size, const std::string & ros1_type_name, const std::string & ros1_topic_name, size_t publisher_queue_size) { auto factory = get_factory(ros1_type_name, ros2_type_name); auto ros1_pub = factory->create_ros1_publisher( ros1_node, ros1_topic_name, publisher_queue_size); auto ros2_sub = factory->create_ros2_subscriber( ros2_node, ros2_topic_name, subscriber_queue_size, ros1_pub); Bridge2to1Handles handles; handles.ros2_subscriber = ros2_sub; handles.ros1_publisher = ros1_pub; return handles; }
k3d::iplugin_factory& factory() { return get_factory(); }
const k3d::string_t panel_type() { return get_factory().name(); }
const k3d::bool_t test_type(const k3d::string_t& TestExtension, const k3d::string_t& TestType, const k3d::filesystem::path& File, k3d::string_t& FileType) { if(TestExtension != k3d::filesystem::extension(File).lowercase().raw()) return false; FileType = TestType; k3d::log() << info << "Identified " << File.native_console_string() << " as " << FileType << " using " << get_factory().name() << std::endl; return true; }