Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

rdbModel::Row Class Reference

#include <Column.h>

List of all members.

Public Member Functions

void addField (const FieldVal &f)
void addField (const FieldVal &f)
void clear ()
void clear ()
FieldValfind (std::string colname)
FieldValfind (std::string colname)
void regroup (std::vector< std::string > &colNames, std::vector< std::string > &colVals, std::vector< std::string > &nullCols) const
 Reorder information suitable for Connection::insert.
void regroup (std::vector< std::string > &colNames, std::vector< std::string > &colVals, std::vector< std::string > &nullCols) const
 Reorder information suitable for Connection::insert.
 Row (std::vector< FieldVal > &fields)
 Row ()
 Row (std::vector< FieldVal > &fields)
 Row ()
void rowSort ()
void rowSort ()
 ~Row ()
 ~Row ()

Private Attributes

std::vector< FieldValm_fields
std::vector< FieldValm_fields
bool m_sorted


Detailed Description

A collection of column names and values.


Constructor & Destructor Documentation

rdbModel::Row::Row  )  [inline]
 

00152 : m_sorted(false) {m_fields.clear();}

rdbModel::Row::Row std::vector< FieldVal > &  fields  )  [inline]
 

00153 : m_fields(fields), m_sorted(false) {}

rdbModel::Row::~Row  )  [inline]
 

00155 { m_fields.clear(); }

rdbModel::Row::Row  )  [inline]
 

00152 : m_sorted(false) {m_fields.clear();}

rdbModel::Row::Row std::vector< FieldVal > &  fields  )  [inline]
 

00153 : m_fields(fields), m_sorted(false) {}

rdbModel::Row::~Row  )  [inline]
 

00155 { m_fields.clear(); }


Member Function Documentation

void rdbModel::Row::addField const FieldVal f  )  [inline]
 

00157 {m_fields.push_back(f); m_sorted = false;}

void rdbModel::Row::addField const FieldVal f  )  [inline]
 

00157 {m_fields.push_back(f); m_sorted = false;}

void rdbModel::Row::clear void   )  [inline]
 

00158 {m_fields.clear();}

void rdbModel::Row::clear  )  [inline]
 

00158 {m_fields.clear();}

FieldVal* rdbModel::Row::find std::string  colname  ) 
 

FieldVal * rdbModel::Row::find std::string  colname  ) 
 

00073                                        {
00074     unsigned nField = m_fields.size();
00075     unsigned minI = 0;
00076     unsigned maxI = nField;
00077 
00078     unsigned guess = maxI/2;
00079     unsigned oldGuess = nField;
00080 
00081     int cmp = colname.compare(m_fields[guess].m_colname);
00082 
00083     while (cmp != 0)  {
00084       if (guess == oldGuess) return 0;        // not found
00085 
00086       if (cmp < 0 ) {    // thing we tried is > colName, so decrease maxI
00087         maxI = guess;
00088       }  else {   // thing we tried is > colName, so increase minI
00089         minI =  guess;
00090       }
00091       oldGuess = guess;
00092       guess = (minI + maxI)/2;
00093       cmp = colname.compare(m_fields[guess].m_colname);
00094     }
00095     return &m_fields[guess];
00096   }

void rdbModel::Row::regroup std::vector< std::string > &  colNames,
std::vector< std::string > &  colVals,
std::vector< std::string > &  nullCols
const
 

Reorder information suitable for Connection::insert.

void rdbModel::Row::regroup std::vector< std::string > &  colNames,
std::vector< std::string > &  colVals,
std::vector< std::string > &  nullCols
const
 

Reorder information suitable for Connection::insert.

00100                                                             {
00101      unsigned nFields = m_fields.size();
00102      colNames.reserve(nFields);
00103      colVals.reserve(nFields);
00104 
00105      for (unsigned i = 0; i < nFields; i++) {
00106        if (m_fields[i].m_null) {
00107          nullCols.push_back(m_fields[i].m_colname);
00108        }
00109        else {
00110          colNames.push_back(m_fields[i].m_colname);
00111          colVals.push_back(m_fields[i].m_val);
00112        }
00113      }
00114    }

void rdbModel::Row::rowSort  ) 
 

void rdbModel::Row::rowSort  ) 
 

00065                     {
00066     if (m_sorted) return;
00067 
00068     FieldValCompare cmp;
00069     std::sort(m_fields.begin(), m_fields.end(), cmp);
00070     m_sorted = true;
00071   }


Member Data Documentation

std::vector<FieldVal> rdbModel::Row::m_fields [private]
 

std::vector<FieldVal> rdbModel::Row::m_fields [private]
 

bool rdbModel::Row::m_sorted [private]
 


The documentation for this class was generated from the following files:
Generated on Wed Feb 2 19:22:38 2011 for BOSS6.5.5 by  doxygen 1.3.9.1