OPAL (Object Oriented Parallel Accelerator Library) 2022.1
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
26class Object;
27
28
29// Class Directory
30// ------------------------------------------------------------------------
31
32typedef std::map<std::string, Pointer<Object>, std::less<std::string> >
34
36// Used as the directory for OPAL objects.
37
38class Directory {
39
40public:
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]nullptr[/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
81private:
82
83 // The directory of objects.
85};
86
87#endif // OPAL_Directory_HH
std::map< std::string, Pointer< Object >, std::less< std::string > > ObjectDir
Definition: Directory.h:26
const std::string name
std::string::iterator iterator
Definition: MSLang.h:16
A map of string versus pointer to Object.
Definition: Directory.h:38
void erase()
Delete all entries.
Definition: Directory.cpp:56
ObjectDir::iterator end()
Last object in alphabetic order of name.
Definition: Directory.cpp:46
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
Directory()
Constructor.
Definition: Directory.cpp:26
ObjectDir dir
Definition: Directory.h:84
void insert(const std::string &name, Object *newObject)
Define new object.
Definition: Directory.cpp:77
The base class for all OPAL objects.
Definition: Object.h:48