All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DataStoreItem.h
Go to the documentation of this file.
1 // $Header: /tmp/svngaudi/tmp.jEpFh25751/Gaudi/GaudiKernel/GaudiKernel/DataStoreItem.h,v 1.2 2000/12/13 12:57:12 mato Exp $
2 #ifndef GAUDIKERNEL_DATASTOREITEM_H
3 #define GAUDIKERNEL_DATASTOREITEM_H
4 
5 // STL include files
6 #include <string>
7 
19 protected:
21  std::string m_path;
23  int m_depth;
24 public:
26  DataStoreItem (const std::string& path, int depth = 1)
27  : m_path(path), m_depth(depth) {
28  analyse();
29  }
32  : m_path(item.m_path), m_depth(item.m_depth) {
33  analyse();
34  }
36  virtual ~DataStoreItem() {
37  }
39  bool operator==(const DataStoreItem& cmp) const {
40  return m_path == cmp.path() && m_depth == cmp.depth();
41  }
43  bool operator!=(const DataStoreItem& cmp) const {
44  return ! ( m_path == cmp.path() && m_depth == cmp.depth() );
45  }
48  m_path = cmp.path();
49  m_depth = cmp.depth();
50  analyse();
51  return *this;
52  }
54  void analyse() {
55  int len = m_path.length()-1;
56  if ( m_path[len] == '*' ) {
57  m_depth = 99999999;
58  (m_path[len-1] == '/') ? m_path.erase(len-1, 2) : m_path.erase(len, 1);
59  }
60  else if ( m_path[len] == '+' ) {
61  (m_path[len-1] == '/') ? m_path.erase(len-1, 2) : m_path.erase(len, 1);
62  m_depth = 2;
63  }
64  }
66  const std::string& path() const {
67  return m_path;
68  }
70  int depth() const {
71  return m_depth;
72  }
73 };
74 #endif // GAUDIKERNEL_DATASTOREITEM_H
int depth() const
Accessor: Retrieve load depth.
Definition: DataStoreItem.h:70
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:43
DataStoreItem(const std::string &path, int depth=1)
Standard Constructor.
Definition: DataStoreItem.h:26
Description of the DataStoreItem class.
Definition: DataStoreItem.h:18
virtual ~DataStoreItem()
Standard Destructor.
Definition: DataStoreItem.h:36
const std::string & path() const
Accessor: Retrieve load path.
Definition: DataStoreItem.h:66
void analyse()
Interprete the load path for special options.
Definition: DataStoreItem.h:54
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:39
DataStoreItem & operator=(const DataStoreItem &cmp)
Equivalence operator.
Definition: DataStoreItem.h:47
DataStoreItem(const DataStoreItem &item)
Copy constructor.
Definition: DataStoreItem.h:31
tuple item
print s1,s2
Definition: ana.py:146