1
// Copyright 2009-2013 Toby Schneider (https://launchpad.net/~tes)
2
// Massachusetts Institute of Technology (2007-)
3
// Woods Hole Oceanographic Institution (2007-)
1
// Copyright 2009-2014 Toby Schneider (https://launchpad.net/~tes)
2
// GobySoft, LLC (2013-)
3
// Massachusetts Institute of Technology (2007-2014)
4
4
// Goby Developers Team (https://launchpad.net/~goby-dev)
7
// This file is part of the Goby Underwater Autonomy Project MOOS Interface Library
8
// ("The Goby MOOS Library").
7
// This file is part of the Goby Underwater Autonomy Project Libraries
8
// ("The Goby Libraries").
10
// The Goby MOOS Library is free software: you can redistribute it and/or modify
11
// it under the terms of the GNU General Public License as published by
12
// the Free Software Foundation, either version 3 of the License, or
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
13
// (at your option) any later version.
15
// The Goby MOOS Library is distributed in the hope that it will be useful,
15
// The Goby Libraries are distributed in the hope that they will be useful,
16
16
// but WITHOUT ANY WARRANTY; without even the implied warranty of
17
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
// GNU General Public License for more details.
18
// GNU Lesser General Public License for more details.
20
// You should have received a copy of the GNU General Public License
20
// You should have received a copy of the GNU Lesser General Public License
21
21
// along with Goby. If not, see <http://www.gnu.org/licenses/>.
24
25
#ifndef DYNAMICMOOSVARSH
25
26
#define DYNAMICMOOSVARSH
27
#include "MOOSLIB/MOOSLib.h"
28
#include "goby/moos/moos_header.h"
34
const CMOOSMsg & get_moos_var(const std::string& s)
37
const CMOOSMsg & operator[](const std::string& s)
40
// read the whole list
41
void update_moos_vars(const MOOSMSG_LIST& NewMail)
37
const CMOOSMsg & get_moos_var(const std::string& s)
40
const CMOOSMsg & operator[](const std::string& s)
43
// read the whole list
44
void update_moos_vars(const MOOSMSG_LIST& NewMail)
43
46
for(MOOSMSG_LIST::const_iterator p = NewMail.begin(), n = NewMail.end(); p != n; ++p)
44
47
vars[p->GetKey()] = *p;
47
// update a single variable at a time
48
void update_moos_vars(const CMOOSMsg& msg)
50
// update a single variable at a time
51
void update_moos_vars(const CMOOSMsg& msg)
49
52
{ vars[msg.GetKey()] = msg; }
51
std::map<std::string, CMOOSMsg>& all() { return vars; }
54
std::map<std::string, CMOOSMsg> vars;
54
std::map<std::string, CMOOSMsg>& all() { return vars; }
57
std::map<std::string, CMOOSMsg> vars;
59
63
inline bool valid(const CMOOSMsg& m)