23 #ifndef DCCLTRANSITIONAL20091211H 24 #define DCCLTRANSITIONAL20091211H 33 #include "goby/common/logger.h" 34 #include "goby/common/time.h" 35 #include "goby/moos/transitional/xml/xml_parser.h" 37 #include "goby/acomms/acomms_helpers.h" 38 #include "goby/acomms/dccl.h" 39 #include "goby/acomms/protobuf/modem_message.pb.h" 40 #include "goby/acomms/protobuf/queue.pb.h" 41 #include "goby/moos/protobuf/pAcommsHandler_config.pb.h" 42 #include "goby/moos/protobuf/transitional.pb.h" 44 #include "message_val.h" 46 #include <google/protobuf/compiler/importer.h> 47 #include <google/protobuf/descriptor.h> 48 #include <google/protobuf/dynamic_message.h> 59 namespace transitional
62 template <
typename Value>
63 std::ostream& operator<<(std::ostream& out, const std::map<std::string, Value>& m)
65 typedef std::pair<std::string, Value> P;
66 BOOST_FOREACH (
const P& p, m)
69 <<
"key: " << p.first << std::endl
71 <<
"value: " << p.second << std::endl;
76 template <
typename Value>
77 std::ostream& operator<<(std::ostream& out, const std::multimap<std::string, Value>& m)
79 typedef std::pair<std::string, Value> P;
80 BOOST_FOREACH (
const P& p, m)
83 <<
"key: " << p.first << std::endl
85 <<
"value: " << p.second << std::endl;
91 std::ostream& operator<<(std::ostream& out, const std::set<unsigned>& s);
93 std::ostream& operator<<(std::ostream& out, const std::set<std::string>& s);
123 template <
typename Key>
const google::protobuf::Descriptor* descriptor(
const Key& k)
125 return to_iterator(k)->descriptor();
133 template <
typename Key>
unsigned get_repeat(
const Key& k) {
return to_iterator(k)->repeat(); }
136 std::set<unsigned> all_message_ids();
138 std::set<std::string> all_message_names();
140 template <
typename Key> std::map<std::string, std::string>
message_var_names(
const Key& k)
const 142 return to_iterator(k)->message_var_names();
147 std::string
id2name(
unsigned id) {
return to_iterator(
id)->name(); }
150 unsigned name2id(
const std::string& name) {
return to_iterator(name)->id(); }
158 std::vector<DCCLMessage>& messages() {
return messages_; }
164 void convert_xml_message_file(
166 google::protobuf::RepeatedPtrField<goby::moos::protobuf::TranslatorEntry>*
171 boost::shared_ptr<DCCLMessageVar> var,
172 std::map<std::string, goby::moos::protobuf::TranslatorEntry::CreateParser*>* parser_map,
175 std::vector<DCCLMessage>::const_iterator to_iterator(
const std::string& message_name)
const;
176 std::vector<DCCLMessage>::iterator to_iterator(
const std::string& message_name);
177 std::vector<DCCLMessage>::const_iterator to_iterator(
const unsigned&
id)
const;
178 std::vector<DCCLMessage>::iterator to_iterator(
const unsigned&
id);
180 void check_duplicates();
186 std::vector<DCCLMessage> messages_;
188 std::map<std::string, size_t> name2messages_;
189 std::map<unsigned, size_t> id2messages_;
193 boost::posix_time::ptime start_time_;
provides an API to the Transitional Dynamic CCL Codec (looks like DCCLv1, but calls DCCLv2)...
~DCCLTransitionalCodec()
destructor
unsigned get_repeat(const Key &k)
unsigned name2id(const std::string &name)
The global namespace for the Goby project.
std::map< std::string, std::string > message_var_names(const Key &k) const
std::string id2name(unsigned id)