LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
nutools::dbi::Row Class Reference

#include "Row.h"

Public Member Functions

 Row (int ncol)
 
 Row (const std::vector< Column > &)
 
 Row (std::vector< ColumnDef > &)
 
 ~Row ()
 
void Clear ()
 
template<class T >
bool Set (int idx, T value)
 
template<class T >
bool Update (int idx, T value)
 
bool InDB ()
 
void SetInDB ()
 
int NModified ()
 
int NCol ()
 
ColumnCol (int i)
 
uint64_t Channel ()
 
float VldTime ()
 
float VldTimeEnd ()
 
bool IsVldRow ()
 
bool SetChannel (uint64_t ch)
 
bool SetVldTime (float t)
 
bool SetVldTimeEnd (float t)
 

Private Attributes

bool fInDB
 
bool fIsVldRow
 
int fNModified
 
uint64_t fChannel
 
float fVldTime
 
float fVldTimeEnd
 
std::vector< ColumnfCol
 

Friends

std::ostream & operator<< (std::ostream &stream, const Row &row)
 

Detailed Description

Generalized Database Row Interface

Author
Jonathan Paley
Version
Id
Row.h,v 1.16 2011/11/01 16:15:18 anorman Exp

Definition at line 19 of file Row.h.

Constructor & Destructor Documentation

nutools::dbi::Row::Row ( int  ncol)
inline

Definition at line 22 of file Row.h.

References Clear(), and ~Row().

22 : fIsVldRow(false), fNModified(0), fCol(ncol) { };
std::vector< Column > fCol
Definition: Row.h:76
bool fIsVldRow
Definition: Row.h:71
int fNModified
Definition: Row.h:72
nutools::dbi::Row::Row ( const std::vector< Column > &  col)

Definition at line 13 of file Row.cpp.

References fCol.

13  :
14  fInDB(false), fIsVldRow(false), fNModified(0),
15  fChannel(0xffffffff),fVldTime(0),fVldTimeEnd(0)
16  {
17  for (unsigned int i=0; i<col.size(); ++i) {
18  fCol.push_back(Column(col[i]));
19  }
20  }
std::vector< Column > fCol
Definition: Row.h:76
uint64_t fChannel
Definition: Row.h:73
bool fIsVldRow
Definition: Row.h:71
float fVldTimeEnd
Definition: Row.h:75
float fVldTime
Definition: Row.h:74
bool fInDB
Definition: Row.h:70
int fNModified
Definition: Row.h:72
nutools::dbi::Row::Row ( std::vector< ColumnDef > &  col)

Definition at line 24 of file Row.cpp.

References fCol.

24  :
25  fInDB(false), fIsVldRow(false), fNModified(0),
26  fChannel(0xffffffff),fVldTime(0),fVldTimeEnd(0)
27  {
28  for (unsigned int i=0; i<col.size(); ++i)
29  fCol.push_back(Column(col[i]));
30  }
std::vector< Column > fCol
Definition: Row.h:76
uint64_t fChannel
Definition: Row.h:73
bool fIsVldRow
Definition: Row.h:71
float fVldTimeEnd
Definition: Row.h:75
float fVldTime
Definition: Row.h:74
bool fInDB
Definition: Row.h:70
int fNModified
Definition: Row.h:72
nutools::dbi::Row::~Row ( )

Definition at line 34 of file Row.cpp.

Referenced by Row().

35  {
36 
37  }

Member Function Documentation

uint64_t nutools::dbi::Row::Channel ( )
inline

Definition at line 55 of file Row.h.

References fChannel.

Referenced by nutools::dbi::Table::FillChanRowMap(), and nutools::dbi::Table::MakeConditionsCSVString().

55 { return fChannel; }
uint64_t fChannel
Definition: Row.h:73
void nutools::dbi::Row::Clear ( )

Definition at line 40 of file Row.cpp.

References fCol.

Referenced by Row().

41  {
42  for (unsigned int i=0; i<fCol.size(); ++i)
43  fCol[i].Clear();
44 
45  }
std::vector< Column > fCol
Definition: Row.h:76
void Clear()
Definition: Row.cpp:40
Column& nutools::dbi::Row::Col ( int  i)
inline

Definition at line 53 of file Row.h.

References fCol.

Referenced by nutools::dbi::Table::AddRow(), nutools::dbi::Table::MakeConditionsCSVString(), and nutools::dbi::Table::WriteToDB().

53 {return fCol[i]; }
std::vector< Column > fCol
Definition: Row.h:76
bool nutools::dbi::Row::InDB ( )
inline

Definition at line 46 of file Row.h.

References fInDB.

46 { return fInDB; }
bool fInDB
Definition: Row.h:70
bool nutools::dbi::Row::IsVldRow ( )
inline

Definition at line 58 of file Row.h.

References fIsVldRow.

58 { return fIsVldRow; }
bool fIsVldRow
Definition: Row.h:71
int nutools::dbi::Row::NCol ( )
inline

Definition at line 51 of file Row.h.

References fCol.

51 { return fCol.size(); }
std::vector< Column > fCol
Definition: Row.h:76
int nutools::dbi::Row::NModified ( )
inline

Definition at line 49 of file Row.h.

References fNModified.

Referenced by nutools::dbi::Table::WriteToDB().

49 { return fNModified; }
int fNModified
Definition: Row.h:72
template<class T >
bool nutools::dbi::Row::Set ( int  idx,
value 
)
inline

Definition at line 31 of file Row.h.

References fCol.

Referenced by nutools::dbi::Table::WriteToDB().

31  {
32  if (idx < (int)fCol.size() && idx>=0)
33  return (fCol[idx].Set(value));
34  return false;
35  }
std::vector< Column > fCol
Definition: Row.h:76
bool Set(int idx, T value)
Definition: Row.h:31
std::string value(boost::any const &)
bool nutools::dbi::Row::SetChannel ( uint64_t  ch)
inline

Definition at line 60 of file Row.h.

References fChannel, and fIsVldRow.

60 { fIsVldRow=true; return (fChannel=ch); }
uint64_t fChannel
Definition: Row.h:73
bool fIsVldRow
Definition: Row.h:71
void nutools::dbi::Row::SetInDB ( )
inline

Definition at line 47 of file Row.h.

References fInDB.

47 { fInDB = true; }
bool fInDB
Definition: Row.h:70
bool nutools::dbi::Row::SetVldTime ( float  t)
inline

Definition at line 61 of file Row.h.

References fIsVldRow, and fVldTime.

61 { fIsVldRow=true; return (fVldTime=t); }
bool fIsVldRow
Definition: Row.h:71
float fVldTime
Definition: Row.h:74
bool nutools::dbi::Row::SetVldTimeEnd ( float  t)
inline

Definition at line 62 of file Row.h.

References fIsVldRow, fVldTime, and operator<<.

62 { fIsVldRow=true; return (fVldTime=t); }
bool fIsVldRow
Definition: Row.h:71
float fVldTime
Definition: Row.h:74
template<class T >
bool nutools::dbi::Row::Update ( int  idx,
value 
)
inline

Definition at line 38 of file Row.h.

References fCol, fNModified, and Modified().

Referenced by nutools::dbi::Table::WriteToDB().

38  {
39  if (idx < (int)fCol.size() && idx>=0) {
40  if (!fCol[idx].Modified()) fNModified++;
41  return (fCol[idx].Update(value));
42  }
43  return false;
44  }
std::vector< Column > fCol
Definition: Row.h:76
bool Update(int idx, T value)
Definition: Row.h:38
std::string value(boost::any const &)
int fNModified
Definition: Row.h:72
c1 Modified()
float nutools::dbi::Row::VldTime ( )
inline

Definition at line 56 of file Row.h.

References fVldTime.

Referenced by nutools::dbi::Table::FillChanRowMap(), and nutools::dbi::Table::MakeConditionsCSVString().

56 { return fVldTime; }
float fVldTime
Definition: Row.h:74
float nutools::dbi::Row::VldTimeEnd ( )
inline

Definition at line 57 of file Row.h.

References fVldTimeEnd.

Referenced by nutools::dbi::Table::MakeConditionsCSVString().

57 { return fVldTimeEnd; }
float fVldTimeEnd
Definition: Row.h:75

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  stream,
const Row row 
)
friend

Definition at line 82 of file Row.h.

Referenced by SetVldTimeEnd().

82  {
83  for (unsigned int i=0; i<row.fCol.size(); ++i) {
84  stream << row.fCol[i];
85  if (i < row.fCol.size()-1)
86  stream << ", ";
87  }
88  return stream;
89  }

Member Data Documentation

uint64_t nutools::dbi::Row::fChannel
private

Definition at line 73 of file Row.h.

Referenced by Channel(), and SetChannel().

std::vector<Column> nutools::dbi::Row::fCol
private

Definition at line 76 of file Row.h.

Referenced by Clear(), Col(), NCol(), nutools::dbi::operator<<(), Row(), Set(), and Update().

bool nutools::dbi::Row::fInDB
private

Definition at line 70 of file Row.h.

Referenced by InDB(), and SetInDB().

bool nutools::dbi::Row::fIsVldRow
private

Definition at line 71 of file Row.h.

Referenced by IsVldRow(), SetChannel(), SetVldTime(), and SetVldTimeEnd().

int nutools::dbi::Row::fNModified
private

Definition at line 72 of file Row.h.

Referenced by NModified(), and Update().

float nutools::dbi::Row::fVldTime
private

Definition at line 74 of file Row.h.

Referenced by SetVldTime(), SetVldTimeEnd(), and VldTime().

float nutools::dbi::Row::fVldTimeEnd
private

Definition at line 75 of file Row.h.

Referenced by VldTimeEnd().


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