DASH  0.3.0
dash::UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LMemSpace > Class Template Reference

Classes

struct  local_index
 

Public Types

typedef map_t::value_type value_type
 
typedef dash::default_index_t index_type
 
typedef dash::default_size_t size_type
 
typedef value_type * pointer
 
typedef const value_type * const_pointer
 
typedef value_type & reference
 
typedef const value_type & const_reference
 

Public Member Functions

 UnorderedMapLocalIter ()
 Default constructor. More...
 
 UnorderedMapLocalIter (map_t *map, index_type local_position)
 Constructor, creates iterator at specified global position. More...
 
 UnorderedMapLocalIter (const self_t &other)=default
 Copy constructor. More...
 
self_toperator= (const self_t &other)=default
 Assignment operator. More...
 
 UnorderedMapLocalIter (std::nullptr_t)
 Null-pointer constructor. More...
 
self_toperator= (std::nullptr_t) noexcept
 Null-pointer assignment operator. More...
 
bool operator== (std::nullptr_t) const noexcept
 
bool operator!= (std::nullptr_t) const noexcept
 
reference operator[] (index_type offset)
 Random access operator. More...
 
 operator pointer () const
 Type conversion operator to native pointer. More...
 
reference operator* () const
 Dereference operator. More...
 
dart_gptr_t dart_gptr () const
 Explicit conversion to dart_gptr_t. More...
 
constexpr bool is_local () const noexcept
 Checks whether the element referenced by this global iterator is in the calling unit's local memory. More...
 
local_index lpos () const noexcept
 Unit and local offset at the iterator's position. More...
 
index_type pos () const noexcept
 Position of the iterator in global index space. More...
 
self_toperator++ ()
 Prefix increment operator. More...
 
self_toperator-- ()
 Prefix decrement operator. More...
 
self_t operator++ (int)
 Postfix increment operator. More...
 
self_t operator-- (int)
 Postfix decrement operator. More...
 
template<typename K_ , typename M_ , typename H_ , typename P_ , typename A_ >
bool operator== (const UnorderedMapLocalIter< K_, M_, H_, P_, A_ > &other) const
 
template<typename K_ , typename M_ , typename H_ , typename P_ , typename A_ >
bool operator!= (const UnorderedMapLocalIter< K_, M_, H_, P_, A_ > &other) const
 
self_toperator+= (index_type offset)
 
self_toperator-= (index_type offset)
 
self_t operator+ (index_type offset) const
 
self_t operator- (index_type offset) const
 
index_type operator+ (const self_t &other) const
 
index_type operator- (const self_t &other) const
 
template<typename K_ , typename M_ , typename H_ , typename P_ , typename A_ >
bool operator< (const UnorderedMapLocalIter< K_, M_, H_, P_, A_ > &other) const
 
template<typename K_ , typename M_ , typename H_ , typename P_ , typename A_ >
bool operator<= (const UnorderedMapLocalIter< K_, M_, H_, P_, A_ > &other) const
 
template<typename K_ , typename M_ , typename H_ , typename P_ , typename A_ >
bool operator> (const UnorderedMapLocalIter< K_, M_, H_, P_, A_ > &other) const
 
template<typename K_ , typename M_ , typename H_ , typename P_ , typename A_ >
bool operator>= (const UnorderedMapLocalIter< K_, M_, H_, P_, A_ > &other) const
 

Friends

template<typename K_ , typename M_ , typename H_ , typename P_ , typename LM_ >
std::ostream & dash::operator<< (std::ostream &os, const dash::UnorderedMapLocalIter< K_, M_, H_, P_, LM_ > &it)
 

Detailed Description

template<typename Key, typename Mapped, typename Hash, typename Pred, typename LMemSpace>
class dash::UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LMemSpace >

Definition at line 40 of file UnorderedMapLocalIter.h.

Constructor & Destructor Documentation

◆ UnorderedMapLocalIter() [1/4]

template<typename Key, typename Mapped, typename Hash, typename Pred, typename LMemSpace>
dash::UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LMemSpace >::UnorderedMapLocalIter ( )
inline

Default constructor.

Definition at line 84 of file UnorderedMapLocalIter.h.

Referenced by dash::UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LMemSpace >::UnorderedMapLocalIter().

85  : UnorderedMapLocalIter(nullptr)
86  { }
UnorderedMapLocalIter()
Default constructor.

◆ UnorderedMapLocalIter() [2/4]

template<typename Key, typename Mapped, typename Hash, typename Pred, typename LMemSpace>
dash::UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LMemSpace >::UnorderedMapLocalIter ( map_t map,
index_type  local_position 
)
inline

Constructor, creates iterator at specified global position.

Definition at line 91 of file UnorderedMapLocalIter.h.

References dash::UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LMemSpace >::operator=(), and dash::UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LMemSpace >::UnorderedMapLocalIter().

94  : _map(map),
95  _idx(local_position),
97  {
98  DASH_LOG_TRACE("UnorderedMapLocalIter(map,lpos)()");
99  DASH_LOG_TRACE_VAR("UnorderedMapLocalIter(map,lpos)", _idx);
100  DASH_LOG_TRACE("UnorderedMapLocalIter(map,lpos) >");
101  }
static global_unit_t GlobalUnitID()
The invariant unit ID in dash::Team::All().
Definition: Team.h:221

◆ UnorderedMapLocalIter() [3/4]

template<typename Key, typename Mapped, typename Hash, typename Pred, typename LMemSpace>
dash::UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LMemSpace >::UnorderedMapLocalIter ( const self_t other)
default

Copy constructor.

◆ UnorderedMapLocalIter() [4/4]

template<typename Key, typename Mapped, typename Hash, typename Pred, typename LMemSpace>
dash::UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LMemSpace >::UnorderedMapLocalIter ( std::nullptr_t  )
inline

Null-pointer constructor.

Definition at line 118 of file UnorderedMapLocalIter.h.

119  : _map(nullptr)
120  , _myid(DART_UNDEFINED_UNIT_ID)
121  , _is_nullptr(true)
122  {
123  DASH_LOG_TRACE("UnorderedMapLocalIter(nullptr)");
124  }
#define DART_UNDEFINED_UNIT_ID
Undefined unit ID.
Definition: dart_types.h:160

Member Function Documentation

◆ dart_gptr()

template<typename Key, typename Mapped, typename Hash, typename Pred, typename LMemSpace>
dart_gptr_t dash::UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LMemSpace >::dart_gptr ( ) const
inline

Explicit conversion to dart_gptr_t.

Returns
A DART global pointer to the element at the iterator's position

Definition at line 195 of file UnorderedMapLocalIter.h.

References dash::GlobHeapMem< ElementType, LocalMemorySpace, AllocationPolicy, LocalAlloc >::at(), dash::GlobHeapPtr< ElementType, MemSpaceT >::dart_gptr(), DART_GPTR_NULL, and dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::globmem().

196  {
197  DASH_LOG_TRACE_VAR("UnorderedMapLocalIter.dart_gptr()", _idx);
199  if (!_is_nullptr) {
200  dart_gptr = _map->globmem().at(_myid, _idx).dart_gptr();
201  }
202  DASH_LOG_TRACE_VAR("UnorderedMapLocalIter.dart_gptr >", dart_gptr);
203  return dart_gptr;
204  }
const glob_mem_type & globmem() const
Reference to instance of DashGlobalMemoryConcept used for underlying memory management of this contai...
dart_gptr_t dart_gptr() const
Explicit conversion to dart_gptr_t.
Definition: GlobHeapPtr.h:236
#define DART_GPTR_NULL
A NULL global pointer.
Definition: dart_globmem.h:105
pointer at(team_unit_t unit, IndexT local_index)
Resolve the global iterator referencing an element position in a unit&#39;s local memory.
Definition: GlobHeapMem.h:913
DART Global pointer type.
Definition: dart_globmem.h:77
dart_gptr_t dart_gptr() const
Explicit conversion to dart_gptr_t.

◆ is_local()

template<typename Key, typename Mapped, typename Hash, typename Pred, typename LMemSpace>
constexpr bool dash::UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LMemSpace >::is_local ( ) const
inlinenoexcept

Checks whether the element referenced by this global iterator is in the calling unit's local memory.

Definition at line 210 of file UnorderedMapLocalIter.h.

211  {
212  return true;
213  }

◆ lpos()

template<typename Key, typename Mapped, typename Hash, typename Pred, typename LMemSpace>
local_index dash::UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LMemSpace >::lpos ( ) const
inlinenoexcept

Unit and local offset at the iterator's position.

Definition at line 218 of file UnorderedMapLocalIter.h.

219  {
220  local_index local_pos;
221  local_pos.unit = _myid;
222  local_pos.index = _idx;
223  return local_pos;
224  }

◆ operator pointer()

template<typename Key, typename Mapped, typename Hash, typename Pred, typename LMemSpace>
dash::UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LMemSpace >::operator pointer ( ) const
inlineexplicit

Type conversion operator to native pointer.

Returns
A global reference to the element at the iterator's position

Definition at line 160 of file UnorderedMapLocalIter.h.

References dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::globmem(), and dash::GlobHeapMem< ElementType, LocalMemorySpace, AllocationPolicy, LocalAlloc >::lbegin().

161  {
162  typedef typename map_t::local_node_iterator local_iter_t;
163  if (_is_nullptr) {
164  return nullptr;
165  }
166  // TODO: Must be extended for correctness: _idx refers to local iteration
167  // space, not local memory space. Undefined behaviour if local
168  // memory space has gaps, e.g. after erasing elements.
169  local_iter_t l_it = _map->globmem().lbegin();
170  return pointer(l_it + static_cast<index_type>(_idx));
171  }
const glob_mem_type & globmem() const
Reference to instance of DashGlobalMemoryConcept used for underlying memory management of this contai...
local_pointer & lbegin() noexcept
Native pointer of the initial address of the local memory of the unit that initialized this GlobHeapM...
Definition: GlobHeapMem.h:831

◆ operator*()

template<typename Key, typename Mapped, typename Hash, typename Pred, typename LMemSpace>
reference dash::UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LMemSpace >::operator* ( ) const
inline

Dereference operator.

Returns
A global reference to the element at the iterator's position.

Definition at line 178 of file UnorderedMapLocalIter.h.

References dash::UnorderedMap< Key, Mapped, Hash, Pred, LocalMemType >::globmem(), and dash::GlobHeapMem< ElementType, LocalMemorySpace, AllocationPolicy, LocalAlloc >::lbegin().

179  {
180  typedef typename map_t::local_node_iterator local_iter_t;
181  DASH_ASSERT(!_is_nullptr);
182  // TODO: Must be extended for correctness: _idx refers to local iteration
183  // space, not local memory space. Undefined behaviour if local
184  // memory space has gaps, e.g. after erasing elements.
185  local_iter_t l_it = _map->globmem().lbegin();
186  return *pointer(l_it + static_cast<index_type>(_idx));
187  }
const glob_mem_type & globmem() const
Reference to instance of DashGlobalMemoryConcept used for underlying memory management of this contai...
local_pointer & lbegin() noexcept
Native pointer of the initial address of the local memory of the unit that initialized this GlobHeapM...
Definition: GlobHeapMem.h:831

◆ operator++() [1/2]

template<typename Key, typename Mapped, typename Hash, typename Pred, typename LMemSpace>
self_t& dash::UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LMemSpace >::operator++ ( )
inline

Prefix increment operator.

Definition at line 237 of file UnorderedMapLocalIter.h.

238  {
239  increment(1);
240  return *this;
241  }

◆ operator++() [2/2]

template<typename Key, typename Mapped, typename Hash, typename Pred, typename LMemSpace>
self_t dash::UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LMemSpace >::operator++ ( int  )
inline

Postfix increment operator.

Definition at line 255 of file UnorderedMapLocalIter.h.

256  {
257  auto result = *this;
258  increment(1);
259  return result;
260  }

◆ operator--() [1/2]

template<typename Key, typename Mapped, typename Hash, typename Pred, typename LMemSpace>
self_t& dash::UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LMemSpace >::operator-- ( )
inline

Prefix decrement operator.

Definition at line 246 of file UnorderedMapLocalIter.h.

247  {
248  decrement(1);
249  return *this;
250  }

◆ operator--() [2/2]

template<typename Key, typename Mapped, typename Hash, typename Pred, typename LMemSpace>
self_t dash::UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LMemSpace >::operator-- ( int  )
inline

Postfix decrement operator.

Definition at line 265 of file UnorderedMapLocalIter.h.

References DART_UNDEFINED_TEAM_UNIT_ID.

266  {
267  auto result = *this;
268  decrement(1);
269  return result;
270  }

◆ operator=() [1/2]

template<typename Key, typename Mapped, typename Hash, typename Pred, typename LMemSpace>
self_t& dash::UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LMemSpace >::operator= ( const self_t other)
default

◆ operator=() [2/2]

template<typename Key, typename Mapped, typename Hash, typename Pred, typename LMemSpace>
self_t& dash::UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LMemSpace >::operator= ( std::nullptr_t  )
inlinenoexcept

Null-pointer assignment operator.

Definition at line 129 of file UnorderedMapLocalIter.h.

130  {
131  _is_nullptr = true;
132  return *this;
133  }

◆ operator[]()

template<typename Key, typename Mapped, typename Hash, typename Pred, typename LMemSpace>
reference dash::UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LMemSpace >::operator[] ( index_type  offset)
inline

Random access operator.

Definition at line 148 of file UnorderedMapLocalIter.h.

149  {
150  auto res = *this;
151  res += offset;
152  return *this;
153  }

◆ pos()

template<typename Key, typename Mapped, typename Hash, typename Pred, typename LMemSpace>
index_type dash::UnorderedMapLocalIter< Key, Mapped, Hash, Pred, LMemSpace >::pos ( ) const
inlinenoexcept

Position of the iterator in global index space.

Definition at line 229 of file UnorderedMapLocalIter.h.

230  {
231  return _idx;
232  }

The documentation for this class was generated from the following file: