OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
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
21#include <functional>
22#include <map>
23#include <memory>
24#include <string>
25
26class Object;
27
28// Class Directory
29// ------------------------------------------------------------------------
30
31typedef std::map<std::string, std::shared_ptr<Object>, std::less<std::string> > ObjectDir;
32
34// Used as the directory for OPAL objects.
35
36class Directory {
37public:
39 // Build empty directory.
40 Directory();
41
42 ~Directory();
43
45 // (Version for non-constant directory).
46 ObjectDir::iterator begin();
47
49 // (Version for constant directory).
50 ObjectDir::const_iterator begin() const;
51
53 // (Version for non-constant directory).
54 ObjectDir::iterator end();
55
57 // (Version for constant directory).
58 ObjectDir::const_iterator end() const;
59
61 void erase();
62
64 // The entry is identified by [b]name[/b].
65 void erase(const std::string& name);
66
68 // The entry is identified by [b]name[/b].
69 // If the entry [b]name[/b] does not exist, return [b]nullptr[/b].
70 Object* find(const std::string& name) const;
71
73 // Insert new object in directory.
74 // If the entry [b]name[/b] exists already, it is removed.
75 void insert(const std::string& name, Object* newObject);
76
77private:
78 // The directory of objects.
80};
81
82#endif // OPAL_Directory_HH
std::map< std::string, std::shared_ptr< Object >, std::less< std::string > > ObjectDir
Definition Directory.h:31
A map of string versus pointer to Object.
Definition Directory.h:36
void erase()
Delete all entries.
Definition Directory.cpp:37
ObjectDir::iterator end()
Last object in alphabetic order of name.
Definition Directory.cpp:33
ObjectDir::iterator begin()
First object in alphabetic order of name.
Definition Directory.cpp:29
Object * find(const std::string &name) const
Find entry.
Definition Directory.cpp:41
Directory()
Constructor.
Definition Directory.cpp:25
ObjectDir dir
Definition Directory.h:79
void insert(const std::string &name, Object *newObject)
Define new object.
Definition Directory.cpp:51
The base class for all OPAL objects.
Definition Object.h:45