int main(){ a_type a[2][5] = { {a_type(1,1), a_type(2,2), a_type(3,3), a_type(4,4), a_type(5,5)}, {a_type(11,11), a_type(22,22), a_type(33,33), a_type(44,44), a_type(55,55)} }; for (int i = 0; i < 2; i++) { for (int j = 0; j < 5; j++) { a[i][j].show(); } } return 0; }
void Resource::addToTable(){ // if we haven't logged the resource type yet, do so if ( !this->is_resource_type_logged() ){ Resource::logNewType(); this->type_logged(); } // if we haven't yet, define the table if ( !resource_table->defined() ) Resource::define_table(); // make a row // declare data data an_id( this->ID() ), a_type( (int)this->type() ), an_amt( this->quantity() ), a_creator( this->originatorID() ); // declare entries entry id("ID",an_id), type("Type",a_type), amt("OriginalQuantity", an_amt), creator("OriginatorID",a_creator); // declare row row aRow; aRow.push_back(id), aRow.push_back(type), aRow.push_back(amt), aRow.push_back(creator); // add the row resource_table->addRow(aRow); // record this primary key pkref_.push_back(id); }
void Resource::logNewType(){ // if we haven't yet, define the table if ( !resource_type_table->defined() ) Resource::define_type_table(); // make a row // declare data data a_type( (int)this->type() ), a_name( this->type_name() ), a_unit( this->units() ); // declare entries entry type("Type",a_type), name("Name", a_name), units("Units", a_unit); // declare row row aRow; aRow.push_back(type), aRow.push_back(name), aRow.push_back(units); // add the row resource_type_table->addRow(aRow); // record this primary key type_pkref_.push_back(type); }