| The Gaudi Framework v28r2-patches (bc4ad17a)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

DataStoreItem.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_DATASTOREITEM_H
2 #define GAUDIKERNEL_DATASTOREITEM_H
3
4 // STL include files
5 #include <string>
6
17 class DataStoreItem {
18 protected:
20 std::string m_path;
22 int m_depth;
23 public:
25 DataStoreItem (std::string path, int depth = 1)
26 : m_path(std::move(path)), m_depth(depth) {
27 analyse();
28 }
30 DataStoreItem (const DataStoreItem& item)
31 : m_path(item.m_path), m_depth(item.m_depth) {
32 analyse();
33 }
35 virtual ~DataStoreItem() = default;
36
38 bool operator==(const DataStoreItem& cmp) const {
39 return m_path == cmp.path() && m_depth == cmp.depth();
40 }
42 bool operator!=(const DataStoreItem& cmp) const {
43 return ! ( m_path == cmp.path() && m_depth == cmp.depth() );
44 }
46 DataStoreItem& operator=(const DataStoreItem& cmp) {
47 m_path = cmp.path();
48 m_depth = cmp.depth();
49 analyse();
50 return *this;
51 }
53 void analyse() {
54 int len = m_path.length()-1;
55 if ( m_path[len] == '*' ) {
56 m_depth = 99999999;
57 (m_path[len-1] == '/') ? m_path.erase(len-1, 2) : m_path.erase(len, 1);
58 }
59 else if ( m_path[len] == '+' ) {
60 (m_path[len-1] == '/') ? m_path.erase(len-1, 2) : m_path.erase(len, 1);
61 m_depth = 2;
62 }
63 }
65 const std::string& path() const {
66 return m_path;
67 }
69 int depth() const {
70 return m_depth;
71 }
72 };
73 #endif // GAUDIKERNEL_DATASTOREITEM_H
DataStoreItem::depth
int depth() const
Accessor: Retrieve load depth.
Definition: DataStoreItem.h:69
DataStoreItem::m_path
std::string m_path
Path of item to be loaded.
Definition: DataStoreItem.h:20
DataStoreItem::operator!=
bool operator!=(const DataStoreItem &cmp) const
Inequality operator.
Definition: DataStoreItem.h:42
std
STL namespace.
DataStoreItem
Description of the DataStoreItem class.
Definition: DataStoreItem.h:17
DataStoreItem::path
const std::string & path() const
Accessor: Retrieve load path.
Definition: DataStoreItem.h:65
std::string
STL class.
DataStoreItem::analyse
void analyse()
Interprete the load path for special options.
Definition: DataStoreItem.h:53
DataStoreItem::DataStoreItem
DataStoreItem(std::string path, int depth=1)
Standard Constructor.
Definition: DataStoreItem.h:25
std::string::erase
T erase(T...args)
DataStoreItem::m_depth
int m_depth
Depth to be auto-loaded from the requested path onwards.
Definition: DataStoreItem.h:22
DataStoreItem::operator==
bool operator==(const DataStoreItem &cmp) const
Equality operator.
Definition: DataStoreItem.h:38
std::string::length
T length(T...args)
DataStoreItem::~DataStoreItem
virtual ~DataStoreItem()=default
Standard Destructor.
DataStoreItem::operator=
DataStoreItem & operator=(const DataStoreItem &cmp)
Equivalence operator.
Definition: DataStoreItem.h:46
DataStoreItem::DataStoreItem
DataStoreItem(const DataStoreItem &item)
Copy constructor.
Definition: DataStoreItem.h:30