BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
TrkId.cxx
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2// File and Version Information:
3// $Id: TrkId.cxx,v 1.1.1.1 2005/04/21 06:01:42 zhangy Exp $
4//
5// Description:
6// Implementation of TrkId class. Not a whole lot here.
7//
8// Environment:
9// Software developed for the BaBar Detector at the SLAC B-Factory.
10//
11// Authors:
12//
13// Copyright (C) 1996 The Board of Trustees of
14// The Leland Stanford Junior University. All Rights Reserved.
15//------------------------------------------------------------------------
16// #include "BaBar/BaBar.hh"
17#include "TrkBase/TrkId.h"
18#include "TrkBase/TrkIdManager.h"
19#include <assert.h>
20#include <iostream>
21
22// Ctors
23//------------------------------------------------------------------------
24TrkId::TrkId( long myval, TrkIdManager* man ) : _value( myval ), _idman( man ) {
25 //------------------------------------------------------------------------
26}
27
28//------------------------------------------------------------------------
29TrkId::TrkId( TrkIdManager* man ) : _value( man->nextId() ), _idman( man ) {
30 //------------------------------------------------------------------------
31}
32
33//------------------------------------------------------------------------
35 //------------------------------------------------------------------------
36}
37
38// Copy ctor
39//------------------------------------------------------------------------
40TrkId::TrkId( const TrkId& rhs ) {
41 //------------------------------------------------------------------------
42 _idman = rhs.idManager();
43 _value = rhs._value;
44}
45
46//------------------------------------------------------------------------
48 //------------------------------------------------------------------------
49 _idman = rhs.idManager();
50 _value = rhs._value;
51 return *this;
52}
53
54//------------------------------------------------------------------------
55bool TrkId::operator<( const TrkId& other ) const {
56 /* if (*idManager() == *(other.idManager()) && _value < other._value) {
57 return true;
58 }
59 else {
60 if (idManager() < other.idManager()) {
61 return true;
62 }
63 else
64 return false;
65 }*/
66 std::cout << " TrkId::operator<(const TrkId& other) const needs to be checked " << std::endl;
67 if ( _value < other._value ) return true;
68 return false;
69}
70//------------------------------------------------------------------------
71
72//------------------------------------------------------------------------
73void TrkId::setNewValue( const TrkId& source ) {
74 //------------------------------------------------------------------------
75 _idman = source.idManager();
76 assert( _idman != 0 );
77 _value = idManager()->nextId();
78}
79
80//------------------------------------------------------------------------
82 //------------------------------------------------------------------------
83 return _idman;
84}
85
86//------------------------------------------------------------------------
88 //------------------------------------------------------------------------
89 _idman = idMan;
90}
virtual long nextId()=0
void setIdManager(TrkIdManager *idMan)
Definition TrkId.cxx:87
TrkIdManager * idManager() const
Definition TrkId.cxx:81
void setNewValue(const TrkId &)
Definition TrkId.cxx:73
bool operator<(const TrkId &) const
Definition TrkId.cxx:55
TrkId & operator=(const TrkId &)
Definition TrkId.cxx:47
TrkId(long idNo, TrkIdManager *idMan)
Definition TrkId.cxx:24
~TrkId()
Definition TrkId.cxx:34