ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Database
AthenaPOOL
PoolSvc
utilities
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
7
#include "
CxxUtils/checker_macros.h
"
8
#include "
PoolSvc/IFileCatalog.h
"
9
#include "
StorageSvc/SimpleUtilityBase.h
"
10
11
using namespace
pool
;
12
13
class
ATLAS_NOT_THREAD_SAFE
InsertFileToCatalogApplication
:
public
SimpleUtilityBase
{
14
public
:
15
InsertFileToCatalogApplication
(
int
argc,
char
* argv[] );
16
17
bool
parseArguments
();
18
void
execute
();
19
void
printSyntax
();
20
21
private
:
22
std::string
m_catalogFN
;
23
};
24
25
26
27
InsertFileToCatalogApplication::InsertFileToCatalogApplication
(
int
argc,
char
* argv[] )
28
:
SimpleUtilityBase
( argc, argv )
29
{
30
initGaudi
();
31
}
32
33
34
bool
35
InsertFileToCatalogApplication::parseArguments
()
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
}
60
return
SimpleUtilityBase::parseArguments
();
61
}
62
63
void
64
InsertFileToCatalogApplication::execute
()
65
{
66
startSession();
67
readFileGUIDs
();
68
69
// Open the file catalog and insert the pfn/fid/technology
70
pool::IFileCatalog
catalog;
71
catalog.
setWriteCatalog
(
m_catalogFN
);
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
82
void
83
InsertFileToCatalogApplication::printSyntax
()
84
{
85
std::cout <<
"Syntax : "
<<
executableName
<<
" [-u fileCatalog] [-t technologyType] files"
<< std::endl;
86
}
87
88
89
90
int
main
ATLAS_NOT_THREAD_SAFE
(
int
argc,
char
* argv[] )
91
{
92
InsertFileToCatalogApplication
app( argc, argv );
93
return
app.
run
();
94
}
main
int main(int, char **)
Main class for all the CppUnit test classes.
Definition
CppUnit_SGtestdriver.cxx:141
IFileCatalog.h
SimpleUtilityBase.h
checker_macros.h
Define macros for attributes used to control the static checker.
ATLAS_NOT_THREAD_SAFE
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
Definition
checker_macros.h:212
InsertFileToCatalogApplication
Definition
pool_insertFileToCatalog.cxx:13
InsertFileToCatalogApplication::parseArguments
bool parseArguments()
Definition
pool_insertFileToCatalog.cxx:35
InsertFileToCatalogApplication::m_catalogFN
std::string m_catalogFN
Definition
pool_insertFileToCatalog.cxx:22
InsertFileToCatalogApplication::printSyntax
void printSyntax()
Definition
pool_insertFileToCatalog.cxx:83
InsertFileToCatalogApplication::InsertFileToCatalogApplication
InsertFileToCatalogApplication(int argc, char *argv[])
Definition
pool_insertFileToCatalog.cxx:27
InsertFileToCatalogApplication::execute
void execute()
Definition
pool_insertFileToCatalog.cxx:64
pool::IFileCatalog
Definition
IFileCatalog.h:20
pool::IFileCatalog::start
void start()
redirect to init() for Gaudi FC
Definition
IFileCatalog.h:36
pool::IFileCatalog::commit
void commit()
Save catalog to file.
Definition
IFileCatalog.h:38
pool::IFileCatalog::registerPFN
void registerPFN(const std::string &pfn, const std::string &ftype, std::string &fid)
Register PFN, assign new FID if not given.
Definition
IFileCatalog.cxx:67
pool::IFileCatalog::setWriteCatalog
void setWriteCatalog(const std::string &connect)
Establish the writable catalog, identified by name.
Definition
IFileCatalog.h:84
pool::SimpleUtilityBase::initGaudi
static bool initGaudi()
initialize the Gaudi framework for standalone executables
pool::SimpleUtilityBase::fileNames
std::vector< std::string > fileNames
Definition
SimpleUtilityBase.h:48
pool::SimpleUtilityBase::ATLAS_NOT_THREAD_SAFE
virtual void startSession ATLAS_NOT_THREAD_SAFE()
pool::SimpleUtilityBase::executableName
std::string executableName
Definition
SimpleUtilityBase.h:43
pool::SimpleUtilityBase::technologyName
std::string technologyName
Definition
SimpleUtilityBase.h:44
pool::SimpleUtilityBase::args
std::vector< std::string > args
Definition
SimpleUtilityBase.h:47
pool::SimpleUtilityBase::readFileGUIDs
virtual void readFileGUIDs()
pool::SimpleUtilityBase::run
virtual int run()
pool::SimpleUtilityBase::SimpleUtilityBase
SimpleUtilityBase(int argc=0, char *argv[]=0)
constructor taking commandline parmeters
pool::SimpleUtilityBase::printSyntax
virtual void printSyntax()
Definition
SimpleUtilityBase.h:37
pool::SimpleUtilityBase::parseArguments
virtual bool parseArguments()
pool::SimpleUtilityBase::fidAndPfn
std::vector< std::pair< std::string, std::string > > fidAndPfn
Definition
SimpleUtilityBase.h:49
pool::SimpleUtilityBase::execute
virtual void execute()
Definition
SimpleUtilityBase.h:36
pool
Framework include files.
Definition
libname.h:15
Generated on
for ATLAS Offline Software by
1.17.0