30 #include <boost/thread.hpp> 33 #include <boost/thread.hpp> 34 #define BOOST_SIGNALS2_MAX_ARGS 3 35 #include <boost/signals2.hpp> 69 iterator
begin() {
return storage.begin(); }
70 const_iterator
begin()
const {
return storage.begin(); }
71 iterator
end() {
return storage.end(); }
72 const_iterator
end()
const {
return storage.end(); }
74 iterator
find(
const std::string& name) {
return storage.find(name); }
75 const_iterator
find(
const std::string& name)
const {
return storage.find(name); }
77 void clear() { storage.clear(); }
79 size_type
size()
const {
return storage.size(); }
80 size_type
count(
const std::string& name)
const {
return storage.count(name); }
82 void erase(iterator pos) { storage.erase(pos); }
83 void erase(
const key_type& k) { storage.erase(k); }
85 template <
typename InputIterator>
87 insert(InputIterator first, InputIterator last)
89 storage.insert(first, last);
92 std::pair<iterator, bool>
insert(
const value_type &v)
94 return storage.insert(v);
97 key_compare
key_comp()
const {
return storage.key_comp(); }
111 return declare(name, t);
122 declare(
const std::string& name,
const std::string& doc)
124 return declare<T>(name).set_doc(doc);
136 declare(
const std::string& name,
const std::string& doc,
const T& default_val)
138 return declare<T>(name, doc).set_default_val(default_val);
157 template<
typename T,
typename CellImpl>
159 declare(
spore<T> CellImpl::* ptm,
const std::string& name,
const std::string& doc =
"",
162 sig_t::extended_slot_type slot(
spore_assign(ptm,name),_1,_2,_3);
163 static_bindings_.connect_extended(slot);
164 return declare<T>(name,doc,default_val);
167 template <
typename Impl>
170 static_bindings_(cookie,
this);
190 get(
const std::string& name)
const 192 const_iterator iter = storage.find(name);
197 return iter->second->get<T>();
198 }
catch (except::TypeMismatch& e)
200 e << except::actualtype_hint(iter->first)
201 << except::tendril_key(name)
213 const tendril_ptr& operator[](
const std::string& name)
const;
223 print_doc(std::ostream& out,
const std::string& tendrils_name)
const;
225 template <
class Archive>
226 void serialize(Archive& ar,
const unsigned int);
230 void doesnt_exist(
const std::string& name)
const;
234 typedef boost::signals2::signal<void(void*, const tendrils*)>
sig_t;
242 template<
typename CellImpl,
typename T>
259 CellImpl* thiz =
static_cast<CellImpl*
>(vthiz);
260 (*thiz).*member_ = (*tdls)[key_];
275 template<
typename CellImpl,
typename T>
The spore is a typed handle for tendrils, making holding onto tendrils a bit easier.
Definition: spore.hpp:45
spore_assign_impl(PtrToMember member, const std::string &key)
Definition: tendrils.hpp:248
spore< T > declare(spore< T > CellImpl::*ptm, const std::string &name, const std::string &doc="", const typename spore< T >::value_type &default_val=typename spore< T >::value_type())
Definition: tendrils.hpp:159
Definition: tendrils.hpp:46
std::map< std::string, tendril_ptr > storage_type
Definition: tendrils.hpp:57
storage_type::key_type key_type
Definition: tendrils.hpp:62
iterator find(const std::string &name)
Definition: tendrils.hpp:74
void realize_potential(Impl *cookie)
Definition: tendrils.hpp:168
#define ECTO_EXPORT
Definition: util.hpp:49
spore< T > declare(const std::string &name, const std::string &doc, const T &default_val)
Definition: tendrils.hpp:136
Definition: parameters.hpp:11
iterator end()
Definition: tendrils.hpp:71
storage_type::iterator iterator
Definition: tendrils.hpp:59
std::pair< iterator, bool > insert(const value_type &v)
Definition: tendrils.hpp:92
void erase(const key_type &k)
Definition: tendrils.hpp:83
spore< T > CellImpl::* PtrToMember
Definition: tendrils.hpp:245
boost::signals2::signal< void(void *, const tendrils *)> sig_t
Definition: tendrils.hpp:234
size_type count(const std::string &name) const
Definition: tendrils.hpp:80
T value_type
Definition: spore.hpp:48
tendril_type
Definition: tendrils.hpp:44
PtrToMember member_
Definition: tendrils.hpp:263
sig_t static_bindings_
Definition: tendrils.hpp:235
storage_type storage
Definition: tendrils.hpp:233
storage_type::const_iterator const_iterator
Definition: tendrils.hpp:60
boost::shared_ptr< tendril > tendril_ptr
Definition: forward.hpp:34
iterator begin()
Definition: tendrils.hpp:69
void insert(InputIterator first, InputIterator last)
Definition: tendrils.hpp:87
key_compare key_comp() const
Definition: tendrils.hpp:97
const_iterator begin() const
Definition: tendrils.hpp:70
void erase(iterator pos)
Definition: tendrils.hpp:82
void operator()(const boost::signals2::connection &conn, void *vthiz, const tendrils *tdls) const
Definition: tendrils.hpp:256
Definition: tendrils.hpp:46
Definition: tendrils.hpp:46
size_type size() const
Definition: tendrils.hpp:79
spore< T > declare(const std::string &name, const std::string &doc)
Definition: tendrils.hpp:122
std::string key_
Definition: tendrils.hpp:264
spore< T > declare(const std::string &name)
Declare a tendril of a certain type, with only a name, no doc, or default values. ...
Definition: tendrils.hpp:108
storage_type::difference_type difference_type
Definition: tendrils.hpp:64
const_iterator find(const std::string &name) const
Definition: tendrils.hpp:75
storage_type::key_compare key_compare
Definition: tendrils.hpp:65
static spore_assign_impl< CellImpl, T > spore_assign(spore< T > CellImpl::*ptm, const std::string &name)
Definition: tendrils.hpp:277
storage_type::value_type value_type
Definition: tendrils.hpp:61
const_iterator end() const
Definition: tendrils.hpp:72
void clear()
Definition: tendrils.hpp:77
The tendrils are a collection for the ecto::tendril class, addressable by a string key...
Definition: tendrils.hpp:53
storage_type::size_type size_type
Definition: tendrils.hpp:63
void result_type
Definition: tendrils.hpp:246
Definition: tendrils.hpp:243