| The Gaudi Framework v30r0 (c919700c)

- 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 {
19 protected:
21 std::string m_path;
23 int m_depth;
24
25 public:
27 DataStoreItem( std::string path, int depth = 1 ) : m_path( std::move( path ) ), m_depth( depth ) { analyse(); }
29 DataStoreItem( const DataStoreItem& item ) : m_path( item.m_path ), m_depth( item.m_depth ) { analyse(); }
31 virtual ~DataStoreItem() = default;
32
34 bool operator==( const DataStoreItem& cmp ) const { return m_path == cmp.path() && m_depth == cmp.depth(); }
36 bool operator!=( const DataStoreItem& cmp ) const { return !( m_path == cmp.path() && m_depth == cmp.depth() ); }
38 DataStoreItem& operator=( const DataStoreItem& cmp )
39 {
40 m_path = cmp.path();
41 m_depth = cmp.depth();
42 analyse();
43 return *this;
44 }
46 void analyse()
47 {
48 int len = m_path.length() - 1;
49 if ( m_path[len] == '*' ) {
50 m_depth = 99999999;
51 ( m_path[len - 1] == '/' ) ? m_path.erase( len - 1, 2 ) : m_path.erase( len, 1 );
52 } else if ( m_path[len] == '+' ) {
53 ( m_path[len - 1] == '/' ) ? m_path.erase( len - 1, 2 ) : m_path.erase( len, 1 );
54 m_depth = 2;
55 }
56 }
58 const std::string& path() const { return m_path; }
60 int depth() const { return m_depth; }
61 };
62 #endif // GAUDIKERNEL_DATASTOREITEM_H
DataStoreItem::depth
int depth() const
Accessor: Retrieve load depth.
Definition: DataStoreItem.h:60
DataStoreItem::m_path
std::string m_path
Path of item to be loaded.
Definition: DataStoreItem.h:21
DataStoreItem::operator!=
bool operator!=(const DataStoreItem &cmp) const
Inequality operator.
Definition: DataStoreItem.h:36
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:58
std::string
STL class.
DataStoreItem::analyse
void analyse()
Interprete the load path for special options.
Definition: DataStoreItem.h:46
DataStoreItem::DataStoreItem
DataStoreItem(std::string path, int depth=1)
Standard Constructor.
Definition: DataStoreItem.h:27
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:23
DataStoreItem::operator==
bool operator==(const DataStoreItem &cmp) const
Equality operator.
Definition: DataStoreItem.h:34
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:38
DataStoreItem::DataStoreItem
DataStoreItem(const DataStoreItem &item)
Copy constructor.
Definition: DataStoreItem.h:29