STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Classes | Public Member Functions | Private Types | Private Attributes | List of all members
Concurrency::details::_CancellationTokenState::TokenRegistrationContainer Class Reference

#include <pplcancellation_token.h>

Classes

struct  _Node
 

Public Member Functions

 TokenRegistrationContainer ()
 
 ~TokenRegistrationContainer ()
 
void swap (TokenRegistrationContainer &list)
 
bool empty ()
 
template<typename T >
void for_each (T lambda)
 
void push_back (_CancellationTokenRegistration *token)
 
void remove (_CancellationTokenRegistration *token)
 

Private Types

typedef struct Concurrency::details::_CancellationTokenState::TokenRegistrationContainer::_Node Node
 

Private Attributes

Node_M_begin
 
Node_M_last
 

Member Typedef Documentation

Constructor & Destructor Documentation

Concurrency::details::_CancellationTokenState::TokenRegistrationContainer::TokenRegistrationContainer ( )
inline
224  : _M_begin(nullptr), _M_last(nullptr)
225  {
226  }
Concurrency::details::_CancellationTokenState::TokenRegistrationContainer::~TokenRegistrationContainer ( )
inline
229  {
230  auto node = _M_begin;
231  while (node != nullptr)
232  {
233  Node* tmp = node;
234  node = node->_M_next;
235  ::free(tmp);
236  }
237  }
_CRTIMP _CRTNOALIAS void __cdecl free(_Pre_maybenull_ _Post_invalid_ void *_Memory)
struct Concurrency::details::_CancellationTokenState::TokenRegistrationContainer::_Node Node

Member Function Documentation

bool Concurrency::details::_CancellationTokenState::TokenRegistrationContainer::empty ( )
inline
246  {
247  return _M_begin == nullptr;
248  }
template<typename T >
void Concurrency::details::_CancellationTokenState::TokenRegistrationContainer::for_each ( lambda)
inline
252  {
253  Node* node = _M_begin;
254 
255  while (node != nullptr)
256  {
257  lambda(node->_M_token);
258  node = node->_M_next;
259  }
260  }
struct Concurrency::details::_CancellationTokenState::TokenRegistrationContainer::_Node Node
void Concurrency::details::_CancellationTokenState::TokenRegistrationContainer::push_back ( _CancellationTokenRegistration token)
inline
263  {
264  Node* node = reinterpret_cast<Node*>(::malloc(sizeof(Node)));
265  if (node == nullptr)
266  {
267  throw ::std::bad_alloc();
268  }
269 
270  node->_M_token = token;
271  node->_M_next = nullptr;
272 
273  if (_M_begin == nullptr)
274  {
275  _M_begin = node;
276  }
277  else
278  {
279  _M_last->_M_next = node;
280  }
281 
282  _M_last = node;
283  }
struct Concurrency::details::_CancellationTokenState::TokenRegistrationContainer::_Node Node
void Concurrency::details::_CancellationTokenState::TokenRegistrationContainer::remove ( _CancellationTokenRegistration token)
inline
286  {
287  Node* node = _M_begin;
288  Node* prev = nullptr;
289 
290  while (node != nullptr)
291  {
292  if (node->_M_token == token) {
293  if (prev == nullptr)
294  {
295  _M_begin = node->_M_next;
296  }
297  else
298  {
299  prev->_M_next = node->_M_next;
300  }
301 
302  if (node->_M_next == nullptr)
303  {
304  _M_last = prev;
305  }
306 
307  ::free(node);
308  break;
309  }
310 
311  prev = node;
312  node = node->_M_next;
313  }
314  }
_CRTIMP _CRTNOALIAS void __cdecl free(_Pre_maybenull_ _Post_invalid_ void *_Memory)
struct Concurrency::details::_CancellationTokenState::TokenRegistrationContainer::_Node Node
_BidIt prev(_BidIt _First, typename iterator_traits< _BidIt >::difference_type _Off=1)
Definition: xutility:784
void Concurrency::details::_CancellationTokenState::TokenRegistrationContainer::swap ( TokenRegistrationContainer list)
inline
240  {
241  std::swap(list._M_begin, _M_begin);
242  std::swap(list._M_last, _M_last);
243  }
Definition: list:860
void swap(array< _Ty, _Size > &_Left, array< _Ty, _Size > &_Right) _NOEXCEPT_OP(_NOEXCEPT_OP(_Left.swap(_Right)))
Definition: array:429

Member Data Documentation

Node* Concurrency::details::_CancellationTokenState::TokenRegistrationContainer::_M_begin
private
Node* Concurrency::details::_CancellationTokenState::TokenRegistrationContainer::_M_last
private

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