ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
D3PDTools
SampleHandler
Root
DiskListLocal.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
7
//
8
// includes
9
//
10
11
#include <
SampleHandler/DiskListLocal.h
>
12
13
#include <memory>
14
#include <TSystem.h>
15
#include <
RootCoreUtils/Assert.h
>
16
#include <
RootCoreUtils/ThrowMsg.h
>
17
18
//
19
// method implementations
20
//
21
22
namespace
SH
23
{
24
void
DiskListLocal ::
25
testInvariant ()
const
26
{
27
}
28
29
30
31
DiskListLocal ::
32
DiskListLocal (
const
std::string& val_dir)
33
:
m_dir
(val_dir),
m_prefix
(val_dir),
m_dirp
(0)
34
{
35
RCU_NEW_INVARIANT
(
this
);
36
}
37
38
39
40
DiskListLocal ::
41
DiskListLocal (
const
std::string& val_dir,
const
std::string& val_prefix)
42
:
m_dir
(val_dir),
m_prefix
(val_prefix),
m_dirp
(0)
43
{
44
RCU_NEW_INVARIANT
(
this
);
45
}
46
47
48
49
DiskListLocal ::
50
~DiskListLocal ()
51
{
52
RCU_DESTROY_INVARIANT
(
this
);
53
54
if
(
m_dirp
)
55
{
56
gSystem->FreeDirectory (
m_dirp
);
57
m_dirp
= 0;
58
}
59
}
60
61
62
63
bool
DiskListLocal ::
64
getNext ()
65
{
66
RCU_CHANGE_INVARIANT
(
this
);
67
68
if
(!
m_dirp
)
69
{
70
m_dirp
= gSystem->OpenDirectory (
m_dir
.c_str());
71
if
(!
m_dirp
)
72
RCU_THROW_MSG
(
"could not open directory "
+
m_dir
);
73
}
74
75
const
char
*subresult = 0;
76
do
77
{
78
subresult = gSystem->GetDirEntry (
m_dirp
);
79
if
(subresult == 0)
80
{
81
gSystem->FreeDirectory (
m_dirp
);
82
m_dirp
= 0;
83
m_file
.clear ();
84
return
false
;
85
}
86
}
while
(strcmp (subresult,
"."
) == 0 || strcmp (subresult,
".."
) == 0);
87
m_file
= subresult;
88
return
subresult;
89
}
90
91
92
93
std::string DiskListLocal ::
94
getPath ()
const
95
{
96
RCU_READ_INVARIANT
(
this
);
97
return
m_prefix
+
"/"
+
m_file
;
98
}
99
100
101
102
DiskList
*DiskListLocal ::
103
doOpenDir ()
const
104
{
105
RCU_READ_INVARIANT
(
this
);
106
107
std::unique_ptr<DiskListLocal> result
108
(
new
DiskListLocal
(
m_dir
+
"/"
+
m_file
,
m_prefix
+
"/"
+
m_file
));
109
result->m_dirp = gSystem->OpenDirectory (result->m_dir.c_str());
110
if
(result->m_dirp)
111
return
result.release();
112
return
0;
113
}
114
115
116
117
std::string DiskListLocal ::
118
getDirname ()
const
119
{
120
RCU_READ_INVARIANT
(
this
);
121
return
m_dir
;
122
}
123
}
Assert.h
RCU_DESTROY_INVARIANT
#define RCU_DESTROY_INVARIANT(x)
Definition
Assert.h:230
RCU_CHANGE_INVARIANT
#define RCU_CHANGE_INVARIANT(x)
Definition
Assert.h:226
RCU_NEW_INVARIANT
#define RCU_NEW_INVARIANT(x)
Definition
Assert.h:228
RCU_READ_INVARIANT
#define RCU_READ_INVARIANT(x)
Definition
Assert.h:224
DiskListLocal.h
RCU_THROW_MSG
#define RCU_THROW_MSG(message)
Definition
PrintMsg.h:53
ThrowMsg.h
SH::DiskListLocal::m_prefix
std::string m_prefix
the directory from with to read actual files
Definition
DiskListLocal.h:105
SH::DiskListLocal::m_dir
std::string m_dir
the directory we are reading
Definition
DiskListLocal.h:101
SH::DiskListLocal::m_dirp
void * m_dirp
the directory pointer used
Definition
DiskListLocal.h:109
SH::DiskListLocal::DiskListLocal
DiskListLocal(const std::string &val_dir)
make the listing for the given directory
Definition
DiskListLocal.cxx:32
SH::DiskListLocal::m_file
std::string m_file
the file we last fetched
Definition
DiskListLocal.h:113
SH::DiskList::DiskList
DiskList()
standard constructor
Definition
DiskList.cxx:38
SH
This module provides a lot of global definitions, forward declarations and includes that are used by ...
Definition
PrunDriver.h:15
Generated on
for ATLAS Offline Software by
1.17.0