Goby v2
hdf5_plugin.h
1 // Copyright 2009-2018 Toby Schneider (http://gobysoft.org/index.wt/people/toby)
2 // GobySoft, LLC (2013-)
3 // Massachusetts Institute of Technology (2007-2014)
4 // Community contributors (see AUTHORS file)
5 //
6 //
7 // This file is part of the Goby Underwater Autonomy Project Libraries
8 // ("The Goby Libraries").
9 //
10 // The Goby Libraries are free software: you can redistribute them and/or modify
11 // them under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 2.1 of the License, or
13 // (at your option) any later version.
14 //
15 // The Goby Libraries are distributed in the hope that they will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with Goby. If not, see <http://www.gnu.org/licenses/>.
22 
23 #ifndef HDF5_PLUGIN20160523H
24 #define HDF5_PLUGIN20160523H
25 
26 #include <google/protobuf/descriptor.h>
27 #include <google/protobuf/message.h>
28 
29 #include <boost/shared_ptr.hpp>
30 
31 #include "goby/common/protobuf/hdf5.pb.h"
32 #include "goby/util/primitive_types.h"
33 
34 namespace goby
35 {
36 namespace common
37 {
39 {
40  std::string channel;
41  goby::uint64 time;
42  boost::shared_ptr<google::protobuf::Message> msg;
43 
44  HDF5ProtobufEntry() : time(0) {}
45 
46  void clear()
47  {
48  channel.clear();
49  time = 0;
50  msg.reset();
51  }
52 };
53 
54 inline std::ostream& operator<<(std::ostream& os, const HDF5ProtobufEntry& entry)
55 {
56  os << "@" << entry.time << ": ";
57  os << "/" << entry.channel;
58  if (entry.msg)
59  {
60  os << "/" << entry.msg->GetDescriptor()->full_name();
61  os << " " << entry.msg->ShortDebugString();
62  }
63  return os;
64 }
65 
67 {
68  public:
70  virtual ~HDF5Plugin() {}
71 
72  virtual bool provide_entry(HDF5ProtobufEntry* entry) = 0;
73 };
74 } // namespace common
75 } // namespace goby
76 
77 #endif
std::ostream & operator<<(std::ostream &out, const google::protobuf::Message &msg)
provides stream output operator for Google Protocol Buffers Message
Definition: core_helpers.h:49
The global namespace for the Goby project.
google::protobuf::uint64 uint64
an unsigned 64 bit integer