Goby3  3.1.5a
2024.05.23
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 
36 namespace goby
37 {
38 namespace 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 
64 inline 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
primitive_types.h
goby::middleware::HDF5ProtobufEntry::msg
std::shared_ptr< google::protobuf::Message > msg
Actual message contents.
Definition: hdf5_plugin.h:48
types.h
goby::middleware::HDF5ProtobufEntry::scheme
int scheme
Scheme.
Definition: hdf5_plugin.h:51
goby
The global namespace for the Goby project.
Definition: acomms_constants.h:33
goby::middleware::HDF5ProtobufEntry::channel
std::string channel
Channel (or Group) name.
Definition: hdf5_plugin.h:44
goby::middleware::HDF5ProtobufEntry::clear
void clear()
Clear the values.
Definition: hdf5_plugin.h:56
goby::middleware::protobuf::HDF5Config
Definition: hdf5.pb.h:73
goby::middleware::HDF5Plugin::~HDF5Plugin
virtual ~HDF5Plugin()=default
goby::middleware::operator<<
std::ostream & operator<<(std::ostream &os, const Group &g)
Definition: group.h:116
message.h
goby::middleware::HDF5Plugin::provide_entry
virtual bool provide_entry(HDF5ProtobufEntry *entry)=0
Implement this function in the plugin to provide a single Protobuf message and related metadata to th...
goby::middleware::HDF5Plugin::HDF5Plugin
HDF5Plugin(const goby::middleware::protobuf::HDF5Config *cfg)
Definition: hdf5_plugin.h:82
goby::middleware::HDF5ProtobufEntry::time
time::MicroTime time
Time of the message.
Definition: hdf5_plugin.h:46
goby::middleware::HDF5Plugin
Superclass for implementing plugins for the goby_hdf5 tool for converting from Google Protocol Buffer...
Definition: hdf5_plugin.h:79
hdf5.pb.h
goby::middleware::HDF5ProtobufEntry::HDF5ProtobufEntry
HDF5ProtobufEntry()=default
goby::time::MicroTime
boost::units::quantity< MicroTimeUnit, std::int64_t > MicroTime
quantity of microseconds (using int64)
Definition: types.h:39
goby::middleware::HDF5ProtobufEntry
Represents an entry in a HDF5 scientific data file converted from a Google Protocol Buffers message.
Definition: hdf5_plugin.h:41