23 #ifndef MESSAGE_VAR_HEAD20100317H 24 #define MESSAGE_VAR_HEAD20100317H 26 #include "message_var.h" 27 #include "message_var_int.h" 29 #include "goby/common/time.h" 30 #include "goby/util/sci.h" 34 namespace transitional
41 default_name_(default_name)
43 set_name(default_name);
47 void initialize_specific()
49 if (default_name_ == name_)
53 virtual void set_defaults_specific(
DCCLMessageVal& v,
unsigned modem_id,
unsigned id) {}
57 std::string default_name_;
65 transitional::HEAD_TIME_SIZE)
69 void set_defaults_specific(
DCCLMessageVal& v,
unsigned modem_id,
unsigned id)
89 goby::util::as<boost::posix_time::ptime>(s)))
93 void write_schema_to_dccl2(std::ofstream* proto_file,
int sequence_number)
95 sequence_number_ = sequence_number;
97 <<
"optional double " << name() <<
" = " << sequence_number
98 <<
" [(dccl.field).codec=\"_time\", (dccl.field).in_head=true];" << std::endl;
107 transitional::HEAD_CCL_ID_SIZE)
111 void set_defaults_specific(
DCCLMessageVal& v,
unsigned modem_id,
unsigned id)
113 v = long(acomms::DCCL_CCL_HEADER);
122 transitional::HEAD_DCCL_ID_SIZE)
126 void set_defaults_specific(
DCCLMessageVal& v,
unsigned modem_id,
unsigned id)
137 transitional::HEAD_SRC_ID_SIZE)
141 void set_defaults_specific(
DCCLMessageVal& v,
unsigned modem_id,
unsigned id)
146 virtual std::string additional_option_extensions() {
return "(dccl.field).in_head=true"; }
154 transitional::HEAD_DEST_ID_SIZE)
158 void set_defaults_specific(
DCCLMessageVal& v,
unsigned modem_id,
unsigned id)
163 virtual std::string additional_option_extensions() {
return "(dccl.field).in_head=true"; }
170 :
DCCLMessageVarHead(transitional::DCCL_HEADER_NAMES[transitional::HEAD_MULTIMESSAGE_FLAG],
171 transitional::HEAD_FLAG_SIZE)
180 :
DCCLMessageVarHead(transitional::DCCL_HEADER_NAMES[transitional::HEAD_BROADCAST_FLAG],
181 transitional::HEAD_FLAG_SIZE)
191 transitional::HEAD_UNUSED_SIZE)
bool empty() const
was this just constructed with DCCLMessageVal() ?
bool get(std::string &s) const
extract as std::string (all reasonable casts are done)
ReturnType goby_time()
Returns current UTC time as a boost::posix_time::ptime.
const int BROADCAST_ID
special modem id for the broadcast destination - no one is assigned this address. Analogous to 192...
The global namespace for the Goby project.
double ptime2unix_double(boost::posix_time::ptime given_time)
convert from boost date_time ptime to the number of seconds (including fractional) since 1/1/1970 0:0...
boost::posix_time::ptime unix_double2ptime(double given_time)
convert to boost date_time ptime from the number of seconds (including fractional) since 1/1/1970 0:0...