LArSoft  v09_90_00
Liquid Argon Software toolkit - https://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 &)
 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=0) const
 
virtual unsigned int NextCount (void) const
 

Protected Attributes

pma::SortedObjectBasenext
 
pma::SortedObjectBaseprev
 

Friends

class pma::SortedBranchBase
 

Detailed Description

Definition at line 22 of file SortedObjects.h.

Constructor & Destructor Documentation

pma::SortedObjectBase::SortedObjectBase ( void  )
inline

Definition at line 26 of file SortedObjects.h.

26 : 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 17 of file SortedObjects.cxx.

References AddNext().

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 )
inline

Note: copy constructor does not preserve connections.

Definition at line 30 of file SortedObjects.h.

30 : 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 32 of file SortedObjects.h.

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

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

References next, prev, and RemoveNext().

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

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

References next, prev, and RemoveNext().

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

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 39 of file SortedObjects.h.

References prev.

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

Reimplemented in pma::SortedBranchBase.

Definition at line 40 of file SortedObjects.h.

References next.

40 { 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 44 of file SortedObjects.h.

References next.

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

45  {
46  if (next)
47  return 1;
48  else
49  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 44 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().

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

Member Data Documentation


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