00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef KERNEL_SELECTSTATEMENT_H
00011 #define KERNEL_SELECTSTATEMENT_H
00012
00013
00014 #include <string>
00015
00016
00017 #include "GaudiKernel/ISelectStatement.h"
00018
00046 class SelectStatement : virtual public ISelectStatement {
00047 public:
00049 explicit SelectStatement(const std::string& s)
00050 : m_select(s), m_refCount(0), m_isActive(false), m_type(STRING)
00051 {
00052 }
00054 explicit SelectStatement()
00055 : m_refCount(0), m_isActive(false), m_type(FUNCTION)
00056 {
00057 }
00059 virtual ~SelectStatement() {
00060 }
00062 virtual unsigned long addRef() {
00063 return ++m_refCount;
00064 }
00066 virtual unsigned long release() {
00067 long cnt = --m_refCount;
00068 if ( cnt <= 0 ) {
00069 delete this;
00070 }
00071 return cnt;
00072 }
00074 virtual StatusCode queryInterface(const IID& riid, void** ppvInterface) {
00075 if ( riid == IID_IInterface ) {
00076 *ppvInterface = (IInterface*)this;
00077 }
00078 if ( riid == IID_ISelectStatement ) {
00079 *ppvInterface = (ISelectStatement*)this;
00080 }
00081 else {
00082 *ppvInterface = 0;
00083 return NO_INTERFACE;
00084 }
00085 addRef();
00086 return StatusCode::SUCCESS;
00087 }
00089 long type() const {
00090 return m_type;
00091 }
00093 const std::string& criteria() const {
00094 return m_select;
00095 }
00097 void setCriteria(const std::string& crit) {
00098 m_select = crit;
00099 (m_select.length() > 0) ? m_type |= STRING : m_type &= ~STRING;
00100 }
00102 void setActive(bool flag = true) {
00103 m_isActive = flag;
00104 }
00106 bool isActive() const {
00107 return m_isActive;
00108 }
00110 virtual bool operator()(void* ) {
00111 return true;
00112 }
00113 protected:
00115 std::string m_select;
00117 long m_refCount;
00119 bool m_isActive;
00120 private:
00122 long m_type;
00123 };
00124 #endif // KERNEL_SELECTSTATEMENT_H