LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
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 19 of file SortedObjects.cxx.

References AddNext().

19  :
20  next(0), prev(0)
21 {
22  if (prevElement) prevElement->AddNext(this);
23  if (nextElement) AddNext(nextElement);
24 }
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.

References AddNext(), Disconnect(), and RemoveNext().

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

Member Function Documentation

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

Reimplemented in pma::SortedBranchBase.

Definition at line 32 of file SortedObjects.cxx.

References next, prev, and RemoveNext().

Referenced by pma::Track3D::AddNode(), pma::Track3D::AttachToSameTPC(), SortedObjectBase(), pma::Track3D::SwapVertices(), pma::SortedBranchBase::~SortedBranchBase(), and ~SortedObjectBase().

33 {
34  if (!nextElement || (nextElement == this)) return false;
35 
36  if (next && (next->prev == this))
37  next->prev = 0;
38 
39  if (nextElement->prev && (nextElement->prev != this))
40  nextElement->prev->RemoveNext(nextElement);
41 
42  next = nextElement;
43  next->prev = this;
44  return true;
45 }
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 26 of file SortedObjects.cxx.

References next, prev, and RemoveNext().

Referenced by pma::Track3D::SwapVertices(), pma::SortedBranchBase::~SortedBranchBase(), and ~SortedObjectBase().

27 {
28  if (prev) prev->RemoveNext(this);
29  if (next) RemoveNext(next);
30 }
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.

References prev.

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.

References next.

42 { 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.

References next.

Referenced by pma::Node3D::Pi(), and pma::Element3D::UpdateHitParams().

47  {
48  if (next) return 1;
49  else return 0;
50  }
pma::SortedObjectBase * next
Definition: SortedObjects.h:53
int pma::SortedObjectBase::RemoveNext ( pma::SortedObjectBase nextElement)
virtual

Reimplemented in pma::SortedBranchBase.

Definition at line 47 of file SortedObjects.cxx.

References next, and prev.

Referenced by AddNext(), pma::SortedBranchBase::AddNext(), Disconnect(), pma::SortedBranchBase::Disconnect(), pma::Track3D::Split(), pma::SortedBranchBase::~SortedBranchBase(), and ~SortedObjectBase().

48 {
49  if (nextElement && (next == nextElement))
50  {
51  if (next->prev == this) next->prev = 0;
52  else
53  {
54  mf::LogError("pma::SortedObjectBase") << "Object structure is broken.";
55  }
56 
57  next = 0;
58  return 0;
59  }
60  else return -1;
61 }
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


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