ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
D3PDTools
SampleHandler
Root
DiskList.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
7
//
8
// includes
9
//
10
11
#include <
SampleHandler/DiskList.h
>
12
13
#include <
RootCoreUtils/Assert.h
>
14
#include <
RootCoreUtils/ThrowMsg.h
>
15
16
//
17
// method implementations
18
//
19
20
namespace
SH
21
{
22
void
DiskList ::
23
testInvariant ()
const
24
{
25
RCU_INVARIANT
(
m_state
<=
S_BROKEN
);
26
}
27
28
29
DiskList ::
30
~DiskList ()
31
{
32
RCU_DESTROY_INVARIANT
(
this
);
33
}
34
35
36
37
DiskList ::
38
DiskList ()
39
:
m_state
(
S_BLANK
)
40
{
41
RCU_NEW_INVARIANT
(
this
);
42
}
43
44
45
46
bool
DiskList ::
47
next ()
48
{
49
RCU_CHANGE_INVARIANT
(
this
);
50
switch
(
m_state
)
51
{
52
case
S_BLANK
:
53
case
S_VALID
:
54
m_state
=
S_BROKEN
;
55
if
(
getNext
())
56
m_state
=
S_VALID
;
57
else
58
m_state
=
S_DONE
;
59
return
m_state
==
S_VALID
;
60
case
S_DONE
:
61
RCU_THROW_MSG
(
"already finished processing list"
);
62
case
S_BROKEN
:
63
RCU_THROW_MSG
(
"list is in error state"
);
64
};
65
return
false
;
// compiler dummy
66
}
67
68
69
70
std::string DiskList ::
71
path ()
const
72
{
73
RCU_READ_INVARIANT
(
this
);
74
RCU_REQUIRE2_SOFT
(
m_state
==
S_VALID
,
"getNext() has not been called successfully"
);
75
return
getPath
();
76
}
77
78
79
80
std::string DiskList ::
81
fileName ()
const
82
{
83
// no invariant used
84
std::string result =
path
();
85
std::string::size_type
split
= result.rfind (
'/'
);
86
if
(
split
!= std::string::npos)
87
result = result.substr (
split
+ 1);
88
return
result;
89
}
90
91
92
93
DiskList
*DiskList ::
94
openDir ()
const
95
{
96
RCU_READ_INVARIANT
(
this
);
97
RCU_REQUIRE2_SOFT
(
m_state
==
S_VALID
,
"getNext() has not been called successfully"
);
98
return
doOpenDir
();
99
}
100
101
102
103
std::string DiskList ::
104
dirname ()
const
105
{
106
RCU_READ_INVARIANT
(
this
);
107
return
getDirname
();
108
}
109
}
Assert.h
RCU_INVARIANT
#define RCU_INVARIANT(x)
Definition
Assert.h:196
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_REQUIRE2_SOFT
#define RCU_REQUIRE2_SOFT(x, y)
Definition
Assert.h:150
RCU_NEW_INVARIANT
#define RCU_NEW_INVARIANT(x)
Definition
Assert.h:228
RCU_READ_INVARIANT
#define RCU_READ_INVARIANT(x)
Definition
Assert.h:224
DiskList.h
RCU_THROW_MSG
#define RCU_THROW_MSG(message)
Definition
PrintMsg.h:53
ThrowMsg.h
SH::DiskList::doOpenDir
virtual DiskList * doOpenDir() const =0
make a new list object for the sub-directory
SH::DiskList::path
std::string path() const
the path for the current entry.
Definition
DiskList.cxx:71
SH::DiskList::getDirname
virtual std::string getDirname() const =0
the base path for the directory listed
SH::DiskList::S_VALID
@ S_VALID
holding a valid entry
Definition
DiskList.h:161
SH::DiskList::S_DONE
@ S_DONE
finished reading entries
Definition
DiskList.h:162
SH::DiskList::S_BROKEN
@ S_BROKEN
an error occured
Definition
DiskList.h:163
SH::DiskList::S_BLANK
@ S_BLANK
just initialized
Definition
DiskList.h:160
SH::DiskList::m_state
State m_state
the current state
Definition
DiskList.h:166
SH::DiskList::getPath
virtual std::string getPath() const =0
the path for the current entry.
SH::DiskList::getNext
virtual bool getNext()=0
get the next list entry
SH::DiskList::DiskList
DiskList()
standard constructor
Definition
DiskList.cxx:38
split
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition
hcg.cxx:179
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