예제 #1
0
KVDBRecord *KVDBTable::GetRecord(Int_t num) const
{
   //Search for record using its number.
   //To keep things simple, we only search in the top level of the folder structure.
   TIter next(GetListOfFolders());
   KVDBRecord *obj = 0;
   while ((obj = (KVDBRecord *) next()) && (obj->GetNumber() != num));
   return (obj ? (obj->GetNumber() == num ? obj : 0) : 0);
}
예제 #2
0
Int_t KVDBRecord::Compare(const TObject* obj) const
{
   // Compare two record numbers for sorting lists.
   // Lists will be sorted in ascending order.

   KVDBRecord* dbobj =
      dynamic_cast < KVDBRecord* >(const_cast < TObject* >(obj));
   return (dbobj->GetNumber() ==
           GetNumber() ? 0 : (dbobj->GetNumber() > GetNumber() ? -1 : 1));
}
예제 #3
0
KVDBRecord* KVDBTable::GetRecord(Int_t num) const
{
    // Sequential search for record using its number.
    // To keep things simple, we only search in the top level of the folder structure.
    //
    // NOTE: if there are many records, this sequential search can be long.
    // If a default format for the record name using its number has been defined
    // (see SetDefaultFormat(const TString&)) the search will be performed using
    // the resulting formatted object name, which is fast (hash list).

    if (HasDefaultFormat()) return GetRecord(Form(fDefFormatNumRec.Data(), num));

    TIter next(GetListOfFolders());
    KVDBRecord* obj = 0;
    while ((obj = (KVDBRecord*) next()) && (obj->GetNumber() != num));
    return (obj ? (obj->GetNumber() == num ? obj : 0) : 0);
}
예제 #4
0
void KVDataBaseBrowser::FillRecordsList(Long_t table)
{
   //Fill fCB_Records with records found in table number "table" in the GetTables() list of dataBase

   //How many entries in fCB_Records already ?
   Int_t n_records = fCB_Records->GetListBox()->GetNumberOfEntries();

   //Clear out any existing records in list
   if (n_records)
      fCB_Records->RemoveEntries(0, n_records - 1);

   //Get list of records for our table
   KVDBTable* dbtab = (KVDBTable*) fDbase->GetTables()->At(table);

   // fill list with all available tables
   TIter next_rec(dbtab->GetRecords());
   KVDBRecord* rec;
   Int_t i = 0;
   while ((rec = (KVDBRecord*) next_rec())) {
      fCB_Records->AddEntry(rec->GetName(), i++);
   }
   //highlight first table
   fCB_Records->Select(0);
}