Program Listing for File utils.hpp

Return to documentation for file (include/utils.hpp)

#ifndef RIG_RECONFIGURE_UTILS_HPP
#define RIG_RECONFIGURE_UTILS_HPP

#include <string>
#include <imgui.h>
#include <filesystem>

#include <GLFW/glfw3.h> // will drag system OpenGL headers
#include <rcl_interfaces/msg/parameter_descriptor.hpp>

struct Status {
    enum class Type { NONE, NO_NODES_AVAILABLE, PARAMETER_CHANGED, SERVICE_TIMEOUT };

    Type type = Type::NONE;
    std::string text;
};

void highlightedText(const std::string &text, std::size_t start, std::size_t end,
                     const ImVec4 &highlightColor);

bool highlightedSelectableText(const std::string &text, std::size_t start, std::size_t end,
                               const ImVec4 &highlightColor);

std::string getFormatStringFromStep(double step, int max_digits = 10);

bool hasBoundedRange(const rcl_interfaces::msg::ParameterDescriptor& param);

bool areDoublesEqual(double x, double y, double ulp = 100.0);

double snapToDoubleRange(double value, double from_value, double to_value, double step);

int64_t snapToIntegerRange(int64_t value, int64_t from_value, int64_t to_value, uint64_t step);

std::filesystem::path findResourcePath(const std::string &execPath);

void loadWindowIcon(GLFWwindow *windowPtr, const std::filesystem::path &resourcePath);

void glfw_error_callback(int error, const char *description);

#endif //RIG_RECONFIGURE_UTILS_HPP