OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
Directory.h
Go to the documentation of this file.
1 #ifndef OPAL_Directory_HH
2 #define OPAL_Directory_HH
3 
4 // ------------------------------------------------------------------------
5 // $RCSfile: Directory.h,v $
6 // ------------------------------------------------------------------------
7 // $Revision: 1.1.1.1 $
8 // ------------------------------------------------------------------------
9 // Copyright: see Copyright.readme
10 // ------------------------------------------------------------------------
11 //
12 // Class: Directory
13 //
14 // ------------------------------------------------------------------------
15 //
16 // $Date: 2000/03/27 09:33:34 $
17 // $Author: Andreas Adelmann $
18 //
19 // ------------------------------------------------------------------------
20 
22 #include <functional>
23 #include <map>
24 #include <string>
25 
26 class Object;
27 
28 
29 // Class Directory
30 // ------------------------------------------------------------------------
31 
32 typedef std::map<std::string, Pointer<Object>, std::less<std::string> >
33 ObjectDir;
34 
36 // Used as the directory for OPAL objects.
37 
38 class Directory {
39 
40 public:
41 
43  // Build empty directory.
44  Directory();
45 
46  ~Directory();
47 
49  // (Version for non-constant directory).
51 
53  // (Version for constant directory).
54  ObjectDir::const_iterator begin() const;
55 
57  // (Version for non-constant directory).
59 
61  // (Version for constant directory).
62  ObjectDir::const_iterator end() const;
63 
65  void erase();
66 
68  // The entry is identified by [b]name[/b].
69  void erase(const std::string &name);
70 
72  // The entry is identified by [b]name[/b].
73  // If the entry [b]name[/b] does not exist, return [b]NULL[/b].
74  Object *find(const std::string &name) const;
75 
77  // Insert new object in directory.
78  // If the entry [b]name[/b] exists already, it is removed.
79  void insert(const std::string &name, Object *newObject);
80 
81 private:
82 
83  // The directory of objects.
85 };
86 
87 #endif // OPAL_Directory_HH
void erase()
Delete all entries.
Definition: Directory.cpp:56
A map of string versus pointer to Object.
Definition: Directory.h:38
Directory()
Constructor.
Definition: Directory.cpp:26
ObjectDir::iterator begin()
First object in alphabetic order of name.
Definition: Directory.cpp:36
Object * find(const std::string &name) const
Find entry.
Definition: Directory.cpp:66
void insert(const std::string &name, Object *newObject)
Define new object.
Definition: Directory.cpp:77
ObjectDir::iterator end()
Last object in alphabetic order of name.
Definition: Directory.cpp:46
std::map< std::string, Pointer< Object >, std::less< std::string > > ObjectDir
Definition: Directory.h:26
The base class for all OPAL objects.
Definition: Object.h:48
const std::string name
std::string::iterator iterator
Definition: MSLang.h:16
ObjectDir dir
Definition: Directory.h:84