ATLAS Offline Software
DiskList.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef SAMPLE_HANDLER__DISK_LIST_H
6 #define SAMPLE_HANDLER__DISK_LIST_H
7 
8 //
9 // Distributed under the Boost Software License, Version 1.0.
10 // (See accompanying file LICENSE_1_0.txt or copy at
11 // http://www.boost.org/LICENSE_1_0.txt)
12 
13 // Please feel free to contact me (krumnack@iastate.edu) for bug
14 // reports, feature suggestions, praise and complaints.
15 
16 
17 
18 #include <SampleHandler/Global.h>
19 
20 #include <string>
21 
22 namespace SH
23 {
31  class DiskList
32  {
33  //
34  // public interface
35  //
36 
41  public:
42  void testInvariant () const;
43 
44 
51  public:
52  virtual ~DiskList ();
53 
54 
62  public:
63  bool next ();
64 
65 
73  public:
74  std::string path () const;
75 
76 
85  public:
86  std::string fileName () const;
87 
88 
98  public:
99  DiskList *openDir () const;
100 
101 
107  public:
108  std::string dirname () const;
109 
110 
111 
112  //
113  // protected interface
114  //
115 
122  protected:
123  DiskList ();
124 
125 
126 
127  //
128  // virtual interface
129  //
130 
134  protected:
135  virtual bool getNext () = 0;
136 
137 
141  protected:
142  virtual std::string getPath () const = 0;
143 
144 
148  protected:
149  virtual DiskList *doOpenDir () const = 0;
150 
151 
155  protected:
156  virtual std::string getDirname () const = 0;
157 
158 
159 
160  //
161  // private interface
162  //
163 
165  private:
166  enum State
167  {
171  S_BROKEN
172  };
175  };
176 }
177 
178 #endif
SH::DiskList::~DiskList
virtual ~DiskList()
standard destructor
Definition: DiskList.cxx:37
SH::DiskList::DiskList
DiskList()
standard constructor
Definition: DiskList.cxx:45
SH::DiskList::doOpenDir
virtual DiskList * doOpenDir() const =0
make a new list object for the sub-directory
SH::DiskList::getDirname
virtual std::string getDirname() const =0
the base path for the directory listed
SH::DiskList::fileName
std::string fileName() const
the filename for the current entry
Definition: DiskList.cxx:88
SH::DiskList::getNext
virtual bool getNext()=0
get the next list entry
SH::DiskList::testInvariant
void testInvariant() const
test the invariant of this object
Definition: DiskList.cxx:30
SH::DiskList::S_VALID
@ S_VALID
holding a valid entry
Definition: DiskList.h:169
SH::DiskList
an interface for listing directory contents, locally or on a file server
Definition: DiskList.h:32
SH::DiskList::m_state
State m_state
the current state
Definition: DiskList.h:174
SH::DiskList::next
bool next()
get the next list entry
Definition: DiskList.cxx:54
SH::DiskList::State
State
the current state
Definition: DiskList.h:167
SH::DiskList::openDir
DiskList * openDir() const
make a new list object for the sub-directory
Definition: DiskList.cxx:101
SH::DiskList::getPath
virtual std::string getPath() const =0
the path for the current entry.
SH::DiskList::S_BLANK
@ S_BLANK
just initialized
Definition: DiskList.h:168
SH
This module provides a lot of global definitions, forward declarations and includes that are used by ...
Definition: PrunDriver.h:15
SH::DiskList::path
std::string path() const
the path for the current entry.
Definition: DiskList.cxx:78
SH::DiskList::S_BROKEN
@ S_BROKEN
an error occured
Definition: DiskList.h:171
SH::DiskList::dirname
std::string dirname() const
the base path for the directory listed
Definition: DiskList.cxx:111
Global.h
SH::DiskList::S_DONE
@ S_DONE
finished reading entries
Definition: DiskList.h:170