Goby3 3.2.3
2025.05.13
Loading...
Searching...
No Matches
hdf5_plugin.h
Go to the documentation of this file.
1// Copyright 2016-2022:
2// GobySoft, LLC (2013-)
3// Community contributors (see AUTHORS file)
4// File authors:
5// Toby Schneider <toby@gobysoft.org>
6//
7//
8// This file is part of the Goby Underwater Autonomy Project Libraries
9// ("The Goby Libraries").
10//
11// The Goby Libraries are free software: you can redistribute them and/or modify
12// them under the terms of the GNU Lesser General Public License as published by
13// the Free Software Foundation, either version 2.1 of the License, or
14// (at your option) any later version.
15//
16// The Goby Libraries are distributed in the hope that they will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19// GNU Lesser General Public License for more details.
20//
21// You should have received a copy of the GNU Lesser General Public License
22// along with Goby. If not, see <http://www.gnu.org/licenses/>.
23
24#ifndef GOBY_MIDDLEWARE_LOG_HDF5_HDF5_PLUGIN_H
25#define GOBY_MIDDLEWARE_LOG_HDF5_HDF5_PLUGIN_H
26
27#include <google/protobuf/descriptor.h>
29
30#include <memory>
31
33#include "goby/time/types.h"
35
36namespace goby
37{
38namespace middleware
39{
42{
44 std::string channel;
46 time::MicroTime time{0 * boost::units::si::seconds};
48 std::shared_ptr<google::protobuf::Message> msg;
49
51 int scheme{-1};
52
53 HDF5ProtobufEntry() = default;
54
56 void clear()
57 {
58 channel.clear();
59 time = time::MicroTime(0 * boost::units::si::seconds);
60 msg.reset();
61 }
62};
63
64inline std::ostream& operator<<(std::ostream& os, const HDF5ProtobufEntry& entry)
65{
66 os << "@" << entry.time.value() << ": ";
67 os << "/" << entry.channel;
68 if (entry.msg)
69 {
70 os << "/" << entry.msg->GetDescriptor()->full_name();
71 os << " " << entry.msg->ShortDebugString();
72 }
73 return os;
74}
75
80{
81 public:
83 virtual ~HDF5Plugin() = default;
84
89 virtual bool provide_entry(HDF5ProtobufEntry* entry) = 0;
90};
91} // namespace middleware
92} // namespace goby
93
94#endif
Superclass for implementing plugins for the goby_hdf5 tool for converting from Google Protocol Buffer...
Definition hdf5_plugin.h:80
virtual bool provide_entry(HDF5ProtobufEntry *entry)=0
Implement this function in the plugin to provide a single Protobuf message and related metadata to th...
HDF5Plugin(const goby::middleware::protobuf::HDF5Config *cfg)
Definition hdf5_plugin.h:82
virtual ~HDF5Plugin()=default
boost::units::quantity< MicroTimeUnit, std::int64_t > MicroTime
quantity of microseconds (using int64)
Definition types.h:39
The global namespace for the Goby project.
Represents an entry in a HDF5 scientific data file converted from a Google Protocol Buffers message.
Definition hdf5_plugin.h:42
void clear()
Clear the values.
Definition hdf5_plugin.h:56
std::string channel
Channel (or Group) name.
Definition hdf5_plugin.h:44
std::shared_ptr< google::protobuf::Message > msg
Actual message contents.
Definition hdf5_plugin.h:48
time::MicroTime time
Time of the message.
Definition hdf5_plugin.h:46