LCIO  02.17
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
lccol.cc
Go to the documentation of this file.
1 #include "CPPFORT/lccol.h"
2 
3 #include "lcio.h"
4 #include "Exceptions.h"
5 #include "IOIMPL/LCFactory.h"
6 #include "IMPL/LCRunHeaderImpl.h"
7 #include "IMPL/LCCollectionVec.h"
8 #include "IMPL/LCEventImpl.h"
9 #include "IMPL/LCTOOLS.h"
10 #include "EVENT/MCParticle.h"
12 #include "EVENT/CalorimeterHit.h"
13 #include "EVENT/SimTrackerHit.h"
14 #include "EVENT/TPCHit.h"
15 #include "EVENT/LCIO.h"
16 
17 #include <iostream>
18 
19 using namespace lcio ;
20 using namespace std ;
21 
22 PTRTYPE lccolcreate( const char* colname ){
23  LCCollectionVec* col = new LCCollectionVec( colname ) ;
24  return reinterpret_cast<PTRTYPE>( col ) ;
25 }
26 int lccoldelete( PTRTYPE collection ){
27  LCCollectionVec* col = reinterpret_cast<LCCollectionVec*>(collection) ;
28  delete col ;
29  return LCIO::SUCCESS ;
30 }
31 
33  LCCollectionVec* col = reinterpret_cast<LCCollectionVec*>(collection) ;
34  return col->getNumberOfElements() ;
35 }
36 
37 char* lccolgettypename( PTRTYPE collection ){
38  const LCCollectionVec* col = reinterpret_cast<LCCollectionVec*>( (collection) ) ;
39  return const_cast<char*>( col->getTypeName().c_str() ) ;
40 }
41 
42 PTRTYPE lccolgetelementat( PTRTYPE collection, int index ){
43  LCCollectionVec* col = reinterpret_cast<LCCollectionVec*>(collection) ;
44 // return reinterpret_cast<PTRTYPE>( col->getElementAt( index - 1 ) ) ;
45  return C2F_POINTER( LCObject*, col->getElementAt( index - 1 ) ) ;
46 }
47 
48 int lccolgetflag(PTRTYPE collection){
49  LCCollectionVec* col = reinterpret_cast<LCCollectionVec*>(collection) ;
50  return col->getFlag() ;
51 }
52 
53 bool lccolistransient(PTRTYPE collection){
54  LCCollectionVec* col = reinterpret_cast<LCCollectionVec*>(collection) ;
55  return col->isTransient() ;
56 }
57 
58 int lccolsettransient(PTRTYPE collection, bool value){
59  LCCollectionVec* col = reinterpret_cast<LCCollectionVec*>(collection) ;
60  col->setTransient( value) ;
61  return LCIO::SUCCESS ;
62 }
63 bool lccolisdefault(PTRTYPE collection){
64  LCCollectionVec* col = reinterpret_cast<LCCollectionVec*>(collection) ;
65  return col->isDefault() ;
66 }
67 
68 int lccolsetdefault(PTRTYPE collection, bool value){
69  LCCollectionVec* col = reinterpret_cast<LCCollectionVec*>(collection) ;
70  col->setDefault( value) ;
71  return LCIO::SUCCESS ;
72 }
73 
74 int lccolsetflag(PTRTYPE collection, int flag){
75  LCCollectionVec* col = reinterpret_cast<LCCollectionVec*>(collection) ;
76  col->setFlag( flag) ;
77  return LCIO::SUCCESS ;
78 }
79 int lccoladdelement(PTRTYPE collection, PTRTYPE object){
80  try{
81  LCCollectionVec* col = reinterpret_cast<LCCollectionVec*>(collection) ;
82  col->addElement( reinterpret_cast<LCObject*>(object) ) ;
83 
84  }catch(...){ return LCIO::ERROR ; }
85  return LCIO::SUCCESS ;
86 }
87 
88 int lccolremoveelementat(PTRTYPE collection, int i){
89  try{
90  LCCollectionVec* col = reinterpret_cast<LCCollectionVec*>(collection) ;
91  col->removeElementAt( i ) ;
92  }catch(...){ return LCIO::ERROR ; }
93  return LCIO::SUCCESS ;
94 }
95 
LCIO_DEPRECATED_CAPI int lccolgetnumberofelements(PTRTYPE collection)
Definition: lccol.cc:32
LCIO_DEPRECATED_CAPI int lccoladdelement(PTRTYPE collection, PTRTYPE object)
Definition: lccol.cc:79
LCIO_DEPRECATED_CAPI PTRTYPE lccolgetelementat(PTRTYPE collection, int index)
Definition: lccol.cc:42
LCIO_DEPRECATED_CAPI int lccoldelete(PTRTYPE collection)
Definition: lccol.cc:26
LCIO_DEPRECATED_CAPI bool lccolistransient(PTRTYPE collection)
Definition: lccol.cc:53
LCIO_DEPRECATED_CAPI int lccolsetflag(PTRTYPE collection, int flag)
Definition: lccol.cc:74
LCIO_DEPRECATED_CAPI bool lccolisdefault(PTRTYPE collection)
Definition: lccol.cc:63
LCIO_DEPRECATED_CAPI char * lccolgettypename(PTRTYPE collection)
Definition: lccol.cc:37
long PTRTYPE
Fortran interface - define the length of pointers this has to made machine independent ...
Definition: cpointer.h:12
LCIO_DEPRECATED_CAPI int lccolsettransient(PTRTYPE collection, bool value)
Definition: lccol.cc:58
LCIO_DEPRECATED_CAPI int lccolsetdefault(PTRTYPE collection, bool value)
Definition: lccol.cc:68
LCIO_DEPRECATED_CAPI int lccolremoveelementat(PTRTYPE collection, int i)
Definition: lccol.cc:88
LCIO_DEPRECATED_CAPI PTRTYPE lccolcreate(const char *colname)
Header file for the f77-wrapper functions of the LCCollectionVec class.
Definition: lccol.cc:22
LCIO_DEPRECATED_CAPI int lccolgetflag(PTRTYPE collection)
Definition: lccol.cc:48
#define C2F_POINTER(T, ptr)
Definition: cpointer.h:33