BRAT 2.4.5
Class index
Full class index
brahmlib
BRAHMS
ROOT page
//____________________________________________________________________
//
//

//
// $Id: BrDbConditionsVar.cxx,v 1.1.1.1 2001/06/21 14:55:17 hagel Exp $
// $Author: hagel $
// $Date: 2001/06/21 14:55:17 $
// $Copyright: 2000 Brahms Collaboration 
//

#include <BrDbConditionsVar.h>
#ifndef BRAT_BrException
#include "BrException.h"
#endif
#ifndef WIN32 
#include <cstdlib>
#include <iostream>
#else 
#include <stdlib.h>
#include <iostream.h>
#endif

ClassImp(BrDbConditionsVar);
 
//____________________________________________________________________
const Char_t* BrDbConditionsVar::kTableName = "ConditionsVars";

//____________________________________________________________________
 BrDbConditionsVar::BrDbConditionsVar(void) 
{
  // Empty default constructor.
}

//____________________________________________________________________
 BrDbConditionsVar::BrDbConditionsVar(const Char_t* varName,
				     Int_t   varId,
				     const Char_t* units,
				     const Char_t* comments)
{
  // Constructor.
  SetVarName(varName);
  fVarId = varId;
  SetUnits(units);
  SetComments(comments);

  SetDBID(varId);
}

//____________________________________________________________________
BrDbQuery* 
 BrDbConditionsVar::Create(void)
{
  // Returns a SQL query string suitable for creation of this table in
  // a varbase. 

  cerr << "BrDbConditionsVar::Create not implemented for this table"
       << endl;
  return new BrDbQuery();
}

//____________________________________________________________________
BrDbConditionsVar*  
 BrDbConditionsVar::SingleInstance(TSQLRow* row)
{
  // Returns an instance of a BrDbConditionsVar. User needs to store this
  // object imidiatly. 
  if (!row) return 0;
  BrDbConditionsVar* var = 
    new BrDbConditionsVar(row->GetField(0),                 // VarName
			  strtol(row->GetField(1),NULL,0),  // varId
			  row->GetField(2),                 // VarUnits
			  row->GetField(3)                  // VarComments
			  );
  return var;
}

//____________________________________________________________________
TObjArray*    
 BrDbConditionsVar::MultipleInstance(TSQLResult* res)
{
  // Returns an (1D) array of BrDbConditionsVar's matching Query that made
  // the TSQLResult. User need to store this immediately. 
  Int_t count = (res) ? res->GetRowCount() : 0;
  TObjArray* table = new TObjArray(count);

  for (Int_t i = 0; i < count; i++)
    table->Add(BrDbConditionsVar::SingleInstance(res->Next()));
  
  return table;
}

//____________________________________________________________________
BrDbQuery* 
 BrDbConditionsVar::Insert(void) 
{
  cerr << "BrDbConditionsVar::Insert not implemented for this table"
       << endl;
  return new BrDbQuery();
}

//____________________________________________________________________
 void BrDbConditionsVar::SetVarName(const Char_t* x) {
  // Set FileType
  if (strlen(x) > 256) {
    strncpy(fVarName, x, 255);
    fVarName[255] = '0';
  } else 
    strcpy(fVarName, x);
}

//____________________________________________________________________
 void BrDbConditionsVar::SetUnits(const Char_t* x) {
  // Set TriggerSummary
  fUnitsSize = strlen(x) + 1;
  if (fUnits) 
    delete [] fUnits;
  fUnits = new Char_t[fUnitsSize];
  strcpy(fUnits, x);
  fUnits[fUnitsSize-1] = '0';
}

//____________________________________________________________________
 void BrDbConditionsVar::SetComments(const Char_t* x) {
  // Set TriggerSummary
  fCommentsSize = strlen(x) + 1;
  if (fComments) 
    delete [] fComments;
  fComments = new Char_t[fCommentsSize];
  strcpy(fComments, x);
  fComments[fCommentsSize-1] = '0';
}

//____________________________________________________________________



//
// $Log: BrDbConditionsVar.cxx,v $
// Revision 1.1.1.1  2001/06/21 14:55:17  hagel
// Initial revision of brat2
//
// Revision 1.3  2001/06/05 18:40:20  cholm
// Removed BrDbInc.h an all references to it
//
// Revision 1.2  2001/03/22 20:44:18  cholm
// Added protection for NULL TSqlRow in SingleInstance methods, and cleaned
// up a bit of the stuff.
//
// Revision 1.1  2001/01/19 16:30:48  cholm
// Revisited the Run database classes. Deleted old implemtation via BrRun,
// and put in BrDbRun, BrDbFile, BrDbMagnet, BrDbConditions*, and
// BrDbShiftReport. A description will be posted to brahms-dev-l soon.
//
// 

This page automatically generated by script docBrat by Christian Holm

Copyright ; 2002 BRAHMS Collaboration <brahmlib@rcf.rhic.bnl.gov>
Last Update on by

Validate HTML
Validate CSS