1 #ifndef UTIL_LCFIXEDOBJECT_H
2 #define UTIL_LCFIXEDOBJECT_H 1
5 #include "IMPL/LCGenericObjectImpl.h"
26 template <
int NINT,
int NFLOAT,
int NDOUBLE>
34 _createdObject( true ) {
35 _obj =
new LCGenericObjectImpl( NINT, NFLOAT , NDOUBLE ) ;
45 _createdObject(false) {
47 _obj =
dynamic_cast<LCGenericObjectImpl*
>(
obj ) ;
62 throw Exception(
"Cannot create LCFixedObject from sth."
63 " that is not LCGenericObjectImpl" ) ;
66 if( ( _obj->getNInt() != NINT ) ||
67 ( _obj->getNFloat() != NFLOAT ) ||
68 ( _obj->getNDouble() != NDOUBLE ) ) {
70 throw Exception(
"LCFixedObject(LCObject* obj): Wrong number of elements in object" ) ;
76 LCGenericObjectImpl*
obj() {
return _obj ; }
82 if( _createdObject )
delete _obj ;
87 virtual int id()
const {
return _obj->id() ; }
92 int getNInt()
const {
return NINT ; }
93 int getNFloat()
const {
return NFLOAT ; }
94 int getNDouble()
const {
return NDOUBLE ; }
96 int getIntVal(
int index)
const {
97 return _obj->getIntVal( index ) ;
99 float getFloatVal(
int index)
const {
100 return _obj->getFloatVal( index ) ;
102 double getDoubleVal(
int index)
const {
103 return _obj->getDoubleVal( index ) ;
105 bool isFixedSize()
const {
return true ; }
112 bool _createdObject ;
The generic object that is held in an LCCollection.
Definition: LCObject.h:30
Base exception class for LCIO - all other exceptions extend this.
Definition: Exceptions.h:21
virtual int id() const
Return the id of the underlying LCGenericObjectImpl.
Definition: LCFixedObject.h:87
LCGenericObjectImpl * obj()
The LCGenericObjectImpl .
Definition: LCFixedObject.h:76
virtual ~LCFixedObject()
Clean up if we created a new LCGenericObjectImpl.
Definition: LCFixedObject.h:81
LCFixedObject(LCObject *obj)
C'tor to be used for elements of LCGenericObjects read from an LCIO file or the database.
Definition: LCFixedObject.h:44
LCFixedObject()
Default c'tor.
Definition: LCFixedObject.h:33
Default LCIO implementation of the interface to store generic user data.
Definition: LCGenericObjectImpl.h:18
Template class for fixed size LCGenericObject subclasses.
Definition: LCFixedObject.h:27