From 7cc493934962e7fc75e2b34c4ba41de9869ae4cf Mon Sep 17 00:00:00 2001 From: Rainer Kartmann <rainer.kartmann@kit.edu> Date: Fri, 26 Nov 2021 16:46:55 +0100 Subject: [PATCH] Add doc for and modernize ArVizStorage --- .../components/ArViz/ArVizStorage.cpp | 33 +++++++-- .../RobotAPI/components/ArViz/ArVizStorage.h | 74 +++++++------------ 2 files changed, 51 insertions(+), 56 deletions(-) diff --git a/source/RobotAPI/components/ArViz/ArVizStorage.cpp b/source/RobotAPI/components/ArViz/ArVizStorage.cpp index b0b29f259..1fbb408cc 100644 --- a/source/RobotAPI/components/ArViz/ArVizStorage.cpp +++ b/source/RobotAPI/components/ArViz/ArVizStorage.cpp @@ -60,10 +60,33 @@ namespace armarx } + std::string ArVizStorage::getDefaultName() const + { + return "ArVizStorage"; + } + + + armarx::PropertyDefinitionsPtr ArVizStorage::createPropertyDefinitions() + { + armarx::PropertyDefinitionsPtr defs(new ComponentPropertyDefinitions(getConfigIdentifier())); + + defs->optional(topicName, "TopicName", + "Layer updates are sent over this topic."); + + defs->optional(maxHistorySize, "MaxHistorySize", + "How many layer updates are saved in the history until they are compressed") + .setMin(0); + + defs->defineOptionalProperty<std::string>( + "HistoryPath", "RobotAPI/ArVizStorage", + "Destination path where the history are serialized to"); + + return defs; + } + + void ArVizStorage::onInitComponent() { - topicName = getProperty<std::string>("TopicName").getValue(); - maxHistorySize = getProperty<int>("MaxHistorySize").getValue(); std::filesystem::path historyPathProp = getProperty<std::string>("HistoryPath").getValue(); historyPath = getAbsolutePath(historyPathProp); if (!std::filesystem::exists(historyPath)) @@ -106,14 +129,8 @@ namespace armarx void ArVizStorage::onExitComponent() { - } - armarx::PropertyDefinitionsPtr ArVizStorage::createPropertyDefinitions() - { - return armarx::PropertyDefinitionsPtr(new ArVizPropertyDefinitions( - getConfigIdentifier())); - } void ArVizStorage::updateLayers(viz::data::LayerUpdateSeq const& updates, const Ice::Current&) { diff --git a/source/RobotAPI/components/ArViz/ArVizStorage.h b/source/RobotAPI/components/ArViz/ArVizStorage.h index 08b7d20ff..220bc12b3 100644 --- a/source/RobotAPI/components/ArViz/ArVizStorage.h +++ b/source/RobotAPI/components/ArViz/ArVizStorage.h @@ -36,72 +36,50 @@ namespace armarx { - /** - * @class ArVizPropertyDefinitions - * @brief - */ - class ArVizPropertyDefinitions: - public armarx::ComponentPropertyDefinitions - { - public: - ArVizPropertyDefinitions(std::string prefix): - armarx::ComponentPropertyDefinitions(prefix) - { - defineOptionalProperty<std::string>("TopicName", "ArVizTopic", "Layer updates are sent over this topic."); - defineOptionalProperty<int>("MaxHistorySize", 1000, "How many layer updates are saved in the history until they are compressed") - .setMin(0); - defineOptionalProperty<std::string>("HistoryPath", "RobotAPI/ArVizStorage", "Destination path where the history are serialized to"); - } - }; /** - * @defgroup Component-ArViz ArViz + * @defgroup Component-ArVizStorage ArVizStorage * @ingroup RobotAPI-Components - * A description of the component ArViz. + * + * The ArViz storage stores visualization elements published by ArViz + * clients and provides them for visualizing components such as the + * ArViz gui plugin. + * + * In addition, the ArViz storage can be used to record and restore + * visualization episodes and restore. + * * * @class ArViz - * @ingroup Component-ArViz - * @brief Brief description of class ArViz. + * @ingroup Component-ArVizStorage + * + * @brief Stores visualization elements drawn by ArViz clients. * - * Detailed description of class ArViz. */ class ArVizStorage : virtual public armarx::Component , virtual public armarx::viz::StorageAndTopicInterface { public: - /** - * @see armarx::ManagedIceObject::getDefaultName() - */ - std::string getDefaultName() const override - { - return "ArVizStorage"; - } - - /** - * @see armarx::ManagedIceObject::onInitComponent() - */ + + /// armarx::ManagedIceObject::getDefaultName() + std::string getDefaultName() const override; + + + /// PropertyUser::createPropertyDefinitions() + armarx::PropertyDefinitionsPtr createPropertyDefinitions() override; + + /// armarx::ManagedIceObject::onInitComponent() void onInitComponent() override; - /** - * @see armarx::ManagedIceObject::onConnectComponent() - */ + /// armarx::ManagedIceObject::onConnectComponent() void onConnectComponent() override; - /** - * @see armarx::ManagedIceObject::onDisconnectComponent() - */ + /// armarx::ManagedIceObject::onDisconnectComponent() void onDisconnectComponent() override; - /** - * @see armarx::ManagedIceObject::onExitComponent() - */ + /// armarx::ManagedIceObject::onExitComponent() void onExitComponent() override; - /** - * @see PropertyUser::createPropertyDefinitions() - */ - armarx::PropertyDefinitionsPtr createPropertyDefinitions() override; // Topic interface void updateLayers(viz::data::LayerUpdateSeq const& updates, const Ice::Current&) override; @@ -119,8 +97,8 @@ namespace armarx void recordBatch(viz::data::RecordingBatch& batch); private: - std::string topicName; - int maxHistorySize = 100; + std::string topicName = "ArVizTopic"; + int maxHistorySize = 1000; std::filesystem::path historyPath; std::mutex historyMutex; -- GitLab