cgma
TDPtr Class Reference

#include <TDUPtr.hpp>

Inheritance diagram for TDPtr:
ToolData

List of all members.

Public Member Functions

virtual ~TDPtr ()

Static Public Member Functions

static void add_to_TD (TDUPtrListNode *add, ToolDataUser *to)
static void remove_from_TD (TDUPtrListNode *remove, ToolDataUser *from)

Private Member Functions

 TDPtr ()

Static Private Member Functions

static int is_ptr (const ToolData *td)

Private Attributes

TDUPtrListNodelistHead

Detailed Description

Definition at line 106 of file TDUPtr.hpp.


Constructor & Destructor Documentation

TDPtr::~TDPtr ( ) [virtual]

Definition at line 46 of file TDUPtr.cpp.

{
  while (listHead) {
    TDUPtrListNode* dead = listHead;
    listHead = dead->nextInTD;
    dead->nextInTD = 0;
    dead->nullify();
  }
}
TDPtr::TDPtr ( ) [inline, private]

Definition at line 116 of file TDUPtr.hpp.

: listHead(0) { }

Member Function Documentation

void TDPtr::add_to_TD ( TDUPtrListNode add,
ToolDataUser to 
) [static]

Definition at line 31 of file TDUPtr.cpp.

{
  if( !tdu )
    return;
  
  TDPtr* td = (TDPtr*)(tdu->get_TD(&is_ptr));
  if( ! td ) {
    tdu->add_TD(td = new TDPtr);
  }
  
  assert(ptr && !ptr->nextInTD);
  ptr->nextInTD = td->listHead;
  td->listHead = ptr;
}
static int TDPtr::is_ptr ( const ToolData td) [inline, static, private]

Definition at line 118 of file TDUPtr.hpp.

    { return dynamic_cast<const TDPtr*>(td) != 0; }
void TDPtr::remove_from_TD ( TDUPtrListNode remove,
ToolDataUser from 
) [static]

Definition at line 5 of file TDUPtr.cpp.

{
  if ( !tdu )
    return;
  
  TDPtr* td = (TDPtr*)(tdu->get_TD(&is_ptr));
  assert(td != NULL);
  
  if (ptr == td->listHead) {
    td->listHead = ptr->nextInTD;
    if (!td->listHead ) {
      delete tdu->remove_TD(&is_ptr);
    }
  }
  else {
    TDUPtrListNode* prev = td->listHead;
    while (prev->nextInTD != ptr) {
      prev = prev->nextInTD;
      assert(prev != NULL);
    }
    prev->nextInTD = ptr->nextInTD;
  }
  
  ptr->nextInTD = 0;
}

Member Data Documentation

Definition at line 121 of file TDUPtr.hpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines