/data3/calcul/jacquem/working_dir/Micromegas/micromegasFrameWork/lcio/src/cpp/src/CPPFORT/lccol.cc

Go to the documentation of this file.
00001 #include "CPPFORT/lccol.h"
00002 
00003 #include "lcio.h" 
00004 #include "Exceptions.h"
00005 #include "IOIMPL/LCFactory.h"
00006 #include "IMPL/LCRunHeaderImpl.h"
00007 #include "IMPL/LCCollectionVec.h"
00008 #include "IMPL/LCEventImpl.h"
00009 #include "IMPL/LCTOOLS.h"
00010 #include "EVENT/MCParticle.h"
00011 #include "EVENT/SimCalorimeterHit.h"
00012 #include "EVENT/CalorimeterHit.h"
00013 #include "EVENT/SimTrackerHit.h"
00014 #include "EVENT/TPCHit.h"
00015 #include "EVENT/LCIO.h"
00016 
00017 #include <iostream>
00018 
00019 using namespace lcio ;
00020 using namespace std ;
00021 
00022 PTRTYPE lccolcreate( const char* colname ){
00023   LCCollectionVec* col = new LCCollectionVec( colname ) ;
00024   return reinterpret_cast<PTRTYPE>( col ) ;
00025 }
00026 int lccoldelete( PTRTYPE collection ){
00027   LCCollectionVec* col = reinterpret_cast<LCCollectionVec*>(collection) ;
00028   delete col ;
00029   return LCIO::SUCCESS ;
00030 }
00031 
00032 int lccolgetnumberofelements( PTRTYPE collection ){
00033   LCCollectionVec* col = reinterpret_cast<LCCollectionVec*>(collection) ;
00034   return col->getNumberOfElements() ;
00035 }
00036 
00037 char* lccolgettypename( PTRTYPE collection ){
00038   const LCCollectionVec* col = reinterpret_cast<LCCollectionVec*>( (collection) ) ;
00039   return const_cast<char*>( col->getTypeName().c_str() ) ;
00040 }
00041 
00042 PTRTYPE lccolgetelementat( PTRTYPE collection, int index ){
00043   LCCollectionVec* col = reinterpret_cast<LCCollectionVec*>(collection) ;
00044 //  return  reinterpret_cast<PTRTYPE>( col->getElementAt( index - 1 )  ) ;
00045   return C2F_POINTER( LCObject*, col->getElementAt( index - 1 )  ) ;
00046 }
00047 
00048 int lccolgetflag(PTRTYPE collection){
00049   LCCollectionVec* col = reinterpret_cast<LCCollectionVec*>(collection) ;
00050   return col->getFlag() ;
00051 }
00052 
00053 bool lccolistransient(PTRTYPE collection){
00054   LCCollectionVec* col = reinterpret_cast<LCCollectionVec*>(collection) ;
00055   return col->isTransient() ;
00056 }
00057 
00058 int lccolsettransient(PTRTYPE collection, bool value){
00059   LCCollectionVec* col = reinterpret_cast<LCCollectionVec*>(collection) ;
00060   col->setTransient( value) ;
00061   return LCIO::SUCCESS ;
00062 }
00063 bool lccolisdefault(PTRTYPE collection){
00064   LCCollectionVec* col = reinterpret_cast<LCCollectionVec*>(collection) ;
00065   return col->isDefault() ;
00066 }
00067 
00068 int lccolsetdefault(PTRTYPE collection, bool value){
00069   LCCollectionVec* col = reinterpret_cast<LCCollectionVec*>(collection) ;
00070   col->setDefault( value) ;
00071   return LCIO::SUCCESS ;
00072 }
00073  
00074 int lccolsetflag(PTRTYPE collection, int flag){
00075   LCCollectionVec* col = reinterpret_cast<LCCollectionVec*>(collection) ;
00076   col->setFlag( flag) ;
00077   return LCIO::SUCCESS ;
00078 }
00079 int lccoladdelement(PTRTYPE collection, PTRTYPE object){
00080   try{
00081     LCCollectionVec* col = reinterpret_cast<LCCollectionVec*>(collection) ;
00082     col->addElement( reinterpret_cast<LCObject*>(object) ) ;
00083 
00084   }catch(...){ return LCIO::ERROR ; }
00085   return LCIO::SUCCESS ;
00086 }
00087 
00088 int lccolremoveelementat(PTRTYPE collection, int i){
00089   try{
00090     LCCollectionVec* col = reinterpret_cast<LCCollectionVec*>(collection) ;
00091     col->removeElementAt( i ) ;
00092   }catch(...){ return LCIO::ERROR ; }
00093   return LCIO::SUCCESS ;
00094 }
00095 

Generated on Mon Jan 7 13:15:21 2013 for MicromegasFramework by  doxygen 1.4.7