00001 /* 00002 * 00003 * 00004 * Distributed under the OpenDDS License. 00005 * See: http://www.opendds.org/license.html 00006 */ 00007 00008 #ifndef OPENDDS_DCPS_BASICQUEUELINK_T_H 00009 #define OPENDDS_DCPS_BASICQUEUELINK_T_H 00010 00011 #include "dds/DCPS/PoolAllocationBase.h" 00012 00013 namespace OpenDDS { 00014 namespace DCPS { 00015 00016 template <typename T> 00017 class BasicQueueLink : public PoolAllocationBase { 00018 public: 00019 00020 BasicQueueLink() 00021 : elem_(0), 00022 next_(0) { 00023 } 00024 00025 BasicQueueLink(T* value) 00026 : elem_(value), 00027 next_(0) { 00028 } 00029 00030 /// Accessor for elem_ data memeber. 00031 T* elem() { 00032 return this->elem_; 00033 } 00034 00035 /// Mutator for elem_ data memeber. 00036 void elem(T* value) { 00037 this->elem_ = value; 00038 } 00039 00040 /// Accessor for reference to the elem_ data memeber. 00041 T*& elem_ref() { 00042 return this->elem_; 00043 } 00044 00045 /// Accessor for next_ data member. 00046 BasicQueueLink<T>* next() { 00047 return this->next_; 00048 } 00049 00050 /// Mutator for next_ data member. 00051 void next(BasicQueueLink<T>* value) { 00052 this->next_ = value; 00053 } 00054 00055 /// Changes state of this object to match the state of the 00056 /// object following (default) construction. 00057 void reset() { 00058 this->elem_ = 0; 00059 this->next_ = 0; 00060 } 00061 00062 private: 00063 00064 /// The "payload" of the link -- the actual pointer that is 00065 /// being "wrapped" inside this link. 00066 T* elem_; 00067 00068 /// The next link, or NULL (0) if this is the last link. 00069 BasicQueueLink<T>* next_; 00070 }; 00071 00072 } // namespace DCPS 00073 } // namespace OpenDDS 00074 00075 #endif /* OPENDDS_DCPS_BASICQUEUELINK_T_H */