Goby v2
message_var_hex.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 MESSAGE_VAR_HEX20100317H
24 #define MESSAGE_VAR_HEX20100317H
25 
26 #include "goby/acomms/dccl.h"
27 #include "message_var.h"
28 
29 #include "dccl_constants.h"
30 #include "goby/util/as.h"
31 #include "goby/util/binary.h"
32 
33 namespace goby
34 {
35 namespace transitional
36 {
38 {
39  public:
40  DCCLMessageVarHex() : DCCLMessageVar(), num_bytes_(0) {}
41 
42  /* int calc_size() const */
43  /* { return num_bytes_*acomms::BITS_IN_BYTE; } */
44 
45  void set_num_bytes(unsigned num_bytes) { num_bytes_ = num_bytes; }
46  void set_num_bytes(const std::string& s) { set_num_bytes(boost::lexical_cast<unsigned>(s)); }
47 
48  unsigned num_bytes() const { return num_bytes_; }
49  DCCLType type() const { return dccl_hex; }
50 
51  private:
52  void initialize_specific() {}
53 
54  void get_display_specific(std::stringstream& ss) const {}
55 
56  private:
57  unsigned num_bytes_;
58 };
59 } // namespace transitional
60 } // namespace goby
61 #endif
DCCLType
Enumeration of DCCL types used for sending messages. dccl_enum and dccl_string primarily map to cpp_s...
The global namespace for the Goby project.