reSIProcate/rutil  9694
Classes | Namespaces
IntrusiveListElement.hxx File Reference

Heritable intrusive doubly linked list element templates. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  resip::IntrusiveListElement< P >
class  resip::IntrusiveListElement< P >::iterator
class  resip::IntrusiveListElement1< P >
class  resip::IntrusiveListElement1< P >::iterator
class  resip::IntrusiveListElement2< P >
class  resip::IntrusiveListElement2< P >::iterator
class  resip::IntrusiveListElement3< P >
class  resip::IntrusiveListElement3< P >::iterator

Namespaces

namespace  resip
 

dcm! -- add UnusedChecking(_enum) below;



Detailed Description

Heritable intrusive doubly linked list element templates.

For a class that is an element in a single list, use like this:

  class Foo : public IntrusiveListElement<Foo*>
  {
     ...
  };

  Foo* fooHead = new Foo();
  // initialize head to cycle -- represent an empty list
  Foo::makeList(fooHead);

For a class that is an element of multiple lists, use like this: has two independent intrusive lists, named read and write

  class FooFoo : public IntrusiveListElement<FooFoo*>, public IntrusiveListElement1<FooFoo*>
  {
     public:
        typedef IntrusiveListElement<FooFoo*> read;
        typedef IntrusiveListElement1<FooFoo*> write;

     ...
  };

  FooFoo* fooFooHead = new FooFoo();
  // initialize head to cycle -- represent two empty lists
  FooFoo::read::makeList(fooFooHead);
  FooFoo::write::makeList(fooFooHead);
  for (FooFoo::read::iterator f = fooFooHead->read::begin(); f != fooFooHead->read::end(); f++)
  {
     ...
  };

  // elsewhere:
  FooFoo head;
  FooFoo::read* mReadHead = FooFoo::read::makeList(&head);
  FooFoo::write* mWriteHead = FooFoo::write::makeList(&head);

  FooFoo element* = new FooFoo();
  // don't need to disambiguate methods
  mReadHead->push_back(element);
  mWriteHead->push_back(element);

  // element could be in either list, so use aspect
  element->write::remove();  

Definition in file IntrusiveListElement.hxx.