\section{lccd\-:\-:D\-B\-Cond\-Handler Class Reference}
\label{classlccd_1_1DBCondHandler}\index{lccd\-::\-D\-B\-Cond\-Handler@{lccd\-::\-D\-B\-Cond\-Handler}}


Implementation of \doxyref{Conditions\-Handler\-Base}{p.}{classlccd_1_1ConditionsHandlerBase} that reads the conditions data from the database.  




{\ttfamily \#include $<$D\-B\-Cond\-Handler.\-hh$>$}

Inheritance diagram for lccd\-:\-:D\-B\-Cond\-Handler\-:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=3.000000cm]{classlccd_1_1DBCondHandler}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
{\bf D\-B\-Cond\-Handler} (const std\-::string \&db\-Init, const std\-::string \&folder, const std\-::string \&{\bf name}, const std\-::string \&tag=\char`\"{}\char`\"{})
\begin{DoxyCompactList}\small\item\em Default constructor. \end{DoxyCompactList}\item 
virtual void {\bf update} ({\bf L\-C\-C\-D\-Time\-Stamp} time\-Stamp)
\begin{DoxyCompactList}\small\item\em Retrieves the conditions data from the data base if time stamp exceeds current validity time range. \end{DoxyCompactList}\item 
virtual void {\bf register\-Default\-Collection} (lcio\-::\-L\-C\-Collection $\ast$col)\label{classlccd_1_1DBCondHandler_a1bc75082a1737fb7e1e924de43a9bab0}

\begin{DoxyCompactList}\small\item\em Register a pointer to a default collection which will be passed to the \doxyref{I\-Conditions\-Change\-Listener}{p.}{classlccd_1_1IConditionsChangeListener} if no data can be found for a given time stamp. \end{DoxyCompactList}\item 
virtual lcio\-::\-L\-C\-Collection $\ast$ {\bf default\-Collection} ()\label{classlccd_1_1DBCondHandler_a35cfa35473afc373e02db0dc1a2e0af1}

\begin{DoxyCompactList}\small\item\em The default collection registered with the handler. \end{DoxyCompactList}\item 
virtual lcio\-::\-L\-C\-Collection $\ast$ {\bf last\-Valid\-Collection} ()\label{classlccd_1_1DBCondHandler_ad3d348e363f6595ea3e87ac15d0577a3}

\begin{DoxyCompactList}\small\item\em The last valid collection held by the handler. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Protected Attributes}
\begin{DoxyCompactItemize}
\item 
{\bf lccd\-::\-D\-B\-Interface} $\ast$ {\bfseries \-\_\-db}\label{classlccd_1_1DBCondHandler_ad96a873bba09ae037d038bc00919a5dd}

\item 
std\-::string {\bfseries \-\_\-db\-Init}\label{classlccd_1_1DBCondHandler_ab7ab69fe23f7b67455c53a4b66e3fd90}

\item 
std\-::string {\bfseries \-\_\-folder}\label{classlccd_1_1DBCondHandler_a7697c2ba212cd4038e0a29604b4e49ef}

\item 
std\-::string {\bfseries \-\_\-tag}\label{classlccd_1_1DBCondHandler_a1ee760c482f1888d8824aa2879668dc0}

\item 
lcio\-::\-L\-C\-Collection $\ast$ {\bf \-\_\-default\-Collection}\label{classlccd_1_1DBCondHandler_a5e19946f2946f95d94450128c55fcce8}

\begin{DoxyCompactList}\small\item\em The registered default collection. \end{DoxyCompactList}\item 
lcio\-::\-L\-C\-Collection $\ast$ {\bf \-\_\-last\-Valid\-Collection}
\begin{DoxyCompactList}\small\item\em The last valid collection of conditions data. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Additional Inherited Members}


\subsection{Detailed Description}
Implementation of \doxyref{Conditions\-Handler\-Base}{p.}{classlccd_1_1ConditionsHandlerBase} that reads the conditions data from the database. 

On every call to \doxyref{update()}{p.}{classlccd_1_1DBCondHandler_a3ea91c36bcdb5e79824c581802d0004e} it checks whether the provided time stamp exceeds the validity of the current conditions data. If so, new constants are retrieved from the data base.

In the case where no collection is available for a given time range, the default collection will be set as the present collection, and will be the one returned to the registered \doxyref{I\-Conditions\-Change\-Listener}{p.}{classlccd_1_1IConditionsChangeListener}. The previously last valid collection i.\-e. not the Default Collection, will be held and can be accessed via the method \doxyref{last\-Valid\-Collection()}{p.}{classlccd_1_1DBCondHandler_ad3d348e363f6595ea3e87ac15d0577a3}.

The Default Collection should be set via the method \doxyref{register\-Default\-Collection( lcio\-::\-L\-C\-Collection$\ast$ col)}{p.}{classlccd_1_1DBCondHandler_a1bc75082a1737fb7e1e924de43a9bab0} In the case of no collection found and no Default Collection set an exception will be raised. Only one Default Collection may be registered per Conditions Handler. Trying to register additional Default Collections will cause an lccd\-::\-Exception( std\-::string ) to be thrown.

The default collection may be accessed via the method \doxyref{default\-Collection()}{p.}{classlccd_1_1DBCondHandler_a35cfa35473afc373e02db0dc1a2e0af1}, and if so desired this method should be used by the \doxyref{I\-Conditions\-Change\-Listener}{p.}{classlccd_1_1IConditionsChangeListener} to verify if this is the collection provided via the call-\/back method conditions\-Changed.

Upon registering an \doxyref{I\-Conditions\-Change\-Listener}{p.}{classlccd_1_1IConditionsChangeListener} with the Conditions Handler the call-\/back method registered\-With\-Handler( I\-Conditions\-Handler$\ast$ ch ) will be called. Likewise calling \doxyref{remove\-Change\-Listener( I\-Conditions\-Change\-Listener$\ast$ cl)}{p.}{classlccd_1_1ConditionsHandlerBase_a3231c12576bf08b59d698d8575dd48b0} will call the call-\/back method de\-Registered\-With\-Handler( I\-Conditions\-Handler$\ast$ ch )

\begin{DoxyAuthor}{Author}
F.\-Gaede, S.\-Aplin, D\-E\-S\-Y 
\end{DoxyAuthor}
\begin{DoxyVersion}{Version}

\end{DoxyVersion}
\begin{DoxyParagraph}{Id\-:}
\doxyref{D\-B\-Cond\-Handler.\-hh}{p.}{DBCondHandler_8hh_source},v 1.\-2 2007-\/04-\/27 13\-:21\-:31 gaede Exp 
\end{DoxyParagraph}


\subsection{Constructor \& Destructor Documentation}
\index{lccd\-::\-D\-B\-Cond\-Handler@{lccd\-::\-D\-B\-Cond\-Handler}!D\-B\-Cond\-Handler@{D\-B\-Cond\-Handler}}
\index{D\-B\-Cond\-Handler@{D\-B\-Cond\-Handler}!lccd::DBCondHandler@{lccd\-::\-D\-B\-Cond\-Handler}}
\subsubsection[{D\-B\-Cond\-Handler}]{\setlength{\rightskip}{0pt plus 5cm}lccd\-::\-D\-B\-Cond\-Handler\-::\-D\-B\-Cond\-Handler (
\begin{DoxyParamCaption}
\item[{const std\-::string \&}]{db\-Init, }
\item[{const std\-::string \&}]{folder, }
\item[{const std\-::string \&}]{name, }
\item[{const std\-::string \&}]{tag = {\ttfamily \char`\"{}\char`\"{}}}
\end{DoxyParamCaption}
)}\label{classlccd_1_1DBCondHandler_a81d583d66fabeef1292085915b46d851}


Default constructor. 

You have to specify the following parameters\-:


\begin{DoxyParams}{Parameters}
{\em db\-Init} & initialization string for the database, e.\-g. \char`\"{}localhost\-:lccd\-\_\-test\-:calvin\-:hobbes\char`\"{} \\
\hline
{\em folder} & name of the database folder \\
\hline
{\em name} & of this conditions data set -\/ used, e.\-g. as collection name in update(\-L\-C\-Event$\ast$ evt) \\
\hline
{\em tag} & tag to be used for queries, H\-E\-A\-D if omitted \\
\hline
\end{DoxyParams}


References lccd\-::\-Conditions\-Handler\-Base\-::\-\_\-col, \-\_\-default\-Collection, and \-\_\-last\-Valid\-Collection.



\subsection{Member Function Documentation}
\index{lccd\-::\-D\-B\-Cond\-Handler@{lccd\-::\-D\-B\-Cond\-Handler}!update@{update}}
\index{update@{update}!lccd::DBCondHandler@{lccd\-::\-D\-B\-Cond\-Handler}}
\subsubsection[{update}]{\setlength{\rightskip}{0pt plus 5cm}void lccd\-::\-D\-B\-Cond\-Handler\-::update (
\begin{DoxyParamCaption}
\item[{{\bf L\-C\-C\-D\-Time\-Stamp}}]{time\-Stamp}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [virtual]}}\label{classlccd_1_1DBCondHandler_a3ea91c36bcdb5e79824c581802d0004e}


Retrieves the conditions data from the data base if time stamp exceeds current validity time range. 

\par
 Notifies all registered listeners if conditions have changed. Note in the case that no valid collection is available for time\-Stamp, the default collection will be sent if registered, otherwise an exception will be thrown which can not be caught in user code. If sent the default collection will have the following attributes attached as collection parameters\-: D\-B\-S\-I\-N\-C\-E, D\-B\-T\-I\-L\-L and D\-B\-Q\-U\-E\-R\-Y\-T\-I\-M\-E 

Implements {\bf lccd\-::\-Conditions\-Handler\-Base} \doxyref{}{p.}{classlccd_1_1ConditionsHandlerBase_aafbe952660e65887cd9290b4e62ae256}.



References lccd\-::\-Conditions\-Handler\-Base\-::\-\_\-col, \-\_\-default\-Collection, \-\_\-last\-Valid\-Collection, lccd\-::\-Conditions\-Handler\-Base\-::\-\_\-valid\-Since, lccd\-::\-Conditions\-Handler\-Base\-::\-\_\-valid\-Till, lccd\-::\-D\-B\-Q\-U\-E\-R\-Y\-T\-I\-M\-E, lccd\-::\-D\-B\-S\-I\-N\-C\-E, lccd\-::\-D\-B\-T\-I\-L\-L, lccd\-::\-D\-B\-Interface\-::find\-Collection(), lccd\-::\-D\-B\-Interface\-::find\-Last\-Valid\-Collection(), lccd\-::\-D\-B\-Interface\-::find\-Next\-Valid\-Collection(), lccd\-::\-L\-C\-C\-D\-Minus\-Inf, lccd\-::\-L\-C\-C\-D\-Plus\-Inf, lccd\-::\-Conditions\-Handler\-Base\-::name(), and lccd\-::\-Conditions\-Handler\-Base\-::notify\-Listeners().



\subsection{Member Data Documentation}
\index{lccd\-::\-D\-B\-Cond\-Handler@{lccd\-::\-D\-B\-Cond\-Handler}!\-\_\-last\-Valid\-Collection@{\-\_\-last\-Valid\-Collection}}
\index{\-\_\-last\-Valid\-Collection@{\-\_\-last\-Valid\-Collection}!lccd::DBCondHandler@{lccd\-::\-D\-B\-Cond\-Handler}}
\subsubsection[{\-\_\-last\-Valid\-Collection}]{\setlength{\rightskip}{0pt plus 5cm}lcio\-::\-L\-C\-Collection$\ast$ lccd\-::\-D\-B\-Cond\-Handler\-::\-\_\-last\-Valid\-Collection\hspace{0.3cm}{\ttfamily [protected]}}\label{classlccd_1_1DBCondHandler_a70137477a4c63adba375e90150578355}


The last valid collection of conditions data. 



Referenced by D\-B\-Cond\-Handler(), last\-Valid\-Collection(), and update().



The documentation for this class was generated from the following files\-:\begin{DoxyCompactItemize}
\item 
D\-B\-Cond\-Handler.\-hh\item 
D\-B\-Cond\-Handler.\-cc\end{DoxyCompactItemize}
