ATLAS Offline Software
Loading...
Searching...
No Matches
pool_insertFileToCatalog.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include <memory>
6
10
11using namespace pool;
12
14public:
15 InsertFileToCatalogApplication( int argc, char* argv[] );
16
17 bool parseArguments();
18 void execute();
19 void printSyntax();
20
21private:
22 std::string m_catalogFN;
23};
24
25
26
28 : SimpleUtilityBase( argc, argv )
29{
30 initGaudi();
31}
32
33
34bool
36{
37 unsigned int excludedArgument = 0;
38 for ( unsigned int iArg = 0; iArg < args.size(); ++iArg ) {
39 if ( iArg > 0 && iArg == excludedArgument )
40 continue;
41 const std::string& arg = args[iArg];
42 if ( arg == "-u" ) {
43 unsigned int nextArgumentIndex = iArg + 1;
44 if( nextArgumentIndex < args.size() ) {
45 excludedArgument = nextArgumentIndex;
46 m_catalogFN = args[nextArgumentIndex];
47 }
48 }
49 else if( arg == "-t" ) {
50 unsigned int nextArgumentIndex = iArg + 1;
51 if ( nextArgumentIndex < args.size() ) {
52 excludedArgument = nextArgumentIndex;
53 technologyName = args[nextArgumentIndex];
54 }
55 }
56 else {
57 fileNames.push_back( arg );
58 }
59 }
61}
62
63void
65{
66 startSession();
68
69 // Open the file catalog and insert the pfn/fid/technology
70 pool::IFileCatalog catalog;
72 catalog.start();
73
74 for( const auto& fp : fidAndPfn ) {
75 std::string fid = fp.first; // can't be const
76 catalog.registerPFN(fp.second, technologyName, fid);
77 }
78 catalog.commit();
79}
80
81
82void
84{
85 std::cout << "Syntax : " << executableName << " [-u fileCatalog] [-t technologyType] files" << std::endl;
86}
87
88
89
90int main ATLAS_NOT_THREAD_SAFE ( int argc, char* argv[] )
91{
92 InsertFileToCatalogApplication app( argc, argv );
93 return app.run();
94}
int main(int, char **)
Main class for all the CppUnit test classes.
Define macros for attributes used to control the static checker.
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
InsertFileToCatalogApplication(int argc, char *argv[])
void start()
redirect to init() for Gaudi FC
void commit()
Save catalog to file.
void registerPFN(const std::string &pfn, const std::string &ftype, std::string &fid)
Register PFN, assign new FID if not given.
void setWriteCatalog(const std::string &connect)
Establish the writable catalog, identified by name.
static bool initGaudi()
initialize the Gaudi framework for standalone executables
std::vector< std::string > fileNames
virtual void startSession ATLAS_NOT_THREAD_SAFE()
std::vector< std::string > args
virtual void readFileGUIDs()
SimpleUtilityBase(int argc=0, char *argv[]=0)
constructor taking commandline parmeters
virtual bool parseArguments()
std::vector< std::pair< std::string, std::string > > fidAndPfn
Framework include files.
Definition libname.h:15