OPAL (Object Oriented Parallel Accelerator Library)  2024.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 
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 nullptr;
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 }
The base class for all OPAL objects.
Definition: Object.h:48
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two distribute and or modify the software for each author s protection and we want to make certain that everyone understands that there is no warranty for this free software If the software is modified by someone else and passed we want its recipients to know that what they have is not the so that any problems introduced by others will not reflect on the original authors reputations any free program is threatened constantly by software patents We wish to avoid the danger that redistributors of a free program will individually obtain patent in effect making the program proprietary To prevent we have made it clear that any patent must be licensed for everyone s free use or not licensed at all The precise terms and conditions for distribution and modification follow GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR DISTRIBUTION AND MODIFICATION This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License The refers to any such program or and a work based on the Program means either the Program or any derivative work under copyright a work containing the Program or a portion of it
Definition: LICENSE:43
Reference-counted pointer.
Definition: Pointer.h:38
Object * find(const std::string &name) const
Find entry.
Definition: Directory.cpp:66
ObjectDir dir
Definition: Directory.h:84
std::string::iterator iterator
Definition: MSLang.h:15
ObjectDir::iterator end()
Last object in alphabetic order of name.
Definition: Directory.cpp:46
void erase()
Delete all entries.
Definition: Directory.cpp:56
Directory()
Constructor.
Definition: Directory.cpp:26
const std::string name
T * value_type(const SliceIterator< T > &)
ObjectDir::iterator begin()
First object in alphabetic order of name.
Definition: Directory.cpp:36
void insert(const std::string &name, Object *newObject)
Define new object.
Definition: Directory.cpp:77