DCVertex< T > Class Template Reference

#include <DCVertex.h>

List of all members.

Public Member Functions

 DCVertex ()
 DCVertex (T *idata, DCVertex< T > *nextVert)
virtual ~DCVertex ()
T * GetData ()
DCVertex< T > * GetNextVertex ()
DCEdge< T > * GetFirstEdge ()
void ResetNextVertex (DCVertex< T > *newvert)
void ResetFirstEdge (DCEdge< T > *newedge)
virtual void Print (Option_t *t="") const
void PrintEdges ()
void PrintGraph ()
float ConnectTo (DCVertex< T > *)
virtual void Draw (Option_t *t="")
void DrawEdges (Option_t *t="")
void DrawGraph (Option_t *t="")
void ClearConnections ()

Private Attributes

T * data
DCEdge< T > * edges
DCVertex< T > * next

Detailed Description

template<class T>
class DCVertex< T >

Definition at line 25 of file DCVertex.h.


Constructor & Destructor Documentation

template<class T>
DCVertex< T >::DCVertex (  )  [inline]

Definition at line 29 of file DCVertex.h.

References DCVertex< T >::data, DCVertex< T >::edges, and DCVertex< T >::next.

00029 {data=0; edges=0; next=0;}

template<class T>
DCVertex< T >::DCVertex ( T *  idata,
DCVertex< T > *  nextVert 
) [inline]

Definition at line 30 of file DCVertex.h.

References DCVertex< T >::data, DCVertex< T >::edges, and DCVertex< T >::next.

00030 { data=new T(*idata); next=nextVert; edges=0;}

template<class T>
virtual DCVertex< T >::~DCVertex (  )  [inline, virtual]

Definition at line 32 of file DCVertex.h.

References DCVertex< T >::data, DCVertex< T >::edges, and DCVertex< T >::next.

00032                       { 
00033       if(data!=0){delete data; data=0;}
00034       if(next!=0){delete next; next=0;}
00035       if(edges!=0){delete edges; edges=0;}
00036    }


Member Function Documentation

template<class T >
void DCVertex< T >::ClearConnections (  )  [inline]

Definition at line 144 of file DCVertex.h.

References DCVertex< T >::edges.

00145 {
00146    edges=0;
00147 }

template<class T >
float DCVertex< T >::ConnectTo ( DCVertex< T > *  Vert  )  [inline]

Definition at line 123 of file DCVertex.h.

References DCVertex< T >::data, DCVertex< T >::edges, DCVertex< T >::GetData(), DCEdge< T >::GetMetric(), and Munits::m.

Referenced by DCGraph< T >::AddEdge().

00124 {
00125 //   cout<<"In DCVertex::ConnectTo"<<endl;
00126   // allocate memory for a new Edge, set its Vertex pointer to point 
00127   // to Vert, and its Edge pointer to point to the rest of edges 
00128    T minus = (*(Vert->GetData()))-(*data);
00129    float m=(*data-*(Vert->GetData())).abs();
00130    float xm=0.;
00131    float ym=0.; 
00132    float zm=0.;
00133    minus.GetData(xm,ym,zm);
00134    float wm = m*zm;
00135    float xwm=xm*zm;
00136    float ywm=ym*zm;
00137    DCEdge<T> *newEdge = new DCEdge<T>(Vert, edges, m, xm, ym, wm, xwm, ywm);
00138    
00139    // make the new edge the first edge of the vertex
00140    edges = newEdge; 
00141    return newEdge->GetMetric();
00142 }

template<class T >
void DCVertex< T >::Draw ( Option_t *  t = ""  )  [inline, virtual]

Definition at line 89 of file DCVertex.h.

References DCVertex< T >::data.

00090 {
00091 //   cout<<"in DCVertex::Draw on ";
00092 //   data->Print();
00093 //   cout<<endl;
00094    data->Draw(t);
00095 }

template<class T >
void DCVertex< T >::DrawEdges ( Option_t *  t = ""  )  [inline]

Definition at line 97 of file DCVertex.h.

References DCVertex< T >::data, and DCVertex< T >::edges.

Referenced by DCVertex< T >::DrawGraph().

00098 {
00099 //   cout<<"In DCVertex::DrawEdges "<<endl;
00100    data->Draw(t);
00101    if(edges!=0){
00102       edges->DrawThisEdge(this,t);
00103    }
00104 }

template<class T >
void DCVertex< T >::DrawGraph ( Option_t *  t = ""  )  [inline]

Definition at line 106 of file DCVertex.h.

References DCVertex< T >::DrawEdges(), and DCVertex< T >::next.

00107 {
00108 //   cout<<"In DCVertex::DrawGraph"<<endl;
00109    DrawEdges(t);
00110    if (next != 0){
00111 //      cout<<"Drawing next vertex"<<endl;
00112       next->DrawGraph(t);
00113    }  
00114 }

template<class T>
T* DCVertex< T >::GetData (  )  [inline]
template<class T>
DCEdge<T>* DCVertex< T >::GetFirstEdge (  )  [inline]

Definition at line 40 of file DCVertex.h.

References DCVertex< T >::edges.

Referenced by DCGraph< T >::AddEdge(), DCGraph< T >::GetAllWeights(), and MSTCalcAna::GraphLoop().

00040 {return edges;}

template<class T>
DCVertex<T>* DCVertex< T >::GetNextVertex (  )  [inline]
template<class T >
void DCVertex< T >::Print ( Option_t *  t = ""  )  const [inline, virtual]

Definition at line 117 of file DCVertex.h.

References DCVertex< T >::data.

00118 {
00119    data->Print(t);
00120 }

template<class T>
void DCVertex< T >::PrintEdges (  ) 
template<class T >
void DCVertex< T >::PrintGraph (  )  [inline]

Definition at line 81 of file DCVertex.h.

References DCVertex< T >::next, and DCVertex< T >::PrintEdges().

00082 {
00083    PrintEdges();
00084    if (next != 0){
00085       next->PrintGraph();
00086    }
00087 }

template<class T>
void DCVertex< T >::ResetFirstEdge ( DCEdge< T > *  newedge  )  [inline]

Definition at line 42 of file DCVertex.h.

References DCVertex< T >::edges.

00042 { edges=newedge;}

template<class T>
void DCVertex< T >::ResetNextVertex ( DCVertex< T > *  newvert  )  [inline]

Definition at line 41 of file DCVertex.h.

References DCVertex< T >::next.

00041 { next=newvert;}


Member Data Documentation

template<class T>
T* DCVertex< T >::data [private]
template<class T>
DCEdge<T>* DCVertex< T >::edges [private]
template<class T>
DCVertex<T>* DCVertex< T >::next [private]

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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1