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
122  {
123  }
_Message ** _M_ppTail
Definition: agents.h:112
size_t _M_count
Definition: agents.h:115
#define NULL
Definition: crtdbg.h:30
_Message * _M_pHead
Definition: agents.h:109
template<class _Message>
Concurrency::details::_Queue< _Message >::~_Queue ( )
inline
127  {
128  }

Member Function Documentation

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

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: