Skip to content

Commit

Permalink
Revert "Measurement: Prepare mcap support by introducing measurement …
Browse files Browse the repository at this point in the history
…base class. (#1077)"

This reverts commit 10db141.
  • Loading branch information
FlorianReimold committed Jul 21, 2023
1 parent 6a26e53 commit 06f0231
Show file tree
Hide file tree
Showing 22 changed files with 128 additions and 518 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,6 @@ if(HAS_HDF5)
add_subdirectory(contrib/ecalhdf5)
add_subdirectory(contrib/message)
endif()
add_subdirectory(contrib/measurement/base)

# --------------------------------------------------------
# ecal core python binding
Expand Down
2 changes: 1 addition & 1 deletion app/meas_cutter/src/measurement_exporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void MeasurementExporter::setPath(const std::string& path, const std::string& ba
{
_root_output_path = EcalUtils::Filesystem::CleanPath(path);
_output_path = EcalUtils::Filesystem::CleanPath(_root_output_path + EcalUtils::Filesystem::NativeSeparator(EcalUtils::Filesystem::OsStyle::Current) + eCALMeasCutterUtils::kDefaultFolderOutput, EcalUtils::Filesystem::OsStyle::Current);
if (!_writer->Open(_output_path, eCAL::measurement::base::CREATE))
if (!_writer->Open(_output_path, eCAL::eh5::eAccessType::CREATE))
{
throw ExporterException("Unable to create HDF5 protobuf output path " + path + ".");
}
Expand Down
4 changes: 2 additions & 2 deletions app/meas_cutter/src/measurement_exporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class MeasurementExporter
std::string getRootOutputPath() const;

private:
std::unique_ptr<eCAL::measurement::base::Measurement> _writer;
std::string _current_channel_name;
std::unique_ptr<eCAL::eh5::HDF5Meas> _writer;
std::string _current_channel_name;
std::string _output_path;
std::string _root_output_path;
};
Expand Down
2 changes: 1 addition & 1 deletion app/meas_cutter/src/measurement_importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,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::eh5::EntryInfoSet entry_info_set;
_reader->GetEntriesInfo(channel_name, entry_info_set);

for (const auto& entry_info : entry_info_set)
Expand Down
8 changes: 4 additions & 4 deletions app/meas_cutter/src/measurement_importer.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ class MeasurementImporter
private:
bool isEcalMeasFile(const std::string& path);
bool isProtoChannel(const std::string& channel_type);
std::unique_ptr<eCAL::measurement::base::Measurement> _reader;
eCALMeasCutterUtils::ChannelData _current_opened_channel_data;
std::string _loaded_path;
eCALMeasCutterUtils::ChannelNameSet _channel_names;
std::unique_ptr<eCAL::eh5::HDF5Meas> _reader;
eCALMeasCutterUtils::ChannelData _current_opened_channel_data;
std::string _loaded_path;
eCALMeasCutterUtils::ChannelNameSet _channel_names;
};

class ImporterException : public std::exception
Expand Down
2 changes: 1 addition & 1 deletion app/meas_cutter/src/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,6 @@ namespace eCALMeasCutterUtils
{
ChannelInfo _channel_info;
TimestampSet _timestamps;
std::unordered_map<Timestamp, eCAL::measurement::base::EntryInfo> _timestamp_entry_info_map;
std::unordered_map<Timestamp, eCAL::eh5::SEntryInfo> _timestamp_entry_info_map;
};
}
4 changes: 2 additions & 2 deletions app/play/play_core/src/ecal_play.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ bool EcalPlay::LoadMeasurement(const std::string& path)
{
EcalPlayLogger::Instance()->info("Loading measurement...");

std::shared_ptr<eCAL::measurement::base::Measurement> measurement(std::make_shared<eCAL::eh5::HDF5Meas>());
std::shared_ptr<eCAL::eh5::HDF5Meas> measurement(std::make_shared<eCAL::eh5::HDF5Meas>());

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
Expand Down Expand Up @@ -129,7 +129,7 @@ bool EcalPlay::LoadMeasurement(const std::string& path)
void EcalPlay::CloseMeasurement()
{
description_ = "";
play_thread_->SetMeasurement(std::shared_ptr<eCAL::measurement::base::Measurement>(nullptr));
play_thread_->SetMeasurement(std::shared_ptr<eCAL::eh5::HDF5Meas>(nullptr));
measurement_path_ = "";
clearScenariosPath();
channel_mapping_path_ = "";
Expand Down
8 changes: 4 additions & 4 deletions app/play/play_core/src/measurement_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <math.h>
#include <stdlib.h>

MeasurementContainer::MeasurementContainer(std::shared_ptr<eCAL::measurement::base::Measurement> hdf5_meas, const std::string& meas_dir, bool use_receive_timestamp)
MeasurementContainer::MeasurementContainer(std::shared_ptr<eCAL::eh5::HDF5Meas> 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)
Expand All @@ -48,7 +48,7 @@ void MeasurementContainer::CreateFrameTable()
auto channel_names = hdf5_meas_->GetChannelNames();
for (auto& channel_name : channel_names)
{
eCAL::measurement::base::EntryInfoSet entry_info_set;
eCAL::eh5::EntryInfoSet entry_info_set;
if (hdf5_meas_->GetEntriesInfo(channel_name, entry_info_set))
{
for (auto& entry_info : entry_info_set)
Expand Down Expand Up @@ -83,7 +83,7 @@ void MeasurementContainer::CalculateEstimatedSizeForChannels()
auto channel_names = hdf5_meas_->GetChannelNames();
for (auto& channel_name : channel_names)
{
eCAL::measurement::base::EntryInfoSet entry_info_set;
eCAL::eh5::EntryInfoSet entry_info_set;
if (hdf5_meas_->GetEntriesInfo(channel_name, entry_info_set))
{
auto size = entry_info_set.size();
Expand Down Expand Up @@ -451,7 +451,7 @@ std::map<std::string, ContinuityReport> MeasurementContainer::CreateContinuityRe
auto channel_names = hdf5_meas_->GetChannelNames();
for (auto& channel_name : channel_names)
{
eCAL::measurement::base::EntryInfoSet entry_info_set;
eCAL::eh5::EntryInfoSet entry_info_set;
if (hdf5_meas_->GetEntriesInfo(channel_name, entry_info_set))
{

Expand Down
8 changes: 4 additions & 4 deletions app/play/play_core/src/measurement_container.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
class MeasurementContainer
{
public:
MeasurementContainer(std::shared_ptr<eCAL::measurement::base::Measurement> hdf5_meas, const std::string& meas_dir = "", bool use_receive_timestamp = true);
MeasurementContainer(std::shared_ptr<eCAL::eh5::HDF5Meas> hdf5_meas, const std::string& meas_dir = "", bool use_receive_timestamp = true);
~MeasurementContainer();

void CreatePublishers();
Expand Down Expand Up @@ -108,9 +108,9 @@ class MeasurementContainer
PublisherInfo* publisher_info_;
};

std::shared_ptr<eCAL::measurement::base::Measurement> hdf5_meas_;
std::string meas_dir_;
bool use_receive_timestamp_;
std::shared_ptr<eCAL::eh5::HDF5Meas> hdf5_meas_;
std::string meas_dir_;
bool use_receive_timestamp_;

std::vector<MeasurementFrame> frame_table_;
std::map<std::string, size_t> total_estimated_channel_size_map_;
Expand Down
2 changes: 1 addition & 1 deletion app/play/play_core/src/play_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ void PlayThread::LogChannelMapping(const std::map<std::string, std::string>& cha
//// Measurement ////
////////////////////////////////////////////////////////////////////////////////

void PlayThread::SetMeasurement(const std::shared_ptr<eCAL::measurement::base::Measurement>& measurement, const std::string& path)
void PlayThread::SetMeasurement(std::shared_ptr<eCAL::eh5::HDF5Meas> measurement, const std::string& path)
{
std::unique_ptr<MeasurementContainer> new_measurment_container;

Expand Down
2 changes: 1 addition & 1 deletion app/play/play_core/src/play_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,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<eCAL::measurement::base::Measurement>& measurement, const std::string& path = "");
void SetMeasurement(std::shared_ptr<eCAL::eh5::HDF5Meas> measurement, const std::string& path = "");

/**
* @brief Returns whether a measurement has successfully been loaded
Expand Down
2 changes: 1 addition & 1 deletion app/rec/rec_client_core/src/job/hdf5_writer_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ namespace eCAL
#endif // NDEBUG
std::unique_lock<decltype(hdf5_writer_mutex_)> hdf5_writer_lock(hdf5_writer_mutex_);

if (hdf5_writer_->Open(hdf5_dir, eCAL::measurement::base::AccessType::CREATE))
if (hdf5_writer_->Open(hdf5_dir, eCAL::eh5::eAccessType::CREATE))
{
#ifndef NDEBUG
EcalRecLogger::Instance()->debug("Hdf5WriterThread::Open(): Successfully opened HDF5-Writer with path \"" + hdf5_dir + "\"");
Expand Down
4 changes: 2 additions & 2 deletions app/rec/rec_client_core/src/job/hdf5_writer_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ namespace eCAL
bool new_topic_info_map_available_; /**< Telling that a new topic info map has been set from the outside. */
mutable RecHdf5JobStatus last_status_;

mutable std::mutex hdf5_writer_mutex_;
std::unique_ptr<eCAL::measurement::base::Measurement> hdf5_writer_;
mutable std::mutex hdf5_writer_mutex_;
std::unique_ptr<eCAL::eh5::HDF5Meas> hdf5_writer_;


std::atomic<bool> flushing_;
Expand Down
1 change: 0 additions & 1 deletion contrib/ecalhdf5/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ target_link_libraries(${PROJECT_NAME}

target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_14)

target_link_libraries(${PROJECT_NAME} PUBLIC eCAL::measurement_base)
if (${ECAL_LINK_HDF5_SHARED})
if (TARGET hdf5::hdf5-shared)
target_link_libraries(${PROJECT_NAME} PRIVATE
Expand Down
20 changes: 10 additions & 10 deletions contrib/ecalhdf5/include/ecal/measurement/imeasurement.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ namespace eCAL
class IBinaryChannel
{
public:
IBinaryChannel(std::shared_ptr<base::Measurement> meas_, std::string name_)
IBinaryChannel(std::shared_ptr<eh5::HDF5Meas> 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 eh5::SEntryInfo& entry)
{
size_t message_size;
meas->GetEntryDataSize(entry.ID, message_size);
Expand All @@ -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 eh5::EntryInfoSet::iterator& it)
: m_owner(owner_)
, m_entry_iterator(it)
{};
Expand Down Expand Up @@ -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;
eh5::EntryInfoSet::iterator m_entry_iterator;
mutable std::string m_msg;
};

Expand All @@ -115,8 +115,8 @@ namespace eCAL

private:
const std::string channel_name;
std::shared_ptr<base::Measurement> meas;
mutable base::EntryInfoSet entry_infos;
std::shared_ptr<eh5::HDF5Meas> meas;
mutable eh5::EntryInfoSet entry_infos;
mutable std::string data;
};

Expand All @@ -125,7 +125,7 @@ namespace eCAL
class IChannel
{
public:
IChannel(std::shared_ptr<base::Measurement> meas_, std::string name_)
IChannel(std::shared_ptr<eh5::HDF5Meas> meas_, std::string name_)
: binary_channel(meas_, name_)
{
}
Expand All @@ -134,7 +134,7 @@ namespace eCAL
bool operator!=(const IChannel& rhs) const { return !(operator==(rhs)); }

//virtual Entry<T> operator[](unsigned long long timestamp);
virtual Frame<T> operator[](const base::EntryInfo& entry)
virtual Frame<T> operator[](const eh5::SEntryInfo& entry)
{
auto binary_entry = binary_channel[entry];
eCAL::message::Deserialize(binary_entry.message, message);
Expand Down Expand Up @@ -225,11 +225,11 @@ namespace eCAL
IChannel<T> Get(const std::string& channel) const;

private:
std::shared_ptr<base::Measurement> meas;
std::shared_ptr<eh5::HDF5Meas> meas;
};

inline IMeasurement::IMeasurement(const std::string& path)
: meas{ std::make_shared<eh5::HDF5Meas>(path, eCAL::measurement::base::RDONLY) }
: meas{ std::make_shared<eh5::HDF5Meas>(path, eh5::RDONLY) }
{
}

Expand Down
10 changes: 5 additions & 5 deletions contrib/ecalhdf5/include/ecal/measurement/omeasurement.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace eCAL
class OBinaryChannel
{
public:
OBinaryChannel(std::shared_ptr<base::Measurement> meas_, const std::string& name_)
OBinaryChannel(std::shared_ptr<eh5::HDF5Meas> meas_, const std::string& name_)
: channel_name(name_)
, meas(meas_)
, SenderID(0)
Expand All @@ -61,7 +61,7 @@ namespace eCAL

private:
const std::string channel_name;
std::shared_ptr<base::Measurement> meas;
std::shared_ptr<eh5::HDF5Meas> meas;

long long SenderID;
long long clock;
Expand All @@ -72,7 +72,7 @@ namespace eCAL
class OChannel
{
public:
OChannel(std::shared_ptr<base::Measurement> meas_, std::string name_)
OChannel(std::shared_ptr<eh5::HDF5Meas> meas_, std::string name_)
: binary_channel(meas_, name_)
{
}
Expand Down Expand Up @@ -113,13 +113,13 @@ namespace eCAL
OChannel<T> Create(const std::string& channel) const;

private:
std::shared_ptr<base::Measurement> meas;
std::shared_ptr<eh5::HDF5Meas> meas;
};



inline OMeasurement::OMeasurement(const std::string& base_path_, const std::string& measurement_name_)
: meas{ std::make_shared<eh5::HDF5Meas>(base_path_, base::CREATE) }
: meas{ std::make_shared<eh5::HDF5Meas>(base_path_, eh5::CREATE) }
{
meas->SetFileBaseName(measurement_name_);
}
Expand Down
Loading

0 comments on commit 06f0231

Please sign in to comment.