1#ifndef SHM_REFERENCE_IMPL_H
2#define SHM_REFERENCE_IMPL_H
11: m_name(
Shm::the().createArrayId()), m_p(
shm<T>::construct(m_name)(
Shm::the().
allocator()))
15 (*this)->resize(data.size());
16 std::copy(data.begin(), data.end(), (*this)->begin());
22: m_name(
Shm::the().createArrayId()), m_p(
shm<T>::construct(m_name)(
Shm::the().
allocator()))
26 (*this)->resize(data.size());
27 std::copy(data.begin(), data.end(), (*this)->begin());
32: m_name(
Shm::the().createArrayId()), m_p(
shm<T>::construct(m_name)(
Shm::the().
allocator()))
36 (*this)->resize(size);
37 std::copy(data, data + size, (*this)->begin());
41template<
class Archive>
44 ar &
V_NAME(ar,
"shm_name", m_name);
45 ar.template saveArray<typename T::value_type>(*
this);
49template<
class Archive>
53 ar &
V_NAME(ar,
"shm_name", shmname);
55 std::string arname = shmname.
str();
56 std::string name = ar.translateArrayName(arname);
58 if (name.empty() || m_name.str() != name) {
63 ObjectData *obj = ar.currentObject();
66 obj->unresolvedReference();
69 auto handler = ar.objectCompletionHandler();
70 ar.template fetchArray<typename T::value_type>(arname, [
this, obj, handler](
const std::string &name) ->
void {
74 std::cerr <<
"shm_array: NOT COMPLETE: array completion handler: " << name <<
", ref=" << ref << std::endl;
80 obj->referenceResolved(handler);
82 std::cerr <<
"shm_array RESOLVED: " << name <<
", but no handler" << std::endl;
124 return m_p->refcount();
#define V_NAME(ar, name, obj)
Definition: archives_config.h:441
void addArray(const std::string &name, const ShmData *array)
Definition: shm.cpp:510
static Shm & the()
Definition: shm.cpp:315
const ShmVector< T > getArrayFromName(const std::string &name) const
Definition: shm_impl.h:32
Definition: allocator.h:12
Definition: shm_reference.h:15
T * operator->()
Definition: shm_reference_impl.h:101
T & operator*()
Definition: shm_reference_impl.h:89
const shm_name_t & name() const
Definition: shm_reference_impl.h:129
shm_array_ref()
Definition: shm_reference.h:17
void ref()
Definition: shm_reference.h:123
int refcount() const
Definition: shm_reference_impl.h:121
Definition: allobjects.cpp:30
std::string str() const
Definition: shmname.cpp:18