The Gaudi Framework  v30r3 (a5ef0a68)
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 
18 {
19 protected:
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() ); }
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
int depth() const
Accessor: Retrieve load depth.
Definition: DataStoreItem.h:60
std::string m_path
Path of item to be loaded.
Definition: DataStoreItem.h:21
bool operator!=(const DataStoreItem &cmp) const
Inequality operator.
Definition: DataStoreItem.h:36
STL namespace.
Description of the DataStoreItem class.
Definition: DataStoreItem.h:17
const std::string & path() const
Accessor: Retrieve load path.
Definition: DataStoreItem.h:58
STL class.
void analyse()
Interprete the load path for special options.
Definition: DataStoreItem.h:46
DataStoreItem(std::string path, int depth=1)
Standard Constructor.
Definition: DataStoreItem.h:27
T erase(T...args)
int m_depth
Depth to be auto-loaded from the requested path onwards.
Definition: DataStoreItem.h:23
bool operator==(const DataStoreItem &cmp) const
Equality operator.
Definition: DataStoreItem.h:34
T length(T...args)
virtual ~DataStoreItem()=default
Standard Destructor.
DataStoreItem & operator=(const DataStoreItem &cmp)
Equivalence operator.
Definition: DataStoreItem.h:38
DataStoreItem(const DataStoreItem &item)
Copy constructor.
Definition: DataStoreItem.h:29