OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
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 
20 #include "AbstractObjects/Object.h"
21 
22 
23 // Class Directory
24 // ------------------------------------------------------------------------
25 
27  dir()
28 {}
29 
30 
32  erase();
33 }
34 
35 
37  return dir.begin();
38 }
39 
40 
41 ObjectDir::const_iterator Directory::begin() const {
42  return dir.begin();
43 }
44 
45 
47  return dir.end();
48 }
49 
50 
51 ObjectDir::const_iterator Directory::end() const {
52  return dir.end();
53 }
54 
55 
57  dir.erase(dir.begin(), dir.end());
58 }
59 
60 
61 void Directory::erase(const std::string &name) {
62  dir.erase(name);
63 }
64 
65 
66 Object *Directory::find(const std::string &name) const {
67  ObjectDir::const_iterator it = dir.find(name);
68 
69  if(it == dir.end()) {
70  return NULL;
71  } else {
72  return &*it->second;
73  }
74 }
75 
76 
77 void Directory::insert(const std::string &name, Object *newObject) {
78  ObjectDir::value_type p(name, Pointer<Object>(newObject));
79  dir.insert(p);
80 }
void erase()
Delete all entries.
Definition: Directory.cpp:56
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
Reference-counted pointer.
Definition: Pointer.h:38
void insert(const std::string &name, Object *newObject)
Define new object.
Definition: Directory.cpp:77
T * value_type(const SliceIterator< T > &)
ObjectDir::iterator end()
Last object in alphabetic order of name.
Definition: Directory.cpp:46
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