Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | Friends | List of all members
nova::database::Row Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N21-01-16/NovaDatabase/cxx/include/Row.h"

Inheritance diagram for nova::database::Row:
nova::database::dBRow_t

Public Types

typedef ::nova::database::dBColumn_t dBCol_type
 
typedef ::xsd::cxx::tree::sequence< dBCol_typedBCol_sequence
 
typedef dBCol_sequence::iterator dBCol_iterator
 
typedef dBCol_sequence::const_iterator dBCol_const_iterator
 
typedef ::xsd::cxx::tree::traits< dBCol_type, char > dBCol_traits
 

Public Member Functions

 Row (const std::vector< Column > &, const dBRow_t &)
 
 Row (const std::vector< Column > &)
 
 ~Row ()
 
void Clear ()
 
template<class T >
bool Set (std::string cname, T value)
 
template<class T >
bool Update (std::string cname, T value)
 
bool InDB ()
 
void SetInDB ()
 
int NModified ()
 
void ClearModified ()
 
int NCol ()
 
ColumnCol (int i)
 
ColumnCol (std::string name)
 
ColumnCol (const char *name)
 
const dBCol_sequencedBCol () const
 
dBCol_sequencedBCol ()
 
void dBCol (const dBCol_sequence &s)
 
::xml_schema::integer getDBColCount () const
 
const dBCol_typegetDBCol (int index) const
 
dBCol_typegetDBColReference (int index)
 
bool hasDBCol () const
 
void removeAllDBCol ()
 
void addDBCol (const dBCol_type &newDBCol)
 
virtual dBRow_t_clone (::xml_schema::flags f=0,::xml_schema::container *c=0) const
 
void copyNeededFields (const dBRow_t &x)
 

Protected Member Functions

void parse (::xsd::cxx::xml::dom::parser< char > &,::xml_schema::flags)
 

Protected Attributes

dBCol_sequence dBCol_
 

Private Attributes

bool fInDB
 
int fNModified
 
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.17 2016/05/03 03:05:02 jpaley Exp

Definition at line 20 of file Row.h.

Member Typedef Documentation

typedef dBCol_sequence::const_iterator nova::database::dBRow_t::dBCol_const_iterator
inherited

Definition at line 705 of file NovaDatabase.h.

typedef dBCol_sequence::iterator nova::database::dBRow_t::dBCol_iterator
inherited

Definition at line 704 of file NovaDatabase.h.

typedef ::xsd::cxx::tree::sequence< dBCol_type > nova::database::dBRow_t::dBCol_sequence
inherited

Definition at line 703 of file NovaDatabase.h.

typedef ::xsd::cxx::tree::traits< dBCol_type, char > nova::database::dBRow_t::dBCol_traits
inherited

Definition at line 706 of file NovaDatabase.h.

Definition at line 702 of file NovaDatabase.h.

Constructor & Destructor Documentation

Row::Row ( const std::vector< Column > &  col,
const dBRow_t row 
)

Definition at line 14 of file Row.cpp.

References fCol, nova::database::dBRow_t::getDBCol(), nova::database::dBRow_t::getDBColCount(), MECModelEnuComparisons::i, and Set().

14  :
15  dBRow_t(row), fInDB(false), fNModified(0)
16 {
17  for (unsigned int i=0; i<col.size(); ++i) {
18  fCol.push_back(Column(col[i]));
19  }
20 
21  for (unsigned int i=0; i<this->getDBColCount(); ++i) {
22  this->Set(string(this->getDBCol(i).getName()),
23  string(this->getDBCol(i).getValue()));
24  }
25 
26 }
bool Set(std::string cname, T value)
Definition: Row.h:30
const dBCol_type & getDBCol(int index) const
Int_t col[ntarg]
Definition: Style.C:29
::xml_schema::integer getDBColCount() const
std::vector< Column > fCol
Definition: Row.h:63
int fNModified
Definition: Row.h:62
Row::Row ( const std::vector< Column > &  col)

Definition at line 30 of file Row.cpp.

References fCol, and MECModelEnuComparisons::i.

30  : fInDB(false), fNModified(0)
31 {
32  for (unsigned int i=0; i<col.size(); ++i) {
33  fCol.push_back(Column(col[i]));
34  }
35 }
Int_t col[ntarg]
Definition: Style.C:29
std::vector< Column > fCol
Definition: Row.h:63
int fNModified
Definition: Row.h:62
Row::~Row ( )

Definition at line 39 of file Row.cpp.

40 {
41 
42 }

Member Function Documentation

dBRow_t * nova::database::dBRow_t::_clone ( ::xml_schema::flags  f = 0,
::xml_schema::container c = 0 
) const
virtualinherited
void nova::database::dBRow_t::addDBCol ( const dBCol_type newDBCol)
inherited

Definition at line 623 of file NovaDatabase.cpp.

References nova::database::dBTable::dBColumn().

Referenced by nova::database::dBRow_t::copyNeededFields(), nova::database::Table::CreateFromDB(), and nova::database::dBRow_t::dBCol().

624  {
625  this->dBCol_.push_back (newDBCol);
626  }
dBCol_sequence dBCol_
Definition: NovaDatabase.h:767
void Row::Clear ( )
void nova::database::Row::ClearModified ( )
inline

Definition at line 47 of file Row.h.

References fNModified.

47 { fNModified = 0; }
int fNModified
Definition: Row.h:62
Column& nova::database::Row::Col ( int  i)
inline

Definition at line 51 of file Row.h.

References fCol, MECModelEnuComparisons::i, and string.

Referenced by dbutils::daqappmgr::ConfiguredProcessList::_fetchProcessData(), dbutils::daqconfig::DLRunConfig::_fetchStreamData(), dbutils::daqconfig::BNEVBRunConfig::_fetchSystemData(), dbutils::daqconfig::DLRunConfig::_fetchSystemData(), dbutils::daqconfig::GTRunConfig::_fetchTriggerData(), dbutils::daqconfig::NamedConfigUtils::_findNextAncestor(), dbutils::daqconfig::NamedConfigUtils::_findNextChild(), dbutils::daqconfig::NamedConfigUtils::_getDetails(), dbutils::daqconfig::GeneralDataReader::_getListOfValuesFromDB(), dbutils::daqconfig::GeneralDataReader::_getSetOfValuesFromDB(), dbutils::daqconfig::GeneralDataReader::_getValueFromDB(), dbutils::daqconfig::ConfigDataTree::_initialize(), nova::database::Table::AddRow(), nova::database::Table::BulkInsertInDB(), dbutils::hw::FEB::GetAllInstalled(), dbutils::hw::APD::GetAllInstalled(), dbutils::daqconfig::NamedConfigUtils::getAvailableGlobalConfigs(), dbutils::daqconfig::NamedConfigUtils::getAvailableSubsystemConfigs(), dbutils::daqconfig::NamedConfigUtils::getConfigDetailAncestry(), dbutils::daqconfig::NamedConfigUtils::getRecentGlobalConfigs(), dbutils::daqconfig::NamedConfigUtils::getSubsystemConfigIdAncestryFromGlobalId(), dbutils::daqconfig::NamedConfigUtils::getSubsystemConfigIdFromGlobalId(), dbutils::daqconfig::NamedConfigUtils::getSubsystemConfigIdFromGlobalName(), dbutils::daqconfig::NamedConfigUtils::getSubsystemConfigIdsFromGlobalId(), dbutils::daqconfig::NamedConfigUtils::getSubsystemConfigsFromGlobalId(), dbutils::daqconfig::NamedConfigUtils::incrementUsageCount(), dbutils::hw::FEB::Installed(), dbutils::hw::APD::Installed(), dbutils::gui::ConfigDataTableModel::loadData(), nova::database::Table::LoadFromCSV(), nova::database::Table::LoadFromDB(), nova::database::Table::LoadFromSSV(), Set(), nova::database::Table::SetValidityRange(), DevelopmentTests::testColumnLookup(), BasicTests::testColumnLookup(), BasicTests::testRowInsertWithAutoIncrColumn(), Update(), and nova::database::Table::WriteToDB().

51 {return fCol[i]; }
std::vector< Column > fCol
Definition: Row.h:63
Column * Row::Col ( std::string  name)

Definition at line 45 of file Row.cpp.

References fCol, and MECModelEnuComparisons::i.

46 {
47  unsigned int i=0;
48  for (; i<name.length(); ++i)
49  name[i] = tolower(name[i]);
50 
51  i=0;
52  for (; i<fCol.size(); ++i) {
53  if (fCol[i].Name() == name)
54  return &fCol[i];
55  }
56 
57  return 0;
58 }
const XML_Char * name
Definition: expat.h:151
std::vector< Column > fCol
Definition: Row.h:63
Column* nova::database::Row::Col ( const char *  name)
inline

Definition at line 53 of file Row.h.

References Col(), operator<<, check_grl::row, runNovaSAM::stream, and string.

Referenced by Col().

53 { return Col(std::string(name)); }
const XML_Char * name
Definition: expat.h:151
Column & Col(int i)
Definition: Row.h:51
enum BeamMode string
void nova::database::dBRow_t::copyNeededFields ( const dBRow_t x)
inherited

Definition at line 2095 of file NovaDatabase.cpp.

References nova::database::dBRow_t::addDBCol(), nova::database::dBTable::dBTable(), nova::database::dBRow_t::getDBCol(), nova::database::dBRow_t::getDBColCount(), nova::database::dBRow_t::hasDBCol(), and compare_h5_caf::idx.

Referenced by nova::database::copyTraits< dBRow_t >::copyNeededFields(), and nova::database::dBRow_t::~dBRow_t().

2096  {
2097  if (x.hasDBCol() && x.getDBColCount() > 0) {
2098  if (! this->hasDBCol() || this->getDBColCount() == 0) {
2099  for (::xml_schema::integer idx = 0; idx < x.getDBColCount(); ++idx) {
2100  this->addDBCol(x.getDBCol(idx));
2101  }
2102  }
2103  //else {
2104  // copyTraits<dBCol_type>::copyNeededFields(x.getDBCol(), this->dBCol());
2105  //}
2106  }
2107  }
void addDBCol(const dBCol_type &newDBCol)
::xml_schema::integer getDBColCount() const
long long integer
Definition: Database.h:136
const dBRow_t::dBCol_sequence & nova::database::dBRow_t::dBCol ( ) const
inherited

Definition at line 575 of file NovaDatabase.cpp.

Referenced by nova::database::dBCheck_t::constraint(), nova::database::operator<<(), and nova::database::dBRow_t::removeAllDBCol().

576  {
577  return this->dBCol_;
578  }
dBCol_sequence dBCol_
Definition: NovaDatabase.h:767
dBRow_t::dBCol_sequence & nova::database::dBRow_t::dBCol ( )
inherited

Definition at line 581 of file NovaDatabase.cpp.

References nova::database::dBRow_t::getDBColCount().

582  {
583  return this->dBCol_;
584  }
dBCol_sequence dBCol_
Definition: NovaDatabase.h:767
void nova::database::dBRow_t::dBCol ( const dBCol_sequence s)
inherited

Definition at line 617 of file NovaDatabase.cpp.

References nova::database::dBRow_t::addDBCol().

618  {
619  this->dBCol_ = s;
620  }
const XML_Char * s
Definition: expat.h:262
dBCol_sequence dBCol_
Definition: NovaDatabase.h:767
const dBRow_t::dBCol_type & nova::database::dBRow_t::getDBCol ( int  index) const
inherited
xml_schema::integer nova::database::dBRow_t::getDBColCount ( ) const
inherited

Definition at line 587 of file NovaDatabase.cpp.

References nova::database::dBRow_t::getDBCol().

Referenced by nova::database::dBRow_t::copyNeededFields(), nova::database::dBRow_t::dBCol(), and Row().

588  {
589  return this->dBCol_.size ();
590  }
dBCol_sequence dBCol_
Definition: NovaDatabase.h:767
dBRow_t::dBCol_type & nova::database::dBRow_t::getDBColReference ( int  index)
inherited

Definition at line 599 of file NovaDatabase.cpp.

References nova::database::dBRow_t::hasDBCol(), and allTimeWatchdog::index.

Referenced by nova::database::dBRow_t::getDBCol().

600  {
601  return this->dBCol_[index];
602  }
dBCol_sequence dBCol_
Definition: NovaDatabase.h:767
bool nova::database::dBRow_t::hasDBCol ( ) const
inherited

Definition at line 605 of file NovaDatabase.cpp.

References nova::database::dBRow_t::removeAllDBCol().

Referenced by nova::database::dBRow_t::copyNeededFields(), and nova::database::dBRow_t::getDBColReference().

606  {
607  return ! (this->dBCol_.empty ());
608  }
dBCol_sequence dBCol_
Definition: NovaDatabase.h:767
bool nova::database::Row::InDB ( )
inline

Definition at line 43 of file Row.h.

References fInDB.

43 { return fInDB; }
int nova::database::Row::NCol ( )
inline

Definition at line 49 of file Row.h.

References fCol.

49 { return fCol.size(); }
std::vector< Column > fCol
Definition: Row.h:63
int nova::database::Row::NModified ( )
inline

Definition at line 46 of file Row.h.

References fNModified.

Referenced by nova::database::Table::WriteToDB().

46 { return fNModified; }
int fNModified
Definition: Row.h:62
void nova::database::dBRow_t::parse ( ::xsd::cxx::xml::dom::parser< char > &  p,
::xml_schema::flags  f 
)
protectedinherited

Definition at line 2046 of file NovaDatabase.cpp.

References nova::database::dBRow_t::_clone(), nova::database::dBRow_t::dBCol_, MECModelEnuComparisons::i, getGoodRuns4SAM::n, and r().

Referenced by nova::database::dBRow_t::dBRow_t().

2048  {
2049  for (; p.more_content (); p.next_content (false))
2050  {
2051  const ::xercesc::DOMElement& i (p.cur_element ());
2052  const ::xsd::cxx::xml::qualified_name< char > n (
2053  ::xsd::cxx::xml::dom::name< char > (i));
2054 
2055  // dBCol
2056  //
2057  if (n.name () == "dBCol" && n.namespace_ ().empty ())
2058  {
2059  ::std::unique_ptr< dBCol_type > r (
2060  dBCol_traits::create (i, f, this));
2061 
2062  this->dBCol_.push_back (::std::move (r));
2063  continue;
2064  }
2065 
2066  break;
2067  }
2068  }
const char * p
Definition: xmltok.h:285
dBCol_sequence dBCol_
Definition: NovaDatabase.h:767
TRandom3 r(0)
void nova::database::dBRow_t::removeAllDBCol ( )
inherited

Definition at line 611 of file NovaDatabase.cpp.

References nova::database::dBRow_t::dBCol().

Referenced by nova::database::dBRow_t::hasDBCol().

612  {
613  this->dBCol_.clear ();
614  }
dBCol_sequence dBCol_
Definition: NovaDatabase.h:767
template<class T >
bool nova::database::Row::Set ( std::string  cname,
T  value 
)
inline

Definition at line 30 of file Row.h.

References col, Col(), and nova::database::Column::Set().

Referenced by nova::database::Table::BulkInsertInDB(), comi::CosmicMetrics::endJob(), comi::DataCheck::endJob(), Row(), DevelopmentTests::testEmptyStringVsNULL(), BasicTests::testEmptyStringVsNULL(), DevelopmentTests::testUpdateTwice(), BasicTests::testUpdateTwice(), and nova::database::Table::WriteToDB().

30  {
31  Column* col = this->Col(cname);
32  if (!col) return false;
33  return (col->Set(value));
34  }
const XML_Char int const XML_Char * value
Definition: expat.h:331
Int_t col[ntarg]
Definition: Style.C:29
Column & Col(int i)
Definition: Row.h:51
void nova::database::Row::SetInDB ( )
inline

Definition at line 44 of file Row.h.

References fInDB.

Referenced by nova::database::Table::LoadFromDB().

44 { fInDB = true; }
template<class T >
bool nova::database::Row::Update ( std::string  cname,
T  value 
)
inline

Definition at line 37 of file Row.h.

References col, Col(), fNModified, nova::database::Column::Modified(), and nova::database::Column::Update().

Referenced by progbar.ProgressBar::Finish(), dbutils::daqconfig::NamedConfigUtils::incrementUsageCount(), nova::database::Table::LoadFromCSV(), nova::database::Table::LoadFromSSV(), progbar.ProgressBar::Start(), and nova::database::Table::WriteToDB().

37  {
38  Column* col = this->Col(cname);
39  if (!col) return false;
40  if (! col->Modified()) fNModified++;
41  return (col->Update(value));
42  }
const XML_Char int const XML_Char * value
Definition: expat.h:331
Int_t col[ntarg]
Definition: Style.C:29
int fNModified
Definition: Row.h:62
Column & Col(int i)
Definition: Row.h:51

Friends And Related Function Documentation

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

Definition at line 69 of file Row.h.

Referenced by Col().

69  {
70  for (unsigned int i=0; i<row.fCol.size(); ++i) {
71  stream << row.fCol[i];
72  if (i < row.fCol.size()-1)
73  stream << ", ";
74  }
75  return stream;
76  }

Member Data Documentation

dBCol_sequence nova::database::dBRow_t::dBCol_
protectedinherited
std::vector<Column> nova::database::Row::fCol
private

Definition at line 63 of file Row.h.

Referenced by Clear(), Col(), NCol(), nova::database::operator<<(), and Row().

bool nova::database::Row::fInDB
private

Definition at line 61 of file Row.h.

Referenced by InDB(), and SetInDB().

int nova::database::Row::fNModified
private

Definition at line 62 of file Row.h.

Referenced by ClearModified(), NModified(), and Update().


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