STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Protected Attributes | List of all members
Concurrency::details::_Queue< _Message > Class Template Reference

#include <agents.h>

Inheritance diagram for Concurrency::details::_Queue< _Message >:
Concurrency::details::_AllocBase

Public Types

typedef _Message type
 

Public Member Functions

 _Queue ()
 
 ~_Queue ()
 
size_t _Count () const
 
bool _Enqueue (_Message *_Element)
 
bool _Remove (_Message *_OldElement)
 
_Message * _Dequeue ()
 
_Message * _Peek ()
 
bool _Is_head (runtime_object_identity _MsgId)
 
- Public Member Functions inherited from Concurrency::details::_AllocBase
voidoperator new (size_t _Size)
 
void operator delete (void *_Ptr) throw ()
 
voidoperator new (size_t _Size, const std::nothrow_t &) throw ()
 
void operator delete (void *_Ptr, const std::nothrow_t &) throw ()
 
voidoperator new[] (size_t _Size)
 
void operator delete[] (void *_Ptr) throw ()
 
voidoperator new[] (size_t _Size, const std::nothrow_t &_No_throw) throw ()
 
void operator delete[] (void *_Ptr, const std::nothrow_t &_No_throw) throw ()
 
voidoperator new (size_t, void *_Location) throw ()
 
void operator delete (void *, void *) throw ()
 
void *__cdecl operator new[] (size_t, void *_Location) throw ()
 
void __cdecl operator delete[] (void *, void *) throw ()
 

Protected Attributes

_Message * _M_pHead
 
_Message ** _M_ppTail
 
size_t _M_count
 

Member Typedef Documentation

template<class _Message>
typedef _Message Concurrency::details::_Queue< _Message >::type

Constructor & Destructor Documentation

template<class _Message>
Concurrency::details::_Queue< _Message >::_Queue ( )
inline
123  {
124  }
#define NULL
Definition: vcruntime.h:236
_Message ** _M_ppTail
Definition: agents.h:113
size_t _M_count
Definition: agents.h:116
_Message * _M_pHead
Definition: agents.h:110
template<class _Message>
Concurrency::details::_Queue< _Message >::~_Queue ( )
inline
128  {
129  }

Member Function Documentation

template<class _Message>
size_t Concurrency::details::_Queue< _Message >::_Count ( ) const
inline
133  {
134  return _M_count;
135  }
size_t _M_count
Definition: agents.h:116
template<class _Message>
_Message* Concurrency::details::_Queue< _Message >::_Dequeue ( )
inline
205  {
206  if (_M_pHead == NULL)
207  {
208  return NULL;
209  }
210 
211  _Message * _Result = _M_pHead;
212 
213  _M_pHead = _Result->_M_pNext;
214  if (_M_pHead == NULL)
215  {
216  _M_ppTail = &_M_pHead;
217  }
218 
219  _Result->_M_pNext = NULL;
220  _M_count--;
221  return _Result;
222  }
#define NULL
Definition: vcruntime.h:236
_Message ** _M_ppTail
Definition: agents.h:113
size_t _M_count
Definition: agents.h:116
_Message * _M_pHead
Definition: agents.h:110
template<class _Message>
bool Concurrency::details::_Queue< _Message >::_Enqueue ( _Message *  _Element)
inline
141  {
142  _CONCRT_ASSERT(_Element->_M_pNext == NULL);
144 
145  *_M_ppTail = _Element;
146  _Element->_M_pNext = NULL;
147  _M_ppTail = &(_Element->_M_pNext);
148  _M_count++;
149 
150  return true;
151  }
#define NULL
Definition: vcruntime.h:236
_Message ** _M_ppTail
Definition: agents.h:113
#define _CONCRT_ASSERT(x)
Definition: concrt.h:123
size_t _M_count
Definition: agents.h:116
template<class _Message>
bool Concurrency::details::_Queue< _Message >::_Is_head ( runtime_object_identity  _MsgId)
inline
234  {
235  // Peek at the next message in the message buffer. Use it to
236  // check if the IDs match
237  _Message * _Msg = _M_pHead;
238 
239  if (_Msg == NULL || _Msg->msg_id() != _MsgId)
240  {
241  return false;
242  }
243 
244  return true;
245  }
#define NULL
Definition: vcruntime.h:236
_Message * _M_pHead
Definition: agents.h:110
template<class _Message>
_Message* Concurrency::details::_Queue< _Message >::_Peek ( )
inline
228  {
229  return _M_pHead;
230  }
_Message * _M_pHead
Definition: agents.h:110
template<class _Message>
bool Concurrency::details::_Queue< _Message >::_Remove ( _Message *  _OldElement)
inline
157  {
158  bool _Result = false;
159 
160  _CONCRT_ASSERT(_OldElement != NULL);
161 
162  if (_M_pHead == _OldElement)
163  {
164  _M_pHead = _OldElement->_M_pNext;
165  if (_M_pHead == NULL)
166  {
167  _M_ppTail = &_M_pHead;
168  }
169 
170  _OldElement->_M_pNext = NULL;
171  _M_count--;
172  _Result = true;
173  }
174  else
175  {
176  _Message * _Next = NULL;
177  for (_Message * _Node = _M_pHead; _Node != NULL; _Node = _Next)
178  {
179  _Next = _Node->_M_pNext;
180 
181  if (_Node->_M_pNext == _OldElement)
182  {
183  _Node->_M_pNext = _OldElement->_M_pNext;
184  // if this is the last element of the _Queue
185  if (_Node->_M_pNext == NULL && _M_count == 1)
186  {
187  _M_ppTail = &_M_pHead;
188  }
189 
190  _OldElement->_M_pNext = NULL;
191  _M_count--;
192  _Result = true;
193  break;
194  }
195  }
196  }
197 
198  return _Result;
199  }
#define NULL
Definition: vcruntime.h:236
_Message ** _M_ppTail
Definition: agents.h:113
#define _CONCRT_ASSERT(x)
Definition: concrt.h:123
size_t _M_count
Definition: agents.h:116
_Message * _M_pHead
Definition: agents.h:110

Member Data Documentation

template<class _Message>
size_t Concurrency::details::_Queue< _Message >::_M_count
protected
template<class _Message>
_Message* Concurrency::details::_Queue< _Message >::_M_pHead
protected
template<class _Message>
_Message** Concurrency::details::_Queue< _Message >::_M_ppTail
protected

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