MADNESS
0.10.1
|
A global pointer address, valid anywhere in the world. More...
#include <worldptr.h>
Public Types | |
typedef T * | pointer |
Alias for the pointer type. More... | |
typedef ptr_traits< T >::reference | reference |
typedef unsigned long | worldidT |
World ID type. More... | |
Public Member Functions | |
WorldPtr () | |
Default constructor. More... | |
WorldPtr (const WorldPtr< T > &other) | |
Copy constructor. More... | |
template<typename U > | |
WorldPtr (const WorldPtr< U > &other) | |
Copy conversion constructor. More... | |
WorldPtr (World &w, T *p) | |
World pointer constructor. More... | |
pointer | get () const |
Pointer accessor. More... | |
World & | get_world () const |
World accessor. More... | |
worldidT | get_worldid () const |
World ID accessor. More... | |
bool | has_owner () const |
Check that the world pointer has an owner. More... | |
bool | is_local () const |
Check that the world pointer references a local pointer. More... | |
template<class Archive > | |
void | load_internal_ (const Archive &ar) |
Deserialize the world pointer. More... | |
operator bool () const | |
Boolean conversion operator. More... | |
bool | operator! () const |
Boolean conversion (not) operator. More... | |
template<typename U > | |
bool | operator!= (const WorldPtr< U > &other) const |
Inequality comparison operator. More... | |
reference | operator* () const |
Dereference operator. More... | |
pointer | operator-> () const |
Pointer arrow operator. More... | |
template<typename U > | |
bool | operator< (const WorldPtr< U > &other) const |
Less-than comparison operator. More... | |
WorldPtr< T > & | operator= (const WorldPtr< T > &other) |
Copy assignment operator. More... | |
template<typename U > | |
WorldPtr< T > & | operator= (const WorldPtr< U > &other) |
Copy conversion assignment operator. More... | |
template<typename U > | |
bool | operator== (const WorldPtr< U > &other) const |
Equality comparison operator. More... | |
ProcessID | owner () const |
Rank accessor. More... | |
template<class Archive > | |
void | store_internal_ (const Archive &ar) const |
Serialize the world pointer. More... | |
template<typename U > | |
void | swap (WorldPtr< U > &other) |
Swap the content of this with other . More... | |
Private Member Functions | |
ProcessID | local_rank () const |
Current local rank. More... | |
Private Attributes | |
T * | pointer_ |
The pointer being referenced. More... | |
ProcessID | rank_ |
The rank of the node that the pointer belongs to. More... | |
World * | world_ |
A pointer to the world. More... | |
worldidT | worldid_ |
The world ID. More... | |
Friends | |
template<typename > | |
class | WorldPtr |
std::ostream & | operator<< (std::ostream &out, const WorldPtr< T > &p) |
Output stream insertion operator for world pointers. More... | |
A global pointer address, valid anywhere in the world.
Stores a globally addressable pointer. It can be sent to any process in the world.
T | The pointer type. |
typedef T* madness::detail::WorldPtr< T >::pointer |
Alias for the pointer type.
typedef ptr_traits<T>::reference madness::detail::WorldPtr< T >::reference |
typedef unsigned long madness::detail::WorldPtr< T >::worldidT |
World ID type.
|
inline |
Default constructor.
Creates a NULL
pointer. There is no owner; i.e. the owner is set to -1.
ProcessID
equal to -1 to signify an unowned pointer?
|
inline |
World pointer constructor.
Construct a world pointer form a local pointer.
[in] | w | A reference to the local world. |
[in] | p | The local pointer. |
|
inline |
Copy constructor.
[in] | other | The world pointer to be copied. |
|
inline |
Copy conversion constructor.
Copy and convert a pointer from U*
to T*
type.
U | The pointer type of the other pointer. |
[in] | other | The world pointer to be copied. |
U*
must be implicitly convertible to T*
type.
|
inline |
Pointer accessor.
Get the pointer from the world pointer.
MadnessException | When the pointer references a remote address. |
References madness::detail::WorldPtr< T >::is_local(), MADNESS_ASSERT, and madness::detail::WorldPtr< T >::pointer_.
|
inline |
World accessor.
NULL
). MadnessException | When the pointer world has not been set (i.e. when has_owner()==false ). |
References MADNESS_ASSERT, and madness::detail::WorldPtr< T >::world_.
|
inline |
World ID accessor.
References madness::detail::WorldPtr< T >::worldid_.
Referenced by madness::detail::WorldPtr< T >::load_internal_().
|
inline |
Check that the world pointer has an owner.
References madness::detail::WorldPtr< T >::rank_, and madness::detail::WorldPtr< T >::world_.
|
inline |
Check that the world pointer references a local pointer.
References madness::detail::WorldPtr< T >::local_rank(), and madness::detail::WorldPtr< T >::rank_.
Referenced by madness::detail::WorldPtr< T >::get(), madness::detail::WorldPtr< T >::operator*(), and madness::detail::WorldPtr< T >::operator->().
|
inline |
Deserialize the world pointer.
Deserialize the world pointer for remote communication or write to disk.
Archive | The archive object type. |
[in] | ar | The archive. |
References madness::detail::WorldPtr< T >::get_worldid(), madness::detail::WorldPtr< T >::pointer_, madness::detail::WorldPtr< T >::rank_, madness::detail::WorldPtr< T >::world_, madness::World::world_from_id(), madness::detail::WorldPtr< T >::worldid_, and madness::archive::wrap_opaque().
|
inlineprivate |
Current local rank.
References madness::World::rank(), and madness::detail::WorldPtr< T >::world_.
Referenced by madness::detail::WorldPtr< T >::is_local().
|
inline |
Boolean conversion operator.
References madness::detail::WorldPtr< T >::pointer_.
|
inline |
Boolean conversion (not) operator.
References madness::detail::WorldPtr< T >::pointer_.
|
inline |
Inequality comparison operator.
U | Another pointer type. |
[in] | other | The other pointer to compare with. |
References madness::detail::WorldPtr< T >::pointer_, madness::detail::WorldPtr< T >::rank_, and madness::detail::WorldPtr< T >::worldid_.
|
inline |
Dereference operator.
Dereference the local pointer.
MadnessException | If the pointer references a remote address, or if the pointer is NULL . |
References madness::detail::WorldPtr< T >::is_local(), MADNESS_ASSERT, and madness::detail::WorldPtr< T >::pointer_.
|
inline |
Pointer arrow operator.
Access members of the pointer.
MadnessException | If the pointer references a remote address, or if the pointer is NULL . |
References madness::detail::WorldPtr< T >::is_local(), MADNESS_ASSERT, and madness::detail::WorldPtr< T >::pointer_.
|
inline |
Less-than comparison operator.
This operator does a lexicographical comparison of world ID, rank, and pointer (in that order).
U | Another pointer type. |
[in] | other | The other pointer to compare with. |
References madness::detail::WorldPtr< T >::pointer_, madness::detail::WorldPtr< T >::rank_, and madness::detail::WorldPtr< T >::worldid_.
|
inline |
Copy assignment operator.
[in] | other | The world pointer to be copied. |
References madness::detail::WorldPtr< T >::pointer_, madness::detail::WorldPtr< T >::rank_, madness::detail::WorldPtr< T >::world_, and madness::detail::WorldPtr< T >::worldid_.
|
inline |
Copy conversion assignment operator.
Copy and convert a pointer from U*
to T*
type.
U | The pointer type of the other pointer. |
[in] | other | The world pointer to be copied. |
U*
must be implicitly convertible to T*
type. References madness::detail::WorldPtr< T >::pointer_, madness::detail::WorldPtr< T >::rank_, madness::detail::WorldPtr< T >::world_, and madness::detail::WorldPtr< T >::worldid_.
|
inline |
Equality comparison operator.
U | Another pointer type. |
[in] | other | The pointer to compare with. |
References madness::detail::WorldPtr< T >::pointer_, madness::detail::WorldPtr< T >::rank_, and madness::detail::WorldPtr< T >::worldid_.
|
inline |
Rank accessor.
References madness::detail::WorldPtr< T >::rank_.
|
inline |
Serialize the world pointer.
Serialize the world pointer for remote communication or write to disk.
Archive | The archive object type. |
[in] | ar | The archive. |
References madness::detail::WorldPtr< T >::pointer_, madness::detail::WorldPtr< T >::rank_, madness::detail::WorldPtr< T >::worldid_, and madness::archive::wrap_opaque().
|
inline |
Swap the content of this
with other
.
U | The other world pointer type. |
[in,out] | other | The other world pointer. |
U*
must be implicitly convertible to T*
type. References madness::detail::WorldPtr< T >::pointer_, madness::detail::WorldPtr< T >::rank_, madness::detail::swap(), madness::detail::WorldPtr< T >::world_, and madness::detail::WorldPtr< T >::worldid_.
Referenced by madness::detail::swap().
|
friend |
Output stream insertion operator for world pointers.
[in,out] | out | The output stream. |
[in] | p | The world pointer. |
friend
function need to be implemented in the class or can we move it to a *
.cc file?
|
private |
The pointer being referenced.
Referenced by madness::detail::WorldPtr< T >::get(), madness::detail::WorldPtr< T >::load_internal_(), madness::detail::WorldPtr< T >::operator bool(), madness::detail::WorldPtr< T >::operator!(), madness::detail::WorldPtr< T >::operator!=(), madness::detail::WorldPtr< T >::operator*(), madness::detail::WorldPtr< T >::operator->(), madness::detail::WorldPtr< T >::operator<(), madness::detail::WorldPtr< T >::operator=(), madness::detail::WorldPtr< T >::operator==(), madness::detail::WorldPtr< T >::store_internal_(), and madness::detail::WorldPtr< T >::swap().
|
private |
The rank of the node that the pointer belongs to.
Referenced by madness::detail::WorldPtr< T >::has_owner(), madness::detail::WorldPtr< T >::is_local(), madness::detail::WorldPtr< T >::load_internal_(), madness::detail::WorldPtr< T >::operator!=(), madness::detail::WorldPtr< T >::operator<(), madness::detail::WorldPtr< T >::operator=(), madness::detail::WorldPtr< T >::operator==(), madness::detail::WorldPtr< T >::owner(), madness::detail::WorldPtr< T >::store_internal_(), and madness::detail::WorldPtr< T >::swap().
|
private |
A pointer to the world.
Referenced by madness::detail::WorldPtr< T >::get_world(), madness::detail::WorldPtr< T >::has_owner(), madness::detail::WorldPtr< T >::load_internal_(), madness::detail::WorldPtr< T >::local_rank(), madness::detail::WorldPtr< T >::operator=(), and madness::detail::WorldPtr< T >::swap().
|
private |
The world ID.
Referenced by madness::detail::WorldPtr< T >::get_worldid(), madness::detail::WorldPtr< T >::load_internal_(), madness::detail::WorldPtr< T >::operator!=(), madness::detail::WorldPtr< T >::operator<(), madness::detail::WorldPtr< T >::operator=(), madness::detail::WorldPtr< T >::operator==(), madness::detail::WorldPtr< T >::store_internal_(), and madness::detail::WorldPtr< T >::swap().