当前位置: 首页>>代码示例>>C++>>正文


C++ Tuple::GetSize方法代码示例

本文整理汇总了C++中Tuple::GetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ Tuple::GetSize方法的具体用法?C++ Tuple::GetSize怎么用?C++ Tuple::GetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tuple的用法示例。


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

示例1: Tuple

 /*

Test 03: read tuple, change core attributes and resave to file." << endl;

 */
void SecondoTestFrame::Test03(const TupleAttributes *attributes, 
		SmiRecordFile *recFile, SmiRecordFile *lobFile) {
	Tuple* myTuple;	
	float realv;
	int intv;
	char boolv;
	bool bboolv;
	CcReal *real1;
	CcInt *int1;
	CcBool *bool1;
	SmiRecordId recId;
	
	
	cout << "\tID:";
	cin >> recId;
	cout << "\trecId = " << recId << endl;
						
	cout << "\treading tuple." << endl;
	myTuple = new Tuple(recFile, recId, lobFile, attributes, SmiFile::ReadOnly);

	cout << "\ttest tuple values" << endl;
	cout << "\t" << *myTuple << endl;
	cout << "\tSize: " << myTuple->GetSize() << endl;
	cout << "\tAttributes: " << myTuple->GetAttrNum() << endl;

	cout << "\ta new float value, please: "; cin >> realv;
	cout << "\ta new int value, please: "; cin >> intv;
	cout << "\tt = true, f = false" << endl;
	cout << "\ta new boolean value, please: "; cin >> boolv;
	bboolv = ((boolv == 't') ? true : false);
	real1 = new CcReal(true, realv);
    int1 = new CcInt(true, intv);
	bool1 = new CcBool(true, bboolv);
					
	myTuple->Put(0, int1);
	myTuple->Put(1, bool1);
	myTuple->Put(2, real1);
						
	cout << "\ttest tuple values" << endl;
	cout << "\t" << *myTuple << endl;
	cout << "\tSize: " << myTuple->GetSize() << endl;
	cout << "\tAttributes: " << myTuple->GetAttrNum() << endl;
	myTuple->Save();
					
	delete bool1;
	delete int1;
	delete real1;
	delete(myTuple);
}
开发者ID:awarematics,项目名称:SECONDO,代码行数:54,代码来源:SecondoTestFrame.cpp

示例2: wTuple

/*
7 Implementation of class ~SortAlgorithm~

*/
SortAlgorithm::SortAlgorithm( Word stream,
                              const SortOrderSpecification& spec,
                              SortProgressLocalInfo* p,
                              Supplier s,
                              size_t maxFanIn,
                              size_t maxMemSize,
                              size_t ioBufferSize)
: F0(0)
, W(0)
, nextRunNumber(1)
, checkProgressAfter(10)
, stream(stream)
, attributes(-1)
, spec(spec)
//, cmpObj(cmpObj)
, usedMemory(0)
, traceMode(RTFlag::isActive("ERA:TraceSort"))
, traceModeExtended(RTFlag::isActive("ERA:TraceSortExtended"))
, progress(p)
{
  SortedRun *curRun = 0, *nextRun = 0;

  Word wTuple(Address(0));

  // Check specified fan-in for a merge phase
  setMaxFanIn(maxFanIn);

  // Check specified main memory for this operation

  setMemory(maxMemSize, s);

  // Check I/O buffer size for this operation
  setIoBuffer(ioBufferSize);

  if ( traceMode )
  {
    info = new SortInfo(MAX_MEMORY, IO_BUFFER_SIZE);
    info->RunBuildPhase();
    info->MaxMergeFanIn = FMAX;
    TupleQueueCompare::ResetComparisonCounter();
  }

  // Request first tuple and consume the stream completely
  qp->Request(stream.addr, wTuple);

  while( qp->Received(stream.addr) )
  {
    Tuple *t = static_cast<Tuple*>( wTuple.addr );

    progress->read++;

    size_t memSize = t->GetMemSize();

    // Save number of attributes
    if ( attributes == -1 )
    {
      attributes = t->GetNoAttributes();
      curRun = new SortedRun(nextRunNumber++, attributes, spec, IO_BUFFER_SIZE);
      runs.push_back(curRun);
    }

    if ( traceMode )
    {
      info->UpdateStatistics(t->GetSize());
    }

    if( usedMemory <= MAX_MEMORY )
    {
      curRun->AppendToMemory(t);
      usedMemory += memSize;
    }
    else
    {
      if ( curRun->IsFirstTupleOnDisk() )
      {
        // memory is completely used, append to disk
        progress->state = 1;
        curRun->AppendToDisk(t);
      }
      else
      {
        if ( curRun->IsInSortOrder(t) )
        {
          // tuple is on sort order, append to disk
          curRun->AppendToDisk(t);
        }
        else
        {
          if ( traceMode )
          {
            curRun->Info()->TuplesPassedToNextRun++;
          }

          // create next run if necessary
          if ( nextRun == 0 )
          {
//.........这里部分代码省略.........
开发者ID:awarematics,项目名称:SECONDO,代码行数:101,代码来源:Sort.cpp


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