Public Member Functions | Protected Attributes | Friends | List of all members
pma::SortedObjectBase Class Reference

#include <SortedObjects.h>

Inheritance diagram for pma::SortedObjectBase:
pma::Segment3D pma::SortedBranchBase pma::Node3D

Public Member Functions

 SortedObjectBase (void)
 
 SortedObjectBase (pma::SortedObjectBase *prevElement, pma::SortedObjectBase *nextElement)
 
 SortedObjectBase (const pma::SortedObjectBase &src)
 Note: copy constructor does not preserve connections. More...
 
virtual ~SortedObjectBase (void)
 
virtual void Disconnect (void)
 
virtual bool AddNext (pma::SortedObjectBase *nextElement)
 
virtual int RemoveNext (pma::SortedObjectBase *nextElement)
 
virtual bool IsFirst (void) const
 
virtual bool IsLast (void) const
 
virtual pma::SortedObjectBasePrev (void) const
 
virtual pma::SortedObjectBaseNext (unsigned int index=0) const
 
virtual unsigned int NextCount (void) const
 

Protected Attributes

pma::SortedObjectBasenext
 
pma::SortedObjectBaseprev
 

Friends

class pma::SortedBranchBase
 

Detailed Description

Definition at line 23 of file SortedObjects.h.

Constructor & Destructor Documentation

pma::SortedObjectBase::SortedObjectBase ( void  )
inline

Definition at line 28 of file SortedObjects.h.

28 : next(0), prev(0) {}
pma::SortedObjectBase * prev
Definition: SortedObjects.h:54
pma::SortedObjectBase * next
Definition: SortedObjects.h:53
pma::SortedObjectBase::SortedObjectBase ( pma::SortedObjectBase prevElement,
pma::SortedObjectBase nextElement 
)

Definition at line 18 of file SortedObjects.cxx.

18  :
19  next(0), prev(0)
20 {
21  if (prevElement) prevElement->AddNext(this);
22  if (nextElement) AddNext(nextElement);
23 }
pma::SortedObjectBase * prev
Definition: SortedObjects.h:54
pma::SortedObjectBase * next
Definition: SortedObjects.h:53
virtual bool AddNext(pma::SortedObjectBase *nextElement)
pma::SortedObjectBase::SortedObjectBase ( const pma::SortedObjectBase src)
inline

Note: copy constructor does not preserve connections.

Definition at line 32 of file SortedObjects.h.

32 : next(0), prev(0) {}
pma::SortedObjectBase * prev
Definition: SortedObjects.h:54
pma::SortedObjectBase * next
Definition: SortedObjects.h:53
virtual pma::SortedObjectBase::~SortedObjectBase ( void  )
inlinevirtual

Definition at line 34 of file SortedObjects.h.

34 { Disconnect(); }
virtual void Disconnect(void)

Member Function Documentation

bool pma::SortedObjectBase::AddNext ( pma::SortedObjectBase nextElement)
virtual

Reimplemented in pma::SortedBranchBase.

Definition at line 31 of file SortedObjects.cxx.

32 {
33  if (!nextElement || (nextElement == this)) return false;
34 
35  if (next && (next->prev == this))
36  next->prev = 0;
37 
38  if (nextElement->prev && (nextElement->prev != this))
39  nextElement->prev->RemoveNext(nextElement);
40 
41  next = nextElement;
42  next->prev = this;
43  return true;
44 }
pma::SortedObjectBase * prev
Definition: SortedObjects.h:54
virtual int RemoveNext(pma::SortedObjectBase *nextElement)
pma::SortedObjectBase * next
Definition: SortedObjects.h:53
void pma::SortedObjectBase::Disconnect ( void  )
virtual

Reimplemented in pma::SortedBranchBase.

Definition at line 25 of file SortedObjects.cxx.

26 {
27  if (prev) prev->RemoveNext(this);
28  if (next) RemoveNext(next);
29 }
pma::SortedObjectBase * prev
Definition: SortedObjects.h:54
virtual int RemoveNext(pma::SortedObjectBase *nextElement)
pma::SortedObjectBase * next
Definition: SortedObjects.h:53
virtual bool pma::SortedObjectBase::IsFirst ( void  ) const
inlinevirtual

Definition at line 41 of file SortedObjects.h.

41 { return !prev; }
pma::SortedObjectBase * prev
Definition: SortedObjects.h:54
virtual bool pma::SortedObjectBase::IsLast ( void  ) const
inlinevirtual

Reimplemented in pma::SortedBranchBase.

Definition at line 42 of file SortedObjects.h.

42 { return !next; }
pma::SortedObjectBase * next
Definition: SortedObjects.h:53
virtual pma::SortedObjectBase* pma::SortedObjectBase::Next ( unsigned int  index = 0) const
inlinevirtual

Reimplemented in pma::SortedBranchBase.

Definition at line 45 of file SortedObjects.h.

45 { return next; }
pma::SortedObjectBase * next
Definition: SortedObjects.h:53
virtual unsigned int pma::SortedObjectBase::NextCount ( void  ) const
inlinevirtual

Reimplemented in pma::SortedBranchBase.

Definition at line 46 of file SortedObjects.h.

47  {
48  if (next) return 1;
49  else return 0;
50  }
pma::SortedObjectBase * next
Definition: SortedObjects.h:53
virtual pma::SortedObjectBase* pma::SortedObjectBase::Prev ( void  ) const
inlinevirtual

Definition at line 44 of file SortedObjects.h.

44 { return prev; }
pma::SortedObjectBase * prev
Definition: SortedObjects.h:54
int pma::SortedObjectBase::RemoveNext ( pma::SortedObjectBase nextElement)
virtual

Reimplemented in pma::SortedBranchBase.

Definition at line 46 of file SortedObjects.cxx.

47 {
48  if (nextElement && (next == nextElement))
49  {
50  if (next->prev == this) next->prev = 0;
51  else
52  {
53  mf::LogError("pma::SortedObjectBase") << "Object structure is broken.";
54  }
55 
56  next = 0;
57  return 0;
58  }
59  else return -1;
60 }
pma::SortedObjectBase * prev
Definition: SortedObjects.h:54
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
pma::SortedObjectBase * next
Definition: SortedObjects.h:53

Friends And Related Function Documentation

friend class pma::SortedBranchBase
friend

Definition at line 25 of file SortedObjects.h.

Member Data Documentation

pma::SortedObjectBase* pma::SortedObjectBase::next
protected

Definition at line 53 of file SortedObjects.h.

pma::SortedObjectBase* pma::SortedObjectBase::prev
protected

Definition at line 54 of file SortedObjects.h.


The documentation for this class was generated from the following files: