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

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

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

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

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

示例1: test_tuple_initialization

void test_tuple_initialization (){    std::cout << "testing tuple-based initialization/n";    typedef BasedVectorSpace_c<VectorSpace_c<RealField,12,IdX>,Basis_c<IdX>> BVS;    typedef ImplementationOf_t<BVS,float,UseMemberArray_t<ComponentsAreConst::FALSE>> U;    float array[12];    typedef ImplementationOf_t<BVS,float,UsePreallocatedArray_t<ComponentsAreConst::FALSE>> V;    U u(tuple(1.0f, 2.0f, 3.0f, 4.0f) | tuple(5.0f, 6.0f, 7.0f, 8.0f) | tuple(9.0f, 10.0f, 11.0f, 12.0f));    V v(tuple(1.0f, 2.0f, 3.0f, 4.0f) | tuple(5.0f, 6.0f, 7.0f, 8.0f) | tuple(9.0f, 10.0f, 11.0f, 12.0f), &array[0]);    std::cout << FORMAT_VALUE(u) << '/n';    std::cout << FORMAT_VALUE(v) << '/n';    std::cout << '/n';}
开发者ID:GabrielHare,项目名称:tensorheaven,代码行数:13,


示例2: callFunctionWithArgs

PythonObject callFunctionWithArgs(    PythonObject function,    const std::vector<PythonObject>& args,    const std::vector<std::pair<std::string, PythonObject>>& kwargs){    if (!PyCallable_Check(function.get())) {        throw WrappyError("Wrappy: Supplied object isn't callable.");    }    // Build tuple    size_t sz = args.size();    PythonObject tuple(PythonObject::owning {}, PyTuple_New(sz));    if (!tuple) {        PyErr_Print();        throw WrappyError("Wrappy: Couldn't create python typle.");    }    for (size_t i = 0; i < sz; ++i) {        PyObject* arg = args.at(i).get();        Py_XINCREF(arg); // PyTuple_SetItem steals a reference        PyTuple_SetItem(tuple.get(), i, arg);    }    // Build kwargs dict    PythonObject dict(PythonObject::owning {}, PyDict_New());    if (!dict) {        PyErr_Print();        throw WrappyError("Wrappy: Couldn't create python dictionary.");    }    for (const auto& kv : kwargs) {        PyDict_SetItemString(dict.get(), kv.first.c_str(), kv.second.get());    }    PythonObject res(PythonObject::owning{},        PyObject_Call(function.get(), tuple.get(), dict.get()));    if (!res) {        PyErr_Print();        throw WrappyError("Wrappy: Error calling function");    }    return res;}
开发者ID:islenv,项目名称:wrappy,代码行数:44,


示例3: PL_ASSERT

/** * @brief Create projected tuples based on one or two input. * Newly-created physical tiles are needed. * * @return true on success, false otherwise. */bool ProjectionExecutor::DExecute() {  PL_ASSERT(project_info_);  PL_ASSERT(schema_);  PL_ASSERT(children_.size() == 1);  // NOTE: We only handle 1 child for now  if (children_.size() == 1) {    LOG_TRACE("Projection : child 1 ");    // Execute child    auto status = children_[0]->Execute();    if (false == status) return false;    // Get input from child    std::unique_ptr<LogicalTile> source_tile(children_[0]->GetOutput());    auto num_tuples = source_tile->GetTupleCount();    // Create new physical tile where we store projected tuples    std::shared_ptr<storage::Tile> dest_tile(        storage::TileFactory::GetTempTile(*schema_, num_tuples));    // Create projections tuple-at-a-time from original tile    oid_t new_tuple_id = 0;    for (oid_t old_tuple_id : *source_tile) {      storage::Tuple *buffer = new storage::Tuple(schema_, true);      expression::ContainerTuple<LogicalTile> tuple(source_tile.get(),                                                    old_tuple_id);      project_info_->Evaluate(buffer, &tuple, nullptr, executor_context_);      // Insert projected tuple into the new tile      dest_tile.get()->InsertTuple(new_tuple_id, buffer);      delete buffer;      new_tuple_id++;    }    // Wrap physical tile in logical tile and return it    SetOutput(LogicalTileFactory::WrapTiles({dest_tile}));    return true;  }  return false;}
开发者ID:Michael-Tieying-Zhang,项目名称:peloton,代码行数:50,


示例4: tuple

bool DatabaseMetricsCatalog::InsertDatabaseMetrics(    oid_t database_oid, oid_t txn_committed, oid_t txn_aborted,    oid_t time_stamp, type::AbstractPool *pool, concurrency::TransactionContext *txn) {  std::unique_ptr<storage::Tuple> tuple(      new storage::Tuple(catalog_table_->GetSchema(), true));  auto val0 = type::ValueFactory::GetIntegerValue(database_oid);  auto val1 = type::ValueFactory::GetIntegerValue(txn_committed);  auto val2 = type::ValueFactory::GetIntegerValue(txn_aborted);  auto val3 = type::ValueFactory::GetIntegerValue(time_stamp);  tuple->SetValue(ColumnId::DATABASE_OID, val0, pool);  tuple->SetValue(ColumnId::TXN_COMMITTED, val1, pool);  tuple->SetValue(ColumnId::TXN_ABORTED, val2, pool);  tuple->SetValue(ColumnId::TIME_STAMP, val3, pool);  // Insert the tuple into catalog table  return InsertTuple(std::move(tuple), txn);}
开发者ID:foche,项目名称:peloton,代码行数:19,


示例5: start

  void Array::unshift(STATE, Object* val) {    native_int new_size = total_->to_native() + 1;    native_int lend = start_->to_native();    if(lend > 0) {      tuple_->put(state, lend-1, val);      start(state, Fixnum::from(lend-1));      total(state, Fixnum::from(new_size));    } else {      Tuple* nt = Tuple::create(state, new_size);      nt->copy_from(state, tuple_, start_, total_,		    Fixnum::from(1));      nt->put(state, 0, val);      total(state, Fixnum::from(new_size));      start(state, Fixnum::from(0));      tuple(state, nt);    }  }
开发者ID:code0100fun,项目名称:rubinius,代码行数:19,


示例6: VOLT_DEBUG

std::string Table::debug(const std::string &spacer) const {    VOLT_DEBUG("tabledebug start");    std::ostringstream buffer;    std::string infoSpacer = spacer + "  |";    buffer << infoSpacer << tableType() << "(" << name() << "):/n";    buffer << infoSpacer << "/tAllocated Tuples:  " << allocatedTupleCount() << "/n";    buffer << infoSpacer << "/tNumber of Columns: " << columnCount() << "/n";    //    // Columns    //    buffer << infoSpacer << "===========================================================/n";    buffer << infoSpacer << "/tCOLUMNS/n";    buffer << infoSpacer << m_schema->debug();    //buffer << infoSpacer << " - TupleSchema needs a /"debug/" method. Add one for output here./n";    //    // Tuples    //    if (tableType().compare("LargeTempTable") != 0) {        buffer << infoSpacer << "===========================================================/n";        buffer << infoSpacer << "/tDATA/n";        TableIterator iter = const_cast<Table*>(this)->iterator();        TableTuple tuple(m_schema);        if (this->activeTupleCount() == 0) {            buffer << infoSpacer << "/t<NONE>/n";        } else {            std::string lastTuple = "";            while (iter.next(tuple)) {                if (tuple.isActive()) {                    buffer << infoSpacer << "/t" << tuple.debug(this->name().c_str()) << "/n";                }            }        }        buffer << infoSpacer << "===========================================================/n";    }    std::string ret(buffer.str());    VOLT_DEBUG("tabledebug end");    return ret;}
开发者ID:simonzhangsm,项目名称:voltdb,代码行数:43,


示例7: switch

void var::print(wostream& o) const {    switch (primary()) {	case Primary::Null:		o << _W("Null");		return;    case Primary::Symbol:        symbol()->print(o);        return;    case Primary::Key:        key().print(o);        return;    case Primary::Object:        object().print(o);        return;    case Primary::Tuple:        tuple().print(o);        return;    }}
开发者ID:hyln9,项目名称:nV,代码行数:19,


示例8: picture_is_cached

static boolpicture_is_cached (url file_name, int w, int h) {    tree key= tuple (file_name->t, as_string (w), as_string (h));    if (!picture_cache->contains (key)) return false;    int loaded= last_modified (file_name, false);    int cached= picture_stamp [key];    if (cached >= loaded)        return true;    else {        int ow,oh,nw,nh;        image_size (file_name, ow, oh);        clear_imgbox_cache (key[0]);        image_size (file_name, nw, nh);        // the new size will be displayed correctly only        // after the typesetter's image box is invalidated.        // if (nw!=ow || nh!=oh) call("update-current-buffer");        return false;    }}
开发者ID:mgubi,项目名称:texmacs,代码行数:19,


示例9: LoadTable

void LoadTable() {  const oid_t col_count = state.attribute_count + 1;  const int tuple_count = state.scale_factor * state.tuples_per_tilegroup;  auto table_schema = sdbench_table->GetSchema();  /////////////////////////////////////////////////////////  // Load in the data  /////////////////////////////////////////////////////////  // Insert tuples into tile_group.  auto &txn_manager = concurrency::TransactionManagerFactory::GetInstance();  const bool allocate = true;  auto txn = txn_manager.BeginTransaction();  std::unique_ptr<type::AbstractPool> pool(new type::EphemeralPool());  std::unique_ptr<executor::ExecutorContext> context(      new executor::ExecutorContext(txn));  for (int rowid = 0; rowid < tuple_count; rowid++) {    int populate_value = rowid;    std::unique_ptr<storage::Tuple> tuple(new storage::Tuple(table_schema, allocate));    for (oid_t col_itr = 0; col_itr < col_count; col_itr++) {      auto value = type::ValueFactory::GetIntegerValue(populate_value);      tuple->SetValue(col_itr, value, pool.get());    }    planner::InsertPlan node(sdbench_table.get(), std::move(tuple));    executor::InsertExecutor executor(&node, context.get());    executor.Execute();  }  auto result = txn_manager.CommitTransaction(txn);  if (result == ResultType::SUCCESS) {    LOG_TRACE("commit successfully");  } else {    LOG_TRACE("commit failed");  }}
开发者ID:wy4515,项目名称:peloton,代码行数:42,


示例10: segment

   VstigTuple KernelHandle::getVirtualStigmergyTuple(unsigned int id, std::string key_std)   {       std::string robot_id_string=boost::lexical_cast<std::string>(KernelInitializer::unique_robot_id_);       std::string shm_object_name="KernelData"+robot_id_string;       boost::interprocess::managed_shared_memory segment(boost::interprocess::open_or_create ,shm_object_name.data(), 102400);       VoidAllocator alloc_inst (segment.get_segment_manager());              micros_swarm_framework::shm_string  key(key_std.data(), alloc_inst);          std::pair<shm_virtual_stigmergy_type*, std::size_t> virtual_stigmergy = segment.find<shm_virtual_stigmergy_type>("shm_virtual_stigmergy_");        if(virtual_stigmergy.first==0)       {                  }        shm_virtual_stigmergy_type *vst_pointer=virtual_stigmergy.first;       shm_virtual_stigmergy_type::iterator vst_it;       vst_it=vst_pointer->find(id);          if(vst_it!=vst_pointer->end())       {           shm_virtual_stigmergy_tuple_type::iterator svstt_it=vst_it->second.find(key);                  if(svstt_it!=vst_it->second.end())           {               shm_string value_shm=svstt_it->second.getVirtualStigmergyValue();               std::string value(value_shm.data(), value_shm.size());               time_t time_now=svstt_it->second.getVirtualStigmergyTimestamp();               unsigned int robot_id=svstt_it->second.getRobotID();               VstigTuple new_tuple(value, time_now, robot_id);                              return new_tuple;           }       }              std::string value="";       time_t time_now=0;       unsigned int robot_id=0;       VstigTuple tuple(value, time_now, robot_id);                  return tuple;   }
开发者ID:Swarm-IITKgp,项目名称:micros_swarm_framework,代码行数:42,


示例11: TEST_F

TEST_F(TupleTests, VarcharTest) {  std::vector<catalog::Column> columns;  catalog::Column column1(VALUE_TYPE_INTEGER, GetTypeSize(VALUE_TYPE_INTEGER),                          "A", true);  catalog::Column column2(VALUE_TYPE_INTEGER, GetTypeSize(VALUE_TYPE_INTEGER),                          "B", true);  catalog::Column column3(VALUE_TYPE_TINYINT, GetTypeSize(VALUE_TYPE_TINYINT),                          "C", true);  catalog::Column column4(VALUE_TYPE_VARCHAR, 25, "D", false);  columns.push_back(column1);  columns.push_back(column2);  columns.push_back(column3);  columns.push_back(column4);  catalog::Schema *schema(new catalog::Schema(columns));  storage::Tuple *tuple(new storage::Tuple(schema, true));  auto pool = TestingHarness::GetInstance().GetTestingPool();  tuple->SetValue(0, ValueFactory::GetIntegerValue(23), pool);  tuple->SetValue(1, ValueFactory::GetIntegerValue(45), pool);  tuple->SetValue(2, ValueFactory::GetTinyIntValue(1), pool);  Value val = ValueFactory::GetStringValue("hello hello world", pool);  tuple->SetValue(3, val, pool);  EXPECT_EQ(tuple->GetValue(3), val);  LOG_INFO("%s", tuple->GetInfo().c_str());  Value val2 = ValueFactory::GetStringValue("hi joy !", pool);  tuple->SetValue(3, val2, pool);  EXPECT_NE(tuple->GetValue(3), val);  EXPECT_EQ(tuple->GetValue(3), val2);  LOG_INFO("%s", tuple->GetInfo().c_str());  delete tuple;  delete schema;}
开发者ID:GeorgeErickson,项目名称:peloton,代码行数:42,


示例12: primary

long var::compare(const var& x) const {    long r = primary() - x.primary();    if (r)        return r;    switch (primary()) {    case Primary::Symbol:        return symbol()->compare(x.symbol());    case Primary::Key:        return key().compare(x.key());    case Primary::Object: {        long r = object().type->compare(x.object().type);        if (r)            return r;    }    return object().compare(x.object());    case Primary::Tuple:        return tuple().compare(x.tuple());    }    return 0;}
开发者ID:hyln9,项目名称:nV,代码行数:20,


示例13: FMatrix

// ============================================================================// retrieve (book on demand) matrix-items for ntuple (fixed)// ============================================================================Tuples::TupleObj::FMatrix*Tuples::TupleObj::fMatrix( const std::string&              name   ,  const Tuples::TupleObj::MIndex& rows   ,  const Tuples::TupleObj::MIndex& cols   ){  // existing array ?  FMatrices::iterator found = m_matricesf.find( name ) ;  if( m_matricesf.end() != found ) { return found->second ; }  // create new array  FMatrix* matrix = new FMatrix () ;  m_matricesf[ name] =  matrix   ;  const StatusCode sc =    tuple() -> addItem( name , rows , cols , *matrix ) ;  if( sc.isFailure() )  { Error ( "matrix ('" + name + "'): item is not added",  sc ) ; }  if ( !addItem ( name , "FMatrix" ) )  { Error ( "matrix ('" + name + "'): item is not unique"     ) ; }  return matrix ;}
开发者ID:atlas-org,项目名称:gaudi,代码行数:23,


示例14: context

bool TransactionTestsUtil::ExecuteInsert(concurrency::Transaction *transaction,                                         storage::DataTable *table, int id,                                         int value) {  std::unique_ptr<executor::ExecutorContext> context(      new executor::ExecutorContext(transaction));  // Make tuple  std::unique_ptr<storage::Tuple> tuple(      new storage::Tuple(table->GetSchema(), true));  auto testing_pool = TestingHarness::GetInstance().GetTestingPool();  tuple->SetValue(0, ValueFactory::GetIntegerValue(id), testing_pool);  tuple->SetValue(1, ValueFactory::GetIntegerValue(value), testing_pool);  std::unique_ptr<const planner::ProjectInfo> project_info{      MakeProjectInfoFromTuple(tuple.get())};  // Insert  planner::InsertPlan node(table, std::move(project_info));  executor::InsertExecutor executor(&node, context.get());  return executor.Execute();}
开发者ID:LuZhang-Lou,项目名称:CMUDB-peloton,代码行数:20,


示例15: tuple

storage::Tuple StatsTestsUtil::PopulateTuple(const catalog::Schema *schema,                                             int first_col_val,                                             int second_col_val,                                             int third_col_val,                                             int fourth_col_val) {  auto testing_pool = TestingHarness::GetInstance().GetTestingPool();  storage::Tuple tuple(schema, true);  tuple.SetValue(0, common::ValueFactory::GetIntegerValue(first_col_val),                 testing_pool);  tuple.SetValue(1, common::ValueFactory::GetIntegerValue(second_col_val),                 testing_pool);  tuple.SetValue(2, common::ValueFactory::GetDoubleValue(third_col_val),                 testing_pool);  common::Value string_value =      common::ValueFactory::GetVarcharValue(std::to_string(fourth_col_val));  tuple.SetValue(3, string_value, testing_pool);  return tuple;}
开发者ID:eric-haibin-lin,项目名称:peloton-1,代码行数:21,


示例16: assert

/* * Recalculate how many tuples are remaining and compare to the countdown value. * This method does not work once we're in the middle of the temp table. * Only call it while m_finishedTableScan==false. */void CopyOnWriteContext::checkRemainingTuples(const std::string &label) {    assert(m_iterator != NULL);    assert(!m_finishedTableScan);    intmax_t count1 = static_cast<CopyOnWriteIterator*>(m_iterator.get())->countRemaining();    TableTuple tuple(getTable().schema());    boost::scoped_ptr<TupleIterator> iter(m_backedUpTuples.get()->makeIterator());    intmax_t count2 = 0;    while (iter->next(tuple)) {        count2++;    }    if (m_tuplesRemaining != count1 + count2) {        VOLT_ERROR("CopyOnWriteContext::%s remaining tuple count mismatch: "                   "table=%s partcol=%d count=%jd count1=%jd count2=%jd "                   "expected=%jd compacted=%jd batch=%jd "                   "inserts=%jd updates=%jd",                   label.c_str(), getTable().name().c_str(), getTable().partitionColumn(),                   count1 + count2, count1, count2, (intmax_t)m_tuplesRemaining,                   (intmax_t)m_blocksCompacted, (intmax_t)m_serializationBatches,                   (intmax_t)m_inserts, (intmax_t)m_updates);    }}
开发者ID:ifcharming,项目名称:voltdb,代码行数:26,


示例17: LoadYCSBDatabase

void LoadYCSBDatabase() {  const oid_t col_count = state.column_count + 1;  const int tuple_count = state.scale_factor * 1000;  // Pick the user table  auto table_schema = user_table->GetSchema();  // std::string field_raw_value(ycsb_field_length - 1, 'o');  int field_raw_value = 1;  /////////////////////////////////////////////////////////  // Load in the data  /////////////////////////////////////////////////////////  // Insert tuples into tile_group.  auto &txn_manager = concurrency::TransactionManagerFactory::GetInstance();  const bool allocate = true;  auto txn = txn_manager.BeginTransaction();  // std::unique_ptr<VarlenPool> pool(new VarlenPool(BACKEND_TYPE_MM));  std::unique_ptr<executor::ExecutorContext> context(      new executor::ExecutorContext(txn));  int rowid;  for (rowid = 0; rowid < tuple_count; rowid++) {    std::unique_ptr<storage::Tuple> tuple(        new storage::Tuple(table_schema, allocate));    auto key_value = ValueFactory::GetIntegerValue(rowid);    auto field_value = ValueFactory::GetIntegerValue(field_raw_value);    tuple->SetValue(0, key_value, nullptr);    for (oid_t col_itr = 1; col_itr < col_count; col_itr++) {      tuple->SetValue(col_itr, field_value, nullptr);    }    planner::InsertPlan node(user_table, std::move(tuple));    executor::InsertExecutor executor(&node, context.get());    executor.Execute();  }  txn_manager.CommitTransaction();}
开发者ID:EccentricLoggers,项目名称:peloton,代码行数:40,


示例18: tile_itr

bool Tile::SerializeTo(SerializeOutput &output, oid_t num_tuples) {  /**   * The table is serialized as:   *   * [(int) total size]   * [(int) header size] [num columns] [column types] [column names]   * [(int) num tuples] [tuple data]   *   */  // A placeholder for the total table size written at the end  std::size_t pos = output.Position();  output.WriteInt(-1);  // Serialize the header  if (!SerializeHeaderTo(output)) return false;  // Active tuple count  output.WriteInt(static_cast<int>(num_tuples));  oid_t written_count = 0;  TupleIterator tile_itr(this);  Tuple tuple(&schema);  while (tile_itr.Next(tuple) && written_count < num_tuples) {    tuple.SerializeTo(output);    ++written_count;  }  tuple.SetNull();  PL_ASSERT(written_count == num_tuples);  // Length prefix is non-inclusive  int32_t sz = static_cast<int32_t>(output.Position() - pos - sizeof(int32_t));  PL_ASSERT(sz > 0);  output.WriteIntAt(pos, sz);  return true;}
开发者ID:Michael-Tieying-Zhang,项目名称:peloton,代码行数:40,


示例19: tuple

bool IndexCatalog::InsertIndex(concurrency::TransactionContext *txn,                               const std::string &schema_name,                               oid_t table_oid,                               oid_t index_oid,                               const std::string &index_name,                               IndexType index_type,                               IndexConstraintType index_constraint,                               bool unique_keys,                               std::vector<oid_t> index_keys,                               type::AbstractPool *pool) {  // Create the tuple first  std::unique_ptr<storage::Tuple> tuple(      new storage::Tuple(catalog_table_->GetSchema(), true));  auto val0 = type::ValueFactory::GetIntegerValue(index_oid);  auto val1 = type::ValueFactory::GetVarcharValue(index_name, nullptr);  auto val2 = type::ValueFactory::GetIntegerValue(table_oid);  auto val3 = type::ValueFactory::GetVarcharValue(schema_name, nullptr);  auto val4 = type::ValueFactory::GetIntegerValue(static_cast<int>(index_type));  auto val5 =      type::ValueFactory::GetIntegerValue(static_cast<int>(index_constraint));  auto val6 = type::ValueFactory::GetBooleanValue(unique_keys);  std::stringstream os;  for (oid_t indkey : index_keys) os << std::to_string(indkey) << " ";  auto val7 = type::ValueFactory::GetVarcharValue(os.str(), nullptr);  tuple->SetValue(IndexCatalog::ColumnId::INDEX_OID, val0, pool);  tuple->SetValue(IndexCatalog::ColumnId::INDEX_NAME, val1, pool);  tuple->SetValue(IndexCatalog::ColumnId::TABLE_OID, val2, pool);  tuple->SetValue(IndexCatalog::ColumnId::SCHEMA_NAME, val3, pool);  tuple->SetValue(IndexCatalog::ColumnId::INDEX_TYPE, val4, pool);  tuple->SetValue(IndexCatalog::ColumnId::INDEX_CONSTRAINT, val5, pool);  tuple->SetValue(IndexCatalog::ColumnId::UNIQUE_KEYS, val6, pool);  tuple->SetValue(IndexCatalog::ColumnId::INDEXED_ATTRIBUTES, val7, pool);  // Insert the tuple  return InsertTuple(txn, std::move(tuple));}
开发者ID:cmu-db,项目名称:peloton,代码行数:39,


示例20: identify_rise

void identify_rise(struct cpudata *cpu){    rise_nameptr = cpu->name;    switch (tuple(cpu) & 0xff0) {    case 0x500:        add_to_cpuname("iDragon (0.25um)");        break;    case 0x520:        add_to_cpuname("iDragon (0.18um)");        break;    case 0x580:        add_to_cpuname("iDragon II (0.25um)");        break;    case 0x590:        add_to_cpuname("iDragon II (0.18um)");        break;    default:        add_to_cpuname("Unknown CPU");        break;    }}
开发者ID:aguocool,项目名称:x86info,代码行数:22,


示例21: as_string

voidedit_select_rep::selection_set (string key, tree t, bool persistant) {  selecting= shift_selecting= false;  string mode= as_string (selection_get_env_value (MODE));  string lan = as_string (selection_get_env_value (MODE_LANGUAGE (mode)));  tree sel= tuple ("texmacs", t, mode, lan);  /* TODO: add mode="graphics" somewhere in the context of the <graphics>     tag. To be done when implementing the different embeddings for     nicely copying graphics into text, text into graphics, etc. */  string s;  if (key == "primary" || key == "mouse") {    if (selection_export == "verbatim") t= exec_verbatim (t, tp);    if (selection_export == "html") t= exec_html (t, tp);    if (selection_export == "latex") t= exec_latex (t, tp);    if ((selection_export == "latex") && (mode == "math"))      t= compound ("math", t);    s= tree_to_generic (t, selection_export * "-snippet");    s= selection_encode (lan, s);  }  if (::set_selection (key, sel, s, selection_export) && !persistant)    selection_cancel ();}
开发者ID:Easycker,项目名称:itexmacs,代码行数:22,


示例22: set

  Array* Array::concat(STATE, Array* other) {    size_t osize = other->size();    if(osize == 0) return this;    if(is_frozen_p()) return force_as<Array>(Primitives::failure());    if(osize == 1) {      set(state, size(), other->get(state, 0));      return this;    }    size_t new_size = size() + osize;    Tuple* nt = Tuple::create(state, new_size);    nt->copy_from(state, tuple_, start_, total_, Fixnum::from(0));    nt->copy_from(state, other->tuple(), other->start(), other->total(), total_);    tuple(state, nt);    start(state, Fixnum::from(0));    total(state, Fixnum::from(new_size));    return this;  }
开发者ID:saifalharthi,项目名称:rubinius,代码行数:22,


示例23: InsertTest

// INSERT HELPER FUNCTIONvoid InsertTest(size_t scale_factor, catalog::Schema *schema, uint64_t thread_itr) {  uint32_t base = thread_itr * base_scale * max_scale_factor;  uint32_t tuple_count = scale_factor * base_scale;  for (uint32_t tuple_itr = 1; tuple_itr <= tuple_count; tuple_itr++) {    uint32_t tuple_offset = base + tuple_itr;    storage::Tuple *tuple(new storage::Tuple(schema, true));    tuple->SetValue(0, ValueFactory::GetIntegerValue(tuple_offset), nullptr);    key_type key;    key.SetFromKey(tuple);    value_type val = &foo;    auto status = test_skip_list_map.Insert(key, val);    EXPECT_TRUE(status);    delete tuple;  }}
开发者ID:gitter-badger,项目名称:peloton,代码行数:24,


示例24: drd

edit_env_rep::edit_env_rep (drd_info& drd2,			    url base_file_name2,			    hashmap<string,tree>& local_ref2,			    hashmap<string,tree>& global_ref2,			    hashmap<string,tree>& local_aux2,			    hashmap<string,tree>& global_aux2):  drd (drd2),  env (UNINIT), back (UNINIT), src (path (DECORATION)),  var_type (default_var_type),  base_file_name (base_file_name2),  cur_file_name (base_file_name2),  secure (is_secure (base_file_name2)),  local_ref (local_ref2), global_ref (global_ref2),  local_aux (local_aux2), global_aux (global_aux2){  initialize_default_env ();  initialize_default_var_type ();  env= copy (default_env);  style_init_env ();  update ();  complete= false;  recover_env= tuple ();}
开发者ID:Easycker,项目名称:itexmacs,代码行数:23,


示例25: assert

bool UnionSetOperator::processTuples(){    // Set to keep candidate tuples.    TupleSet tuples;    //    // For each input table, grab their TableIterator and then append all of its tuples    // to our ouput table. Only distinct tuples are retained.    //    for (size_t ctr = 0, cnt = m_input_tablerefs.size(); ctr < cnt; ctr++) {        Table* input_table = m_input_tablerefs[ctr].getTable();        assert(input_table);        TableIterator iterator = input_table->iterator();        TableTuple tuple(input_table->schema());        while (iterator.next(tuple)) {            if (m_is_all || needToInsert(tuple, tuples)) {                // we got tuple to insert                m_output_table->insertTempTuple(tuple);            }        }    }    return true;}
开发者ID:akhanzode,项目名称:voltdb,代码行数:23,


示例26: read_wkt

void read_wkt(std::string const& filename, std::vector<Tuple>& tuples, Box& box){    std::ifstream cpp_file(filename.c_str());    if (cpp_file.is_open())    {        while (! cpp_file.eof() )        {            std::string line;            std::getline(cpp_file, line);            Geometry geometry;            boost::trim(line);            if (! line.empty() && ! boost::starts_with(line, "#"))            {                std::string name;                // Split at ';', if any                std::string::size_type pos = line.find(";");                if (pos != std::string::npos)                {                    name = line.substr(pos + 1);                    line.erase(pos);                    boost::trim(line);                    boost::trim(name);                }                Geometry geometry;                boost::geometry::read_wkt(line, geometry);                Tuple tuple(geometry, name);                tuples.push_back(tuple);                boost::geometry::combine(box, boost::geometry::make_envelope<Box>(geometry));            }        }    }}
开发者ID:nurF,项目名称:Brute-Force-Game-Engine,代码行数:37,


示例27: merge_vectors

void merge_vectors(    const std::vector<std::vector<int>>& in,    std::vector<int>* out) {  typedef std::vector<int> Array;  typedef Array::const_iterator Iterator;  typedef std::tuple<Iterator, Iterator> Element;  std::vector<Element> heap;  for (int index = 0; index < in.size(); ++index) {    if (!in[index].empty()) {      Element tuple(in[index].begin(),                    in[index].end());      heap.push_back(tuple);    }  }  auto comparator = [] (const Element& lhs,                        const Element& rhs) {    return *std::get<0>(lhs) < *std::get<0>(rhs);  };  std::make_heap(heap.begin(),                 heap.end(),                 comparator);  while (!heap.empty()) {    auto tuple = heap.front();    std::pop_heap(      heap.begin(),      heap.end(),      comparator);    out->push_back(*std::get<0>(tuple));    if (std::get<1>(tuple) != ++std::get<0>(tuple)) {      heap.push_back(tuple);      std::push_heap(        heap.begin(),        heap.end(),        comparator);    }  }}
开发者ID:ProgrammingProblems,项目名称:Volume1,代码行数:37,


示例28: assert

  void HyperMatrix<T>::print_2D  (const std::vector<int> & dimension, ostream& out) const  // Library facilities used: assert  {    int ways = static_cast<int>(dimensions.size());    assert(int(dimension.size()) == ways);    // get row and column ways    vector<int> plane;    for(int way = 0; way != ways; ++way)      if(dimension[way] == -1) plane.push_back(way);    assert(int(plane.size()) == 2);    const int ROW = plane[0];    const int COL = plane[1];    assert(ROW < COL);    // set indexer tuple    vector<int> tuple(ways);    for(int way = 0; way != ways; ++way)      if(dimension[way] == -1) tuple[way] = 0;    // build hyper-cube indexer    std::vector<bool> mask(ways, true); mask[ROW] = mask[COL] = false;    Indexer indexer(*this, tuple, mask);    // print    int ccount = 0;    while(!indexer.end())    {      out << operator[](indexer.index());      if(++ccount % dimensions[COL] == 0) out << " " << endl;      indexer.forward();    }  }
开发者ID:jcasse,项目名称:co-clustering,代码行数:37,


示例29: event_dependencies

// Compute the dependencies of a given event.  Returns a list of (thread,kind,event) triples.vector<Tuple<int,int,history_t>> event_dependencies(const vector<vector<Array<const history_t>>>& event_sorted_history, const int direction, const int thread, const int kind, const history_t source) {  vector<Tuple<int,int,history_t>> deps;  for (const auto kind_event : dependencies(direction,time_kind_t(kind),source.event)) {    const int dep_kind = kind_event.x;    const event_t dep_event = kind_event.y;    // Search for event in each thread    bool found = false;    for (const int t : range((int)event_sorted_history.size())) {      const auto& sorted_events = event_sorted_history.at(t).at(dep_kind);      for (const int i : range(find_event(sorted_events,dep_event),sorted_events.size())) {        const history_t& event = sorted_events[i];        if (event.event != dep_event)          break;        GEODE_ASSERT(!found || dep_kind==compute_kind);        found = true;        deps.push_back(tuple(t,dep_kind,event));      }    }    if (!found) {      int count = 0;      for (const int t : range((int)event_sorted_history.size())) {        const auto& events = event_sorted_history[t].at(dep_kind);        for (const int i : range(max(0,events.size()-1)))          if (events[i].event > events[i+1].event)            THROW(RuntimeError,"event_dependencies: order failure: thread %d, kind %d, i %d (%d), events %lld %lld",t,dep_kind,i,events.size(),events[i].event,events[i+1].event);        for (auto& e : events)          if (e.event==dep_event)            count++;      }      THROW(RuntimeError,"event_dependencies: dependency not found, direction = %d, count %d, source = %d %s %s, dependency = %s %s",        direction,count,        thread,time_kind_names().at(kind),str_event(source.event),        time_kind_names().at(dep_kind),str_event(dep_event));    }  }  return deps;}
开发者ID:Botrix,项目名称:pentago,代码行数:38,


示例30: iterator

bool Table::serializeTo(SerializeOutput &serialize_io) {    // The table is serialized as:    // [(int) total size]    // [(int) header size] [num columns] [column types] [column names]    // [(int) num tuples] [tuple data]    /* NOTE:       VoltDBEngine uses a binary template to create tables of single integers.       It's called m_templateSingleLongTable and if you are seeing a serialization       bug in tables of single integers, make sure that's correct.    */    // a placeholder for the total table size    std::size_t pos = serialize_io.position();    serialize_io.writeInt(-1);    if (!serializeColumnHeaderTo(serialize_io))        return false;    // active tuple counts    serialize_io.writeInt(static_cast<int32_t>(m_tupleCount));    int64_t written_count = 0;    TableIterator titer = iterator();    TableTuple tuple(m_schema);    while (titer.next(tuple)) {        tuple.serializeTo(serialize_io);        ++written_count;    }    assert(written_count == m_tupleCount);    // length prefix is non-inclusive    int32_t sz = static_cast<int32_t>(serialize_io.position() - pos - sizeof(int32_t));    assert(sz > 0);    serialize_io.writeIntAt(pos, sz);    return true;}
开发者ID:YacineTALEB,项目名称:voltdb,代码行数:37,



注:本文中的tuple函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ tuplestore_begin_heap函数代码示例
C++ tuner_i2c_xfer_send函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。