本文整理汇总了C++中Table::addColumn方法的典型用法代码示例。如果您正苦于以下问题:C++ Table::addColumn方法的具体用法?C++ Table::addColumn怎么用?C++ Table::addColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Table
的用法示例。
在下文中一共展示了Table::addColumn方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: crossJoin
//table join operations
Table Table::crossJoin(Table a, Table b) {
Table t;
vector<Attribute> a_columns = a.getColumns();
vector<Attribute> b_columns = b.getColumns();
for(int i = 0; i<a_columns.size(); i++){
t.addColumn(a_columns[i]);
}
for(int i = 0; i<b_columns.size(); i++){
t.addColumn(b_columns[i]);
}
for(int i = 0; i<a.getNumberOfRows(); i++){
for(int j = 0; j<b.getNumberOfRows(); j++){
vector<string> entries;
for(int k = 0; k<a_columns.size(); k++){//a entries
entries.push_back(a.rowAt(i).elementAt(k));
}
for(int k = 0; k<b_columns.size(); k++){
entries.push_back(b.rowAt(j).elementAt(k));
}
t.insertRow(entries);
}
}
return t;
}
示例2: Table
Table *RunnerDB::getClubTB()//Table mode
{
bool canEdit = !oe->isClient();
if (clubTable == 0) {
Table *table = new Table(oe, 20, "Klubbdatabasen", "clubdb");
table->addColumn("Id", 70, true, true);
table->addColumn("Ändrad", 70, false);
table->addColumn("Namn", 200, false);
oClub::buildTableCol(oe, table);
if (canEdit)
table->setTableProp(Table::CAN_DELETE|Table::CAN_INSERT|Table::CAN_PASTE);
else
table->setTableProp(0);
table->setClearOnHide(false);
table->addOwnership();
clubTable = table;
}
int nr = 0;
for (size_t k = 0; k < cdb.size(); k++) {
if (!cdb[k].isRemoved())
nr++;
}
if (clubTable->getNumDataRows() != nr)
clubTable->update();
return clubTable;
}
示例3: isSatisfiable
bool Problem::isSatisfiable() const {
Table table;
table.empty();
table.addRow();
table.addColumn(ProblemConstants::cResultColumnName);
table.setField(table.getCurrentRow(), ProblemConstants::cResultColumnName, 0);
for (unsigned int i = 0; i < _variables.size(); i++) {
table.addColumn(_variables[i].toString());
table.setField(table.getCurrentRow(), _variables[i].toString(), -1);
}
return simSat(table, 0);
}
示例4: naturalJoin
Table Table::naturalJoin(Table a, Table b) {
Table t;
vector<Attribute> a_keys = a.getKeys();
vector<Attribute> b_keys = b.getKeys();
vector<Attribute> matching_keys;
for(int i = 0; i<a_keys.size(); i++){
for(int j = 0; j<b_keys.size(); j++){
if(a_keys[i].name == b_keys[j].name){
matching_keys.push_back(a_keys[i]);
}
}
}
if(matching_keys.size() > 0){
vector<Attribute> a_columns = a.getColumns();
vector<Attribute> b_columns = b.getColumns();
for(int i = 0; i<a_columns.size(); i++){
t.addColumn(a_columns[i]);
}
for(int i = 0; i<b_columns.size(); i++){
t.addColumn(b_columns[i]); //duplicate columns handled in this function
}
for(int i = 0; i<a.getNumberOfRows(); i++){
vector<string> entries;
for(int j = 0; j<a.getColumns().size(); j++){
entries.push_back(a.rowAt(i).elementAt(j));
}
string key_value = a.rowAt(i).elementAt(a.getKeyIndex(matching_keys[0].name)); //for now, just handle first matching key
for(int j = 0; j<b.getNumberOfRows(); j++){
if(key_value == b.rowAt(j).elementAt(b.getKeyIndex(matching_keys[0].name))){ //key_value matches row in table b
for(int k = 0; k<b.getColumns().size(); k++){ //add all other contents of matching row
if(k != b.getKeyIndex(matching_keys[0].name)){
entries.push_back(b.rowAt(j).elementAt(k));
}
}
break;
}
}
//if matching rows are joined, add to the new table
if(entries.size() != a.getColumns().size()){
t.insertRow(entries);
}
}
return t;
}
else{
throw NoMatchingKeysException();
}
}
示例5: fillTable
void fillTable( const std::vector<Path>& items )
{
unsigned int columnCount = table->width() / 150;
table->setRowHeight( 150 );
if( items.size() < columnCount )
columnCount = items.size();
for( unsigned int k=0; k < columnCount; k++ )
{
table->addColumn( "" );
table->setColumnWidth( table->columnCount()-1, 150 );
}
for( unsigned int k=0; k < items.size(); k++ )
{
int rowNumber = k / columnCount;
int columnNumber = k % columnCount;
if( rowNumber >= table->rowCount() )
{
table->addRow( rowNumber );
}
Path picPath = items[ k ];
if( available.contains( picPath.extension() ) )
{
picPath = picPath.changeExtension( "png" );
}
Picture pic = PictureLoader::instance().load( vfs::NFile::open( picPath ) );
Image* image = new Image( table, Rect( 0, 0, 140, 140 ), pic, Image::best );
table->addElementToCell( rowNumber, columnNumber, image );
table->setCellData( rowNumber, columnNumber, "path", items[ k ].toString() );
}
}
示例6: printTimers
std::ostream &
Dashboard::print(std::ostream & os) {
Table myTable;
myTable.addColumn("timername","Timer Name",Table::JUSTIFIED_LEFT,Table::JUSTIFIED_LEFT);
myTable.addColumn("elapsed","ms",'.',Table::JUSTIFIED_MIDDLE,4);
myTable.addColumn("average","avrg.",'.',Table::JUSTIFIED_MIDDLE,4);
myTable.addColumn("minimum","min.",'.',Table::JUSTIFIED_MIDDLE,4);
myTable.addColumn("maximum","max.",'.',Table::JUSTIFIED_MIDDLE,4);
myTable.addColumn("intervals","i",Table::JUSTIFIED_RIGHT);
myTable.addColumn("persec","i/sec",Table::JUSTIFIED_MIDDLE);
myTable.addColumn("cycles","cyc.",Table::JUSTIFIED_RIGHT);
printTimers(myTable);
myTable.print(os);
if (!_myCounters.empty()) {
Table myCounterTable;
myCounterTable.addColumn("countername","Counter Name",Table::JUSTIFIED_LEFT);
myCounterTable.addColumn("count","Count",'.');
myCounterTable.addColumn("cycles","Cycles",Table::JUSTIFIED_MIDDLE);
for (std::map<std::string,CounterPtr>::iterator it=_myCounters.begin();
it != _myCounters.end(); ++it)
{
myCounterTable.addRow();
const asl::Counter & myCounter = _myCompleteCycleCounters[it->first];
unsigned long myCycleCount = _myGroupCounters[myCounter.getGroup()].getCount();
myCounterTable.setField("countername",it->first);
if (myCycleCount > 1) {
myCounterTable.setField("count",as_string(myCounter.getCount()));
// we do not want an averaged counter (vs)
//myCounterTable.setField("count",as_string(myCounter.getCount() / myCycleCount ));
myCounterTable.setField("cycles",as_string(myCycleCount));
} else {
myCounterTable.setField("count",as_string(myCounter.getCount()));
myCounterTable.setField("cycles","incomplete");
}
}
myCounterTable.print(os);
}
return os;
}
示例7: addColumn
bool NdbInfo::addColumn(Uint32 tableId, Column aCol)
{
Table * table = NULL;
// Find the table with correct id
for (size_t i = 0; i < m_tables.entries(); i++)
{
table = m_tables.value(i);
if (table->m_table_id == tableId)
break;
}
table->addColumn(aCol);
return true;
}
示例8: fillTableArg
void InvokeCommand::fillTableArg(Table & tableArg, const mArray &tableArray) {
for (mArray::const_iterator i = tableArray.begin(); i != tableArray.end(); ++i) {
const mArray rowArray = i->get_array();
if (i == tableArray.begin()) { // the first row are the columns
for (mArray::const_iterator j = rowArray.begin(); j != rowArray.end(); ++j) {
tableArg.addColumn(j->get_str());
}
} else {
Table::row_type row;
for (mArray::const_iterator j = rowArray.begin(); j != rowArray.end(); ++j) {
row.push_back(j->get_str());
}
tableArg.addRow(row);
}
}
}
示例9: tableBasicArtificialStep
void Solver::tableBasicArtificialStep(Table& instance, int* rowBasis) {
if (_excessiveLogging) {
printf("------------------------------------------\n");
printf("- BASIC INFO -\n");
printf("------------------------------------------\n");
}
//Calculate all existing basic data
findBasicInfo(instance, rowBasis);
//First row is the objective function, should have no basic variables
for (unsigned int i = 1; i < instance.getNumRows(); i++) {
//If a row has no basic column then insert an artificial variable to compensate
if (rowBasis[i] == -1) {
int col = instance.addColumn(std::string("artificial") + std::to_string(_lastArtificial++), true);
instance.setField(i, col, 1);
rowBasis[i] = col;
if (_excessiveLogging) {
printf("DEBUG: Failed to find basic variable for row %i\n", i);
printf("DEBUG: Creating artificial variable for row %i\n", i);
instance.print();
}
}
if (_excessiveLogging) {
double basicField = instance.getField(i, rowBasis[i]);
double resultField = instance.getField(i, 0);
printf("DEBUG: Row %i: Col %i is basic (Solution: %f/%f -> %f)\n",
i,
rowBasis[i],
instance.getField(i, rowBasis[i]),
instance.getField(i, 0),
resultField == 0 ? 0 : basicField / resultField);
}
}
if (_excessiveLogging) {
printf("------------------------------------------\n");
}
}