Minsky
ravelState-schema2.h
Go to the documentation of this file.
1 /*
2  @copyright Steve Keen 2018
3  @author Russell Standish
4  This file is part of Minsky.
5 
6  Minsky is free software: you can redistribute it and/or modify it
7  under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  Minsky is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with Minsky. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef RAVELSTATE_SCHEMA2_H
21 #define RAVELSTATE_SCHEMA2_H
22 #include <map>
23 #include <string>
24 #include <vector>
25 #include "ravelState.h"
26 
27 namespace schema2
28 {
29  struct RavelState
30  {
31  // ravel::RavelState imported here
32  double radius=ravel::ravelDefaultRadius;
33  std::vector<std::string> outputHandles;
34 
35  // schema3 ravel state differs by how handle states are stored
36  std::map<std::string, ravel::HandleState> handleStates;
38  ravel::RavelState toRavelRavelState() const {
39  ravel::RavelState r;
40  r.radius=radius;
41  r.outputHandles=outputHandles;
42  for (auto& i: handleStates)
43  {
44  r.handleStates.push_back(i.second);
45  r.handleStates.back().description=i.first;
46  }
47  return r;
48  }
49  RavelState(const ravel::RavelState& x) {
50  radius=x.radius;
51  outputHandles=x.outputHandles;
52  for (auto& i: x.handleStates)
53  handleStates[i.description]=i;
54  }
55  };
56 
57 }
58 #include "ravelState.xcd"
59 #include "ravelState-schema2.cd"
60 #include "ravelState-schema2.xcd"
61 #endif
RavelState(const ravel::RavelState &x)
ravel::RavelState toRavelRavelState() const
std::vector< std::string > outputHandles
std::map< std::string, ravel::HandleState > handleStates