From be88ddc3dd202fbeeccae31e082d4ffbfe2b4b05 Mon Sep 17 00:00:00 2001 From: Kerstin Keller Date: Tue, 16 Jan 2024 16:55:32 +0100 Subject: [PATCH] Introduce experimental namespace to mark new api as not yet stable. --- app/meas_cutter/src/measurement_exporter.cpp | 2 +- app/meas_cutter/src/measurement_exporter.h | 2 +- app/meas_cutter/src/measurement_importer.cpp | 4 +- app/meas_cutter/src/measurement_importer.h | 2 +- app/meas_cutter/src/utils.h | 2 +- app/play/play_core/src/ecal_play.cpp | 4 +- .../play_core/src/measurement_container.cpp | 8 +- .../play_core/src/measurement_container.h | 4 +- app/play/play_core/src/play_thread.cpp | 2 +- app/play/play_core/src/play_thread.h | 2 +- .../src/job/hdf5_writer_thread.cpp | 2 +- .../src/job/hdf5_writer_thread.h | 2 +- contrib/ecalhdf5/include/ecalhdf5/eh5_meas.h | 8 +- contrib/ecalhdf5/include/ecalhdf5/eh5_types.h | 12 +- .../include/ecal/measurement/base/reader.h | 337 ++++++++-------- .../include/ecal/measurement/base/types.h | 94 ++--- .../include/ecal/measurement/base/writer.h | 277 ++++++------- .../include/ecal/measurement/imeasurement.h | 20 +- .../include/ecal/measurement/omeasurement.h | 10 +- .../include/ecal/measurement/hdf5/reader.h | 367 +++++++++--------- .../include/ecal/measurement/hdf5/writer.h | 295 +++++++------- contrib/measurement/hdf5/src/reader.cpp | 2 +- contrib/measurement/hdf5/src/writer.cpp | 2 +- lang/python/ecalhdf5/src/ecalhdf5_wrap.cxx | 8 +- 24 files changed, 742 insertions(+), 726 deletions(-) diff --git a/app/meas_cutter/src/measurement_exporter.cpp b/app/meas_cutter/src/measurement_exporter.cpp index eb234e02ea..909be8bbf0 100644 --- a/app/meas_cutter/src/measurement_exporter.cpp +++ b/app/meas_cutter/src/measurement_exporter.cpp @@ -21,7 +21,7 @@ #include MeasurementExporter::MeasurementExporter(): - _writer(std::make_unique()) + _writer(std::make_unique()) { } diff --git a/app/meas_cutter/src/measurement_exporter.h b/app/meas_cutter/src/measurement_exporter.h index 2bb38d4873..3d8c51334d 100644 --- a/app/meas_cutter/src/measurement_exporter.h +++ b/app/meas_cutter/src/measurement_exporter.h @@ -43,7 +43,7 @@ class MeasurementExporter std::string getRootOutputPath() const; private: - std::unique_ptr _writer; + std::unique_ptr _writer; std::string _current_channel_name; std::string _output_path; std::string _root_output_path; diff --git a/app/meas_cutter/src/measurement_importer.cpp b/app/meas_cutter/src/measurement_importer.cpp index 8993640f9f..717acd3649 100644 --- a/app/meas_cutter/src/measurement_importer.cpp +++ b/app/meas_cutter/src/measurement_importer.cpp @@ -21,7 +21,7 @@ #include MeasurementImporter::MeasurementImporter() : - _reader(std::make_unique()), + _reader(std::make_unique()), _current_opened_channel_data() { } @@ -80,7 +80,7 @@ void MeasurementImporter::openChannel(const std::string& channel_name) _current_opened_channel_data._channel_info.description = _reader->GetChannelDescription(channel_name); _current_opened_channel_data._channel_info.name = channel_name; - eCAL::measurement::base::EntryInfoSet entry_info_set; + eCAL::experimental::measurement::base::EntryInfoSet entry_info_set; _reader->GetEntriesInfo(channel_name, entry_info_set); for (const auto& entry_info : entry_info_set) diff --git a/app/meas_cutter/src/measurement_importer.h b/app/meas_cutter/src/measurement_importer.h index 5190433277..6f1c348f87 100644 --- a/app/meas_cutter/src/measurement_importer.h +++ b/app/meas_cutter/src/measurement_importer.h @@ -53,7 +53,7 @@ class MeasurementImporter private: bool isEcalMeasFile(const std::string& path); bool isProtoChannel(const std::string& channel_type); - std::unique_ptr _reader; + std::unique_ptr _reader; eCALMeasCutterUtils::ChannelData _current_opened_channel_data; std::string _loaded_path; eCALMeasCutterUtils::ChannelNameSet _channel_names; diff --git a/app/meas_cutter/src/utils.h b/app/meas_cutter/src/utils.h index 19fda28bdb..9d40dee26f 100644 --- a/app/meas_cutter/src/utils.h +++ b/app/meas_cutter/src/utils.h @@ -340,6 +340,6 @@ namespace eCALMeasCutterUtils { ChannelInfo _channel_info; TimestampSet _timestamps; - std::unordered_map _timestamp_entry_info_map; + std::unordered_map _timestamp_entry_info_map; }; } diff --git a/app/play/play_core/src/ecal_play.cpp b/app/play/play_core/src/ecal_play.cpp index e3a72ef93f..45d9608688 100644 --- a/app/play/play_core/src/ecal_play.cpp +++ b/app/play/play_core/src/ecal_play.cpp @@ -58,7 +58,7 @@ bool EcalPlay::LoadMeasurement(const std::string& path) { EcalPlayLogger::Instance()->info("Loading measurement..."); - std::shared_ptr measurement(std::make_shared()); + std::shared_ptr measurement(std::make_shared()); std::string meas_dir; // The directory of the measurement std::string path_to_load; // The actual path we load the measurement from. May be a directory or a .hdf5 file @@ -129,7 +129,7 @@ bool EcalPlay::LoadMeasurement(const std::string& path) void EcalPlay::CloseMeasurement() { description_ = ""; - play_thread_->SetMeasurement(std::shared_ptr(nullptr)); + play_thread_->SetMeasurement(std::shared_ptr(nullptr)); measurement_path_ = ""; clearScenariosPath(); channel_mapping_path_ = ""; diff --git a/app/play/play_core/src/measurement_container.cpp b/app/play/play_core/src/measurement_container.cpp index 4b94b48acc..d95de520b4 100644 --- a/app/play/play_core/src/measurement_container.cpp +++ b/app/play/play_core/src/measurement_container.cpp @@ -24,7 +24,7 @@ #include #include -MeasurementContainer::MeasurementContainer(std::shared_ptr hdf5_meas, const std::string& meas_dir, bool use_receive_timestamp) +MeasurementContainer::MeasurementContainer(std::shared_ptr hdf5_meas, const std::string& meas_dir, bool use_receive_timestamp) : hdf5_meas_ (hdf5_meas) , meas_dir_ (meas_dir) , use_receive_timestamp_ (use_receive_timestamp) @@ -49,7 +49,7 @@ void MeasurementContainer::CreateFrameTable() auto channel_names = hdf5_meas_->GetChannelNames(); for (auto& channel_name : channel_names) { - eCAL::measurement::base::EntryInfoSet entry_info_set; + eCAL::experimental::measurement::base::EntryInfoSet entry_info_set; if (hdf5_meas_->GetEntriesInfo(channel_name, entry_info_set)) { for (auto& entry_info : entry_info_set) @@ -84,7 +84,7 @@ void MeasurementContainer::CalculateEstimatedSizeForChannels() auto channel_names = hdf5_meas_->GetChannelNames(); for (auto& channel_name : channel_names) { - eCAL::measurement::base::EntryInfoSet entry_info_set; + eCAL::experimental::measurement::base::EntryInfoSet entry_info_set; if (hdf5_meas_->GetEntriesInfo(channel_name, entry_info_set)) { auto size = entry_info_set.size(); @@ -452,7 +452,7 @@ std::map MeasurementContainer::CreateContinuityRe auto channel_names = hdf5_meas_->GetChannelNames(); for (auto& channel_name : channel_names) { - eCAL::measurement::base::EntryInfoSet entry_info_set; + eCAL::experimental::measurement::base::EntryInfoSet entry_info_set; if (hdf5_meas_->GetEntriesInfo(channel_name, entry_info_set)) { diff --git a/app/play/play_core/src/measurement_container.h b/app/play/play_core/src/measurement_container.h index b9f67b7284..690af019d8 100644 --- a/app/play/play_core/src/measurement_container.h +++ b/app/play/play_core/src/measurement_container.h @@ -31,7 +31,7 @@ class MeasurementContainer { public: - MeasurementContainer(std::shared_ptr hdf5_meas, const std::string& meas_dir = "", bool use_receive_timestamp = true); + MeasurementContainer(std::shared_ptr hdf5_meas, const std::string& meas_dir = "", bool use_receive_timestamp = true); ~MeasurementContainer(); void CreatePublishers(); @@ -108,7 +108,7 @@ class MeasurementContainer PublisherInfo* publisher_info_; }; - std::shared_ptr hdf5_meas_; + std::shared_ptr hdf5_meas_; std::string meas_dir_; bool use_receive_timestamp_; diff --git a/app/play/play_core/src/play_thread.cpp b/app/play/play_core/src/play_thread.cpp index a95f1d6c8f..3bf3a3f2c1 100644 --- a/app/play/play_core/src/play_thread.cpp +++ b/app/play/play_core/src/play_thread.cpp @@ -576,7 +576,7 @@ void PlayThread::LogChannelMapping(const std::map& cha //// Measurement //// //////////////////////////////////////////////////////////////////////////////// -void PlayThread::SetMeasurement(const std::shared_ptr& measurement, const std::string& path) +void PlayThread::SetMeasurement(const std::shared_ptr& measurement, const std::string& path) { std::unique_ptr new_measurment_container; diff --git a/app/play/play_core/src/play_thread.h b/app/play/play_core/src/play_thread.h index 618e01fb33..5e782f3b0e 100644 --- a/app/play/play_core/src/play_thread.h +++ b/app/play/play_core/src/play_thread.h @@ -79,7 +79,7 @@ class PlayThread : public InterruptibleThread * @param measurement The new measurement * @param path The (optional) path from where the measurement was loaded */ - void SetMeasurement(const std::shared_ptr& measurement, const std::string& path = ""); + void SetMeasurement(const std::shared_ptr& measurement, const std::string& path = ""); /** * @brief Returns whether a measurement has successfully been loaded diff --git a/app/rec/rec_client_core/src/job/hdf5_writer_thread.cpp b/app/rec/rec_client_core/src/job/hdf5_writer_thread.cpp index e8fc791850..c3ddd4902f 100644 --- a/app/rec/rec_client_core/src/job/hdf5_writer_thread.cpp +++ b/app/rec/rec_client_core/src/job/hdf5_writer_thread.cpp @@ -42,7 +42,7 @@ namespace eCAL , new_topic_info_map_available_(true) , flushing_ (false) { - hdf5_writer_ = std::make_unique(); + hdf5_writer_ = std::make_unique(); } Hdf5WriterThread::~Hdf5WriterThread() diff --git a/app/rec/rec_client_core/src/job/hdf5_writer_thread.h b/app/rec/rec_client_core/src/job/hdf5_writer_thread.h index e56117ee38..042b64eeba 100644 --- a/app/rec/rec_client_core/src/job/hdf5_writer_thread.h +++ b/app/rec/rec_client_core/src/job/hdf5_writer_thread.h @@ -94,7 +94,7 @@ namespace eCAL mutable RecHdf5JobStatus last_status_; mutable std::mutex hdf5_writer_mutex_; - std::unique_ptr hdf5_writer_; + std::unique_ptr hdf5_writer_; std::atomic flushing_; diff --git a/contrib/ecalhdf5/include/ecalhdf5/eh5_meas.h b/contrib/ecalhdf5/include/ecalhdf5/eh5_meas.h index c7cdcf6884..848f640c0a 100644 --- a/contrib/ecalhdf5/include/ecalhdf5/eh5_meas.h +++ b/contrib/ecalhdf5/include/ecalhdf5/eh5_meas.h @@ -55,7 +55,7 @@ namespace eCAL * @param access Access type * **/ - explicit HDF5Meas(const std::string& path, measurement::base::AccessType access = measurement::base::AccessType::RDONLY); + explicit HDF5Meas(const std::string& path, eAccessType access = RDONLY); /** * @brief Destructor @@ -105,7 +105,7 @@ namespace eCAL * @return true if output (eAccessType::CREATE) measurement directory structure can be accessed/created, false otherwise. * true if input (eAccessType::RDONLY) measurement/file path was opened, false otherwise. **/ - bool Open(const std::string& path, measurement::base::AccessType access = measurement::base::AccessType::RDONLY); + bool Open(const std::string& path, eAccessType access = RDONLY); /** * @brief Close file @@ -241,7 +241,7 @@ namespace eCAL * * @return true if succeeds, false if it fails **/ - bool GetEntriesInfo(const std::string& channel_name, measurement::base::EntryInfoSet& entries) const; + bool GetEntriesInfo(const std::string& channel_name, EntryInfoSet& entries) const; /** * @brief Gets the header info for data entries for the given channel included in given time range (begin->end) @@ -254,7 +254,7 @@ namespace eCAL * * @return true if succeeds, false if it fails **/ - bool GetEntriesInfoRange(const std::string& channel_name, long long begin, long long end, measurement::base::EntryInfoSet& entries) const; + bool GetEntriesInfoRange(const std::string& channel_name, long long begin, long long end, EntryInfoSet& entries) const; /** * @brief Gets data size of a specific entry diff --git a/contrib/ecalhdf5/include/ecalhdf5/eh5_types.h b/contrib/ecalhdf5/include/ecalhdf5/eh5_types.h index 34955e5154..18332bb5fb 100644 --- a/contrib/ecalhdf5/include/ecalhdf5/eh5_types.h +++ b/contrib/ecalhdf5/include/ecalhdf5/eh5_types.h @@ -43,12 +43,12 @@ namespace eCAL const std::string kChnAttrTitle ("Channels"); // Remove @eCAL6 -> backwards compatibility with old interface! - using SEntryInfo = eCAL::measurement::base::EntryInfo; - using EntryInfoSet = eCAL::measurement::base::EntryInfoSet; - using EntryInfoVect = eCAL::measurement::base::EntryInfoVect; - using eAccessType = eCAL::measurement::base::AccessType; - using eCAL::measurement::base::RDONLY; - using eCAL::measurement::base::CREATE; + using SEntryInfo = eCAL::experimental::measurement::base::EntryInfo; + using EntryInfoSet = eCAL::experimental::measurement::base::EntryInfoSet; + using EntryInfoVect = eCAL::experimental::measurement::base::EntryInfoVect; + using eAccessType = eCAL::experimental::measurement::base::AccessType; + using eCAL::experimental::measurement::base::RDONLY; + using eCAL::experimental::measurement::base::CREATE; //!< @endcond } // namespace eh5 } // namespace eCAL diff --git a/contrib/measurement/base/include/ecal/measurement/base/reader.h b/contrib/measurement/base/include/ecal/measurement/base/reader.h index 0b1b5ab7a2..521ece05f1 100644 --- a/contrib/measurement/base/include/ecal/measurement/base/reader.h +++ b/contrib/measurement/base/include/ecal/measurement/base/reader.h @@ -33,177 +33,180 @@ namespace eCAL { - namespace measurement + namespace experimental { - namespace base + namespace measurement { - /** - * @brief eCAL Measurement Reader API - **/ - class Reader + namespace base { - public: /** - * @brief Constructor - **/ - Reader() = default; - - /** - * @brief Destructor - **/ - virtual ~Reader() = default; - - /** - * @brief Copy operator - **/ - Reader(const Reader& other) = delete; - Reader& operator=(const Reader& other) = delete; - - /** - * @brief Move operator - **/ - Reader(Reader&&) = default; - Reader& operator=(Reader&&) = default; - - /** - * @brief Open file - * - * @param path Input file path / Reader directory path. - * - * Default Reader directory structure: - * - root directory e.g.: M:\Reader_directory\Reader01 - * - documents directory: |_doc - * - hosts directories: |_Host1 (e.g.: CARPC01) - * |_Host2 (e.g.: CARPC02) - * - * File path as input - * - root directory (e.g.: M:\Reader_directory\Reader01) in this case all hosts subdirectories will be iterated, - * - host directory (e.g.: M:\Reader_directory\Reader01\CARPC01), - * - file path, path to file from Reader (e.g.: M:\Reader_directory\Reader01\CARPC01\meas01_05.hdf5). - * - * - * @return true if input measurement/file path was opened, false otherwise. - **/ - virtual bool Open(const std::string& path) = 0; - - /** - * @brief Close file - * - * @return true if succeeds, false if it fails - **/ - virtual bool Close() = 0; - - /** - * @brief Checks if file/measurement is ok - * - * @return true if meas can be opened(read) false otherwise - **/ - virtual bool IsOk() const = 0; - - /** - * @brief Get the File Type Version of the current opened file - * - * @return file version - **/ - virtual std::string GetFileVersion() const = 0; - - /** - * @brief Get the available channel names of the current opened file / measurement - * - * @return channel names - **/ - virtual std::set GetChannelNames() const = 0; - - /** - * @brief Check if channel exists in measurement - * - * @param channel_name name of the channel - * - * @return true if exists, false otherwise - **/ - virtual bool HasChannel(const std::string& channel_name) const = 0; - - /** - * @brief Get the channel description for the given channel - * - * @param channel_name channel name - * - * @return channel description - **/ - virtual std::string GetChannelDescription(const std::string& channel_name) const = 0; - - /** - * @brief Gets the channel type of the given channel - * - * @param channel_name channel name - * - * @return channel type - **/ - virtual std::string GetChannelType(const std::string& channel_name) const = 0; - - /** - * @brief Gets minimum timestamp for specified channel - * - * @param channel_name channel name - * - * @return minimum timestamp value - **/ - virtual long long GetMinTimestamp(const std::string& channel_name) const = 0; - - /** - * @brief Gets maximum timestamp for specified channel - * - * @param channel_name channel name - * - * @return maximum timestamp value - **/ - virtual long long GetMaxTimestamp(const std::string& channel_name) const = 0; - - /** - * @brief Gets the header info for all data entries for the given channel - * Header = timestamp + entry id - * - * @param [in] channel_name channel name - * @param [out] entries header info for all data entries - * - * @return true if succeeds, false if it fails - **/ - virtual bool GetEntriesInfo(const std::string& channel_name, EntryInfoSet& entries) const = 0; - - /** - * @brief Gets the header info for data entries for the given channel included in given time range (begin->end) - * Header = timestamp + entry id - * - * @param [in] channel_name channel name - * @param [in] begin time range begin timestamp - * @param [in] end time range end timestamp - * @param [out] entries header info for data entries in given range - * - * @return true if succeeds, false if it fails - **/ - virtual bool GetEntriesInfoRange(const std::string& channel_name, long long begin, long long end, EntryInfoSet& entries) const = 0; - - /** - * @brief Gets data size of a specific entry - * - * @param [in] entry_id Entry ID - * @param [out] size Entry data size - * - * @return true if succeeds, false if it fails - **/ - virtual bool GetEntryDataSize(long long entry_id, size_t& size) const = 0; - - /** - * @brief Gets data from a specific entry - * - * @param [in] entry_id Entry ID - * @param [out] data Entry data - * - * @return true if succeeds, false if it fails - **/ - virtual bool GetEntryData(long long entry_id, void* data) const = 0; - - }; + * @brief eCAL Measurement Reader API + **/ + class Reader + { + public: + /** + * @brief Constructor + **/ + Reader() = default; + + /** + * @brief Destructor + **/ + virtual ~Reader() = default; + + /** + * @brief Copy operator + **/ + Reader(const Reader& other) = delete; + Reader& operator=(const Reader& other) = delete; + + /** + * @brief Move operator + **/ + Reader(Reader&&) = default; + Reader& operator=(Reader&&) = default; + + /** + * @brief Open file + * + * @param path Input file path / Reader directory path. + * + * Default Reader directory structure: + * - root directory e.g.: M:\Reader_directory\Reader01 + * - documents directory: |_doc + * - hosts directories: |_Host1 (e.g.: CARPC01) + * |_Host2 (e.g.: CARPC02) + * + * File path as input + * - root directory (e.g.: M:\Reader_directory\Reader01) in this case all hosts subdirectories will be iterated, + * - host directory (e.g.: M:\Reader_directory\Reader01\CARPC01), + * - file path, path to file from Reader (e.g.: M:\Reader_directory\Reader01\CARPC01\meas01_05.hdf5). + * + * + * @return true if input measurement/file path was opened, false otherwise. + **/ + virtual bool Open(const std::string& path) = 0; + + /** + * @brief Close file + * + * @return true if succeeds, false if it fails + **/ + virtual bool Close() = 0; + + /** + * @brief Checks if file/measurement is ok + * + * @return true if meas can be opened(read) false otherwise + **/ + virtual bool IsOk() const = 0; + + /** + * @brief Get the File Type Version of the current opened file + * + * @return file version + **/ + virtual std::string GetFileVersion() const = 0; + + /** + * @brief Get the available channel names of the current opened file / measurement + * + * @return channel names + **/ + virtual std::set GetChannelNames() const = 0; + + /** + * @brief Check if channel exists in measurement + * + * @param channel_name name of the channel + * + * @return true if exists, false otherwise + **/ + virtual bool HasChannel(const std::string& channel_name) const = 0; + + /** + * @brief Get the channel description for the given channel + * + * @param channel_name channel name + * + * @return channel description + **/ + virtual std::string GetChannelDescription(const std::string& channel_name) const = 0; + + /** + * @brief Gets the channel type of the given channel + * + * @param channel_name channel name + * + * @return channel type + **/ + virtual std::string GetChannelType(const std::string& channel_name) const = 0; + + /** + * @brief Gets minimum timestamp for specified channel + * + * @param channel_name channel name + * + * @return minimum timestamp value + **/ + virtual long long GetMinTimestamp(const std::string& channel_name) const = 0; + + /** + * @brief Gets maximum timestamp for specified channel + * + * @param channel_name channel name + * + * @return maximum timestamp value + **/ + virtual long long GetMaxTimestamp(const std::string& channel_name) const = 0; + + /** + * @brief Gets the header info for all data entries for the given channel + * Header = timestamp + entry id + * + * @param [in] channel_name channel name + * @param [out] entries header info for all data entries + * + * @return true if succeeds, false if it fails + **/ + virtual bool GetEntriesInfo(const std::string& channel_name, EntryInfoSet& entries) const = 0; + + /** + * @brief Gets the header info for data entries for the given channel included in given time range (begin->end) + * Header = timestamp + entry id + * + * @param [in] channel_name channel name + * @param [in] begin time range begin timestamp + * @param [in] end time range end timestamp + * @param [out] entries header info for data entries in given range + * + * @return true if succeeds, false if it fails + **/ + virtual bool GetEntriesInfoRange(const std::string& channel_name, long long begin, long long end, EntryInfoSet& entries) const = 0; + + /** + * @brief Gets data size of a specific entry + * + * @param [in] entry_id Entry ID + * @param [out] size Entry data size + * + * @return true if succeeds, false if it fails + **/ + virtual bool GetEntryDataSize(long long entry_id, size_t& size) const = 0; + + /** + * @brief Gets data from a specific entry + * + * @param [in] entry_id Entry ID + * @param [out] data Entry data + * + * @return true if succeeds, false if it fails + **/ + virtual bool GetEntryData(long long entry_id, void* data) const = 0; + + }; + } } } } diff --git a/contrib/measurement/base/include/ecal/measurement/base/types.h b/contrib/measurement/base/include/ecal/measurement/base/types.h index 989acb6aeb..34fa97b6cd 100644 --- a/contrib/measurement/base/include/ecal/measurement/base/types.h +++ b/contrib/measurement/base/include/ecal/measurement/base/types.h @@ -29,63 +29,67 @@ namespace eCAL { - namespace measurement + namespace experimental { - namespace base + + namespace measurement { - /** - * @brief Info struct for a single measurement entry - **/ - struct EntryInfo + namespace base { - long long RcvTimestamp; //!< Receive time stamp - long long ID; //!< Channel ID - long long SndClock; //!< Send clock - long long SndTimestamp; //!< Send time stamp - long long SndID; //!< Send ID + /** + * @brief Info struct for a single measurement entry + **/ + struct EntryInfo + { + long long RcvTimestamp; //!< Receive time stamp + long long ID; //!< Channel ID + long long SndClock; //!< Send clock + long long SndTimestamp; //!< Send time stamp + long long SndID; //!< Send ID - //!< @cond - EntryInfo() : RcvTimestamp(0), ID(0), SndClock(0), SndTimestamp(0), SndID(0) {} + //!< @cond + EntryInfo() : RcvTimestamp(0), ID(0), SndClock(0), SndTimestamp(0), SndID(0) {} - EntryInfo(long long rcv_timestamp, long long id) : RcvTimestamp(rcv_timestamp), ID(id), SndClock(0), SndTimestamp(0), SndID(0) {} + EntryInfo(long long rcv_timestamp, long long id) : RcvTimestamp(rcv_timestamp), ID(id), SndClock(0), SndTimestamp(0), SndID(0) {} - EntryInfo(long long rcv_timestamp, long long id, long long snd_clock) : RcvTimestamp(rcv_timestamp), ID(id), SndClock(snd_clock), SndTimestamp(0), SndID(0) {} + EntryInfo(long long rcv_timestamp, long long id, long long snd_clock) : RcvTimestamp(rcv_timestamp), ID(id), SndClock(snd_clock), SndTimestamp(0), SndID(0) {} - EntryInfo(long long rcv_timestamp, long long id, long long snd_clock, long long snd_timestamp) : RcvTimestamp(rcv_timestamp), ID(id), SndClock(snd_clock), SndTimestamp(snd_timestamp), SndID(0) {} + EntryInfo(long long rcv_timestamp, long long id, long long snd_clock, long long snd_timestamp) : RcvTimestamp(rcv_timestamp), ID(id), SndClock(snd_clock), SndTimestamp(snd_timestamp), SndID(0) {} - EntryInfo(long long rcv_timestamp, long long id, long long snd_clock, long long snd_timestamp, long long snd_id) : RcvTimestamp(rcv_timestamp), ID(id), SndClock(snd_clock), SndTimestamp(snd_timestamp), SndID(snd_id) {} + EntryInfo(long long rcv_timestamp, long long id, long long snd_clock, long long snd_timestamp, long long snd_id) : RcvTimestamp(rcv_timestamp), ID(id), SndClock(snd_clock), SndTimestamp(snd_timestamp), SndID(snd_id) {} - bool operator==(const EntryInfo& other) const - { - return (ID == other.ID && SndTimestamp == other.SndTimestamp && RcvTimestamp == other.RcvTimestamp && SndClock == other.SndClock && SndID == other.SndID); - } + bool operator==(const EntryInfo& other) const + { + return (ID == other.ID && SndTimestamp == other.SndTimestamp && RcvTimestamp == other.RcvTimestamp && SndClock == other.SndClock && SndID == other.SndID); + } + + bool operator<(const EntryInfo& other) const + { + return (RcvTimestamp < other.RcvTimestamp); + } + //!< @endcond + }; - bool operator<(const EntryInfo& other) const + /** + * @brief eCAL HDF5 entries (as set container) + **/ + using EntryInfoSet = std::set; + + /** + * @brief eCAL HDF5 entries (as vector container) + **/ + using EntryInfoVect = std::vector; + + /** + * @brief eCAL Measurement Access types + **/ + enum AccessType { - return (RcvTimestamp < other.RcvTimestamp); - } - //!< @endcond - }; - - /** - * @brief eCAL HDF5 entries (as set container) - **/ - using EntryInfoSet = std::set; - - /** - * @brief eCAL HDF5 entries (as vector container) - **/ - using EntryInfoVect = std::vector; - - /** - * @brief eCAL Measurement Access types - **/ - enum AccessType - { - RDONLY, //!< ReadOnly - the measurement can only be read - CREATE //!< Create - a new measurement will be created - }; + RDONLY, //!< ReadOnly - the measurement can only be read + CREATE //!< Create - a new measurement will be created + }; + } } } } \ No newline at end of file diff --git a/contrib/measurement/base/include/ecal/measurement/base/writer.h b/contrib/measurement/base/include/ecal/measurement/base/writer.h index 16f346983f..72fff0a07b 100644 --- a/contrib/measurement/base/include/ecal/measurement/base/writer.h +++ b/contrib/measurement/base/include/ecal/measurement/base/writer.h @@ -33,148 +33,151 @@ namespace eCAL { - namespace measurement + namespace experimental { - namespace base + namespace measurement { - /** - * @brief eCAL Measurement Writer API - **/ - class Writer + namespace base { - public: /** - * @brief Constructor + * @brief eCAL Measurement Writer API **/ - Writer() = default; - - /** - * @brief Destructor - **/ - virtual ~Writer() = default; - - /** - * @brief Copy operator - **/ - Writer(const Writer& other) = delete; - Writer& operator=(const Writer& other) = delete; - - /** - * @brief Move operator - **/ - Writer(Writer&&) = default; - Writer& operator=(Writer&&) = default; - - /** - * @brief Open file - * - * @param path Input file path / measurement directory path. - * - * Default measurement directory structure: - * - root directory e.g.: M:\measurement_directory\measurement01 - * - documents directory: |_doc - * - hosts directories: |_Host1 (e.g.: CARPC01) - * |_Host2 (e.g.: CARPC02) - * - * File path as output - * - full path to measurement directory (recommended with host name) (e.g.: M:\measurement_directory\measurement01\CARPC01), - * - to set the name of the actual hdf5 file use SetFileBaseName method. - * - * @param access Access type - * - * @return true if output measurement directory structure can be accessed/created, false otherwise. - **/ - virtual bool Open(const std::string& path) = 0; - - /** - * @brief Close file - * - * @return true if succeeds, false if it fails - **/ - virtual bool Close() = 0; - - /** - * @brief Checks if file/measurement is ok - * - * @return true if location is accessible, false otherwise - **/ - virtual bool IsOk() const = 0; - - /** - * @brief Gets maximum allowed size for an individual file - * - * @return maximum size in MB - **/ - virtual size_t GetMaxSizePerFile() const = 0; - - /** - * @brief Sets maximum allowed size for an individual file - * - * @param size maximum size in MB - **/ - virtual void SetMaxSizePerFile(size_t size) = 0; - - /** - * @brief Whether each Channel shall be writte in its own file - * - * When enabled, data is clustered by channel and each channel is written - * to its own file. The filenames will consist of the basename and the - * channel name. - * - * @return true, if one file per channel is enabled - */ - virtual bool IsOneFilePerChannelEnabled() const = 0; - - /** - * @brief Enable / disable the creation of one individual file per channel - * - * When enabled, data is clustered by channel and each channel is written - * to its own file. The filenames will consist of the basename and the - * channel name. - * - * @param enabled Whether one file shall be created per channel - */ - virtual void SetOneFilePerChannelEnabled(bool enabled) = 0; - - /** - * @brief Set description of the given channel - * - * @param channel_name channel name - * @param description description of the channel - **/ - virtual void SetChannelDescription(const std::string& channel_name, const std::string& description) = 0; - - /** - * @brief Set type of the given channel - * - * @param channel_name channel name - * @param type type of the channel - **/ - virtual void SetChannelType(const std::string& channel_name, const std::string& type) = 0; - - /** - * @brief Set measurement file base name (desired name for the actual hdf5 files that will be created) - * - * @param base_name Name of the hdf5 files that will be created. - **/ - virtual void SetFileBaseName(const std::string& base_name) = 0; - - /** - * @brief Add entry to file - * - * @param data data to be added - * @param size size of the data - * @param snd_timestamp send time stamp - * @param rcv_timestamp receive time stamp - * @param channel_name channel name - * @param id message id - * @param clock message clock - * - * @return true if succeeds, false if it fails - **/ - virtual bool AddEntryToFile(const void* data, const unsigned long long& size, const long long& snd_timestamp, const long long& rcv_timestamp, const std::string& channel_name, long long id, long long clock) = 0; - - }; + class Writer + { + public: + /** + * @brief Constructor + **/ + Writer() = default; + + /** + * @brief Destructor + **/ + virtual ~Writer() = default; + + /** + * @brief Copy operator + **/ + Writer(const Writer& other) = delete; + Writer& operator=(const Writer& other) = delete; + + /** + * @brief Move operator + **/ + Writer(Writer&&) = default; + Writer& operator=(Writer&&) = default; + + /** + * @brief Open file + * + * @param path Input file path / measurement directory path. + * + * Default measurement directory structure: + * - root directory e.g.: M:\measurement_directory\measurement01 + * - documents directory: |_doc + * - hosts directories: |_Host1 (e.g.: CARPC01) + * |_Host2 (e.g.: CARPC02) + * + * File path as output + * - full path to measurement directory (recommended with host name) (e.g.: M:\measurement_directory\measurement01\CARPC01), + * - to set the name of the actual hdf5 file use SetFileBaseName method. + * + * @param access Access type + * + * @return true if output measurement directory structure can be accessed/created, false otherwise. + **/ + virtual bool Open(const std::string& path) = 0; + + /** + * @brief Close file + * + * @return true if succeeds, false if it fails + **/ + virtual bool Close() = 0; + + /** + * @brief Checks if file/measurement is ok + * + * @return true if location is accessible, false otherwise + **/ + virtual bool IsOk() const = 0; + + /** + * @brief Gets maximum allowed size for an individual file + * + * @return maximum size in MB + **/ + virtual size_t GetMaxSizePerFile() const = 0; + + /** + * @brief Sets maximum allowed size for an individual file + * + * @param size maximum size in MB + **/ + virtual void SetMaxSizePerFile(size_t size) = 0; + + /** + * @brief Whether each Channel shall be writte in its own file + * + * When enabled, data is clustered by channel and each channel is written + * to its own file. The filenames will consist of the basename and the + * channel name. + * + * @return true, if one file per channel is enabled + */ + virtual bool IsOneFilePerChannelEnabled() const = 0; + + /** + * @brief Enable / disable the creation of one individual file per channel + * + * When enabled, data is clustered by channel and each channel is written + * to its own file. The filenames will consist of the basename and the + * channel name. + * + * @param enabled Whether one file shall be created per channel + */ + virtual void SetOneFilePerChannelEnabled(bool enabled) = 0; + + /** + * @brief Set description of the given channel + * + * @param channel_name channel name + * @param description description of the channel + **/ + virtual void SetChannelDescription(const std::string& channel_name, const std::string& description) = 0; + + /** + * @brief Set type of the given channel + * + * @param channel_name channel name + * @param type type of the channel + **/ + virtual void SetChannelType(const std::string& channel_name, const std::string& type) = 0; + + /** + * @brief Set measurement file base name (desired name for the actual hdf5 files that will be created) + * + * @param base_name Name of the hdf5 files that will be created. + **/ + virtual void SetFileBaseName(const std::string& base_name) = 0; + + /** + * @brief Add entry to file + * + * @param data data to be added + * @param size size of the data + * @param snd_timestamp send time stamp + * @param rcv_timestamp receive time stamp + * @param channel_name channel name + * @param id message id + * @param clock message clock + * + * @return true if succeeds, false if it fails + **/ + virtual bool AddEntryToFile(const void* data, const unsigned long long& size, const long long& snd_timestamp, const long long& rcv_timestamp, const std::string& channel_name, long long id, long long clock) = 0; + + }; + } } } } diff --git a/contrib/measurement/base/include/ecal/measurement/imeasurement.h b/contrib/measurement/base/include/ecal/measurement/imeasurement.h index cfc5081776..95d89f8da1 100644 --- a/contrib/measurement/base/include/ecal/measurement/imeasurement.h +++ b/contrib/measurement/base/include/ecal/measurement/imeasurement.h @@ -35,14 +35,14 @@ namespace eCAL class IBinaryChannel { public: - IBinaryChannel(std::shared_ptr meas_, std::string name_) + IBinaryChannel(std::shared_ptr meas_, std::string name_) : channel_name(name_) , meas(meas_) { meas->GetEntriesInfo(channel_name, entry_infos); } - virtual BinaryFrame operator[](const base::EntryInfo& entry) + virtual BinaryFrame operator[](const experimental::measurement::base::EntryInfo& entry) { size_t message_size; meas->GetEntryDataSize(entry.ID, message_size); @@ -64,7 +64,7 @@ namespace eCAL , m_entry_iterator(owner_.entry_infos.begin()) {}; - iterator(IBinaryChannel& owner_, const measurement::base::EntryInfoSet::iterator& it) + iterator(IBinaryChannel& owner_, const experimental::measurement::base::EntryInfoSet::iterator& it) : m_owner(owner_) , m_entry_iterator(it) {}; @@ -96,7 +96,7 @@ namespace eCAL bool operator!=(const iterator& rhs) const { return !(operator==(rhs)); }; private: IBinaryChannel& m_owner; - measurement::base::EntryInfoSet::iterator m_entry_iterator; + experimental::measurement::base::EntryInfoSet::iterator m_entry_iterator; mutable std::string m_msg; }; @@ -115,8 +115,8 @@ namespace eCAL private: const std::string channel_name; - std::shared_ptr meas; - mutable base::EntryInfoSet entry_infos; + std::shared_ptr meas; + mutable experimental::measurement::base::EntryInfoSet entry_infos; mutable std::string data; }; @@ -125,7 +125,7 @@ namespace eCAL class IChannel { public: - IChannel(std::shared_ptr meas_, std::string name_) + IChannel(std::shared_ptr meas_, std::string name_) : binary_channel(meas_, name_) { } @@ -134,7 +134,7 @@ namespace eCAL bool operator!=(const IChannel& rhs) const { return !(operator==(rhs)); } //virtual Entry operator[](unsigned long long timestamp); - virtual Frame operator[](const base::EntryInfo& entry) + virtual Frame operator[](const experimental::measurement::base::EntryInfo& entry) { auto binary_entry = binary_channel[entry]; eCAL::message::Deserialize(binary_entry.message, message); @@ -225,11 +225,11 @@ namespace eCAL IChannel Get(const std::string& channel) const; private: - std::shared_ptr meas; + std::shared_ptr meas; }; inline IMeasurement::IMeasurement(const std::string& path) - : meas{ std::make_shared(path) } + : meas{ std::make_shared(path) } { } diff --git a/contrib/measurement/base/include/ecal/measurement/omeasurement.h b/contrib/measurement/base/include/ecal/measurement/omeasurement.h index 482ddd1aaa..a75d2780fa 100644 --- a/contrib/measurement/base/include/ecal/measurement/omeasurement.h +++ b/contrib/measurement/base/include/ecal/measurement/omeasurement.h @@ -34,7 +34,7 @@ namespace eCAL class OBinaryChannel { public: - OBinaryChannel(std::shared_ptr meas_, const std::string& name_) + OBinaryChannel(std::shared_ptr meas_, const std::string& name_) : channel_name(name_) , meas(meas_) , SenderID(0) @@ -61,7 +61,7 @@ namespace eCAL private: const std::string channel_name; - std::shared_ptr meas; + std::shared_ptr meas; long long SenderID; long long clock; @@ -72,7 +72,7 @@ namespace eCAL class OChannel { public: - OChannel(std::shared_ptr meas_, std::string name_) + OChannel(std::shared_ptr meas_, std::string name_) : binary_channel(meas_, name_) { } @@ -113,13 +113,13 @@ namespace eCAL OChannel Create(const std::string& channel) const; private: - std::shared_ptr meas; + std::shared_ptr meas; }; inline OMeasurement::OMeasurement(const std::string& base_path_, const std::string& measurement_name_) - : meas{ std::make_shared(base_path_) } + : meas{ std::make_shared(base_path_) } { meas->SetFileBaseName(measurement_name_); } diff --git a/contrib/measurement/hdf5/include/ecal/measurement/hdf5/reader.h b/contrib/measurement/hdf5/include/ecal/measurement/hdf5/reader.h index 249ba728a2..be27f56c10 100644 --- a/contrib/measurement/hdf5/include/ecal/measurement/hdf5/reader.h +++ b/contrib/measurement/hdf5/include/ecal/measurement/hdf5/reader.h @@ -35,189 +35,192 @@ namespace eCAL class HDF5Meas; } - namespace measurement - { - namespace hdf5 + namespace experimental + { + namespace measurement { - /** - * @brief Hdf5 based Reader Implementation - **/ - class Reader : public measurement::base::Reader + namespace hdf5 { - public: - /** - * @brief Constructor - **/ - Reader(); - - /** - * @brief Constructor - * - * @param path Input file path / measurement directory path (see meas directory structure description bellow, in Open method). - * - **/ - explicit Reader(const std::string& path); - - /** - * @brief Destructor - **/ - virtual ~Reader(); - - /** - * @brief Copy operator - **/ - Reader(const Reader& other) = delete; - Reader& operator=(const Reader& other) = delete; - - /** - * @brief Move operator - **/ - Reader(Reader&&) noexcept; - Reader& operator=(Reader&&) noexcept; - - /** - * @brief Open file - * - * @param path Input file path / Reader directory path. - * - * Default Reader directory structure: - * - root directory e.g.: M:\Reader_directory\Reader01 - * - documents directory: |_doc - * - hosts directories: |_Host1 (e.g.: CARPC01) - * |_Host2 (e.g.: CARPC02) - * - * File path as input - * - root directory (e.g.: M:\Reader_directory\Reader01) in this case all hosts subdirectories will be iterated, - * - host directory (e.g.: M:\Reader_directory\Reader01\CARPC01), - * - file path, path to file from Reader (e.g.: M:\Reader_directory\Reader01\CARPC01\meas01_05.hdf5). - * - * - * @return true if input measurement/file path was opened, false otherwise. - **/ - bool Open(const std::string& path) override; - /** - * @brief Close file - * - * @return true if succeeds, false if it fails - **/ - bool Close() override; - - /** - * @brief Checks if file/measurement is ok - * - * @return true if meas can be opened(read) false otherwise - **/ - bool IsOk() const override; - - /** - * @brief Get the File Type Version of the current opened file - * - * @return file version - **/ - std::string GetFileVersion() const override; - - /** - * @brief Get the available channel names of the current opened file / measurement - * - * @return channel names - **/ - std::set GetChannelNames() const override; - - /** - * @brief Check if channel exists in measurement - * - * @param channel_name name of the channel - * - * @return true if exists, false otherwise - **/ - bool HasChannel(const std::string& channel_name) const override; - - /** - * @brief Get the channel description for the given channel - * - * @param channel_name channel name - * - * @return channel description - **/ - std::string GetChannelDescription(const std::string& channel_name) const override; - - /** - * @brief Gets the channel type of the given channel - * - * @param channel_name channel name - * - * @return channel type - **/ - std::string GetChannelType(const std::string& channel_name) const override; - - /** - * @brief Gets minimum timestamp for specified channel - * - * @param channel_name channel name - * - * @return minimum timestamp value - **/ - long long GetMinTimestamp(const std::string& channel_name) const override; - - /** - * @brief Gets maximum timestamp for specified channel - * - * @param channel_name channel name - * - * @return maximum timestamp value - **/ - long long GetMaxTimestamp(const std::string& channel_name) const override; - - /** - * @brief Gets the header info for all data entries for the given channel - * Header = timestamp + entry id - * - * @param [in] channel_name channel name - * @param [out] entries header info for all data entries - * - * @return true if succeeds, false if it fails - **/ - bool GetEntriesInfo(const std::string& channel_name, measurement::base::EntryInfoSet& entries) const override; - - /** - * @brief Gets the header info for data entries for the given channel included in given time range (begin->end) - * Header = timestamp + entry id - * - * @param [in] channel_name channel name - * @param [in] begin time range begin timestamp - * @param [in] end time range end timestamp - * @param [out] entries header info for data entries in given range - * - * @return true if succeeds, false if it fails - **/ - bool GetEntriesInfoRange(const std::string& channel_name, long long begin, long long end, measurement::base::EntryInfoSet& entries) const override; - - /** - * @brief Gets data size of a specific entry - * - * @param [in] entry_id Entry ID - * @param [out] size Entry data size - * - * @return true if succeeds, false if it fails - **/ - bool GetEntryDataSize(long long entry_id, size_t& size) const override; - - /** - * @brief Gets data from a specific entry - * - * @param [in] entry_id Entry ID - * @param [out] data Entry data - * - * @return true if succeeds, false if it fails - **/ - bool GetEntryData(long long entry_id, void* data) const override; - - private: - std::unique_ptr measurement; - - }; - - } //namespace hdf5 - } // namespace measurement + * @brief Hdf5 based Reader Implementation + **/ + class Reader : public measurement::base::Reader + { + public: + /** + * @brief Constructor + **/ + Reader(); + + /** + * @brief Constructor + * + * @param path Input file path / measurement directory path (see meas directory structure description bellow, in Open method). + * + **/ + explicit Reader(const std::string& path); + + /** + * @brief Destructor + **/ + virtual ~Reader(); + + /** + * @brief Copy operator + **/ + Reader(const Reader& other) = delete; + Reader& operator=(const Reader& other) = delete; + + /** + * @brief Move operator + **/ + Reader(Reader&&) noexcept; + Reader& operator=(Reader&&) noexcept; + + /** + * @brief Open file + * + * @param path Input file path / Reader directory path. + * + * Default Reader directory structure: + * - root directory e.g.: M:\Reader_directory\Reader01 + * - documents directory: |_doc + * - hosts directories: |_Host1 (e.g.: CARPC01) + * |_Host2 (e.g.: CARPC02) + * + * File path as input + * - root directory (e.g.: M:\Reader_directory\Reader01) in this case all hosts subdirectories will be iterated, + * - host directory (e.g.: M:\Reader_directory\Reader01\CARPC01), + * - file path, path to file from Reader (e.g.: M:\Reader_directory\Reader01\CARPC01\meas01_05.hdf5). + * + * + * @return true if input measurement/file path was opened, false otherwise. + **/ + bool Open(const std::string& path) override; + + /** + * @brief Close file + * + * @return true if succeeds, false if it fails + **/ + bool Close() override; + + /** + * @brief Checks if file/measurement is ok + * + * @return true if meas can be opened(read) false otherwise + **/ + bool IsOk() const override; + + /** + * @brief Get the File Type Version of the current opened file + * + * @return file version + **/ + std::string GetFileVersion() const override; + + /** + * @brief Get the available channel names of the current opened file / measurement + * + * @return channel names + **/ + std::set GetChannelNames() const override; + + /** + * @brief Check if channel exists in measurement + * + * @param channel_name name of the channel + * + * @return true if exists, false otherwise + **/ + bool HasChannel(const std::string& channel_name) const override; + + /** + * @brief Get the channel description for the given channel + * + * @param channel_name channel name + * + * @return channel description + **/ + std::string GetChannelDescription(const std::string& channel_name) const override; + + /** + * @brief Gets the channel type of the given channel + * + * @param channel_name channel name + * + * @return channel type + **/ + std::string GetChannelType(const std::string& channel_name) const override; + + /** + * @brief Gets minimum timestamp for specified channel + * + * @param channel_name channel name + * + * @return minimum timestamp value + **/ + long long GetMinTimestamp(const std::string& channel_name) const override; + + /** + * @brief Gets maximum timestamp for specified channel + * + * @param channel_name channel name + * + * @return maximum timestamp value + **/ + long long GetMaxTimestamp(const std::string& channel_name) const override; + + /** + * @brief Gets the header info for all data entries for the given channel + * Header = timestamp + entry id + * + * @param [in] channel_name channel name + * @param [out] entries header info for all data entries + * + * @return true if succeeds, false if it fails + **/ + bool GetEntriesInfo(const std::string& channel_name, measurement::base::EntryInfoSet& entries) const override; + + /** + * @brief Gets the header info for data entries for the given channel included in given time range (begin->end) + * Header = timestamp + entry id + * + * @param [in] channel_name channel name + * @param [in] begin time range begin timestamp + * @param [in] end time range end timestamp + * @param [out] entries header info for data entries in given range + * + * @return true if succeeds, false if it fails + **/ + bool GetEntriesInfoRange(const std::string& channel_name, long long begin, long long end, measurement::base::EntryInfoSet& entries) const override; + + /** + * @brief Gets data size of a specific entry + * + * @param [in] entry_id Entry ID + * @param [out] size Entry data size + * + * @return true if succeeds, false if it fails + **/ + bool GetEntryDataSize(long long entry_id, size_t& size) const override; + + /** + * @brief Gets data from a specific entry + * + * @param [in] entry_id Entry ID + * @param [out] data Entry data + * + * @return true if succeeds, false if it fails + **/ + bool GetEntryData(long long entry_id, void* data) const override; + + private: + std::unique_ptr measurement; + + }; + + } //namespace hdf5 + } // namespace measurement + } // namespace experimental } // namespace eCAL diff --git a/contrib/measurement/hdf5/include/ecal/measurement/hdf5/writer.h b/contrib/measurement/hdf5/include/ecal/measurement/hdf5/writer.h index 76189744b0..c7de047568 100644 --- a/contrib/measurement/hdf5/include/ecal/measurement/hdf5/writer.h +++ b/contrib/measurement/hdf5/include/ecal/measurement/hdf5/writer.h @@ -38,155 +38,158 @@ namespace eCAL class HDF5Meas; } - namespace measurement + namespace experimental { - namespace hdf5 + namespace measurement { - /** - * @brief Hdf5 based Writer implementation - **/ - class Writer : public measurement::base::Writer + namespace hdf5 { - public: /** - * @brief Constructor + * @brief Hdf5 based Writer implementation **/ - Writer(); - - /** - * @brief Constructor - **/ - Writer(const std::string& path); - - /** - * @brief Destructor - **/ - virtual ~Writer(); - - /** - * @brief Copy operator - **/ - Writer(const Writer& other) = delete; - Writer& operator=(const Writer& other) = delete; - - /** - * @brief Move operator - **/ - Writer(Writer&&) noexcept; - Writer& operator=(Writer&&) noexcept; - - - - /** - * @brief Open file - * - * @param path Input file path / measurement directory path. - * - * Default measurement directory structure: - * - root directory e.g.: M:\measurement_directory\measurement01 - * - documents directory: |_doc - * - hosts directories: |_Host1 (e.g.: CARPC01) - * |_Host2 (e.g.: CARPC02) - * - * File path as output - * - full path to measurement directory (recommended with host name) (e.g.: M:\measurement_directory\measurement01\CARPC01), - * - to set the name of the actual hdf5 file use SetFileBaseName method. - * - * @return true if output (AccessType::CREATE) measurement directory structure can be accessed/created, false otherwise. - **/ - bool Open(const std::string& path) override; - - /** - * @brief Close file - * - * @return true if succeeds, false if it fails - **/ - bool Close() override; - - /** - * @brief Checks if file/measurement is ok - * - * @return true if location is accessible, false otherwise - **/ - bool IsOk() const override; - - /** - * @brief Gets maximum allowed size for an individual file - * - * @return maximum size in MB - **/ - size_t GetMaxSizePerFile() const override; - - /** - * @brief Sets maximum allowed size for an individual file - * - * @param size maximum size in MB - **/ - void SetMaxSizePerFile(size_t size) override; - - /** - * @brief Whether each Channel shall be writte in its own file - * - * When enabled, data is clustered by channel and each channel is written - * to its own file. The filenames will consist of the basename and the - * channel name. - * - * @return true, if one file per channel is enabled - */ - bool IsOneFilePerChannelEnabled() const override; - - /** - * @brief Enable / disable the creation of one individual file per channel - * - * When enabled, data is clustered by channel and each channel is written - * to its own file. The filenames will consist of the basename and the - * channel name. - * - * @param enabled Whether one file shall be created per channel - */ - void SetOneFilePerChannelEnabled(bool enabled) override; - - /** - * @brief Set description of the given channel - * - * @param channel_name channel name - * @param description description of the channel - **/ - void SetChannelDescription(const std::string& channel_name, const std::string& description) override; - - /** - * @brief Set type of the given channel - * - * @param channel_name channel name - * @param type type of the channel - **/ - void SetChannelType(const std::string& channel_name, const std::string& type) override; - - /** - * @brief Set measurement file base name (desired name for the actual hdf5 files that will be created) - * - * @param base_name Name of the hdf5 files that will be created. - **/ - void SetFileBaseName(const std::string& base_name) override; - - /** - * @brief Add entry to file - * - * @param data data to be added - * @param size size of the data - * @param snd_timestamp send time stamp - * @param rcv_timestamp receive time stamp - * @param channel_name channel name - * @param id message id - * @param clock message clock - * - * @return true if succeeds, false if it fails - **/ - bool AddEntryToFile(const void* data, const unsigned long long& size, const long long& snd_timestamp, const long long& rcv_timestamp, const std::string& channel_name, long long id, long long clock) override; - - private: - std::unique_ptr measurement; - }; - } // namespace hdf5 - } // namespace measurement + class Writer : public measurement::base::Writer + { + public: + /** + * @brief Constructor + **/ + Writer(); + + /** + * @brief Constructor + **/ + Writer(const std::string& path); + + /** + * @brief Destructor + **/ + virtual ~Writer(); + + /** + * @brief Copy operator + **/ + Writer(const Writer& other) = delete; + Writer& operator=(const Writer& other) = delete; + + /** + * @brief Move operator + **/ + Writer(Writer&&) noexcept; + Writer& operator=(Writer&&) noexcept; + + + + /** + * @brief Open file + * + * @param path Input file path / measurement directory path. + * + * Default measurement directory structure: + * - root directory e.g.: M:\measurement_directory\measurement01 + * - documents directory: |_doc + * - hosts directories: |_Host1 (e.g.: CARPC01) + * |_Host2 (e.g.: CARPC02) + * + * File path as output + * - full path to measurement directory (recommended with host name) (e.g.: M:\measurement_directory\measurement01\CARPC01), + * - to set the name of the actual hdf5 file use SetFileBaseName method. + * + * @return true if output (AccessType::CREATE) measurement directory structure can be accessed/created, false otherwise. + **/ + bool Open(const std::string& path) override; + + /** + * @brief Close file + * + * @return true if succeeds, false if it fails + **/ + bool Close() override; + + /** + * @brief Checks if file/measurement is ok + * + * @return true if location is accessible, false otherwise + **/ + bool IsOk() const override; + + /** + * @brief Gets maximum allowed size for an individual file + * + * @return maximum size in MB + **/ + size_t GetMaxSizePerFile() const override; + + /** + * @brief Sets maximum allowed size for an individual file + * + * @param size maximum size in MB + **/ + void SetMaxSizePerFile(size_t size) override; + + /** + * @brief Whether each Channel shall be writte in its own file + * + * When enabled, data is clustered by channel and each channel is written + * to its own file. The filenames will consist of the basename and the + * channel name. + * + * @return true, if one file per channel is enabled + */ + bool IsOneFilePerChannelEnabled() const override; + + /** + * @brief Enable / disable the creation of one individual file per channel + * + * When enabled, data is clustered by channel and each channel is written + * to its own file. The filenames will consist of the basename and the + * channel name. + * + * @param enabled Whether one file shall be created per channel + */ + void SetOneFilePerChannelEnabled(bool enabled) override; + + /** + * @brief Set description of the given channel + * + * @param channel_name channel name + * @param description description of the channel + **/ + void SetChannelDescription(const std::string& channel_name, const std::string& description) override; + + /** + * @brief Set type of the given channel + * + * @param channel_name channel name + * @param type type of the channel + **/ + void SetChannelType(const std::string& channel_name, const std::string& type) override; + + /** + * @brief Set measurement file base name (desired name for the actual hdf5 files that will be created) + * + * @param base_name Name of the hdf5 files that will be created. + **/ + void SetFileBaseName(const std::string& base_name) override; + + /** + * @brief Add entry to file + * + * @param data data to be added + * @param size size of the data + * @param snd_timestamp send time stamp + * @param rcv_timestamp receive time stamp + * @param channel_name channel name + * @param id message id + * @param clock message clock + * + * @return true if succeeds, false if it fails + **/ + bool AddEntryToFile(const void* data, const unsigned long long& size, const long long& snd_timestamp, const long long& rcv_timestamp, const std::string& channel_name, long long id, long long clock) override; + + private: + std::unique_ptr measurement; + }; + } // namespace hdf5 + } // namespace measurement + } // namespace experimental } // namespace eCAL diff --git a/contrib/measurement/hdf5/src/reader.cpp b/contrib/measurement/hdf5/src/reader.cpp index a72fb11471..c2f42a32f8 100644 --- a/contrib/measurement/hdf5/src/reader.cpp +++ b/contrib/measurement/hdf5/src/reader.cpp @@ -1,7 +1,7 @@ #include #include -using namespace eCAL::measurement::hdf5; +using namespace eCAL::experimental::measurement::hdf5; Reader::Reader() : measurement(std::make_unique()) diff --git a/contrib/measurement/hdf5/src/writer.cpp b/contrib/measurement/hdf5/src/writer.cpp index d2a0ccc101..40a8d2d807 100644 --- a/contrib/measurement/hdf5/src/writer.cpp +++ b/contrib/measurement/hdf5/src/writer.cpp @@ -1,7 +1,7 @@ #include #include -using namespace eCAL::measurement::hdf5; +using namespace eCAL::experimental::measurement::hdf5; Writer::Writer() : measurement(std::make_unique()) diff --git a/lang/python/ecalhdf5/src/ecalhdf5_wrap.cxx b/lang/python/ecalhdf5/src/ecalhdf5_wrap.cxx index 98f591c114..6d126db3ef 100644 --- a/lang/python/ecalhdf5/src/ecalhdf5_wrap.cxx +++ b/lang/python/ecalhdf5/src/ecalhdf5_wrap.cxx @@ -107,11 +107,11 @@ static PyObject* Meas_Open(Meas *self, PyObject *args) switch (access) { case 0: - open_meas = self->hdf5_meas->Open(path, eCAL::measurement::base::AccessType::RDONLY); + open_meas = self->hdf5_meas->Open(path, eCAL::experimental::measurement::base::AccessType::RDONLY); break; case 1: - open_meas = self->hdf5_meas->Open(path, eCAL::measurement::base::AccessType::CREATE); + open_meas = self->hdf5_meas->Open(path, eCAL::experimental::measurement::base::AccessType::CREATE); break; default: @@ -279,7 +279,7 @@ static PyObject* Meas_GetEntriesInfo(Meas *self, PyObject *args) if (!PyArg_ParseTuple(args, "s", &channel_name)) return nullptr; - eCAL::measurement::base::EntryInfoSet entries; + eCAL::experimental::measurement::base::EntryInfoSet entries; self->hdf5_meas->GetEntriesInfo(channel_name, entries); PyObject* entries_info = PyList_New(0); @@ -327,7 +327,7 @@ static PyObject* Meas_GetEntriesInfoRange(Meas *self, PyObject *args) if (!PyArg_ParseTuple(args, "sLL", &channel_name, &begin, &end)) return nullptr; - eCAL::measurement::base::EntryInfoSet entries; + eCAL::experimental::measurement::base::EntryInfoSet entries; self->hdf5_meas->GetEntriesInfoRange(channel_name, begin, end, entries); PyObject* entries_info = PyList_New(0);