23 #ifndef MESSAGE20091211H 24 #define MESSAGE20091211H 34 #include <boost/foreach.hpp> 35 #include <boost/shared_ptr.hpp> 37 #include "goby/acomms/protobuf/queue.pb.h" 39 #include "message_var.h" 40 #include "message_var_bool.h" 41 #include "message_var_enum.h" 42 #include "message_var_float.h" 43 #include "message_var_head.h" 44 #include "message_var_hex.h" 45 #include "message_var_int.h" 46 #include "message_var_static.h" 47 #include "message_var_string.h" 49 #include "dccl_constants.h" 50 #include "message_publish.h" 54 namespace transitional
61 void write_schema_to_dccl2(std::ofstream* proto_file);
66 void set_name(
const std::string& name) { name_ = name; }
68 void set_id(
unsigned id) { id_ = id; }
69 template <
typename T>
void set_id(
const T& t) { set_id(util::as<unsigned>(t)); }
71 void set_trigger(
const std::string& trigger_type) { trigger_type_ = trigger_type; }
73 void set_trigger_var(
const std::string& trigger_var) { trigger_var_ = trigger_var; }
75 void set_trigger_time(
double trigger_time) { trigger_time_ = trigger_time; }
76 template <
typename T>
void set_trigger_time(
const T& t)
78 set_trigger_time(util::as<double>(t));
81 void set_trigger_mandatory(
const std::string& trigger_mandatory)
83 trigger_mandatory_ = trigger_mandatory;
86 void set_in_var(
const std::string& in_var) { in_var_ = in_var; }
88 void set_out_var(
const std::string& out_var) { out_var_ = out_var; }
90 void set_size(
unsigned size) { size_ = size; }
92 template <
typename T>
void set_size(
const T& t) { set_size(util::as<unsigned>(t)); }
94 void set_repeat_enabled(
unsigned repeat_enabled) { repeat_enabled_ = repeat_enabled; }
95 template <
typename T>
void set_repeat_enabled(
const T& t)
97 set_repeat_enabled(util::as<unsigned>(t));
100 void add_message_var(
const std::string& type);
103 void set_descriptor(
const google::protobuf::Descriptor* descriptor)
105 descriptor_ = descriptor;
109 std::string name()
const {
return name_; }
110 unsigned id()
const {
return id_; }
111 unsigned size()
const {
return size_; }
112 std::string trigger_var()
const {
return trigger_var_; }
113 std::string trigger_mandatory()
const {
return trigger_mandatory_; }
114 double trigger_time()
const {
return trigger_time_; }
115 unsigned trigger_number()
const {
return trigger_number_; }
116 std::string trigger_type()
const {
return trigger_type_; }
117 std::string in_var()
const {
return in_var_; }
118 std::string out_var()
const {
return out_var_; }
119 bool repeat_enabled()
const {
return repeat_enabled_; }
120 unsigned repeat()
const {
return repeat_; }
123 DCCLMessageVar& header_var(transitional::DCCLHeaderPart p) {
return *header_[p]; }
124 DCCLPublish& last_publish() {
return publishes_.back(); }
126 std::vector<boost::shared_ptr<DCCLMessageVar> >& layout() {
return layout_; }
127 std::vector<boost::shared_ptr<DCCLMessageVar> >& header() {
return header_; }
129 const std::vector<boost::shared_ptr<DCCLMessageVar> >& layout_const()
const {
return layout_; }
130 const std::vector<boost::shared_ptr<DCCLMessageVar> >& header_const()
const {
return header_; }
132 std::vector<DCCLPublish>& publishes() {
return publishes_; }
133 const std::vector<DCCLPublish>& publishes_const()
const {
return publishes_; }
135 boost::shared_ptr<DCCLMessageVar> name2message_var(
const std::string& name)
const;
137 const google::protobuf::Descriptor* descriptor() {
return descriptor_; }
142 std::map<std::string, std::string> message_var_names()
const;
144 void set_repeat_array_length();
145 unsigned calc_total_size();
147 void set_head_defaults(std::map<std::string, std::vector<DCCLMessageVal> >& in,
170 unsigned trigger_number_;
176 double trigger_time_;
178 bool repeat_enabled_;
182 std::string trigger_type_;
183 std::string trigger_var_;
184 std::string trigger_mandatory_;
186 std::string out_var_;
188 std::vector<boost::shared_ptr<DCCLMessageVar> > layout_;
189 std::vector<boost::shared_ptr<DCCLMessageVar> > header_;
191 std::vector<DCCLPublish> publishes_;
193 const google::protobuf::Descriptor* descriptor_;
The global namespace for the Goby project.