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


C++ ArrayPtr类代码示例

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


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

示例1: recordLastError

bool BaseExecutionContext::onFatalError(const Exception &e) {
  recordLastError(e);
  const char *file = NULL;
  int line = 0;
  if (RuntimeOption::InjectedStackTrace) {
    const ExtendedException *ee = dynamic_cast<const ExtendedException *>(&e);
    if (ee) {
      ArrayPtr bt = ee->getBackTrace();
      if (!bt->empty()) {
        Array top = bt->rvalAt(0).toArray();
        if (top.exists("file")) file = top.rvalAt("file").toString();
        if (top.exists("line")) line = top.rvalAt("line");
      }
    }
  }
  if (RuntimeOption::AlwaysLogUnhandledExceptions) {
    Logger::Log(Logger::LogError, "HipHop Fatal error: ", e, file, line);
  }
  bool handled = false;
  if (RuntimeOption::CallUserHandlerOnFatals) {
    int errnum = ErrorConstants::FATAL_ERROR;
    handled = callUserErrorHandler(e, errnum, true);
  }
  if (!handled && !RuntimeOption::AlwaysLogUnhandledExceptions) {
    Logger::Log(Logger::LogError, "HipHop Fatal error: ", e, file, line);
  }
  return handled;
}
开发者ID:Bathrisyah,项目名称:hiphop-php,代码行数:28,代码来源:execution_context.cpp

示例2: getSpecialFolder

// YOU must free the returned string
char * getSpecialFolder (int nFolder, HWND hWnd)
{
    LPMALLOC pMalloc;
    LPITEMIDLIST pidl;

    ArrayPtr<char> str = new char [MAX_PATH + 30];
    if (str == 0)
	throw AppException (WHERE, ERR_OUT_OF_MEMORY);

    if (FAILED (SHGetMalloc (&pMalloc)))
	return NULL;

    if (FAILED (SHGetSpecialFolderLocation (hWnd, nFolder, &pidl))) {
	pMalloc->Release ();
	return NULL;
    }

    if (SHGetPathFromIDList (pidl, str) != TRUE) {
	pMalloc->Free (pidl);
	pMalloc->Release ();
	return NULL;
    }

    pMalloc->Free (pidl);
    pMalloc->Release ();

    return str.detach ();
}
开发者ID:ancientlore,项目名称:hermit,代码行数:29,代码来源:shstuff.cpp

示例3: recordAutoPtr

void RecordHandler::handle(StationData* stationData, Record* record) {
	RecordPtr recordAutoPtr(record);

	if ( stationData->gmGain == 0 ) return;
	if ( !record->data() ) return;

	int dataSize = record->data()->size();
	if ( dataSize <= 0 ) return;

	ArrayPtr array = record->data()->copy(Array::DOUBLE);
	double* data = static_cast<double*>(const_cast<void*>(array->data()));
	if ( !data ) return;

	stationData->gmFilter->setSamplingFrequency(record->samplingFrequency());
	stationData->gmFilter->apply(dataSize, data);

	double* begin = data;
	double* maximumSample = std::max_element(begin, data + dataSize,
	                                         std::ptr_fun(RecordHandlerCompare));

	*maximumSample = fabs(*maximumSample);

	if ( stationData->gmMaximumSample < *maximumSample ||
			Core::Time::GMT() - stationData->gmSampleReceiveTime > _sampleLifespan ) {
		stationData->gmSampleReceiveTime = Core::Time::GMT();
		stationData->gmMaximumSample= *maximumSample;
	}

	try { stationData->gmRecordReceiveTime = record->endTime(); }
	catch ( Core::ValueException& ) { stationData->gmRecordReceiveTime = Core::Time::GMT(); }

	double velocity = stationData->gmMaximumSample / stationData->gmGain * 1E9;

	stationData->gmColor = calculateColorFromVelocity(velocity);
}
开发者ID:koukou73gr,项目名称:seiscomp3,代码行数:35,代码来源:stationdatahandler.cpp

示例4: displayArray

 //-----------------------------------------------------------------------------
 // Tools::displayArray
 //-----------------------------------------------------------------------------
 std::string Tools::displayArray( const ArrayPtr& arr, int maxCell )
 {
   ArrayIterator begin = arr->begin();
   ArrayIterator end   = arr->end();
   
   return Tools::scanValues( begin, end, maxCell );
 }
开发者ID:nhauser,项目名称:cdma,代码行数:10,代码来源:tools.cpp

示例5: as_push

static Variable as_push(AVM &avm){
	ArrayPtr array = avm.getRegister(1).as<Array>();
	if (!array)
		throw Common::Exception("Array::pop this is not an Array object");
	array->push(avm.getRegister(2));
	return Variable();
}
开发者ID:ccawley2011,项目名称:xoreos,代码行数:7,代码来源:array.cpp

示例6: toValue

		Value toValue( const math::Vec3f &vec )
		{
			Value v = Value::createArray();
			ArrayPtr a = v.asArray();
			for( int i=0;i<3;++i )
				a->append( Value::create<float>(vec[i]) );
			return v;
		}
开发者ID:dkoerner,项目名称:base,代码行数:8,代码来源:jsonutil.cpp

示例7: displayValues

 //-----------------------------------------------------------------------------
 // Tools::displayValues
 //-----------------------------------------------------------------------------
 std::string Tools::displayValues(const ArrayPtr& array) 
 {
   std::cout<<"Entering Tools::displayValues"<<std::endl;
   std::string str;
   ArrayIterator begin = array->begin();
   ArrayIterator end = array->end();
   str = scanValues(begin, end, 15);
   std::cout<<"Leaving Tools::displayValues"<<std::endl;
   return str;
 }
开发者ID:nhauser,项目名称:cdma,代码行数:13,代码来源:tools.cpp

示例8: SYNC_VM_REGS_SCOPED

void BaseExecutionContext::handleError(const std::string &msg,
                                       int errnum,
                                       bool callUserHandler,
                                       ErrorThrowMode mode,
                                       const std::string &prefix) {
  SYNC_VM_REGS_SCOPED();

  int newErrorState = ErrorRaised;
  switch (getErrorState()) {
  case ErrorRaised:
  case ErrorRaisedByUserHandler:
    return;
  case ExecutingUserHandler:
    newErrorState = ErrorRaisedByUserHandler;
    break;
  default:
    break;
  }
  ErrorStateHelper esh(this, newErrorState);
  ExtendedException ee(msg);
  recordLastError(ee, errnum);
  bool handled = false;
  if (callUserHandler) {
    handled = callUserErrorHandler(ee, errnum, false);
  }
  if (mode == AlwaysThrow || (mode == ThrowIfUnhandled && !handled)) {
    try {
      if (!Eval::Debugger::InterruptException(String(msg))) return;
    } catch (const Eval::DebuggerClientExitException &e) {}
    throw FatalErrorException(msg.c_str());
  }
  if (!handled &&
      (RuntimeOption::NoSilencer ||
       (getErrorReportingLevel() & errnum) != 0)) {
    try {
      if (!Eval::Debugger::InterruptException(String(msg))) return;
    } catch (const Eval::DebuggerClientExitException &e) {}

    const char *file = NULL;
    int line = 0;
    if (RuntimeOption::InjectedStackTrace) {
      ArrayPtr bt = ee.getBackTrace();
      if (!bt->empty()) {
        Array top = bt->rvalAt(0).toArray();
        if (top.exists("file")) file = top.rvalAt("file").toString();
        if (top.exists("line")) line = top.rvalAt("line");
      }
    }

    Logger::Log(Logger::LogError, prefix.c_str(), ee, file, line);
  }
}
开发者ID:Bathrisyah,项目名称:hiphop-php,代码行数:52,代码来源:execution_context.cpp

示例9: nextChunkSize

Arena::Arena(ArrayPtr<byte> scratch)
    : nextChunkSize(kj::max(sizeof(ChunkHeader), scratch.size())) {
  if (scratch.size() > sizeof(ChunkHeader)) {
    ChunkHeader* chunk = reinterpret_cast<ChunkHeader*>(scratch.begin());
    chunk->end = scratch.end();
    chunk->pos = reinterpret_cast<byte*>(chunk + 1);
    chunk->next = nullptr;  // Never actually observed.

    // Don't place the chunk in the chunk list because it's not ours to delete.  Just make it the
    // current chunk so that we'll allocate from it until it is empty.
    currentChunk = chunk;
  }
}
开发者ID:QingYun,项目名称:kj,代码行数:13,代码来源:arena.cpp

示例10: flushUnusedGeometry

void GeometryManager::flushUnusedGeometry()
{
  ArrayPtr <GeometryInfo> validGeometry;
  
  for (size_t i = 0; i < geometryCollection.length(); i++)
    if (geometryCollection(i)->getUserCount() > 0)
      validGeometry.append(geometryCollection(i));
    else
    {
      deleteObject(geometryCollection(i)->getMedia());
      deleteObject(geometryCollection(i));
    }
    
  geometryCollection = validGeometry;
}
开发者ID:hyperiris,项目名称:praetoriansmapeditor,代码行数:15,代码来源:GeometryManager.cpp

示例11: isValid

int ArrayPtr::operator - ( ArrayPtr _ptr ) const
{
	assert( isValid() );
	assert( _ptr.isValid() );
	assert( sameArray( _ptr ) );
	return m_currentPosition - _ptr.m_currentPosition;
}
开发者ID:zaychenko-sergei,项目名称:oop-samples,代码行数:7,代码来源:array_ptr.cpp

示例12: flushUnusedTextures

void TexturesManager::flushUnusedTextures()
{
  ArrayPtr <TextureInfo> validTextures;
  size_t i;
  unsigned int textureID;
  
  for (i = 0; i < textureCollection.length(); i++)
    if (textureCollection(i)->getUserCount() > 0)
      validTextures.append(textureCollection(i));
    else
    {
      textureID = textureCollection(i)->getMedia();
      glDeleteTextures(1, &textureID);
      deleteObject(textureCollection(i));
    }
    
  textureCollection.clear();
  textureCollection = validTextures;
}
开发者ID:hyperiris,项目名称:praetoriansmapeditor,代码行数:19,代码来源:TexturesManager.cpp

示例13: switch

// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
GenericRecord *Decimation::convert(Record *rec) {
	if ( rec->data() == NULL ) return NULL;

	GenericRecord *out;
	switch ( rec->dataType() ) {
		case Array::CHAR:
		case Array::INT:
		case Array::FLOAT:
		case Array::DOUBLE:
			out = createDecimatedRecord(rec);
			break;
		default:
			return NULL;
	}

	ArrayPtr data = rec->data()->copy(_dataType);
	out->setData(data.get());

	return out;
}
开发者ID:SeisComP3,项目名称:seiscomp3,代码行数:21,代码来源:decimation.cpp

示例14: Vector3

/* ------------------------------------------------------- */
void SphereVolume::computeFromData(const Ptr<VertexData>& vdata)
{
	m_radius = 0.0f;
	m_center = Vector3(0.0f, 0.0f, 0.0f);
	float curDistance = 0.0f;
	
	ArrayPtr<GeometryVertex> vertices = vdata->getGeometryData();

	for (int i = 0; i < vertices.size(); i++)
	{
		m_center += vertices[i].position;
	}
	m_center /= vertices.size();

	for (int i = 0; i < vertices.size(); i++)
	{
		curDistance = (vertices[i].position-m_center).squaredLength();
		if (curDistance > m_radius)
		{
			m_radius = curDistance;
		}
	}
	m_radius = Math<float>::Sqrt(m_radius);
}
开发者ID:widmoser,项目名称:lotus,代码行数:25,代码来源:lspatial.cpp

示例15: array_reserve

	void array_reserve(ArrayPtr array, uint32_t new_size) {
		array->reserve(new_size);
	}
开发者ID:simonask,项目名称:snow-llvm,代码行数:3,代码来源:array.cpp


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