| # Gaudi Framework, version v20r4
Generated: 8 Jan 2009

# SelectStatement Class Reference

`#include <SelectStatement.h>`

Inheritance diagram for SelectStatement:

[legend]
Collaboration diagram for SelectStatement:

[legend]

List of all members.

## Detailed Description

Class of a selection statement.

A select statement can either contain

- a string e.g. for refining an SQL statement
- a function object, which will be called back in order to refine a selection. This happens in calling sequences like the following:

bool MySelect::operator()(IValueLocator* l) { float px, py, pz; if ( l->get("PX",px) && l->get("PY",py) && l->get("PZ",pz) ) { float mom = sqrt(px*px+py*py+pz*pz); return mom > 100.0 * GeV; } return false; }

if "true" is returned, the object will be loaded completely.

History: +---------+----------------------------------------------+--------+ | Date | Comment | Who | +---------+----------------------------------------------+--------+ | 21/10/99| Initial version. | MF | +---------+----------------------------------------------+--------+ Author: M.Frank Version: 1.0

Definition at line 46 of file SelectStatement.h.

## Public Member Functions
| SelectStatement (const std::string &s, long typ)
| Standard Constructor initializing select string.
| SelectStatement (const std::string &s)
| Standard Constructor initializing select string.
| SelectStatement ()
| Standard Constructor initializing function call.
virtual | ~SelectStatement ()
| Standard Destructor.
virtual unsigned long | addRef ()
| Increase reference count.
virtual unsigned long | release ()
| Decrease reference count (and eventually delete).
virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvInterface)
| Query interface.
long | type () const
| Access the type of the object.
const std::string & | criteria () const
| Access the selection string.
void | setCriteria (const std::string &crit)
| Set the type.
void | setActive (bool flag=true)
| Change activity flag.
bool | isActive () const
| Check if selection is active.
virtual bool | operator() (void *)
| Stupid default implementation.
## Protected Attributes
std::string | m_select
| Select string.
long | m_refCount
| Reference counter.
bool | m_isActive
| Activation flag.
long | m_type
| Type identifier.

## Constructor & Destructor Documentation

SelectStatement::SelectStatement | ( | const std::string & | s,
|  | long | typ |
| ) |  |  | `[inline, explicit]`

Standard Constructor initializing select string.

Definition at line 49 of file SelectStatement.h.

    00050   : m_select(s), m_refCount(0), m_isActive(false), m_type(typ)
    00051   {
    00052   }

SelectStatement::SelectStatement | ( | const std::string & | s | ) | `[inline, explicit]`

Standard Constructor initializing select string.

Definition at line 54 of file SelectStatement.h.

    00055   : m_select(s), m_refCount(0), m_isActive(false), m_type(STRING)
    00056   {
    00057   }

SelectStatement::SelectStatement | ( |  | ) | `[inline, explicit]`

Standard Constructor initializing function call.

Definition at line 59 of file SelectStatement.h.

    00060   : m_refCount(0), m_isActive(false), m_type(FUNCTION)
    00061   {
    00062   }

virtual SelectStatement::~SelectStatement | ( |  | ) | `[inline, virtual]`

Standard Destructor.

Definition at line 64 of file SelectStatement.h.

    00064                               {
    00065   }

## Member Function Documentation

virtual unsigned long SelectStatement::addRef | ( |  | ) | `[inline, virtual]`

Increase reference count.

Implements IInterface.

Definition at line 67 of file SelectStatement.h.

    00067                                     {
    00068     return ++m_refCount;
    00069   }

virtual unsigned long SelectStatement::release | ( |  | ) | `[inline, virtual]`

Decrease reference count (and eventually delete).

Implements IInterface.

Definition at line 71 of file SelectStatement.h.

    00071                                       {
    00072     long cnt = --m_refCount;
    00073     if ( cnt <= 0 )   {
    00074       delete this;
    00075     }
    00076     return cnt;
    00077   }

virtual StatusCode SelectStatement::queryInterface | ( | const InterfaceID & | riid,
|  | void ** | ppvInterface |
| ) |  |  | `[inline, virtual]`

Query interface.

Implements IInterface.

Definition at line 79 of file SelectStatement.h.

    00079                                                                                      {
    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   }

long SelectStatement::type | ( |  | ) | const`[inline, virtual]`

Access the type of the object.

Implements ISelectStatement.

Definition at line 94 of file SelectStatement.h.

    00094                         {
    00095     return m_type;
    00096   }

const std::string& SelectStatement::criteria | ( |  | ) | const`[inline, virtual]`

Access the selection string.

Implements ISelectStatement.

Definition at line 98 of file SelectStatement.h.

    00098                                         {
    00099     return m_select;
    00100   }

void SelectStatement::setCriteria | ( | const std::string & | crit | ) | `[inline, virtual]`

Set the type.

Implements ISelectStatement.

Definition at line 102 of file SelectStatement.h.

    00102                                              {
    00103     m_select = crit;
    00104     (m_select.length() > 0) ? m_type |= STRING : m_type &= ~STRING;
    00105   }

void SelectStatement::setActive | ( | bool | flag = `true` | ) | `[inline, virtual]`

Change activity flag.

Implements ISelectStatement.

Definition at line 107 of file SelectStatement.h.

    00107                                      {
    00108     m_isActive = flag;
    00109   }

bool SelectStatement::isActive | ( |  | ) | const`[inline, virtual]`

Check if selection is active.

Implements ISelectStatement.

Definition at line 111 of file SelectStatement.h.

    00111                             {
    00112     return m_isActive;
    00113   }

virtual bool SelectStatement::operator() | ( | void * |  | ) | `[inline, virtual]`

Stupid default implementation.

Implements ISelectStatement.

Reimplemented in NTuple::Selector.

Definition at line 115 of file SelectStatement.h.

    00115                                               {
    00116     return true;
    00117   }

## Member Data Documentation

std::string SelectStatement::m_select`[protected]`

Select string.

Definition at line 120 of file SelectStatement.h.

long SelectStatement::m_refCount`[protected]`

Reference counter.

Definition at line 122 of file SelectStatement.h.

bool SelectStatement::m_isActive`[protected]`

Activation flag.

Definition at line 124 of file SelectStatement.h.

long SelectStatement::m_type`[protected]`

Type identifier.

Definition at line 126 of file SelectStatement.h.

The documentation for this class was generated from the following file:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r4/GaudiKernel/GaudiKernel/SelectStatement.h