CGEM BOSS 6.6.5.f
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 <assert.h>
19#include "TrkBase/TrkIdManager.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//------------------------------------------------------------------------
47TrkId&
49//------------------------------------------------------------------------
50 _idman = rhs.idManager();
51 _value = rhs._value;
52 return *this;
53}
54
55//------------------------------------------------------------------------
56bool
57TrkId::operator<(const TrkId& other) const {
58/* if (*idManager() == *(other.idManager()) && _value < other._value) {
59 return true;
60 }
61 else {
62 if (idManager() < other.idManager()) {
63 return true;
64 }
65 else
66 return false;
67 }*/
68 std::cout << " TrkId::operator<(const TrkId& other) const needs to be checked " << std::endl;
69 if(_value < other._value) return true;
70 return false;
71}
72//------------------------------------------------------------------------
73
74
75//------------------------------------------------------------------------
76void
77TrkId::setNewValue(const TrkId& source) {
78//------------------------------------------------------------------------
79 _idman = source.idManager();
80 assert (_idman != 0);
81 _value = idManager()->nextId();
82}
83
84//------------------------------------------------------------------------
87//------------------------------------------------------------------------
88 return _idman;
89}
90
91//------------------------------------------------------------------------
92void
94//------------------------------------------------------------------------
95 _idman = idMan;
96}
virtual long nextId()=0
void setIdManager(TrkIdManager *idMan)
Definition: TrkId.cxx:93
TrkIdManager * idManager() const
Definition: TrkId.cxx:86
void setNewValue(const TrkId &)
Definition: TrkId.cxx:77
bool operator<(const TrkId &) const
Definition: TrkId.cxx:57
TrkId & operator=(const TrkId &)
Definition: TrkId.cxx:48
TrkId(long idNo, TrkIdManager *idMan)
Definition: TrkId.cxx:24
~TrkId()
Definition: TrkId.cxx:34