13 #ifndef _FBXSDK_CORE_BASE_INTRUSIVE_LIST_H_ 
   14 #define _FBXSDK_CORE_BASE_INTRUSIVE_LIST_H_ 
   23 #ifndef DOXYGEN_SHOULD_SKIP_THIS 
   25 #define FBXSDK_INTRUSIVE_LIST_NODE(Class, NodeCount)\ 
   26     public: inline FbxListNode<Class>& GetListNode(int index = 0){ return this->mNode[index]; }\ 
   27     private: FbxListNode<Class> mNode[NodeCount]; 
   29 template <
typename T> 
class FbxListNode
 
   31     typedef FbxListNode<T> NodeT; 
 
   34     explicit FbxListNode(T* pData = 0):mNext(0),mPrev(0),mData(pData){}
 
   35     ~FbxListNode(){ Disconnect(); }
 
   57 template <
typename T, 
int NodeIndex=0> 
class FbxIntrusiveList
 
   60     typedef T         allocator_type;
 
   63     typedef const T&  const_reference;
 
   65     typedef const T*  const_pointer;
 
   67     typedef FbxListNode<T> NodeT;
 
   70     FbxIntrusiveList():mHead(0)
 
   72         mHead.mNext = mHead.mPrev = &mHead;
 
   77             Begin().Get()->Disconnect();  
 
   83         return ((mHead.mNext==&mHead)&&(mHead.mPrev==&mHead));
 
   87     void PushBack(T& pElement)
 
   89         NodeT* pNode = &pElement.GetListNode(NodeIndex);
 
   90         pNode->mData = &pElement;
 
   94             pNode->mNext = &mHead;
 
   95             pNode->mPrev = &mHead;
 
  101             pNode->mNext = &mHead;
 
  102             pNode->mPrev = mHead.mPrev;
 
  104             pNode->mPrev->mNext = pNode;
 
  109     void PushFront(T& pElement)
 
  111         NodeT* pNode = &pElement.GetListNode(NodeIndex);
 
  112         pNode->mData = &pElement;
 
  116             pNode->mNext = &mHead;
 
  117             pNode->mPrev = &mHead;
 
  123             pNode->mNext = mHead.mNext;
 
  124             pNode->mPrev = &mHead;
 
  126             pNode->mNext->mPrev = pNode;
 
  133         iterator begin = Begin();
 
  143     class IntrusiveListIterator
 
  146         explicit IntrusiveListIterator(NodeT* ptr=0):mPtr(ptr){}
 
  149         IntrusiveListIterator& operator++()
 
  151             mPtr = mPtr->mNext;
return (*
this);
 
  154         const IntrusiveListIterator operator++(
int)
 
  156             IntrusiveListIterator temp = *
this;
 
  161         IntrusiveListIterator& operator--()
 
  163             mPtr = mPtr->mPrev;
return *
this;
 
  166         const IntrusiveListIterator operator--(
int)
 
  168             IntrusiveListIterator temp = *
this;
 
  172         IntrusiveListIterator& operator=(
const IntrusiveListIterator &other){mPtr = other.mPtr; 
return *
this;}
 
  174         reference operator*()
 const { 
return *(mPtr->mData); }
 
  175         pointer operator->()
 const { 
return (&**
this); }
 
  176         bool operator==(
const IntrusiveListIterator& other)
const{ 
return mPtr==other.mPtr; } 
 
  177         bool operator!=(
const IntrusiveListIterator& other)
const{ 
return !(*
this == other); } 
 
  179         inline NodeT* Get()
const { 
return mPtr; }
 
  185     class  IntrusiveListConstIterator
 
  188         explicit IntrusiveListConstIterator(
const NodeT* ptr=0):mPtr(ptr){}
 
  191         IntrusiveListConstIterator& operator++()
 
  193             mPtr = mPtr->mNext;
return (*
this);
 
  196         const IntrusiveListConstIterator operator++(
int)
 
  198             IntrusiveListConstIterator temp = *
this;
 
  203         IntrusiveListConstIterator& operator--()
 
  205             mPtr = mPtr->mPrev;
return *
this;
 
  208         const IntrusiveListConstIterator operator--(
int)
 
  210             IntrusiveListConstIterator temp = *
this;
 
  214         IntrusiveListConstIterator& operator=(
const IntrusiveListConstIterator &other){mPtr = other.mPtr; 
return *
this;}
 
  216         const_reference operator*()
 const { 
return *(mPtr->mData); }
 
  217         const_pointer operator->()
 const { 
return (&**
this); }
 
  218         bool operator==(
const IntrusiveListConstIterator& other)
const{ 
return mPtr==other.mPtr; } 
 
  219         bool operator!=(
const IntrusiveListConstIterator& other)
const{ 
return !(*
this == other); } 
 
  221         inline const NodeT* Get()
const { 
return mPtr; }
 
  224         mutable const NodeT* mPtr;
 
  228     typedef IntrusiveListIterator iterator;
 
  229     typedef IntrusiveListConstIterator const_iterator;
 
  232     inline iterator Begin() { 
return iterator(mHead.mNext); }
 
  233     inline const_iterator Begin()
 const { 
return const_iterator(mHead.mNext); }
 
  234     inline iterator End() { 
return iterator(&mHead); }
 
  235     inline const_iterator End()
 const { 
return const_iterator(&mHead); }
 
  240     reference Front(){
return (*Begin());}
 
  241     const_reference Front()
 const { 
return (*Begin()); }
 
  242     reference Back(){ 
return (*(--End())); }
 
  243     const_reference Back()
 const{ 
return (*(--End())); }
 
  245     iterator& Erase(iterator& it)
 
  247         it.Get()->Disconnect();
 
  254     FbxIntrusiveList(
const FbxIntrusiveList&);
 
  255     FbxIntrusiveList& operator=(
const FbxIntrusiveList& Right){
return (*
this);}
 
FBX SDK environment definition.