| # Gaudi Framework, version v20r3
Generated: 24 Nov 2008

# SelectStatement.h

Go to the documentation of this file.

    00001 //==============================================================================
    00002 // $Id: SelectStatement.h,v 1.3 2004/07/06 10:17:40 mato Exp $
    00003 //------------------------------------------------------------------------------
    00004 //
    00005 // Package : Kernel
    00006 //
    00007 // Author  : M.Frank 10/10/00
    00008 //
    00009 //==============================================================================
    00010 #ifndef KERNEL_SELECTSTATEMENT_H
    00011 #define KERNEL_SELECTSTATEMENT_H
    00012
    00013 // STL include files
    00014 #include <string>
    00015
    00016 // Framework include files
    00017 #include "GaudiKernel/ISelectStatement.h"
    00018
    00046 class SelectStatement  : virtual public ISelectStatement   {
    00047 public:
    00049   explicit SelectStatement(const std::string& s, long typ)
    00050   : m_select(s), m_refCount(0), m_isActive(false), m_type(typ)
    00051   {
    00052   }
    00054   explicit SelectStatement(const std::string& s)
    00055   : m_select(s), m_refCount(0), m_isActive(false), m_type(STRING)
    00056   {
    00057   }
    00059   explicit SelectStatement()
    00060   : m_refCount(0), m_isActive(false), m_type(FUNCTION)
    00061   {
    00062   }
    00064   virtual ~SelectStatement()  {
    00065   }
    00067   virtual unsigned long addRef()    {
    00068     return ++m_refCount;
    00069   }
    00071   virtual unsigned long release()     {
    00072     long cnt = --m_refCount;
    00073     if ( cnt <= 0 )   {
    00074       delete this;
    00075     }
    00076     return cnt;
    00077   }
    00079   virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvInterface)    {
    00080     if ( riid == IID_IInterface )   {
    00081       *ppvInterface = (IInterface*)this;
    00082     }
    00083     if ( riid == IID_ISelectStatement )   {
    00084       *ppvInterface = (ISelectStatement*)this;
    00085     }
    00086     else    {
    00087       *ppvInterface = 0;
    00088       return NO_INTERFACE;
    00089     }
    00090     addRef();
    00091     return StatusCode::SUCCESS;
    00092   }
    00094   long type()   const   {
    00095     return m_type;
    00096   }
    00098   const std::string& criteria()  const    {
    00099     return m_select;
    00100   }
    00102   void setCriteria(const std::string& crit)    {
    00103     m_select = crit;
    00104     (m_select.length() > 0) ? m_type |= STRING : m_type &= ~STRING;
    00105   }
    00107   void setActive(bool flag = true)   {
    00108     m_isActive = flag;
    00109   }
    00111   bool isActive()   const   {
    00112     return m_isActive;
    00113   }
    00115   virtual bool operator()(void* /* val */ )   {
    00116     return true;
    00117   }
    00118 protected:
    00120   std::string   m_select;
    00122   long m_refCount;
    00124   bool m_isActive;
    00126   long m_type;
    00127 };
    00128 #endif  // KERNEL_SELECTSTATEMENT_H