Skip to content
Snippets Groups Projects
Commit 7cc49393 authored by Rainer Kartmann's avatar Rainer Kartmann
Browse files

Add doc for and modernize ArVizStorage

parent 343cff48
No related branches found
No related tags found
No related merge requests found
......@@ -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&)
{
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment