Note: Goby version 1 (shown here) is now considered obsolete. Please use version 2 for new projects, and consider upgrading old projects.

Goby Underwater Autonomy Project  Series: 1.1, revision: 163, released on 2013-02-06 14:23:27 -0500
acomms/xml/tags.h
00001 // copyright 2009 t. schneider tes@mit.edu
00002 // 
00003 // this file is part of the Dynamic Compact Control Language (DCCL),
00004 // the goby-acomms codec. goby-acomms is a collection of libraries 
00005 // for acoustic underwater networking
00006 //
00007 // This program is free software: you can redistribute it and/or modify
00008 // it under the terms of the GNU General Public License as published by
00009 // the Free Software Foundation, either version 3 of the License, or
00010 // (at your option) any later version.
00011 //
00012 // This software is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 // GNU General Public License for more details.
00016 //
00017 // You should have received a copy of the GNU General Public License
00018 // along with this software.  If not, see <http://www.gnu.org/licenses/>.
00019 
00020 #ifndef XMLTags20091211H
00021 #define XMLTags20091211H
00022 
00023 #include "goby/acomms/xml/xerces_strings.h"
00024 
00025 #include <boost/assign.hpp>
00026 
00027 namespace goby
00028 {
00029     namespace acomms
00030     {    
00031         namespace xml
00032         {
00033             
00034             enum Tag { tag_not_defined,
00035                        tag_all,
00036                        tag_array_length,
00037                        tag_bool,
00038                        tag_delta_encode,
00039                        tag_enum,
00040                        tag_max_delta,
00041                        tag_float,
00042                        tag_format,
00043                        tag_hex,
00044                        tag_id,
00045                        tag_incoming_hex_moos_var,
00046                        tag_int,
00047                        tag_key,
00048                        tag_layout,
00049                        tag_max_length,
00050                        tag_max,
00051                        tag_message_var,
00052                        tag_message,
00053                        tag_min,
00054                        tag_moos_var,
00055                        tag_name,
00056                        tag_num_bytes,
00057                        tag_outgoing_hex_moos_var,
00058                        tag_precision, 
00059                        tag_publish,
00060                        tag_publish_var,
00061                        tag_repeat,
00062                        tag_size,
00063                        tag_source,
00064                        tag_src_var,
00065                        tag_static,
00066                        tag_string,
00067                        tag_trigger_var,
00068                        tag_trigger_time,
00069                        tag_trigger,
00070                        tag_value,
00071                        tag_time,
00072                        tag_src_id,
00073                        tag_dest_id,
00074                        tag_destination_var,
00075                        tag_ack,
00076                        tag_blackout_time,
00077                        tag_max_queue,
00078                        tag_newest_first,
00079                        tag_priority_base,
00080                        tag_priority_time_const,
00081                        tag_ttl,
00082                        tag_value_base
00083             };
00084 
00085     
00086             static void initialize_tags(std::map<std::string, Tag>& tags_map)
00087             {
00088                 boost::assign::insert(tags_map)
00089                     ("all",tag_all)
00090                     ("array_length",tag_array_length)
00091                     ("bool",tag_bool)
00092                     ("delta_encode", tag_delta_encode)
00093                     ("enum",tag_enum)
00094                     ("max_delta",tag_max_delta)
00095                     ("float",tag_float)
00096                     ("format",tag_format)
00097                     ("hex", tag_hex)
00098                     ("id",tag_id)
00099                     ("incoming_hex_moos_var",tag_incoming_hex_moos_var)
00100                     ("int",tag_int)
00101                     ("key",tag_key)
00102                     ("layout",tag_layout)
00103                     ("num_bytes",tag_num_bytes)
00104                     ("max_length",tag_max_length)
00105                     ("max",tag_max)
00106                     ("message_var",tag_message_var)
00107                     ("message",tag_message)
00108                     ("min",tag_min)
00109                     ("moos_var",tag_moos_var)
00110                     ("name",tag_name)
00111                     ("outgoing_hex_moos_var",tag_outgoing_hex_moos_var)
00112                     ("precision", tag_precision) 
00113                     ("publish",tag_publish)
00114                     ("publish_var",tag_publish_var)
00115                     ("repeat",tag_repeat)
00116                     ("size",tag_size)
00117                     ("source",tag_source)
00118                     ("src_var",tag_src_var)
00119                     ("static",tag_static)
00120                     ("string",tag_string)
00121                     ("trigger_moos_var",tag_trigger_var)
00122                     ("trigger_var",tag_trigger_var)
00123                     ("trigger_time",tag_trigger_time)
00124                     ("trigger",tag_trigger)
00125                     ("value",tag_value)
00126                     ("time",tag_time)
00127                     ("src_id",tag_src_id)
00128                     ("dest_id",tag_dest_id)
00129                     ("destination_var",tag_destination_var)
00130                     ("destination_moos_var",tag_destination_var)
00131                     ("ack",tag_ack)
00132                     ("blackout_time",tag_blackout_time)
00133                     ("max_queue",tag_max_queue)
00134                     ("newest_first",tag_newest_first)
00135                     ("priority_base",tag_priority_base)
00136                     ("priority_time_const",tag_priority_time_const)
00137                     ("ttl",tag_ttl)
00138                     ("value_base",tag_value_base);
00139 
00140             }
00141     
00142             inline bool in_message_var(std::set<Tag>& parents)
00143             {
00144                 if(parents.count(tag_hex)) return true;
00145                 else if(parents.count(tag_int)) return true;
00146                 else if(parents.count(tag_string)) return true;
00147                 else if(parents.count(tag_float)) return true;
00148                 else if(parents.count(tag_bool)) return true;
00149                 else if(parents.count(tag_static)) return true;
00150                 else if(parents.count(tag_enum)) return true;
00151                 else return false;
00152             }
00153             inline bool in_header_var(std::set<Tag>& parents)
00154             {
00155                 if(parents.count(tag_time)) return true;
00156                 else if(parents.count(tag_src_id)) return true;
00157                 else if(parents.count(tag_dest_id)) return true;
00158                 else return false;
00159             }
00160     
00161             inline bool in_publish(std::set<Tag>& parents)
00162             { return parents.count(tag_publish); }
00163         }    
00164     }
00165 }
00166 
00167 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends