您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ table函数代码示例

51自学网 2021-06-03 08:39:27
  C++
这篇教程C++ table函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中table函数的典型用法代码示例。如果您正苦于以下问题:C++ table函数的具体用法?C++ table怎么用?C++ table使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了table函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: TEST_F

TEST_F(TransactionTests, SingleTransactionTest) {  for (auto test_type : TEST_TYPES) {    concurrency::TransactionManagerFactory::Configure(test_type);    auto &txn_manager = concurrency::TransactionManagerFactory::GetInstance();    std::unique_ptr<storage::DataTable> table(        TestingTransactionUtil::CreateTable());    // Just scan the table    {      TransactionScheduler scheduler(1, table.get(), &txn_manager);      scheduler.Txn(0).Scan(0);      scheduler.Txn(0).Commit();      scheduler.Run();      EXPECT_EQ(10, scheduler.schedules[0].results.size());    }    // read, read, read, read, update, read, read not exist    // another txn read    {      TransactionScheduler scheduler(2, table.get(), &txn_manager);      scheduler.Txn(0).Read(0);      scheduler.Txn(0).Read(0);      scheduler.Txn(0).Read(0);      scheduler.Txn(0).Read(0);      scheduler.Txn(0).Update(0, 1);      scheduler.Txn(0).Read(0);      scheduler.Txn(0).Read(100);      scheduler.Txn(0).Commit();      scheduler.Txn(1).Read(0);      scheduler.Txn(1).Commit();      scheduler.Run();      EXPECT_EQ(ResultType::SUCCESS, scheduler.schedules[0].txn_result);      EXPECT_EQ(ResultType::SUCCESS, scheduler.schedules[1].txn_result);      EXPECT_EQ(0, scheduler.schedules[0].results[0]);      EXPECT_EQ(0, scheduler.schedules[0].results[1]);      EXPECT_EQ(0, scheduler.schedules[0].results[2]);      EXPECT_EQ(0, scheduler.schedules[0].results[3]);      EXPECT_EQ(1, scheduler.schedules[0].results[4]);      EXPECT_EQ(-1, scheduler.schedules[0].results[5]);      EXPECT_EQ(1, scheduler.schedules[1].results[0]);    }    // // update, update, update, update, read    {      TransactionScheduler scheduler(1, table.get(), &txn_manager);      scheduler.Txn(0).Update(0, 1);      scheduler.Txn(0).Update(0, 2);      scheduler.Txn(0).Update(0, 3);      scheduler.Txn(0).Update(0, 4);      scheduler.Txn(0).Read(0);      scheduler.Txn(0).Commit();      scheduler.Run();      EXPECT_EQ(ResultType::SUCCESS, scheduler.schedules[0].txn_result);      EXPECT_EQ(4, scheduler.schedules[0].results[0]);    }    // // delete not exist, delete exist, read deleted, update deleted,    // // read deleted, insert back, update inserted, read newly updated,    // // delete inserted, read deleted    {      TransactionScheduler scheduler(1, table.get(), &txn_manager);      scheduler.Txn(0).Delete(100);      scheduler.Txn(0).Delete(0);      scheduler.Txn(0).Read(0);      scheduler.Txn(0).Update(0, 1);      scheduler.Txn(0).Read(0);      scheduler.Txn(0).Insert(0, 2);      scheduler.Txn(0).Update(0, 3);      scheduler.Txn(0).Read(0);      scheduler.Txn(0).Delete(0);      scheduler.Txn(0).Read(0);      scheduler.Txn(0).Commit();      scheduler.Run();      EXPECT_EQ(ResultType::SUCCESS, scheduler.schedules[0].txn_result);      EXPECT_EQ(-1, scheduler.schedules[0].results[0]);      EXPECT_EQ(-1, scheduler.schedules[0].results[1]);      EXPECT_EQ(3, scheduler.schedules[0].results[2]);      EXPECT_EQ(-1, scheduler.schedules[0].results[3]);      LOG_INFO("FINISH THIS");    }    // // insert, delete inserted, read deleted, insert again, delete again    // // read deleted, insert again, read inserted, update inserted, read    // updated    {      TransactionScheduler scheduler(1, table.get(), &txn_manager);      scheduler.Txn(0).Insert(1000, 0);      scheduler.Txn(0).Delete(1000);      scheduler.Txn(0).Read(1000);      scheduler.Txn(0).Insert(1000, 1);      scheduler.Txn(0).Delete(1000);      scheduler.Txn(0).Read(1000);      scheduler.Txn(0).Insert(1000, 2);//.........这里部分代码省略.........
开发者ID:Michael-Tieying-Zhang,项目名称:peloton,代码行数:101,


示例2: asc_sort_iter_impl

w_rc_t asc_sort_man_impl::get_sort_iter(asc_sort_iter_impl* &sort_iter){    sort_iter = new asc_sort_iter_impl(table(), this);    return (RCOK);}
开发者ID:iMax3060,项目名称:zero,代码行数:5,


示例3: OXML_Element_Table

void OXMLi_ListenerState_Table::startElement (OXMLi_StartElementRequest * rqst){	if (nameMatches(rqst->pName, NS_W_KEY, "tbl"))	{		OXML_Element_Table* pTable = new OXML_Element_Table("");		m_tableStack.push(pTable);		OXML_SharedElement table(pTable);		rqst->stck->push(table);		rqst->handled = true;		pTable->setCurrentRowNumber(-1);		pTable->setCurrentColNumber(-1);	}	else if(nameMatches(rqst->pName, NS_W_KEY, "tr"))	{		if(m_tableStack.empty())		{			rqst->handled = false;			rqst->valid = false;			return;		}		OXML_Element_Table* table = m_tableStack.top();		OXML_Element_Row* pRow = new OXML_Element_Row("", table);		m_rowStack.push(pRow);		OXML_SharedElement row(pRow);		rqst->stck->push(row);		rqst->handled = true;		table->incrementCurrentRowNumber();		table->setCurrentColNumber(0);		pRow->setRowNumber(table->getCurrentRowNumber());	}	else if(nameMatches(rqst->pName, NS_W_KEY, "tc"))	{		if(m_tableStack.empty() || m_rowStack.empty())		{			rqst->handled = false;			rqst->valid = false;			return;		}		OXML_Element_Table* table = m_tableStack.top();						OXML_Element_Row* row = m_rowStack.top();						OXML_Element_Cell* pCell = new OXML_Element_Cell("", table, row, 								table->getCurrentColNumber(), table->getCurrentColNumber()+1, //left right								table->getCurrentRowNumber(), table->getCurrentRowNumber()+1); //top,bottom		m_cellStack.push(pCell);		OXML_SharedElement cell(pCell);		rqst->stck->push(cell);		rqst->handled = true;		table->incrementCurrentColNumber();	}	else if(nameMatches(rqst->pName, NS_W_KEY, "gridSpan"))	{		if(m_tableStack.empty() || m_cellStack.empty())		{			rqst->handled = false;			rqst->valid = false;			return;		}		OXML_Element_Table* table = m_tableStack.top();						const gchar* val = attrMatches(NS_W_KEY, "val", rqst->ppAtts);		if(val)		{			int span = atoi(val);			int left = table->getCurrentColNumber()-1;			int right = left + span;			//change current cell's right index			OXML_Element_Cell* cell = m_cellStack.top();			cell->setRight(right);			//update column index of current table						table->setCurrentColNumber(right);		}		rqst->handled = true;	}	else if(nameMatches(rqst->pName, NS_W_KEY, "vMerge"))	{		if(m_cellStack.empty())		{			rqst->handled = false;			rqst->valid = false;			return;		}		OXML_Element_Cell* cell = m_cellStack.top();						cell->setVerticalMergeStart(false); //default to continue if the attribute is missing		const gchar* val = attrMatches(NS_W_KEY, "val", rqst->ppAtts);		if(val && !strcmp(val, "restart")) 		{			cell->setVerticalMergeStart(true);		}		rqst->handled = true;	}	else if(nameMatches(rqst->pName, NS_W_KEY, "hMerge"))	{		if(m_cellStack.empty())		{			rqst->handled = false;			rqst->valid = false;			return;//.........这里部分代码省略.........
开发者ID:Distrotech,项目名称:abiword,代码行数:101,


示例4: table

void Jacobi::operator () (unsigned p,QType result[]) const {  LogCountTable table(*this,p);    for(unsigned k=1; k<p-1 ;k++,result+=p) table(k,result); }
开发者ID:SergeyStrukov,项目名称:CCore,代码行数:6,


示例5: table

inlineboolTable::iterator::equal( const iterator & it ) const{    return table().data_ == it.table().data_ && row_ == it.row_ ;}
开发者ID:Aleksei-Badyaev,项目名称:ms-sqlite,代码行数:6,


示例6: triple_apply_pagerank

void triple_apply_pagerank(sgraph& g, size_t& num_iter, double& total_pagerank, double& total_delta) {  typedef sgraph_compute::sgraph_engine<flexible_type>::graph_data_type graph_data_type;  typedef sgraph::edge_direction edge_direction;  // initialize every vertex with core id kmin  g.init_vertex_field(PAGERANK_COLUMN, reset_probability);  g.init_vertex_field(PREV_PAGERANK_COLUMN, 1.0);  g.init_vertex_field(DELTA_COLUMN, 0.0);  // Initialize degree count  sgraph_compute::sgraph_engine<flexible_type> ga;  auto degrees = ga.gather(          g,          [=](const graph_data_type& center,              const graph_data_type& edge,              const graph_data_type& other,              edge_direction edgedir,              flexible_type& combiner) {              combiner += 1;          },          flexible_type(0),          edge_direction::OUT_EDGE);  g.add_vertex_field(degrees, OUT_DEGREE_COLUMN);  num_iter = 0;  total_delta = 0.0;  total_pagerank = 0.0;  timer mytimer;  // Triple apply  double w = (1 - reset_probability);  const size_t degree_idx = g.get_vertex_field_id(OUT_DEGREE_COLUMN);  const size_t pr_idx = g.get_vertex_field_id(PAGERANK_COLUMN);  const size_t old_pr_idx = g.get_vertex_field_id(PREV_PAGERANK_COLUMN);  sgraph_compute::triple_apply_fn_type apply_fn =    [&](sgraph_compute::edge_scope& scope) {      auto& source = scope.source();      auto& target = scope.target();      scope.lock_vertices();      target[pr_idx] += w * source[old_pr_idx] / source[degree_idx];      scope.unlock_vertices();    };  table_printer table({{"Iteration", 0},                                 {"L1 change in pagerank", 0}});  table.print_header();  for (size_t iter = 0; iter < max_iterations; ++iter) {    if(cppipc::must_cancel()) {      log_and_throw(std::string("Toolkit cancelled by user."));    }    mytimer.start();    ++num_iter;    g.init_vertex_field(PAGERANK_COLUMN, reset_probability);    sgraph_compute::triple_apply(g, apply_fn, {PAGERANK_COLUMN});    // compute the change in pagerank    auto delta = sgraph_compute::vertex_apply(        g,        flex_type_enum::FLOAT,        [&](const std::vector<flexible_type>& vdata) {          return std::abs((double)(vdata[pr_idx]) - (double)(vdata[old_pr_idx]));        });    // make the current pagerank the old pagerank    g.copy_vertex_field(PAGERANK_COLUMN, PREV_PAGERANK_COLUMN);    g.replace_vertex_field(delta, DELTA_COLUMN);    total_delta =         sgraph_compute::vertex_reduce<double>(g,                                DELTA_COLUMN,                               [](const flexible_type& v, double& acc) {                                 acc += (flex_float)v;                               },                               [](const double& v, double& acc) {                                 acc += v;                               });    table.print_row(iter+1, total_delta);    // check convergence    if (total_delta < threshold) {      break;    }  } // end of pagerank iterations  table.print_footer();  // cleanup  g.remove_vertex_field(PREV_PAGERANK_COLUMN);  g.remove_vertex_field(OUT_DEGREE_COLUMN);  total_pagerank =      sgraph_compute::vertex_reduce<double>(g,                                      PAGERANK_COLUMN,                                     [](const flexible_type& v, double& acc) {//.........这里部分代码省略.........
开发者ID:Hannah1999,项目名称:Dato-Core,代码行数:101,


示例7: assert

 IntVector ZFan::getConeIndices(int dimension, int index, bool orbit, bool maximal)const {   assert(index>=0);   assert(index<numberOfConesOfDimension(dimension,orbit,maximal));   return table(orbit,maximal)[dimension][index]; }
开发者ID:ederc,项目名称:Sources,代码行数:6,


示例8: table

** Description:  DWARF line information processing.*****************************************************************************/#include <stdio.h>#include <stdlib.h>#include <setjmp.h>#include <string.h>#include "wdglb.h"#include "wdfunc.h"static readable_name readableStandardOps[] = {    table( DW_LNS_copy ),    table( DW_LNS_advance_pc ),    table( DW_LNS_advance_line ),    table( DW_LNS_set_file ),    table( DW_LNS_set_column ),    table( DW_LNS_negate_stmt ),    table( DW_LNS_set_basic_block ),    table( DW_LNS_const_add_pc ),    table( DW_LNS_fixed_advance_pc )};#define NUM_STANDARD_OPS /    ( sizeof( readableStandardOps ) / sizeof( readableStandardOps[0] ) )typedef struct {    uint_32                     address;    uint                        file;
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:31,


示例9: stmt

void Repo::loadGlobalData(bool allowFailure /* = false */) {  m_lsrp.load();  if (!RuntimeOption::RepoAuthoritative) return;  std::vector<std::string> failures;  /*   * This should probably just go to the Local repo always, except   * that our unit test suite is currently running RepoAuthoritative   * tests with the compiled repo as the Central repo.   */  for (int repoId = RepoIdCount - 1; repoId >= 0; --repoId) {    if (repoName(repoId).empty()) {      // The repo wasn't loadable      continue;    }    try {      RepoStmt stmt(*this);      const auto& tbl = table(repoId, "GlobalData");      stmt.prepare(        folly::format(          "SELECT count(*), data from {};", tbl        ).str()      );      RepoTxn txn(*this);      RepoTxnQuery query(txn, stmt);      query.step();      if (!query.row()) {        throw RepoExc("Can't find table %s", tbl.c_str());      };      int val;      query.getInt(0, val);      if (val == 0) {        throw RepoExc("No rows in %s. Did you forget to compile that file with "                      "this HHVM version?", tbl.c_str());      }      BlobDecoder decoder = query.getBlob(1);      decoder(s_globalData);      txn.commit();    } catch (RepoExc& e) {      failures.push_back(repoName(repoId) + ": "  + e.msg());      continue;    }    // TODO: this should probably read out the other elements of the global data    // which control Option or RuntimeOption values -- the others are read out    // in an inconsistent and ad-hoc manner. But I don't understand their uses    // and interactions well enough to feel comfortable fixing now.    RuntimeOption::PHP7_IntSemantics = s_globalData.PHP7_IntSemantics;    RuntimeOption::PHP7_ScalarTypes  = s_globalData.PHP7_ScalarTypes;    RuntimeOption::PHP7_Substr       = s_globalData.PHP7_Substr;    RuntimeOption::AutoprimeGenerators = s_globalData.AutoprimeGenerators;    HHBBC::options.HardTypeHints = s_globalData.HardTypeHints;    HHBBC::options.HardReturnTypeHints = s_globalData.HardReturnTypeHints;    return;  }  if (allowFailure) return;  if (failures.empty()) {    std::fprintf(stderr, "No repo was loadable. Check all the possible repo "                 "locations (Repo.Central.Path, HHVM_REPO_CENTRAL_PATH, and "                 "$HOME/.hhvm.hhbc) to make sure one of them is a valid "                 "sqlite3 HHVM repo built with this exact HHVM version./n");  } else {    // We should always have a global data section in RepoAuthoritative    // mode, or the repo is messed up.    std::fprintf(stderr, "Failed to load Repo::GlobalData:/n");    for (auto& f : failures) {      std::fprintf(stderr, "  %s/n", f.c_str());    }  }  assert(Process::IsInMainThread());  exit(1);}
开发者ID:gdbentley,项目名称:hhvm,代码行数:78,


示例10: if

void StorageSystemMutations::fillData(MutableColumns & res_columns, const Context & context, const SelectQueryInfo & query_info) const{    /// Collect a set of *MergeTree tables.    std::map<String, std::map<String, StoragePtr>> merge_tree_tables;    for (const auto & db : context.getDatabases())    {        if (context.hasDatabaseAccessRights(db.first))        {            for (auto iterator = db.second->getIterator(context); iterator->isValid(); iterator->next())            {                if (dynamic_cast<const StorageMergeTree *>(iterator->table().get())                    || dynamic_cast<const StorageReplicatedMergeTree *>(iterator->table().get()))                {                    merge_tree_tables[db.first][iterator->name()] = iterator->table();                }            }        }    }    MutableColumnPtr col_database_mut = ColumnString::create();    MutableColumnPtr col_table_mut = ColumnString::create();    for (auto & db : merge_tree_tables)    {        for (auto & table : db.second)        {            col_database_mut->insert(db.first);            col_table_mut->insert(table.first);        }    }    ColumnPtr col_database = std::move(col_database_mut);    ColumnPtr col_table = std::move(col_table_mut);    /// Determine what tables are needed by the conditions in the query.    {        Block filtered_block        {            { col_database, std::make_shared<DataTypeString>(), "database" },            { col_table, std::make_shared<DataTypeString>(), "table" },        };        VirtualColumnUtils::filterBlockWithQuery(query_info.query, filtered_block, context);        if (!filtered_block.rows())            return;        col_database = filtered_block.getByName("database").column;        col_table = filtered_block.getByName("table").column;    }    for (size_t i_storage = 0; i_storage < col_database->size(); ++i_storage)    {        auto database = (*col_database)[i_storage].safeGet<String>();        auto table = (*col_table)[i_storage].safeGet<String>();        std::vector<MergeTreeMutationStatus> statuses;        {            const IStorage * storage = merge_tree_tables[database][table].get();            if (const auto * merge_tree = dynamic_cast<const StorageMergeTree *>(storage))                statuses = merge_tree->getMutationsStatus();            else if (const auto * replicated = dynamic_cast<const StorageReplicatedMergeTree *>(storage))                statuses = replicated->getMutationsStatus();        }        for (const MergeTreeMutationStatus & status : statuses)        {            Array block_partition_ids;            block_partition_ids.reserve(status.block_numbers.size());            Array block_numbers;            block_numbers.reserve(status.block_numbers.size());            for (const auto & pair : status.block_numbers)            {                block_partition_ids.emplace_back(pair.first);                block_numbers.emplace_back(pair.second);            }            size_t col_num = 0;            res_columns[col_num++]->insert(database);            res_columns[col_num++]->insert(table);            res_columns[col_num++]->insert(status.id);            res_columns[col_num++]->insert(status.command);            res_columns[col_num++]->insert(UInt64(status.create_time));            res_columns[col_num++]->insert(block_partition_ids);            res_columns[col_num++]->insert(block_numbers);            res_columns[col_num++]->insert(status.parts_to_do);            res_columns[col_num++]->insert(status.is_done);        }    }}
开发者ID:chipitsine,项目名称:ClickHouse,代码行数:91,


示例11: connection

void toResultDrawing::query(const QString &, toQueryParams const& params){    toResult::setParams(params);    typedef QPair<QString, QString> Reference;    toConnection &conn = connection();    m_dotGraphView->initEmpty();    QString schema(params.at(0)), table(params.at(1));    QSet<QString> tables;    QSet<Reference> references;    tables.insert(table);    DotGraph newGraph("dot");    QMap<QString,QString> ga;    ga["id"] = "Schema";    ga["compound"] = "true";    ga["shape"] = "box";    ga["rankdir"] = "BT"; // BOTTOM to TOP arrows    newGraph.setGraphAttributes(ga);    toQValue c1, c2, c3, c4, c5, c6, c7, c8, c9;    // TODO: use toCache here - additional attributes    toConnectionSubLoan c(conn);    toQuery QueryC(c, SQLTableFKWithDistance, toQueryParams() << schema.toUpper() << distance << table.toUpper());    while (!QueryC.eof())    {        c1 = QueryC.readValue();        c2 = QueryC.readValue();        c3 = QueryC.readValue();        c4 = QueryC.readValue();        c5 = QueryC.readValue();        c6 = QueryC.readValue();        c7 = QueryC.readValue();        c8 = QueryC.readValue();        c9 = QueryC.readValue();        if ( c5.isNull() && c1.isNull())        {            // Here collect FK details (a column list for compound keys)        }        if ( c5.isNull() && !c1.isNull()) // c5 (column_name) is null - see rollup def        {            tables.insert((QString)c4); // table_name            tables.insert((QString)c7); // r_table_name            references.insert( Reference((QString)c4, (QString)c7));        }    }    Q_FOREACH(QString const&t, tables)    {        QMap<QString,QString> ta; // table atributes        ta["name"] = t;        ta["label"] = t;        ta["fontsize"] = "12";        ta["comment"]= t;        ta["id"]= t;        ta["tooltip"] = t;        newGraph.addNewNode(ta);    }
开发者ID:Daniel1892,项目名称:tora,代码行数:63,


示例12: table

int Discrete::find_max_floor(int ncase, int ndrop){    vector<vector<int> > table(ncase+1, vector<int>(ndrop+1, -1));    return find_max_floor_helper(table, ncase, ndrop);}
开发者ID:zhihongzeng2002,项目名称:cppcoding,代码行数:5,


示例13: ifs

//.........这里部分代码省略.........          break;  // skip comments        }        CHECK_DIE(category.find(std::string(col[i])) != category.end())            << "category [" << col[i] << "] is undefined";        r.c.push_back(col[i]);      }      range.push_back(r);    } else {      CHECK_DIE(size >= 4) << "format error: " << line.get();      std::string key = col[0];      CHECK_DIE(category.find(key) == category.end())          << "category " << key << " is already defined";      CharInfo c;      std::memset(&c, 0, sizeof(c));      c.invoke  = std::atoi(col[1]);      c.group   = std::atoi(col[2]);      c.length  = std::atoi(col[3]);      c.default_type = id++;      category.insert(std::pair<std::string, CharInfo>(key, c));      category_ary.push_back(key);    }  }  CHECK_DIE(category.size() < 18) << "too many categories(>= 18)";  CHECK_DIE(category.find("DEFAULT") != category.end())      << "category [DEFAULT] is undefined";  CHECK_DIE(category.find("SPACE") != category.end())      << "category [SPACE] is undefined";  std::istringstream iss2(UNK_DEF_DEFAULT);  std::ifstream ifs2(WPATH(ufile));  std::istream *is2 = &ifs2;  if (!ifs2) {    std::cerr << ufile              << " is not found. minimum setting is used." << std::endl;    is2 = &iss2;  }  std::set<std::string> unk;  while (is2->getline(line.get(), line.size())) {    const size_t n = tokenizeCSV(line.get(), col.get(), 2);    CHECK_DIE(n >= 1) << "format error: " << line.get();    const std::string key = col[0];    CHECK_DIE(category.find(key) != category.end())        << "category [" << key << "] is undefined in " << cfile;    unk.insert(key);  }  for (std::map<std::string, CharInfo>::const_iterator it = category.begin();       it != category.end();       ++it) {    CHECK_DIE(unk.find(it->first) != unk.end())        << "category [" << it->first << "] is undefined in " << ufile;  }  std::vector<CharInfo> table(0xffff);  {    std::vector<std::string> tmp;    tmp.push_back("DEFAULT");    const CharInfo c = encode(tmp, &category);    std::fill(table.begin(), table.end(), c);  }  for (std::vector<Range>::const_iterator it = range.begin();       it != range.end();       ++it) {    const CharInfo c = encode(it->c, &category);    for (int i = it->low; i <= it->high; ++i) {      table[i] = c;    }  }  // output binary table  {    std::ofstream ofs(WPATH(ofile), std::ios::binary|std::ios::out);    CHECK_DIE(ofs) << "permission denied: " << ofile;    unsigned int size = static_cast<unsigned int>(category.size());    ofs.write(reinterpret_cast<const char*>(&size), sizeof(size));    for (std::vector<std::string>::const_iterator it = category_ary.begin();         it != category_ary.end();         ++it) {      char buf[32];      std::fill(buf, buf + sizeof(buf), '/0');      std::strncpy(buf, it->c_str(), sizeof(buf) - 1);      ofs.write(reinterpret_cast<const char*>(buf), sizeof(buf));    }    ofs.write(reinterpret_cast<const char*>(&table[0]),              sizeof(CharInfo) * table.size());    ofs.close();  }  return true;}
开发者ID:AaronZhangL,项目名称:mecab,代码行数:101,


示例14: table

//staticvoid LLLuaTable::make_table(lua_State* L, const std::vector< lua_Number > vec){	LLLuaTable table(L);	for(std::vector<lua_Number>::const_iterator itr = vec.begin(); itr != vec.end(); itr++)		table.pushvalue(L, (*itr));}
开发者ID:dtshady,项目名称:SingularityViewer,代码行数:7,


示例15: params

void ReplicasStatusHandler::handleRequest(Poco::Net::HTTPServerRequest & request, Poco::Net::HTTPServerResponse & response){	try	{		HTMLForm params(request);		/// Даже в случае, когда отставание небольшое, выводить подробную информацию об отставании.		bool verbose = params.get("verbose", "") == "1";		const MergeTreeSettings & settings = context.getMergeTreeSettings();		bool ok = true;		std::stringstream message;		auto databases = context.getDatabases();		/// Перебираем все реплицируемые таблицы.		for (const auto & db : databases)		{			for (auto iterator = db.second->getIterator(); iterator->isValid(); iterator->next())			{				auto & table = iterator->table();				StorageReplicatedMergeTree * table_replicated = typeid_cast<StorageReplicatedMergeTree *>(table.get());				if (!table_replicated)					continue;				time_t absolute_delay = 0;				time_t relative_delay = 0;				table_replicated->getReplicaDelays(absolute_delay, relative_delay);				if ((settings.min_absolute_delay_to_close && absolute_delay >= static_cast<time_t>(settings.min_absolute_delay_to_close))					|| (settings.min_relative_delay_to_close && relative_delay >= static_cast<time_t>(settings.min_relative_delay_to_close)))					ok = false;				message << backQuoteIfNeed(db.first) << "." << backQuoteIfNeed(iterator->name())					<< ":/tAbsolute delay: " << absolute_delay << ". Relative delay: " << relative_delay << "./n";			}		}		setResponseDefaultHeaders(response);		if (ok && !verbose)		{			const char * data = "Ok./n";			response.sendBuffer(data, strlen(data));		}		else		{			response.send() << message.rdbuf();		}	}	catch (...)	{		tryLogCurrentException("ReplicasStatusHandler");		try		{			response.setStatusAndReason(Poco::Net::HTTPResponse::HTTP_INTERNAL_SERVER_ERROR);			if (!response.sent())			{				/// Ещё ничего не отправляли, и даже не знаем, нужно ли сжимать ответ.				response.send() << getCurrentExceptionMessage(false) << std::endl;			}		}		catch (...)		{			LOG_ERROR((&Logger::get("ReplicasStatusHandler")), "Cannot send exception to client");		}	}}
开发者ID:jacktang,项目名称:ClickHouse,代码行数:73,


示例16: inp

//.........这里部分代码省略.........    const double firstPull = pull / static_cast<double>( loadSteps );    // constrain the boundary    base::dof::constrainBoundary<FEBasis>( meshBoundary.begin(),                                           meshBoundary.end(),                                           mesh, field,                                            boost::bind(                                               &ref06::PulledSheet<dim>::dirichletBC<DoF>,                                               _1, _2, dispControlled, firstPull ) );    // Bind the fields together    typedef base::asmb::FieldBinder<Mesh,Field> FieldBinder;    FieldBinder fieldBinder( mesh, field );    typedef FieldBinder::TupleBinder<1,1>::Type FTB;    typedef base::asmb::SurfaceFieldBinder<BoundaryMesh,Field> SurfaceFieldBinder;    SurfaceFieldBinder surfaceFieldBinder( boundaryMesh, field );    typedef SurfaceFieldBinder::TupleBinder<1>::Type SFTB;    // material object    Material material( mat::Lame::lambda( E, nu), mat::Lame::mu( E, nu ) );    // matrix kernel    typedef solid::HyperElastic<Material,FTB::Tuple> HyperElastic;    HyperElastic hyperElastic( material );                // Number the degrees of freedom    const std::size_t numDofs =        base::dof::numberDoFsConsecutively( field.doFsBegin(), field.doFsEnd() );    std::cout << "# Number of dofs " << numDofs << std::endl;    // create table for writing the convergence behaviour of the nonlinear solves    base::io::Table<4>::WidthArray widths = {{ 2, 5, 5, 15 }};    base::io::Table<4> table( widths );    table % "Step" % "Iter" % "|F|"  % "|x|";    std::cout << "#" << table;    // write a vtk file    ref06::writeVTKFile( baseName, 0, mesh, field, material );    //--------------------------------------------------------------------------    // Loop over load steps    //--------------------------------------------------------------------------    for ( unsigned step = 0; step < loadSteps; step++ ) {        // rescale constraints in every load step: (newValue / oldValue)        const double  pullFactor =            (step == 0 ?             static_cast<double>( step+1 ) :             static_cast<double>( step+1 )/ static_cast<double>(step) );        // scale constraints        base::dof::scaleConstraints( field, pullFactor );        //----------------------------------------------------------------------        // Nonlinear iterations        //----------------------------------------------------------------------        unsigned iter = 0;        while ( iter < maxIter ) {            table % step % iter;                // Create a solver object            typedef base::solver::Eigen3           Solver;            Solver solver( numDofs );
开发者ID:thrueberg,项目名称:inSilico,代码行数:67,


示例17: physmem_available

/* Return the amount of physical memory available.  */doublephysmem_available (void){#if defined _SC_AVPHYS_PAGES && defined _SC_PAGESIZE    {   /* This works on linux-gnu, solaris2 and cygwin.  */        double pages = sysconf (_SC_AVPHYS_PAGES);        double pagesize = sysconf (_SC_PAGESIZE);        if (0 <= pages && 0 <= pagesize)            return pages * pagesize;    }#endif#if HAVE_PSTAT_GETSTATIC && HAVE_PSTAT_GETDYNAMIC    {   /* This works on hpux11.  */        struct pst_static pss;        struct pst_dynamic psd;        if (0 <= pstat_getstatic (&pss, sizeof pss, 1, 0)        && 0 <= pstat_getdynamic (&psd, sizeof psd, 1, 0))        {            double pages = psd.psd_free;            double pagesize = pss.page_size;            if (0 <= pages && 0 <= pagesize)                return pages * pagesize;        }    }#endif#if HAVE_SYSMP && defined MP_SAGET && defined MPSA_RMINFO && defined _SC_PAGESIZE    {   /* This works on irix6. */        struct rminfo realmem;        if (sysmp (MP_SAGET, MPSA_RMINFO, &realmem, sizeof realmem) == 0)        {            double pagesize = sysconf (_SC_PAGESIZE);            double pages = realmem.availrmem;            if (0 <= pages && 0 <= pagesize)                return pages * pagesize;        }    }#endif#if HAVE_TABLE && defined TBL_VMSTATS    {   /* This works on Tru64 UNIX V4/5.  */        struct tbl_vmstats vmstats;        if (table (TBL_VMSTATS, 0, &vmstats, 1, sizeof (vmstats)) == 1)        {            double pages = vmstats.free_count;            double pagesize = vmstats.pagesize;            if (0 <= pages && 0 <= pagesize)                return pages * pagesize;        }    }#endif#if HAVE_SYSCTL && defined HW_USERMEM    {   /* This works on *bsd and darwin.  */        unsigned int usermem;        size_t len = sizeof usermem;        static int mib[2] = { CTL_HW, HW_USERMEM };        if (sysctl (mib, ARRAY_SIZE (mib), &usermem, &len, NULL, 0) == 0                && len == sizeof (usermem))            return (double) usermem;    }#endif#if defined _WIN32    {   /* this works on windows */        PFN_MS_EX pfnex;        HMODULE h = GetModuleHandle ("kernel32.dll");        if (!h)            return 0.0;        /*  Use GlobalMemoryStatusEx if available.  */        if ((pfnex = (PFN_MS_EX) GetProcAddress (h, "GlobalMemoryStatusEx")))        {            lMEMORYSTATUSEX lms_ex;            lms_ex.dwLength = sizeof lms_ex;            if (!pfnex (&lms_ex))                return 0.0;            return (double) lms_ex.ullAvailPhys;        }        /*  Fall back to GlobalMemoryStatus which is always available.            but returns wrong results for physical memory > 4GB  */        else        {            MEMORYSTATUS ms;            GlobalMemoryStatus (&ms);            return (double) ms.dwAvailPhys;        }    }#endif    /* Guess 25% of physical memory.  */    return physmem_total () / 4;}
开发者ID:AntonGorynya,项目名称:LAB4,代码行数:100,


示例18: _page_class_id

 std::vector<O_Page>  _page_class_id(const T_Page::Condition& c) const {     T_Page table(c);     return table.select(table._page_class_id() == _id());    }
开发者ID:danielgelbart,项目名称:ruby_cpp_orm,代码行数:6,


示例19: numberOf

 int ZFan::numberOfConesOfDimension(int d, bool orbit, bool maximal)const {   this->ensureComplex();   return numberOf(table(orbit,maximal),d); }
开发者ID:ederc,项目名称:Sources,代码行数:5,


示例20: _issue_id

 std::vector<O_Issue>  _issue_id(const T_Issue::Condition& c) const {     T_Issue table(c);     return table.select(table._issue_id() == _id());    }
开发者ID:danielgelbart,项目名称:ruby_cpp_orm,代码行数:6,


示例21: wxT

/*********************************************************   DasaExpert   ---   writeMore********************************************************/void DasaExpert::writeMore( Writer *writer, const Horoscope *horoscope, const int varga, const bool show_header ){    Formatter *formatter = Formatter::get();    double startjd;    unsigned int i;    wxString s, s1, lord;    VargaExpert vexpert;    if ( show_header )    {        s.Printf( wxT( "%s %s" ), getName(), _( "Dasa" ) );        writer->writeHeader1( s );    }    vector<Dasa*> v = getFirstLevel( horoscope, varga );    vector<Dasa*> w;    for( i = 0; i < v.size(); i++ )    {        if ( isRasiDasaExpert() ) lord = writer->getSignName( v[i]->getDasaLord(), TLARGE );        else lord =  writer->getObjectName(v[i]->getDasaLord(), TLARGE, true );        s.Printf( wxT( "%d. %s %s" ), i+1, _( "Mahadasa" ), (const wxChar*)lord );        writer->writeHeader2( s );        if ( ! v[i]->getExtraText().IsEmpty())        {            writer->writeLine( v[i]->getExtraText() );        }        startjd = Max( v[i]->getStartJD(), horoscope->getJD() );        s.Printf( wxT( "%s: %s" ), _( "Start Date" ), (const wxChar*)formatter->getDateStringFromJD( startjd ) );        writer->writeLine( s );        s.Printf( wxT( "%s: %s" ), _( "End Date" ), (const wxChar*)formatter->getDateStringFromJD( v[i]->getEndJD() ) );        writer->writeLine( s );        getDasaDuration( s1, v[i]->getEndJD() - v[i]->getStartJD() );        s.Printf( wxT( "%s: %s" ), _( "Duration" ), (const wxChar*)s1 );        writer->writeLine( s );        w = getNextLevel( v[i] );        if ( w.size() == 0 ) continue;        writer->writeHeader3( _( "Antardasas" ) );        // Get the number of lines        int lines = 1;        for( unsigned int j = 0; j < w.size(); j++ )        {            if ( w[j]->getEndJD() >= horoscope->getJD()) lines++;        }        Table table( 4, lines );        table.setHeader( 0, _( "Lord" ));        table.setHeader( 1,  _( "Start Date" ));        table.setHeader( 2,  _( "Final Date" ));        table.setHeader( 3,  _( "Duration" ));        int line = 1;        for( unsigned int j = 0; j < w.size(); j++ )        {            if ( w[j]->getEndJD() >= horoscope->getJD())            {                if ( isRasiDasaExpert() ) lord = writer->getSignName(w[j]->getDasaLord(), TLARGE );                else lord = writer->getObjectName(w[j]->getDasaLord(), TLARGE, true );                table.setEntry( 0, line, lord );                startjd = Max( w[j]->getStartJD(), horoscope->getJD() );                table.setEntry( 1, line, formatter->getDateStringFromJD( startjd ) );                table.setEntry( 2, line, formatter->getDateStringFromJD( w[j]->getEndJD() ) );                getDasaDuration( s, w[j]->getEndJD() - w[j]->getStartJD() );                table.setEntry( 3, line, s );                line++;            }            delete w[j];        }        writer->writeTable( table );    }    for( i = 0; i < v.size(); i++ ) delete v[i];}
开发者ID:jun-zhang,项目名称:qt-utilities,代码行数:85,


示例22: raid_validate

/** * Validate the provided failed blocks. * * This function checks if the specified failed blocks satisfy the redundancy * information using the data from the known valid parity blocks. * * It's similar at raid_check(), just with a different format for arguments. * * The number of failed blocks @nr must be strictly less than the number of * parities @nv, because you need one more parity to validate the recovering. * * No data or parity blocks are modified. * * @nr Number of failed data blocks. * @id[] Vector of @nr indexes of the failed data blocks. *   The indexes start from 0. They must be in order. * @nv Number of valid parity blocks. * @ip[] Vector of @nv indexes of the valid parity blocks. *   The indexes start from 0. They must be in order. * @nd Number of data blocks. * @size Size of the blocks pointed by @v. It must be a multipler of 64. * @v Vector of pointers to the blocks of data and parity. *   It has (@nd + @ip[@nv - 1] + 1) elements. The starting elements are the *   blocks for data, following with the parity blocks. *   Each block has @size bytes.  * @return 0 if the check is satisfied. -1 otherwise. */static int raid_validate(int nr, int *id, int nv, int *ip, int nd, size_t size, void **vv){	uint8_t **v = (uint8_t **)vv;	const uint8_t *T[RAID_PARITY_MAX][RAID_PARITY_MAX];	uint8_t G[RAID_PARITY_MAX * RAID_PARITY_MAX];	uint8_t V[RAID_PARITY_MAX * RAID_PARITY_MAX];	size_t i;	int j, k, l;	BUG_ON(nr >= nv);	/* setup the coefficients matrix */	for (j = 0; j < nr; ++j)		for (k = 0; k < nr; ++k)			G[j * nr + k] = A(ip[j], id[k]);	/* invert it to solve the system of linear equations */	raid_invert(G, V, nr);	/* get multiplication tables */	for (j = 0; j < nr; ++j)		for (k = 0; k < nr; ++k)			T[j][k] = table(V[j * nr + k]);	/* check all positions */	for (i = 0; i < size; ++i) {		uint8_t p[RAID_PARITY_MAX];		/* get parity */		for (j = 0; j < nv; ++j)			p[j] = v[nd + ip[j]][i];		/* compute delta parity, skipping broken disks */		for (j = 0, k = 0; j < nd; ++j) {			uint8_t b;			/* skip broken disks */			if (k < nr && id[k] == j) {				++k;				continue;			}			b = v[j][i];			for (l = 0; l < nv; ++l)				p[l] ^= gfmul[b][gfgen[ip[l]][j]];		}		/* reconstruct data */		for (j = 0; j < nr; ++j) {			uint8_t b = 0;			int idj = id[j];			/* recompute the data */			for (k = 0; k < nr; ++k)				b ^= T[j][k][p[k]];			/* add the parity contribution of the reconstructed data */			for (l = nr; l < nv; ++l)				p[l] ^= gfmul[b][gfgen[ip[l]][idj]];		}		/* check that the final parity is 0 */		for (l = nr; l < nv; ++l)			if (p[l] != 0)				return -1;	}	return 0;}
开发者ID:DarkMatter26,项目名称:snapraid,代码行数:96,


示例23: main

int main() {	int n = 0, x = 0;	std::scanf("%d %d", &n, &x);	--x;	std::vector<beaver> beavers(n);	for (int i = 0; i < n; ++i) {		scanf("%d", &beavers[i].prev);		if (--beavers[i].prev != -1) {			beavers[beavers[i].prev].next = i;		}	}	int xpos = 1;	int j = x;	beavers[x].visited = true;	while (beavers[j].prev != -1) {		j = beavers[j].prev;		beavers[j].visited = true;		++xpos;	}	j = x;	while (beavers[j].next != -1) {		j = beavers[j].next;		beavers[j].visited = true;	}	std::multiset<int> queues;	for (int i = 0; i < n; ++i) {		if (!beavers[i].visited) {			beavers[i].visited = true;			int num = 1;			int j = i;			while (beavers[j].prev != -1) {				j = beavers[j].prev;				beavers[j].visited = true;				++num;			}			j = i;			while (beavers[j].next != -1) {				j = beavers[j].next;				beavers[j].visited = true;				++num;			}			queues.insert(num);		}	}	int queues_sum = 0;	for (std::multiset<int>::const_iterator itr = queues.begin(); itr != queues.end(); ++itr) {		queues_sum += *itr;	}	std::vector<bool> table((queues_sum + 1) * (queues.size() + 1), false);	table[0] = true;	j = 1;	for (std::multiset<int>::const_iterator itr = queues.begin(); itr != queues.end(); ++itr) {		for (int i = 0; i <= queues_sum; ++i) {			if (table[(j - 1) * (queues_sum + 1) + i]) {				table[j * (queues_sum + 1) + i] = true;				table[j * (queues_sum + 1) + i + *itr] = true;			}		}		++j;	}	for (int i = 0; i <= queues_sum; ++i) {		if (table[queues.size() * (queues_sum + 1) + i]) {			printf("%d/n", i + xpos);		}	}	return 0;}
开发者ID:ciechowoj,项目名称:themis,代码行数:74,


示例24: table

lua_tinker::table lua_tinker::read(lua_State *L, int index){	return table(L, index);}
开发者ID:snumrl,项目名称:TillingPatch,代码行数:4,


示例25: run

    void run() {        foldnodeplot.reset(new PlotPoints());        env->add(foldnodeplot);        folddirplot.reset(new PlotLines(3));        env->add(folddirplot);        pickplot.reset(new PlotSpheres());        env->add(pickplot);        pickedNode = NULL;        leftManipAxes.reset(new PlotAxes);        env->add(leftManipAxes);        rightManipAxes.reset(new PlotAxes);        env->add(rightManipAxes);        // load the robot        pr2m.reset(new PR2Manager(*this));        if (FlatteningConfig::useFakeGripper) {            TelekineticGripper::Ptr fakeLeft(new TelekineticGripper(pr2m->pr2Left));            fakeLeft->setTransform(pr2m->pr2Left->getTransform());            env->add(fakeLeft);            gleft.reset(new GenManip(fakeLeft));            TelekineticGripper::Ptr fakeRight(new TelekineticGripper(pr2m->pr2Right));            fakeRight->setTransform(pr2m->pr2Right->getTransform());            gright.reset(new GenManip(fakeRight));            env->add(fakeRight);            pr2m->pr2->setTransform(btTransform(btQuaternion::getIdentity(), btVector3(0, 0, -100))); // out of view        } else {            gleft.reset(new GenManip(pr2m->pr2Left));            gright.reset(new GenManip(pr2m->pr2Right));        }        // create the table        const float table_height = .5;        const float table_thickness = .05;        tableExtents = GeneralConfig::scale * btVector3(.75,.75,table_thickness/2);        tableTrans = btTransform(btQuaternion(0, 0, 0, 1), GeneralConfig::scale * btVector3(0.8, 0, table_height-table_thickness/2));        BoxObject::Ptr table(new BoxObject(0, tableExtents, tableTrans));        table->rigidBody->setFriction(0.1);        env->add(table);        cout << "table margin: " << table->rigidBody->getCollisionShape()->getMargin() << endl;        // put the table in openrave        /*        OpenRAVE::KinBodyPtr raveTable = OpenRAVE::RaveCreateKinBody(rave->env);        raveTable->SetName("table");        vector<OpenRAVE::AABB> v;        v.push_back(OpenRAVE::AABB(util::toRaveTransform(table_trans, 1./pr2m->pr2->scale).trans, 1./pr2m->pr2->scale * util::toRaveVector(table_extents)));        raveTable->InitFromBoxes(v, true);        rave->env->AddKinBody(raveTable);        */#if 0        OpenRAVE::ViewerBasePtr raveViewer = OpenRAVE::RaveCreateViewer(rave->env, "qtcoin");        rave->env->AddViewer(raveViewer);        raveViewer->main(true);#endif        const int resx = 45, resy = 31;//        const btScalar lenx = GeneralConfig::scale * 0.7, leny = GeneralConfig::scale * 0.5;        const btScalar lenx = GeneralConfig::scale * 0.7/2, leny = GeneralConfig::scale * 0.5/2;//        const btVector3 clothcenter = GeneralConfig::scale * btVector3(0.5, 0, table_height+0.01);        const btVector3 clothcenter = GeneralConfig::scale * btVector3(0.3, 0.1, table_height+0.01);//        cloth = makeSelfCollidingTowel(clothcenter, lenx, leny, resx, resy, env->bullet->softBodyWorldInfo);        cloth.reset(new Cloth(resx, resy, lenx, leny, clothcenter, env->bullet->softBodyWorldInfo));        env->add(cloth);        facepicker.reset(new SoftBodyFacePicker(*this, viewer.getCamera(), cloth->softBody.get()));        facepicker->setPickCallback(boost::bind(&CustomScene::pickCallback, this, _1));        sbgripperleft.reset(new GenPR2SoftGripper(pr2m->pr2, gleft, true));        sbgripperleft->setGrabOnlyOnContact(true);        sbgripperleft->setTarget(cloth);        GenPR2SoftGripperAction leftAction(pr2m->pr2, gleft->baseManip()->manip, sbgripperleft);        leftAction.setTarget(cloth);        leftAction.setExecTime(1.);        addVoidKeyCallback('a', boost::bind(&CustomScene::runGripperAction, this, leftAction));        addVoidKeyCallback('c', boost::bind(&CustomScene::graspPickedNode, this));        addVoidKeyCallback('f', boost::bind(&CustomScene::greedyFlattenSingle, this));        addVoidKeyCallback('F', boost::bind(&CustomScene::deepFlattenSingle, this));        addVoidKeyCallback('g', boost::bind(&CustomScene::liftCloth, this));        addPreDrawCallback(boost::bind(&CustomScene::markFolds, this));        addPreDrawCallback(boost::bind(&CustomScene::drawPick, this));        addPreDrawCallback(boost::bind(&CustomScene::drawManipAxes, this));        addPreDrawCallback(boost::bind(&GenPR2SoftGripper::dbgDraw, sbgripperleft.get(), this));        startViewer();        startFixedTimestepLoop(BulletConfig::dt);    }
开发者ID:NaohiroHayashi,项目名称:bulletsim,代码行数:93,


示例26: getloadavg

//.........这里部分代码省略.........  if (nelem > 2)    loadavg[elem++] = load_info.fifteen_minute;# endif /* DGUX */# if !defined (LDAV_DONE) && defined (apollo)#  define LDAV_DONE/* Apollo code from [email
C++ tableName函数代码示例
C++ tabText函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。