ecto
plasm.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011, Willow Garage, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of the Willow Garage, Inc. nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  */
29 #pragma once
30 
31 #include <Python.h>
32 #include <boost/shared_ptr.hpp>
33 #include <boost/enable_shared_from_this.hpp>
34 #include <boost/noncopyable.hpp>
35 #include <boost/serialization/split_member.hpp>
36 #include <boost/thread.hpp>
37 
38 #include <string>
39 #include <map>
40 #include <list>
41 
42 #include <ecto/forward.hpp>
43 #include <ecto/tendril.hpp>
44 
45 namespace ecto
46 {
47 
54  struct ECTO_EXPORT plasm :
55  boost::noncopyable, public boost::enable_shared_from_this<plasm>
56  {
57  public:
58  plasm();
59  ~plasm();
60 
66  void
67  insert(cell_ptr mod);
68 
77  void
78  connect(cell_ptr from, const std::string& output, cell_ptr to, const std::string& input);
79 
88  void
89  disconnect(cell_ptr from, const std::string& output, cell_ptr to, const std::string& input);
94  void
95  viz(std::ostream& out) const;
100  std::string
101  viz() const;
102 
108  void
109  check() const;
110 
116  graph();
117 
118  const graph::graph_t&
119  graph() const;
120 
121 
126  std::size_t size() const;
127 
132  std::vector<cell_ptr> cells() const;
133 
137  void configure_all();
138 
140  void activate_all();
142  void deactivate_all();
143 
144  void reset_ticks();
145 
146  void save(std::ostream&) const;
147  void load(std::istream&);
148 
149  typedef boost::shared_ptr<plasm> ptr;
150  typedef boost::shared_ptr<plasm const> cptr;
151 
152  private:
153  struct impl;
154  boost::shared_ptr<impl> impl_;
156 
157  template<class Archive>
158  void
159  save(Archive & ar, const unsigned int) const;
160 
161  template<class Archive>
162  void
163  load(Archive & ar, const unsigned int);
164  friend class boost::serialization::access;
165  BOOST_SERIALIZATION_SPLIT_MEMBER();
166 
167  };
168 }
void save(Archive &ar, const boost::shared_ptr< ecto::cell > &cell_, const unsigned int file_version)
Definition: cell.hpp:41
The plasm helps construct the graph structure in ecto. It enforces several invariants that are necess...
Definition: plasm.hpp:54
boost::shared_ptr< plasm > ptr
Definition: plasm.hpp:149
void load(Archive &ar, boost::shared_ptr< ecto::cell > &cell_, const unsigned int file_version)
Definition: cell.hpp:52
#define ECTO_EXPORT
Definition: util.hpp:49
boost::shared_ptr< cell > cell_ptr
Definition: forward.hpp:42
Definition: parameters.hpp:11
bool configured
Definition: plasm.hpp:155
boost::shared_ptr< impl > impl_
Definition: plasm.hpp:153
boost::shared_ptr< plasm const > cptr
Definition: plasm.hpp:150
Definition: types.hpp:46