Goby v2
modem_id_convert.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 #ifndef MODEM_ID_CONVERTH
24 #define MODEM_ID_CONVERTH
25 
26 #include <fstream>
27 #include <iostream>
28 #include <map>
29 #include <sstream>
30 
31 namespace goby
32 {
33 namespace moos
34 {
36 {
37  public:
38  ModemIdConvert() : max_name_length_(0), max_id_(0) {}
39 
40  std::string read_lookup_file(std::string path);
41 
42  std::string get_name_from_id(int id);
43  std::string get_type_from_id(int id);
44  std::string get_location_from_id(int id);
45  int get_id_from_name(std::string name);
46 
47  size_t max_name_length() { return max_name_length_; }
48  int max_id() { return max_id_; }
49 
50  const std::map<int, std::string>& names() const { return names_; }
51 
52  private:
53  std::map<int, std::string> names_;
54  std::map<int, std::string> types_;
55  std::map<int, std::string> locations_;
56 
57  size_t max_name_length_;
58  int max_id_;
59 };
60 } // namespace moos
61 } // namespace goby
62 
63 #endif
The global namespace for the Goby project.