long test_row_put_list(HbCli myhbcli, std::string table, int klen, int vlen, int lnum) { long ms = 0; char key[klen+1]; char value[vlen+1]; RowMap rowMap; for (int i=0; i<COUNT; i++) { rand_str(key, klen); rand_str(value, vlen); StrMap columnMap; columnMap.insert(std::pair<std::string, std::string>("entry:m1", value)); rowMap.insert(std::pair<std::string, StrMap>(key, columnMap)); if (rowMap.size() == lnum) { gettimeofday(&tvpre, NULL); myhbcli.putRows(table, rowMap); rowMap.clear(); gettimeofday(&tvafter, NULL); ms += gen_ms(tvpre, tvafter); } } return ms; }
//---------------------------- PUBLIC -----------------------------// wxBuildUIPanel::wxBuildUIPanel(wxWindow* parent, wxSettlersGLCanvas* canvas) : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0) { SetBackgroundColour(SKIN.Element(shBackground)); wxSizer* horz = new wxBoxSizer(wxHORIZONTAL); wxSizer* vert = new wxBoxSizer(wxVERTICAL); typedef std::vector<BuildDataPtr> BuildDataArray; BuildDataArray array; PLUGIN.LoadBuildData(array); // Create a map of prioritized build data to use. typedef std::multimap<wxInt32, BuildDataPtr> BuildDataMap; typedef std::map<wxInt32, BuildDataMap> RowMap; RowMap rowMap; BuildDataArray::const_iterator it = array.begin(), itEnd = array.end(); for(; it != itEnd; ++it) { BuildDataPtr data = (*it); // Sort by row, then priority within the row. rowMap[data->mRow].insert(std::make_pair(data->mPriority, data)); } typedef std::vector<wxSizer*> SizerArray; SizerArray sizers(rowMap.size(), 0); for(size_t i = 0; i < rowMap.size(); ++i) { sizers[i] = new wxBoxSizer(wxHORIZONTAL); } wxSize minSize = wxSize(0, 0); size_t index = 0; bool calcX = true; bool calcY = true; // Now that everything is in rows by priority, create the UIs. RowMap::const_iterator it2 = rowMap.begin(), it2End = rowMap.end(); for(; it2 != it2End; ++it2) { // Go in reverse order here because sizers add left to right, but the // priority goes right to left. BuildDataMap::const_reverse_iterator it3 = it2->second.rbegin(), it3End = it2->second.rend(); // If it's a new row, use the next sizer. wxSizer* sizer = sizers[index]; ++index; for(; it3 != it3End; ++it3) { wxBuildUI* ui = new wxBuildUI(this, it3->second, canvas); wxSize min = ui->GetMinSize(); if(true == calcX) { minSize.x += min.x + 2; } if(true == calcY) { minSize.y += min.y + 2; calcY = false; } sizer->Add(ui, 1, wxEXPAND | wxALL | wxSHAPED, 2); } calcX = false; calcY = true; vert->Add(sizer, 1, wxEXPAND); } minSize += wxSize(2, 2); horz->Add(vert, 1, wxEXPAND | wxTOP | wxLEFT | wxBOTTOM, 2); SetMinSize(minSize); SetSizer(horz); }