/[svn]/linuxsampler/trunk/src/common/Pool.h
ViewVC logotype

Diff of /linuxsampler/trunk/src/common/Pool.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 277 by schoenebeck, Sat Oct 9 15:48:32 2004 UTC revision 361 by schoenebeck, Wed Feb 9 01:22:18 2005 UTC
# Line 45  template<typename T> class RTList; Line 45  template<typename T> class RTList;
45  template<typename T>  template<typename T>
46  class RTListBase {  class RTListBase {
47      protected:      protected:
48          template<typename _T>          template<typename T1>
49          struct _Node {          struct _Node {
50              _Node<_T>* next;              _Node<T1>* next;
51              _Node<_T>* prev;              _Node<T1>* prev;
52              _T* data;              T1* data;
53              #if DEVMODE              #if DEVMODE
54              RTListBase<_T>* list; // list to which this node currently belongs to              RTListBase<T1>* list; // list to which this node currently belongs to
55              #endif // DEVMODE              #endif // DEVMODE
56    
57              _Node() {              _Node() {
# Line 66  class RTListBase { Line 66  class RTListBase {
66          typedef _Node<T> Node;          typedef _Node<T> Node;
67    
68      public:      public:
69          template<typename _T>          template<typename T1>
70          class _Iterator {          class _Iterator {
71              public:              public:
72                  _Iterator() {                  _Iterator() {
# Line 119  class RTListBase { Line 119  class RTListBase {
119                      return preval;                      return preval;
120                  }                  }
121    
122                  inline _T& operator*() {                  inline T1& operator*() {
123                      #if DEVMODE                      #if DEVMODE
124                      #if USE_EXCEPTIONS                      #if USE_EXCEPTIONS
125                      if (isValid()) return *current->data;                      if (isValid()) return *current->data;
126                      else throw std::runtime_error(__err_msg_iterator_invalidated);                      else throw std::runtime_error(__err_msg_iterator_invalidated);
127                      #else                      #else
128                      return *(isValid() ? current->data : (_T*)NULL); // force segfault if iterator became invalidated                      return *(isValid() ? current->data : (T1*)NULL); // force segfault if iterator became invalidated
129                      #endif // USE_EXCEPTIONS                      #endif // USE_EXCEPTIONS
130                      #else                      #else
131                      return *current->data;                      return *current->data;
132                      #endif // DEVMODE                      #endif // DEVMODE
133                  }                  }
134    
135                  inline _T* operator->() {                  inline T1* operator->() {
136                      #if DEVMODE                      #if DEVMODE
137                      #if USE_EXCEPTIONS                      #if USE_EXCEPTIONS
138                      if (isValid()) return current->data;                      if (isValid()) return current->data;
139                      else throw std::runtime_error(__err_msg_iterator_invalidated);                      else throw std::runtime_error(__err_msg_iterator_invalidated);
140                      #else                      #else
141                      return isValid() ? current->data : (_T*)NULL; // force segfault if iterator became invalidated                      return isValid() ? current->data : (T1*)NULL; // force segfault if iterator became invalidated
142                      #endif // USE_EXCEPTIONS                      #endif // USE_EXCEPTIONS
143                      #else                      #else
144                      return current->data;                      return current->data;
145                      #endif // DEVMODE                      #endif // DEVMODE
146                  }                  }
147    
148                  inline bool operator==(const _Iterator<_T> other) {                  inline bool operator==(const _Iterator<T1> other) {
149                      return current == other.current;                      return current == other.current;
150                  }                  }
151    
152                  inline bool operator!=(const _Iterator<_T> other) {                  inline bool operator!=(const _Iterator<T1> other) {
153                      return current != other.current;                      return current != other.current;
154                  }                  }
155    
# Line 161  class RTListBase { Line 161  class RTListBase {
161                      return !(current && current->data);                      return !(current && current->data);
162                  }                  }
163    
164                  inline _Iterator moveToEndOf(RTListBase<_T>* pDstList) {                  inline _Iterator moveToEndOf(RTListBase<T1>* pDstList) {
165                      detach();                      detach();
166                      pDstList->append(*this);                      pDstList->append(*this);
167                      _Iterator iterOnDstList = _Iterator(current);                      _Iterator iterOnDstList = _Iterator(current);
# Line 169  class RTListBase { Line 169  class RTListBase {
169                      return iterOnDstList;                      return iterOnDstList;
170                  }                  }
171    
172                  inline _Iterator moveToBeginOf(RTListBase<_T>* pDstList) {                  inline _Iterator moveToBeginOf(RTListBase<T1>* pDstList) {
173                      detach();                      detach();
174                      pDstList->prepend(*this);                      pDstList->prepend(*this);
175                      _Iterator iterOnDstList = _Iterator(current);                      _Iterator iterOnDstList = _Iterator(current);
# Line 191  class RTListBase { Line 191  class RTListBase {
191                      dir_backward                      dir_backward
192                  };                  };
193                  #if DEVMODE                  #if DEVMODE
194                  RTListBase<_T>* list;                  RTListBase<T1>* list;
195                  #endif // DEVMODE                  #endif // DEVMODE
196    
197                  _Iterator(Node* pNode, dir_t direction = dir_forward) {                  _Iterator(Node* pNode, dir_t direction = dir_forward) {
# Line 216  class RTListBase { Line 216  class RTListBase {
216                  }                  }
217    
218                  inline void detach() {                  inline void detach() {
219                      RTListBase<_T>::detach(*this);                      RTListBase<T1>::detach(*this);
220                  }                  }
221    
222                  friend class RTListBase<_T>;                  friend class RTListBase<T1>;
223                  friend class RTList<_T>;                  friend class RTList<T1>;
224                  friend class Pool<_T>;                  friend class Pool<T1>;
225          };          };
226          typedef _Iterator<T> Iterator;          typedef _Iterator<T> Iterator;
227    

Legend:
Removed from v.277  
changed lines
  Added in v.361

  ViewVC Help
Powered by ViewVC