OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
Directory.cpp
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2// $RCSfile: Directory.cpp,v $
3// ------------------------------------------------------------------------
4// $Revision: 1.1.1.1 $
5// ------------------------------------------------------------------------
6// Copyright: see Copyright.readme
7// ------------------------------------------------------------------------
8//
9// Class: Directory
10// A directory for OPAL objects.
11//
12// ------------------------------------------------------------------------
13//
14// $Date: 2000/03/27 09:33:34 $
15// $Author: Andreas Adelmann $
16//
17// ------------------------------------------------------------------------
18
21
22
23// Class Directory
24// ------------------------------------------------------------------------
25
27 dir()
28{}
29
30
32 erase();
33}
34
35
37 return dir.begin();
38}
39
40
41ObjectDir::const_iterator Directory::begin() const {
42 return dir.begin();
43}
44
45
47 return dir.end();
48}
49
50
51ObjectDir::const_iterator Directory::end() const {
52 return dir.end();
53}
54
55
57 dir.erase(dir.begin(), dir.end());
58}
59
60
61void Directory::erase(const std::string &name) {
62 dir.erase(name);
63}
64
65
66Object *Directory::find(const std::string &name) const {
67 ObjectDir::const_iterator it = dir.find(name);
68
69 if(it == dir.end()) {
70 return nullptr;
71 } else {
72 return &*it->second;
73 }
74}
75
76
77void Directory::insert(const std::string &name, Object *newObject) {
79 dir.insert(p);
80}
T * value_type(const SliceIterator< T > &)
const std::string name
std::string::iterator iterator
Definition: MSLang.h:16
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
Reference-counted pointer.
Definition: Pointer.h:38