Goby v2
core_helpers.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 // copyright 2010-2011 t. schneider tes@mit.edu
24 //
25 // This program is free software: you can redistribute it and/or modify
26 // it under the terms of the GNU General Public License as published by
27 // the Free Software Foundation, either version 3 of the License, or
28 // (at your option) any later version.
29 //
30 // This software is distributed in the hope that it will be useful,
31 // but WITHOUT ANY WARRANTY; without even the implied warranty of
32 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 // GNU General Public License for more details.
34 //
35 // You should have received a copy of the GNU General Public License
36 // along with this software. If not, see <http://www.gnu.org/licenses/>
37 
38 #ifndef CoreHelpers20110411H
39 #define CoreHelpers20110411H
40 
41 #include "goby/common/protobuf/app_base_config.pb.h"
42 #include <boost/program_options.hpp>
43 
44 namespace goby
45 {
46 namespace common
47 {
49 inline std::ostream& operator<<(std::ostream& out, const google::protobuf::Message& msg)
50 {
51  return (out << "### " << msg.GetDescriptor()->full_name() << " ###\n" << msg.DebugString());
52 }
53 
54 inline void merge_app_base_cfg(AppBaseConfig* base_cfg,
55  const boost::program_options::variables_map& var_map)
56 {
57  /* if(var_map.count("ncurses")) */
58  /* { */
59  /* base_cfg->mutable_glog_config()->set_tty_verbosity(util::protobuf::GLogConfig::GUI); */
60  /* } */
61  /* else if (var_map.count("verbose")) */
62  /* { */
63  /* switch(var_map["verbose"].as<std::string>().size()) */
64  /* { */
65  /* default: */
66  /* case 0: */
67  /* base_cfg->mutable_glog_config()->set_tty_verbosity(util::protobuf::GLogConfig::VERBOSE); */
68  /* break; */
69  /* case 1: */
70  /* base_cfg->mutable_glog_config()->set_tty_verbosity(util::protobuf::GLogConfig::DEBUG1); */
71  /* break; */
72  /* case 2: */
73  /* base_cfg->mutable_glog_config()->set_tty_verbosity(util::protobuf::GLogConfig::DEBUG2); */
74  /* break; */
75  /* case 3: */
76  /* base_cfg->mutable_glog_config()->set_tty_verbosity(util::protobuf::GLogConfig::DEBUG3); */
77  /* break; */
78  /* } */
79  /* } */
80 
81  // if(var_map.count("no_db"))
82  // base_cfg->mutable_database_config()->set_using_database(false);
83 }
84 
85 } // namespace common
86 } // namespace goby
87 
88 #endif
std::ostream & operator<<(std::ostream &out, const google::protobuf::Message &msg)
provides stream output operator for Google Protocol Buffers Message
Definition: core_helpers.h:49
The global namespace for the Goby project.