LCIO  02.17
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LCGenericObjectImpl.cc
Go to the documentation of this file.
1 
3 
4 using namespace EVENT ;
5 
6 namespace IMPL {
7 
8 
9  const std::string LCGenericObjectImpl::_typeName = "LCGenericObject" ;
10  const std::string LCGenericObjectImpl::_dataDescription = "" ;
11 
12 
13 
14  LCGenericObjectImpl::LCGenericObjectImpl():
15  _isFixedSize( false ) {
16 
17  }
18 
19 
20  LCGenericObjectImpl::LCGenericObjectImpl(int nInt, int nFloat, int nDouble):
21  _isFixedSize( true ) { // FIXME - fixed size is a collection property !!!
22  _intVec.resize( nInt ) ;
23  _floatVec.resize( nFloat ) ;
24  _doubleVec.resize( nDouble ) ;
25  }
26 
28  return _intVec.size() ;
29  }
31  return _floatVec.size() ;
32  }
33 
35  return _doubleVec.size() ;
36  }
37 
38  int LCGenericObjectImpl::getIntVal(int index) const{
39  return _intVec[ index ] ;
40  }
41 
42  float LCGenericObjectImpl::getFloatVal(int index) const{
43  return _floatVec[ index ] ;
44  }
45 
46  double LCGenericObjectImpl::getDoubleVal(int index) const{
47  return _doubleVec[ index ] ;
48  }
49 
51  return _isFixedSize ;
52  }
53 
54  void LCGenericObjectImpl::setIntVal(unsigned index, int value) {
55  if( _intVec.size() <= index && !_isFixedSize )
56  _intVec.resize( index+1 ) ;
57  _intVec[ index ] = value ;
58  }
59 
60  void LCGenericObjectImpl::setFloatVal(unsigned index, float value){
61  if( _floatVec.size() <= index && !_isFixedSize )
62  _floatVec.resize( index+1 ) ;
63  _floatVec[ index ] = value ;
64  }
65 
66  void LCGenericObjectImpl::setDoubleVal(unsigned index, double value){
67  if( _doubleVec.size() <= index && !_isFixedSize )
68  _doubleVec.resize( index+1 ) ;
69  _doubleVec[ index ] = value ;
70  }
71 
73  return _typeName ;
74  }
75 
77  return _dataDescription ;
78  }
79 
80 }
virtual void setFloatVal(unsigned index, float value)
Sets the float value at the given index.
virtual int getNFloat() const
Number of float values stored in this object.
virtual int getNDouble() const
Number of double values stored in this object.
virtual int getIntVal(int index) const
Returns the integer value for the given index.
virtual float getFloatVal(int index) const
Returns the float value for the given index.
T resize(T...args)
STL class.
virtual double getDoubleVal(int index) const
Returns the double value for the given index.
virtual void setIntVal(unsigned index, int value)
Sets the integer value at the given index.
static const std::string _dataDescription
virtual bool isFixedSize() const
True if objects of the implementation class have a fixed size, i.e getNInt, getNFloat and getNDouble ...
virtual const std::string getTypeName() const
The type name of the user class (typically the class name)
LCGenericObjectImpl()
Variable size c&#39;tor.
T size(T...args)
virtual int getNInt() const
Number of integer values stored in this object.
virtual const std::string getDataDescription() const
The description string.
std::vector< double > _doubleVec
std::vector< float > _floatVec
static const std::string _typeName
virtual void setDoubleVal(unsigned index, double value)
Sets the double value at the given index.