ATLAS Offline Software
Loading...
Searching...
No Matches
InsertFileToCatalogApplication Class Reference
Inheritance diagram for InsertFileToCatalogApplication:
Collaboration diagram for InsertFileToCatalogApplication:

Public Member Functions

 InsertFileToCatalogApplication (int argc, char *argv[])
bool parseArguments ()
void execute ()
void printSyntax ()
virtual int run ()
virtual void startSession ATLAS_NOT_THREAD_SAFE ()
virtual void readFileGUIDs ()
virtual std::string readFileGUID (const std::string &pfn)

Static Public Member Functions

static bool initGaudi ()
 initialize the Gaudi framework for standalone executables

Protected Attributes

std::string m_executableName
std::string m_technologyName
IStorageSvc * m_storageSvc = nullptr
std::vector< std::string > m_args
std::vector< std::string > m_fileNames
std::vector< std::pair< std::string, std::string > > m_fidAndPfn

Private Attributes

std::string m_catalogFN

Detailed Description

Definition at line 14 of file pool_insertFileToCatalog.cxx.

Constructor & Destructor Documentation

◆ InsertFileToCatalogApplication()

InsertFileToCatalogApplication::InsertFileToCatalogApplication ( int argc,
char * argv[] )

Definition at line 28 of file pool_insertFileToCatalog.cxx.

29 : SimpleUtilityBase( argc, argv )
30{
31 initGaudi();
32}
SimpleUtilityBase(int argc=0, char *argv[]=0)
constructor taking commandline parmeters
static bool initGaudi()
initialize the Gaudi framework for standalone executables

Member Function Documentation

◆ ATLAS_NOT_THREAD_SAFE()

virtual void startSession SimpleUtilityBase::ATLAS_NOT_THREAD_SAFE ( )
virtualinherited

◆ execute()

void InsertFileToCatalogApplication::execute ( )
virtual

Reimplemented from SimpleUtilityBase.

Definition at line 65 of file pool_insertFileToCatalog.cxx.

66{
67 startSession();
69
70 // Open the file catalog and insert the pfn/fid/technology
71 SmartIF<Gaudi::IFileCatalogMgr> catalogMgr = Gaudi::svcLocator()->service<Gaudi::IFileCatalogMgr>( "Gaudi::MultiFileCatalog" );
72 SmartIF<Gaudi::IFileCatalog> catalog( catalogMgr );
73 FileCatalogUtils::addCatalog( *catalogMgr, m_catalogFN, true );
74 catalog->init();
75
76 for( const auto& fp : m_fidAndPfn ) {
77 std::string fid = fp.first; // can't be const
79 }
80 catalog->commit();
81}
std::vector< std::pair< std::string, std::string > > m_fidAndPfn
std::string m_technologyName
virtual void readFileGUIDs()
void registerPFN(Gaudi::IFileCatalog &fc, const std::string &pfn, const std::string &ftype, std::string &fid)
Register PFN, assign new FID if not given. Throws if the PFN is already registered.
std::string addCatalog(Gaudi::IFileCatalogMgr &mgr, const std::string &connect, bool forWriting=false)
Add new catalog, identified by name, to the existing ones, optionally as the write catalog.

◆ initGaudi()

bool SimpleUtilityBase::initGaudi ( )
staticinherited

initialize the Gaudi framework for standalone executables

◆ parseArguments()

bool InsertFileToCatalogApplication::parseArguments ( )
virtual

Reimplemented from SimpleUtilityBase.

Definition at line 36 of file pool_insertFileToCatalog.cxx.

37{
38 unsigned int excludedArgument = 0;
39 for ( unsigned int iArg = 0; iArg < m_args.size(); ++iArg ) {
40 if ( iArg > 0 && iArg == excludedArgument )
41 continue;
42 const std::string& arg = m_args[iArg];
43 if ( arg == "-u" ) {
44 unsigned int nextArgumentIndex = iArg + 1;
45 if( nextArgumentIndex < m_args.size() ) {
46 excludedArgument = nextArgumentIndex;
47 m_catalogFN = m_args[nextArgumentIndex];
48 }
49 }
50 else if( arg == "-t" ) {
51 unsigned int nextArgumentIndex = iArg + 1;
52 if ( nextArgumentIndex < m_args.size() ) {
53 excludedArgument = nextArgumentIndex;
54 m_technologyName = m_args[nextArgumentIndex];
55 }
56 }
57 else {
58 m_fileNames.push_back( arg );
59 }
60 }
62}
std::vector< std::string > m_args
std::vector< std::string > m_fileNames
virtual bool parseArguments()

◆ printSyntax()

void InsertFileToCatalogApplication::printSyntax ( )
virtual

Reimplemented from SimpleUtilityBase.

Definition at line 85 of file pool_insertFileToCatalog.cxx.

86{
87 std::cout << "Syntax : " << m_executableName << " [-u fileCatalog] [-t technologyType] files" << std::endl;
88}
std::string m_executableName

◆ readFileGUID()

virtual std::string SimpleUtilityBase::readFileGUID ( const std::string & pfn)
virtualinherited

◆ readFileGUIDs()

virtual void SimpleUtilityBase::readFileGUIDs ( )
virtualinherited

◆ run()

virtual int SimpleUtilityBase::run ( )
virtualinherited

Member Data Documentation

◆ m_args

std::vector< std::string > SimpleUtilityBase::m_args
protectedinherited

Definition at line 45 of file SimpleUtilityBase.h.

◆ m_catalogFN

std::string InsertFileToCatalogApplication::m_catalogFN
private

Definition at line 23 of file pool_insertFileToCatalog.cxx.

◆ m_executableName

std::string SimpleUtilityBase::m_executableName
protectedinherited

Definition at line 41 of file SimpleUtilityBase.h.

◆ m_fidAndPfn

std::vector< std::pair< std::string, std::string > > SimpleUtilityBase::m_fidAndPfn
protectedinherited

Definition at line 47 of file SimpleUtilityBase.h.

◆ m_fileNames

std::vector< std::string > SimpleUtilityBase::m_fileNames
protectedinherited

Definition at line 46 of file SimpleUtilityBase.h.

◆ m_storageSvc

IStorageSvc* SimpleUtilityBase::m_storageSvc = nullptr
protectedinherited

Definition at line 43 of file SimpleUtilityBase.h.

◆ m_technologyName

std::string SimpleUtilityBase::m_technologyName
protectedinherited

Definition at line 42 of file SimpleUtilityBase.h.


The documentation for this class was generated from the following file: