ATLAS Offline Software
CollectionIndex.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef COLLECTIONBASE_COLLECTIONINDEX_H
6 #define COLLECTIONBASE_COLLECTIONINDEX_H
7 
9 
10 
11 namespace pool {
12 
19  class CollectionIndex : virtual public ICollectionIndex
20  {
21  public:
24  : m_name( "" ),
25  m_columnNames(),
26  m_isUnique( false ) {}
27 
35  CollectionIndex( const std::string& indexName,
36  const std::vector< std::string >& columnNames,
37  bool isUnique = false )
38  : m_name( indexName ),
40  m_isUnique( isUnique ) {}
41 
44  : ICollectionIndex(),
45  m_name( rhs.m_name ),
47  m_isUnique( rhs.m_isUnique )
48  {}
49 
52 
55  {
56  m_name = rhs.m_name;
58  m_isUnique = rhs.m_isUnique;
59 
60  return *this;
61  }
62 
64  bool operator==( const CollectionIndex& rhs ) const
65  {
66  if ( m_name == rhs.m_name &&
68  m_isUnique == rhs.m_isUnique )
69  {
70  return true;
71  }
72  else
73  {
74  return false;
75  }
76  }
77 
79  bool operator!=( const CollectionIndex& rhs ) const
80  {
81  return ( ! ( *this == rhs ) );
82  }
83 
89  virtual void setName( const std::string& name ) { m_name = name; }
90 
95  virtual std::vector<std::string>& columnNames() { return m_columnNames; }
96 
102  virtual void setIsUnique( bool isUnique ) { m_isUnique = isUnique; }
103 
105  virtual const std::string& name() const { return m_name; }
106 
108  virtual const std::vector<std::string>& columnNames() const { return m_columnNames; }
109 
111  virtual bool isUnique() const { return m_isUnique; }
112 
113  private:
115  std::string m_name;
116 
118  std::vector< std::string > m_columnNames;
119 
122  };
123 
124 }
125 
126 #endif
127 
128 
pool::CollectionIndex::columnNames
virtual std::vector< std::string > & columnNames()
Returns the names of all columns on which the index is created, with possibility for direct modificat...
Definition: CollectionIndex.h:95
pool::CollectionIndex::m_columnNames
std::vector< std::string > m_columnNames
Names of all columns on which index is created.
Definition: CollectionIndex.h:118
pool::CollectionIndex::~CollectionIndex
~CollectionIndex()
Default destructor.
Definition: CollectionIndex.h:51
pool
pool namespace
Definition: libname.h:15
pool::CollectionIndex::CollectionIndex
CollectionIndex(const std::string &indexName, const std::vector< std::string > &columnNames, bool isUnique=false)
Constructor that takes the index properties as input.
Definition: CollectionIndex.h:35
pool::CollectionIndex::columnNames
virtual const std::vector< std::string > & columnNames() const
Returns the names of all columns on which the index is created.
Definition: CollectionIndex.h:108
ICollectionIndex.h
pool::CollectionIndex
Definition: CollectionIndex.h:20
pool::CollectionIndex::operator=
CollectionIndex & operator=(const CollectionIndex &rhs)
Assignment operator.
Definition: CollectionIndex.h:54
pool::CollectionIndex::m_isUnique
bool m_isUnique
Flag indicating whether index is unique.
Definition: CollectionIndex.h:121
pool::CollectionIndex::CollectionIndex
CollectionIndex(const pool::CollectionIndex &rhs)
Copy constructor.
Definition: CollectionIndex.h:43
pool::CollectionIndex::setName
virtual void setName(const std::string &name)
Sets the name of the index.
Definition: CollectionIndex.h:89
pool::CollectionIndex::operator==
bool operator==(const CollectionIndex &rhs) const
Equality operator.
Definition: CollectionIndex.h:64
pool::CollectionIndex::m_name
std::string m_name
Name of index.
Definition: CollectionIndex.h:115
pool::CollectionIndex::operator!=
bool operator!=(const CollectionIndex &rhs) const
Inequality operator.
Definition: CollectionIndex.h:79
pool::ICollectionIndex
Definition: ICollectionIndex.h:20
pool::CollectionIndex::setIsUnique
virtual void setIsUnique(bool isUnique)
Sets the uniqueness of the index.
Definition: CollectionIndex.h:102
pool::CollectionIndex::name
virtual const std::string & name() const
Returns the name of the index.
Definition: CollectionIndex.h:105
pool::CollectionIndex::CollectionIndex
CollectionIndex()
Default constructor.
Definition: CollectionIndex.h:23
pool::CollectionIndex::isUnique
virtual bool isUnique() const
Indicates whether the combination of indexed column values must be different for each row.
Definition: CollectionIndex.h:111