DbiValRecSet Class Reference

#include <DbiValRecSet.h>

List of all members.

Public Member Functions

 DbiValRecSet (const string &tableName, UInt_t dbNo, UInt_t seqNo=0)
virtual ~DbiValRecSet ()
UInt_t GetDbNo () const
UInt_t GetNumRows () const
const string GetTableName () const
const DbiValidityRecGetTableRow (UInt_t rowNum) const
const DbiValidityRecGetTableRowBySeqNo (UInt_t seqNo) const

Private Attributes

UInt_t fDbNo
DbiResultfResult
 Result holding table of DbiValidityRec.
map< UInt_t, const
DbiValidityRec * > 
fSeqNoToRec

Detailed Description

Id
DbiValRecSet.h,v 1.5 2006/08/08 10:51:32 west Exp

Definition at line 30 of file DbiValRecSet.h.


Constructor & Destructor Documentation

DbiValRecSet::DbiValRecSet ( const string &  tableName,
UInt_t  dbNo,
UInt_t  seqNo = 0 
)

Definition at line 28 of file DbiValRecSet.cxx.

References DbiTableProxy::GetDBProxy(), DbiTableProxyRegistry::GetTableProxy(), DbiTableProxyRegistry::Instance(), Msg::kVerbose, LEA_CTOR, MSG, and DbiDBProxy::QueryAllValidities().

00028                                                                            :
00029 fDbNo(dbNo),
00030 fResult(0)
00031 {
00032 //
00033 //
00034 //  Purpose:  Constructor
00035 //
00036 //  Arguments:
00037 //    tableName    in    Table Name whose DbiValidityRecs are required.
00038 //    dbNo         in    Database number in the cascade.
00039 //    seqNo        in    Just this SEQNO if >0 or all if 0 [default: 0]
00040 //
00041 //  Return:    n/a
00042 //
00043 //  Contact:   N. West
00044 //
00045 //  Specification:-
00046 //  =============
00047 //
00048 //  o  For the required table in the required database, load every
00049 //     DbiValidityRec into DbiResult.
00050 
00051 
00052 //  Program Notes:-
00053 //  =============
00054 
00055 //  None.
00056 
00057   LEA_CTOR    //Leak Checker
00058 
00059   MSG("Dbi", Msg::kVerbose) << "Creating DbiValRecSet" << endl;
00060 
00061 // Get Db proxy for the table.
00062   DbiValidityRec pet;
00063   const DbiDBProxy& proxy = DbiTableProxyRegistry::Instance()
00064                            .GetTableProxy(tableName,&pet)
00065                            .GetDBProxy(); 
00066 
00067 // Collect up all validity records.
00068   DbiResultSet* rset = proxy.QueryAllValidities(dbNo,seqNo);
00069   fResult = new DbiResultNonAgg(rset,&pet,0,kFALSE);
00070   delete rset;
00071 
00072  
00073 }

DbiValRecSet::~DbiValRecSet (  )  [virtual]

Definition at line 78 of file DbiValRecSet.cxx.

References fResult, Msg::kVerbose, LEA_DTOR, and MSG.

00078                             {
00079 //
00080 //
00081 //  Purpose: Destructor
00082 //
00083 //  Arguments: 
00084 //    None.
00085 //
00086 //  Return:    n/a
00087 //
00088 //  Contact:   N. West
00089 //
00090 //  Specification:-
00091 //  =============
00092 //
00093 //  o  Destroy RowStream.
00094 
00095 
00096 //  Program Notes:-
00097 //  =============
00098 
00099 //  None.
00100 
00101   LEA_DTOR    //Leak Checker
00102 
00103   MSG("Dbi", Msg::kVerbose) << "Destroying DbiValRecSet" << endl;
00104   delete fResult;
00105 
00106 }


Member Function Documentation

UInt_t DbiValRecSet::GetDbNo (  )  const [inline]

Definition at line 40 of file DbiValRecSet.h.

References fDbNo.

00040 { return fDbNo; }

UInt_t DbiValRecSet::GetNumRows (  )  const

Definition at line 110 of file DbiValRecSet.cxx.

References fResult, and DbiResult::GetNumRows().

Referenced by GetTableRowBySeqNo().

00110                                       {
00111 //
00112 //
00113 //  Purpose:  Return the number of rows.
00114 //
00115 //  Arguments: None.
00116 //
00117 //  Return:    
00118 //
00119 //  Contact:   N. West
00120 //
00121 //  Specification:-
00122 //  =============
00123 //
00124 //  o Return the number of rows.
00125 
00126 //  Program Notes:-
00127 //  =============
00128 
00129 //  None.
00130 
00131   return fResult ? fResult->GetNumRows() : 0;
00132 }

const string DbiValRecSet::GetTableName (  )  const

Definition at line 136 of file DbiValRecSet.cxx.

References fResult, and DbiResult::TableName().

00136                                               {
00137 //
00138 //
00139 //  Purpose:  Return the table name.
00140 //
00141 //  Arguments: None.
00142 //
00143 //  Return:    
00144 //
00145 //  Contact:   N. West
00146 //
00147 //  Specification:-
00148 //  =============
00149 //
00150 //  o Return the table name.
00151 
00152 //  Program Notes:-
00153 //  =============
00154 
00155 //  None.
00156 
00157   return fResult ? fResult->TableName() : "Unknown";
00158 }

const DbiValidityRec * DbiValRecSet::GetTableRow ( UInt_t  rowNum  )  const

Definition at line 162 of file DbiValRecSet.cxx.

References fResult, and DbiResult::GetTableRow().

Referenced by GetTableRowBySeqNo().

00162                                                                    {
00163 //
00164 //
00165 //  Purpose:  Return DbiValidityRec at supplied row number.
00166 //
00167 //  Arguments: 
00168 //    rowNum      in    Row number whose entry is required or 0 if none.
00169 //
00170 //  Return:    
00171 //
00172 //  Contact:   N. West
00173 //
00174 //  Specification:-
00175 //  =============
00176 //
00177 //  o Return DbiValidityRec at supplied row number.
00178 
00179 //  Program Notes:-
00180 //  =============
00181 
00182 //  None.
00183 
00184     return fResult ?
00185       dynamic_cast<const DbiValidityRec*>(fResult->GetTableRow(rowNum))
00186     : 0;
00187 }

const DbiValidityRec * DbiValRecSet::GetTableRowBySeqNo ( UInt_t  seqNo  )  const

Definition at line 191 of file DbiValRecSet.cxx.

References fSeqNoToRec, GetNumRows(), DbiValidityRec::GetSeqNo(), and GetTableRow().

Referenced by DbmModule::Import().

00192                                                                        {
00193 //
00194 //
00195 //  Purpose:  Return DbiValidityRec having supplied SeqNo.
00196 //
00197 //  Arguments: 
00198 //    seqNo        in    Sequence number of required entry or 0 if none.
00199 //
00200 //  Return:    
00201 //
00202 //  Contact:   N. West
00203 //
00204 //  Specification:-
00205 //  =============
00206 //
00207 //  o Return DbiValidityRec at supplied row number.
00208 
00209 //  Program Notes:-
00210 //  =============
00211 
00212 //  None.
00213 
00214   UInt_t numRows = GetNumRows();
00215   if ( numRows == 0 ) return 0;
00216 
00217 // Create look-up table if not yet built.
00218 
00219   if ( fSeqNoToRec.size() == 0 ) {
00220     for ( UInt_t irow = 0; irow < numRows; ++irow) {
00221       const DbiValidityRec* vrec = GetTableRow(irow);
00222       fSeqNoToRec[vrec->GetSeqNo()] = vrec;
00223     }
00224   }
00225 
00226   map<UInt_t,const DbiValidityRec*>::const_iterator itr = fSeqNoToRec.find(seqNo);
00227   return ( itr == fSeqNoToRec.end() ) ? 0 : itr->second;
00228 
00229 }


Member Data Documentation

UInt_t DbiValRecSet::fDbNo [private]

Definition at line 53 of file DbiValRecSet.h.

Referenced by GetDbNo().

Result holding table of DbiValidityRec.

Definition at line 56 of file DbiValRecSet.h.

Referenced by GetNumRows(), GetTableName(), GetTableRow(), and ~DbiValRecSet().

map<UInt_t,const DbiValidityRec*> DbiValRecSet::fSeqNoToRec [mutable, private]

Lookup SeqNo -> DbiValidityRec lazy creation - see GetTableRowBySeqNo

Definition at line 60 of file DbiValRecSet.h.

Referenced by GetTableRowBySeqNo().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1