52 #ifndef LIB_ELEMENT_TRACKER_H 53 #define LIB_ELEMENT_TRACKER_H 80 template<
typename ELM>
84 using _Vec = std::vector<P<ELM>>;
85 using Iter =
typename _Vec::iterator;
86 using CIter =
typename _Vec::const_iterator;
99 toKill.reserve(_Vec::size());
101 ASSERT (0 == _Vec::size());
102 util::for_each (toKill, unlink_it);
108 REQUIRE (asset,
"Attempt to track a NIL element");
110 this->push_back (asset);
114 remove (ELM
const& asset)
116 for (Iter i = _Vec::begin();
117 i != _Vec::end() ; ++i )
126 isRegistered (ELM
const& asset)
const 128 for (CIter i = _Vec::begin();
129 i != _Vec::end() ; ++i )
141 try { elm->detach(); }
144 WARN (common,
"problems while clearing ElementTracker, ignored.");
162 template<
typename TAR>
176 if (!getRegistry)
return;
177 TAR& element =
static_cast<TAR&
> (*this);
179 getRegistry().remove(element);
180 ENSURE (!getRegistry().isRegistered(element));
193 REQUIRE (getRegistry);
195 PTarget newElement (
new TAR());
196 getRegistry().append (newElement);
199 ENSURE (getRegistry().isRegistered(*newElement));
205 setRegistryInstance (Registry& registry_to_use)
207 getRegistry.link_to (registry_to_use);
211 deactivateRegistryLink()
217 is_attached_to (Registry
const& someRegistry)
219 return getRegistry.points_to (someRegistry);
228 template<
typename TAR>
Optional or switchable link to an existing object.
a checked, switchable reference.
Customised refcounting smart pointer.
Registry for tracking object instances.
Implementation namespace for support and library code.
Helper mixin template for implementing a type intended to participate in automatic element tracking...
static PTarget create()
factory for creating smart-ptr managed TAR instances, automatically registered with the element-track...
void detach()
detach this element from the element-tracking registry.
Some (library-) implementations of the RefArray interface.
The asset subsystem of the Steam-Layer.
Perform operations "for each element" of a collection.
static RegistryLink getRegistry
storage for the functor to link an AutoRegistered entity to the corresponding registration service ...
This variation of the wrapper actually is a vector, but can act as a RefArray.