Goby3  3.1.5
2024.05.14
modem_id_convert.h
Go to the documentation of this file.
1 // Copyright 2011-2021:
2 // GobySoft, LLC (2013-)
3 // Massachusetts Institute of Technology (2007-2014)
4 // Community contributors (see AUTHORS file)
5 // File authors:
6 // Toby Schneider <toby@gobysoft.org>
7 //
8 //
9 // This file is part of the Goby Underwater Autonomy Project Libraries
10 // ("The Goby Libraries").
11 //
12 // The Goby Libraries are free software: you can redistribute them and/or modify
13 // them under the terms of the GNU Lesser General Public License as published by
14 // the Free Software Foundation, either version 2.1 of the License, or
15 // (at your option) any later version.
16 //
17 // The Goby Libraries are distributed in the hope that they will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU Lesser General Public License for more details.
21 //
22 // You should have received a copy of the GNU Lesser General Public License
23 // along with Goby. If not, see <http://www.gnu.org/licenses/>.
24 
25 #ifndef GOBY_MOOS_MODEM_ID_CONVERT_H
26 #define GOBY_MOOS_MODEM_ID_CONVERT_H
27 
28 #include <cstddef> // for size_t
29 #include <map> // for map
30 #include <string> // for string
31 
32 namespace goby
33 {
34 namespace moos
35 {
37 {
38  public:
39  ModemIdConvert() = default;
40 
41  std::string read_lookup_file(const std::string& path);
42 
43  std::string get_name_from_id(int id);
44  std::string get_type_from_id(int id);
45  std::string get_location_from_id(int id);
46  int get_id_from_name(const std::string& name);
47 
48  size_t max_name_length() { return max_name_length_; }
49  int max_id() { return max_id_; }
50 
51  const std::map<int, std::string>& names() const { return names_; }
52 
53  private:
54  std::map<int, std::string> names_;
55  std::map<int, std::string> types_;
56  std::map<int, std::string> locations_;
57 
58  size_t max_name_length_{0};
59  int max_id_{0};
60 };
61 } // namespace moos
62 } // namespace goby
63 
64 #endif
goby::moos::ModemIdConvert::max_name_length
size_t max_name_length()
Definition: modem_id_convert.h:48
goby
The global namespace for the Goby project.
Definition: acomms_constants.h:33
goby::moos::ModemIdConvert::get_location_from_id
std::string get_location_from_id(int id)
goby::moos::ModemIdConvert::ModemIdConvert
ModemIdConvert()=default
goby::moos::ModemIdConvert::read_lookup_file
std::string read_lookup_file(const std::string &path)
goby::moos::ModemIdConvert::max_id
int max_id()
Definition: modem_id_convert.h:49
goby::moos::ModemIdConvert::get_id_from_name
int get_id_from_name(const std::string &name)
goby::moos::ModemIdConvert::get_type_from_id
std::string get_type_from_id(int id)
goby::moos::ModemIdConvert::get_name_from_id
std::string get_name_from_id(int id)
goby::moos::ModemIdConvert
Definition: modem_id_convert.h:36
goby::moos::ModemIdConvert::names
const std::map< int, std::string > & names() const
Definition: modem_id_convert.h:51