26#include <Ice/ObjectAdapter.h>
27#include <IceStorm/IceStorm.h>
29#include <SimoxUtility/algorithm/string/string_tools.h>
73 auto allTopics =
getIceManager()->getTopicManager()->retrieveAll();
74 for (
auto& elem : allTopics)
80 Ice::StringSeq topics;
83 for (
auto& elem : allTopics)
85 topics.push_back(elem.first);
92 for (
auto topic : topics)
94 float maxFrequency = -1.f;
98 maxFrequency = atof(topicAndFreq.at(1).c_str());
99 topic = topicAndFreq.at(0);
122 std::lock_guard<std::mutex> lock(
mutex);
135 std::string time = IceUtil::Time::now().toDateTime();
136 time = simox::alg::replace_all(time,
"/",
"-");
137 time = simox::alg::replace_all(time,
" ",
"_");
138 time = simox::alg::replace_all(time,
":",
"-");
151 if (!storageMode.compare(
"file"))
155 else if (!storageMode.compare(
"database"))
162 <<
"StorageMode " << storageMode
163 <<
" is not supported (database, file). Falling back to default 'database' mode.";
172 std::queue<TopicUtil::TopicData>
data;
173 kv.second->getData(
data);
188 std::lock_guard<std::mutex> lock(
mutex);
225 return "TopicRecorder";
247 std::vector<TopicUtil::TopicData> newDataOfAllTopics;
250 std::queue<TopicUtil::TopicData>
data;
251 elem.second->getData(
data);
253 while (!
data.empty())
255 newDataOfAllTopics.push_back(
data.front());
259 std::sort(newDataOfAllTopics.begin(), newDataOfAllTopics.end(), sortFunc);
260 for (
auto& e : newDataOfAllTopics)
264 if (newDataOfAllTopics.empty())
static void ResolveHomePath(std::string &path)
Resolves a path like ~/myfile.txt or $HOME/myfile.txt to /home/user/myfile.txt.
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Property< PropertyType > getProperty(const std::string &name)
void offeringTopic(const std::string &name)
Registers a topic for retrival after initialization.
TopicProxyType getTopic(const std::string &name)
Returns a proxy of the specified topic.
Ice::ObjectAdapterPtr getObjectAdapter() const
Returns object's Ice adapter.
IceManagerPtr getIceManager() const
Returns the IceManager.
ArmarXManagerPtr getArmarXManager() const
Returns the ArmarX manager used to add and remove components.
static IceUtil::Time GetTime(TimeMode timeMode=TimeMode::VirtualTime)
Get the current time.
void onInitComponent() override
Pure virtual hook for the subclass.
std::condition_variable idleCondition
RunningTask< TopicRecorderComponent >::pointer_type queueTask
void startRecording(const int maxDuration, const Ice::Current &c=Ice::emptyCurrent) override
void onDisconnectComponent() override
Hook for subclass.
std::map< std::string, GenericTopicSubscriberPtr > topicsSubscribers
void stopRecording(const Ice::Current &c=Ice::emptyCurrent) override
TopicRecorderListenerInterfacePrx topicRecoderListener
void onConnectComponent() override
Pure virtual hook for the subclass.
std::string outputFilename
PropertyDefinitionsPtr createPropertyDefinitions() override
std::filesystem::path outputfilePath
void onExitComponent() override
Hook for subclass.
std::string getDefaultName() const override
Retrieve default name of component.
TopicWriterInterfacePtr writer
#define ARMARX_INFO
The normal logging level.
#define ARMARX_IMPORTANT
The logging level for always important information, but expected behaviour (in contrast to ARMARX_WAR...
#define ARMARX_WARNING
The logging level for unexpected behaviour, but not a serious problem.
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceInternal::Handle< GenericTopicSubscriber > GenericTopicSubscriberPtr
std::vector< std::string > Split(const std::string &source, const std::string &splitBy, bool trimElements=false, bool removeEmptyElements=false)
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
bool Contains(const ContainerType &container, const ElementType &searchElement)