52#ifndef LIB_ELEMENT_TRACKER_H
53#define LIB_ELEMENT_TRACKER_H
80 template<
typename ELM>
82 :
public std::vector<P<ELM>>
84 using _Vec = std::vector<P<ELM>>;
85 using Iter = _Vec::iterator;
86 using CIter = _Vec::const_iterator;
99 toKill.reserve(_Vec::size());
101 ASSERT (0 == _Vec::size());
108 REQUIRE (
asset,
"Attempt to track a NIL element");
110 this->push_back (
asset);
116 for (
Iter i = _Vec::begin();
117 i != _Vec::end() ; ++i )
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>
177 TAR& element =
static_cast<TAR&
> (*this);
195 PTarget newElement (
new TAR());
228 template<
typename TAR>
Helper mixin template for implementing a type intended to participate in automatic element tracking.
static RegistryLink getRegistry
storage for the functor to link an AutoRegistered entity to the corresponding registration service
static void deactivateRegistryLink()
lib::ElementTracker< TAR > Registry
static PTarget create()
factory for creating smart-ptr managed TAR instances, automatically registered with the element-track...
lib::OptionalRef< Registry > RegistryLink
void detach()
detach this element from the element-tracking registry.
static void setRegistryInstance(Registry ®istry_to_use)
static bool is_attached_to(Registry const &someRegistry)
Registry for tracking object instances.
static void unlink_it(P< ELM > &elm)
bool isRegistered(ELM const &asset) const
_Vec::const_iterator CIter
void append(P< ELM > const &asset)
std::vector< P< ELM > > _Vec
void remove(ELM const &asset)
Optional or switchable link to an existing object.
bool points_to(T const &target) const
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
Implementation namespace for support and library code.
The asset subsystem of the Steam-Layer.
disable_if< can_IterForEach< Container >, FUN > for_each(Container const &coll, FUN doIt)
operate on all elements of a STL container.
a checked, switchable reference.
Customised refcounting smart pointer.
Perform operations "for each element" of a collection.