MADNESS
0.10.1
|
Simple structure used to manage references/pointers to remote instances. More...
#include <worldref.h>
Public Types | |
typedef T * | pointerT |
typedef detail::ptr_traits< T >::reference | referenceT |
Public Member Functions | |
RemoteReference () | |
Makes a non-shared (no reference count) null pointer. More... | |
RemoteReference (const RemoteReference< T > &other) | |
Copy constructor. More... | |
template<typename U > | |
RemoteReference (const RemoteReference< U > &other) | |
Copy conversion constructor. More... | |
RemoteReference (World &w, const std::shared_ptr< T > &p) | |
Construct a remote reference to p. More... | |
~RemoteReference () | |
pointerT | get () const |
Reference pointer accessor. More... | |
const std::shared_ptr< T > & | get_shared () const |
Reference shared_ptr accessor. More... | |
World & | get_world () const |
Owning world accessor. More... | |
bool | is_local () const |
Locally owned reference. More... | |
operator bool () const | |
Boolean conversion operator. More... | |
referenceT | operator* () const |
Reference object accessor. More... | |
pointerT | operator-> () const |
Reference object pointer accessor. More... | |
RemoteReference< T > & | operator= (const RemoteReference< T > &other) |
Copy conversion assignment operator. More... | |
template<typename U > | |
RemoteReference< T > & | operator= (const RemoteReference< U > &other) |
Copy conversion assignment operator. More... | |
ProcessID | owner () const |
Reference owner accessor. More... | |
void | reset () |
Release this reference. More... | |
template<typename Archive > | |
void | serialize (const Archive &ar) const |
Serialize the remote reference. More... | |
template<typename U > | |
void | swap (RemoteReference< U > &other) |
Swap references. More... | |
bool | unique () const |
Get uniqueness. More... | |
long | use_count () const |
Reference count accessor. More... | |
Static Private Member Functions | |
static void | reset_handler (const AmArg &arg) |
Private Attributes | |
detail::RemoteCounter | counter_ |
Remote reference counter. More... | |
pointerT | pointer_ |
World pointer. More... | |
Friends | |
template<typename > | |
class | RemoteReference |
std::ostream & | operator<< (std::ostream &out, const RemoteReference< T > &ref) |
Add the remote reference to the given std::ostream , out . More... | |
Simple structure used to manage references/pointers to remote instances.
This class was intended only for internal use and is still rather poorly thought through, however, it seems to fill a wider need.
typedef T* madness::RemoteReference< T >::pointerT |
typedef detail::ptr_traits<T>::reference madness::RemoteReference< T >::referenceT |
|
inline |
Makes a non-shared (no reference count) null pointer.
|
inline |
Construct a remote reference to p.
w | The world that p belongs to. |
p | The shared_ptr that is to be referenced. |
p
must be locally addressable pointer
|
inline |
Copy constructor.
other | The reference to be copied |
|
inline |
Copy conversion constructor.
U | The remote reference type to be copied |
other | The reference to be copied |
U*
must be implicitly convertible to T*
|
inline |
|
inline |
Reference pointer accessor.
MadnessException | If the pointer is not local |
References madness::RemoteReference< T >::counter_, madness::detail::RemoteCounter::is_local(), MADNESS_ASSERT, and madness::RemoteReference< T >::pointer_.
Referenced by madness::FutureImpl< T >::set_handler().
|
inline |
Reference shared_ptr accessor.
MadnessException | If the pointer is not local |
References madness::RemoteReference< T >::counter_, madness::detail::RemoteCounter::get_shared(), madness::detail::RemoteCounter::is_local(), MADNESS_ASSERT, and T().
|
inline |
Owning world accessor.
MadnessException | If the reference is uninitialized |
References madness::RemoteReference< T >::counter_, and madness::detail::RemoteCounter::get_world().
Referenced by madness::RemoteReference< T >::reset().
|
inline |
Locally owned reference.
nothing |
References madness::RemoteReference< T >::counter_, and madness::detail::RemoteCounter::is_local().
|
inline |
Boolean conversion operator.
References madness::RemoteReference< T >::counter_, and madness::detail::RemoteCounter::empty().
|
inline |
Reference object accessor.
MadnessException | If the pointer is uninitialized |
MadnessException | If the pointer is not local |
References madness::RemoteReference< T >::counter_, madness::detail::RemoteCounter::is_local(), MADNESS_ASSERT, and madness::RemoteReference< T >::pointer_.
|
inline |
Reference object pointer accessor.
MadnessException | If the pointer is uninitialized |
MadnessException | If the pointer is not local |
References madness::RemoteReference< T >::counter_, madness::detail::RemoteCounter::is_local(), MADNESS_ASSERT, and madness::RemoteReference< T >::pointer_.
|
inline |
Copy conversion assignment operator.
other | The reference to be copied |
References madness::RemoteReference< T >::swap().
|
inline |
Copy conversion assignment operator.
U | The remote reference type to be copied |
other | The reference to be copied |
U*
must be implicitly convertible to T*
References madness::RemoteReference< T >::swap().
|
inline |
Reference owner accessor.
nothing |
References madness::RemoteReference< T >::counter_, and madness::detail::RemoteCounter::owner().
Referenced by madness::RemoteReference< T >::reset().
|
inline |
Release this reference.
This function will clear the reference and leave it in the default constructed state. If the reference is non-local, then a message is sent to the reference owner that releases the reference.
References madness::World::am, madness::RemoteReference< T >::counter_, madness::RemoteReference< T >::get_world(), madness::detail::RemoteCounter::has_owner(), madness::detail::RemoteCounter::is_local(), madness::new_am_arg(), madness::RemoteReference< T >::owner(), madness::WorldAmInterface::send(), and madness::RemoteReference< T >::swap().
Referenced by madness::FutureImpl< T >::set_handler().
|
inlinestaticprivate |
References madness::arg().
|
inline |
Serialize the remote reference.
Archive | The serialization archive type |
ar | The serialization archive object. |
References madness::RemoteReference< T >::counter_, madness::RemoteReference< T >::pointer_, and madness::archive::wrap_opaque().
|
inline |
Swap references.
Exchange the value of this RemoteReference
with other
RemoteReference
U | The type of the other remote reference. |
References madness::RemoteReference< T >::counter_, madness::RemoteReference< T >::pointer_, madness::swap(), and madness::detail::swap().
Referenced by madness::RemoteReference< T >::operator=(), madness::RemoteReference< T >::reset(), and madness::swap().
|
inline |
Get uniqueness.
nothing |
References madness::RemoteReference< T >::counter_, and madness::detail::RemoteCounter::unique().
|
inline |
Reference count accessor.
nothing |
References madness::RemoteReference< T >::counter_, and madness::detail::RemoteCounter::use_count().
|
friend |
Add the remote reference to the given std::ostream
, out
.
out | The output stream to add ref to. |
ref | The remote reference to add to the out stream |
|
private |
Remote reference counter.
Referenced by madness::RemoteReference< T >::get(), madness::RemoteReference< T >::get_shared(), madness::RemoteReference< T >::get_world(), madness::RemoteReference< T >::is_local(), madness::RemoteReference< T >::operator bool(), madness::RemoteReference< T >::operator*(), madness::RemoteReference< T >::operator->(), madness::RemoteReference< T >::owner(), madness::RemoteReference< T >::reset(), madness::RemoteReference< T >::serialize(), madness::RemoteReference< T >::swap(), madness::RemoteReference< T >::unique(), and madness::RemoteReference< T >::use_count().
|
mutableprivate |