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


C++ BaseType类代码示例

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


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

示例1: getType

Instance MemoryDump::getInstanceAt(const QString& type, const size_t address,
        const QStringList& parentNames) const
{
    BaseType* t = getType(type);
	return t ?
	       t->toInstance(address, _vmem, "user", parentNames,
	               BaseType::trLexicalAndPointers) :
	       Instance();
}
开发者ID:wxdublin,项目名称:insight-vmi,代码行数:9,代码来源:memorydump.cpp

示例2:

Sequence *OGRDODSSequenceLayer::FindSuperSequence( BaseType *poChild )

{
    BaseType *poParent;

    for( poParent = poChild->get_parent(); 
         poParent != NULL; 
         poParent = poParent->get_parent() )
    {
        if( poParent->type() == dods_sequence_c )
        {
            return dynamic_cast<Sequence *>( poParent );
        }
    }

    return NULL;
}
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:17,代码来源:ogrdodssequencelayer.cpp

示例3: Render

	void Painter::Render(D3D* d3d, Frustum* frustum, Viewport* viewport, 
		D3DXMATRIX world, D3DXMATRIX view, D3DXMATRIX projection, D3DXMATRIX ortho)
	{
		std::sort(z.begin(), z.end(), Compare);
		for( vector<BaseType*>::iterator p=z.begin(); p!=z.end(); ++p)
		{
			//process(*p); RENDER BACK TO FRONT

			//FRONT = negatives
			//BACK = positives
			//sort list greatest to least so back renders first

			BaseType* base = *p;
			int type = base->GetType();
			if (type == 1)
			{
				ModelType* model = (ModelType*)base;
				model->transform = &xforce(*model->transform, Rad);
				model->Render(d3d->GetDeviceContext(), frustum, viewport);
			}
			if (type == 2)
			{
				TextType* text = (TextType*)base;
				text->Render(d3d->GetDeviceContext(), viewport);
			}
			if (type == 3)
			{
				BitmapType* bitmap = (BitmapType*)base;
				bitmap->transform = &xforce(*bitmap->transform, Rad);
				bitmap->Render(d3d, viewport);
			}
			/*if (type == 4)
			{
				TransformType* transform = (TransformType*)base;
				transform->Render(d3d, world, view, projection, ortho);
			}*/
		}
		return;
	}
开发者ID:roygaogit,项目名称:D3DLib,代码行数:39,代码来源:painter.cpp

示例4: GetPositionInStorageForIndex

bool DataStorePrivate::GetPositionInStorageForIndex(const BaseType& dataStorage, uint& lineNumber, uint& indexInLine, uint index)
{
    indexInLine = index;
    lineNumber = 0;

    uint dataStorageSize = dataStorage.size();
    uint lineSize = 0;
    while (lineNumber < dataStorageSize &&
            indexInLine >= (lineSize = dataStorage[lineNumber]->size()))
    {
        indexInLine -= lineSize;
        lineNumber++;
    }
    return lineNumber < dataStorageSize;
}
开发者ID:Mmonya,项目名称:Monya_folder,代码行数:15,代码来源:CSStringPrivate.cpp

示例5: typeConvertable

TIL_CastOpcode typeConvertable(BaseType Vt1, BaseType Vt2) {
  if (Vt1.isIntegral()) {
    if (Vt2.Base == Vt1.Base)
      if (Vt1.Size <= Vt2.Size)
        return CAST_extendNum;
    if (Vt2.Base == BaseType::BT_Float)
      if (static_cast<unsigned>(Vt1.Size) <= static_cast<unsigned>(Vt2.Size)-1)
        return CAST_extendToFloat;
  }
  else if (Vt1.Base == BaseType::BT_Float &&
           Vt2.Base == BaseType::BT_Float) {
    if (Vt1.Size <= Vt2.Size)
      return CAST_extendNum;
  }
  return CAST_none;
}
开发者ID:google,项目名称:ohmu,代码行数:16,代码来源:TIL.cpp

示例6: AddToFront

	void Painter::AddToFront(BaseType& item)
	{
		item.ZOrder = 0;
		if (!z.empty())
		{
			BaseType* front;
			std::sort(z.begin(), z.end(), Compare);

			//z.BACK = FRONT

			front = z.back(); //z.front or z.back?
			float loc = front->ZOrder - 1;
			item.ZOrder = loc;
		}
		BaseType* base = item.Clone();
		//BaseType* base = dynamic_cast<BaseType*>((BaseType*)&model);
		z.push_back(base);
		return;
	}
开发者ID:roygaogit,项目名称:D3DLib,代码行数:19,代码来源:painter.cpp

示例7: BaseType

template <typename Iter, typename Traits> NEXTWEB_INLINE
StreamBuffer<Iter, Traits>::StreamBuffer(Iter begin, Iter end) :
	BaseType(), current_(begin), begin_(begin), end_(end)
{
	setg(buffer_, buffer_, buffer_);
}
开发者ID:crnt,项目名称:nextweb,代码行数:6,代码来源:StreamBuffer.hpp

示例8: OGRDODSLayer

OGRDODSGridLayer::OGRDODSGridLayer( OGRDODSDataSource *poDSIn,
                                    const char *pszTargetIn,
                                    AttrTable *poOGRLayerInfoIn ) :
    OGRDODSLayer( poDSIn, pszTargetIn, poOGRLayerInfoIn ),
    poTargetGrid(NULL),
    poTargetArray(NULL),
    nArrayRefCount(0),
    paoArrayRefs(NULL),
    nDimCount(0),
    paoDimensions(NULL),
    nMaxRawIndex(0)
{
/* -------------------------------------------------------------------- */
/*      What is the layer name?                                         */
/* -------------------------------------------------------------------- */
    string oLayerName;
    const char *pszLayerName = pszTargetIn;

    if( poOGRLayerInfo != NULL )
    {
        oLayerName = poOGRLayerInfo->get_attr( "layer_name" );
        if( strlen(oLayerName.c_str()) > 0 )
            pszLayerName = oLayerName.c_str();
    }

    poFeatureDefn = new OGRFeatureDefn( pszLayerName );
    poFeatureDefn->Reference();

/* -------------------------------------------------------------------- */
/*      Fetch the target variable.                                      */
/* -------------------------------------------------------------------- */
    BaseType *poTargVar = poDS->poDDS->var( pszTargetIn );

    if( poTargVar->type() == dods_grid_c )
    {
        poTargetGrid = dynamic_cast<Grid *>( poTargVar );
        poTargetArray = dynamic_cast<Array *>(poTargetGrid->array_var());
    }
    else if( poTargVar->type() == dods_array_c )
    {
        poTargetGrid = NULL;
        poTargetArray = dynamic_cast<Array *>( poTargVar );
    }
    else
    {
        CPLAssert( false );
        return;
    }

/* -------------------------------------------------------------------- */
/*      Count arrays in use.                                            */
/* -------------------------------------------------------------------- */
    AttrTable *poExtraContainers = NULL;
    nArrayRefCount = 1; // primary target.

    if( poOGRLayerInfo != NULL )
        poExtraContainers = poOGRLayerInfo->find_container("extra_containers");

    if( poExtraContainers != NULL )
    {
        AttrTable::Attr_iter dv_i;

        for( dv_i = poExtraContainers->attr_begin();
             dv_i != poExtraContainers->attr_end(); dv_i++ )
        {
            nArrayRefCount++;
        }
    }

/* -------------------------------------------------------------------- */
/*      Collect extra_containers.                                       */
/* -------------------------------------------------------------------- */
    paoArrayRefs = new OGRDODSArrayRef[nArrayRefCount];
    paoArrayRefs[0].pszName = CPLStrdup( pszTargetIn );
    paoArrayRefs[0].poArray = poTargetArray;

    nArrayRefCount = 1;

    if( poExtraContainers != NULL )
    {
        AttrTable::Attr_iter dv_i;

        for( dv_i = poExtraContainers->attr_begin();
             dv_i != poExtraContainers->attr_end(); dv_i++ )
        {
            const char *pszTargetName=poExtraContainers->get_attr(dv_i).c_str();
            BaseType *poExtraTarget = poDS->poDDS->var( pszTargetName );

            if( poExtraTarget == NULL )
            {
                CPLError( CE_Warning, CPLE_AppDefined,
                          "Unable to find extra_container '%s', skipping.",
                          pszTargetName );
                continue;
            }

            if( poExtraTarget->type() == dods_array_c )
                paoArrayRefs[nArrayRefCount].poArray =
                    dynamic_cast<Array *>( poExtraTarget );
            else if( poExtraTarget->type() == dods_grid_c )
//.........这里部分代码省略.........
开发者ID:Mavrx-inc,项目名称:gdal,代码行数:101,代码来源:ogrdodsgrid.cpp

示例9: CPLAssert

OGRFeature *OGRDODSSequenceLayer::GetFeature( GIntBig nFeatureId )

{
/* -------------------------------------------------------------------- */
/*      Ensure we have the dataset.                                     */
/* -------------------------------------------------------------------- */
    if( !ProvideDataDDS() )
        return NULL;

    Sequence *seq = dynamic_cast<Sequence *>(poTargetVar);

/* -------------------------------------------------------------------- */
/*      Figure out what the super and subsequence number this           */
/*      feature will be, and validate it.  If there is not super        */
/*      sequence the feature id is the subsequence number.              */
/* -------------------------------------------------------------------- */
    int iSubSeq = -1;

    if( nFeatureId < 0 || nFeatureId >= nRecordCount )
        return NULL;

    if( poSuperSeq == NULL )
        iSubSeq = nFeatureId;
    else
    {
        int nSeqOffset = 0, iSuperSeq;

        // for now we just scan through till find find out what
        // super sequence this in.  In the long term we need a better (cached)
        // approach that doesn't involve this quadratic cost.
        for( iSuperSeq = 0; 
             iSuperSeq < nSuperSeqCount; 
             iSuperSeq++ )
        {
            if( nSeqOffset + panSubSeqSize[iSuperSeq] > nFeatureId )
            {
                iSubSeq = nFeatureId - nSeqOffset;
                break;
            }
            nSeqOffset += panSubSeqSize[iSuperSeq];
        }

        CPLAssert( iSubSeq != -1 );

        // Make sure we have the right target var ... the one 
        // corresponding to our current super sequence. 
        if( iSuperSeq != iLastSuperSeq )
        {
            iLastSuperSeq = iSuperSeq;
            poTargetVar = poSuperSeq->var_value( iSuperSeq, pszSubSeqPath );
            seq = dynamic_cast<Sequence *>(poTargetVar);
        }
    }

/* -------------------------------------------------------------------- */
/*      Create the feature being read.                                  */
/* -------------------------------------------------------------------- */
    OGRFeature *poFeature;

    poFeature = new OGRFeature( poFeatureDefn );
    poFeature->SetFID( nFeatureId );
    m_nFeaturesRead++;

/* -------------------------------------------------------------------- */
/*      Process all the regular data fields.                            */
/* -------------------------------------------------------------------- */
    int      iField;

    for( iField = 0; iField < poFeatureDefn->GetFieldCount(); iField++ )
    {
        if( papoFields[iField]->pszPathToSequence )
            continue;

        BaseType *poFieldVar = GetFieldValue( papoFields[iField], iSubSeq,
                                              NULL );

        if( poFieldVar == NULL )
            continue;

        switch( poFieldVar->type() )
        {
          case dods_byte_c:
          {
              signed char byVal;
              void *pValPtr = &byVal;
              
              poFieldVar->buf2val( &pValPtr );
              poFeature->SetField( iField, byVal );
          }
          break;

          case dods_int16_c:
          {
              GInt16 nIntVal;
              void *pValPtr = &nIntVal;
              
              poFieldVar->buf2val( &pValPtr );
              poFeature->SetField( iField, nIntVal );
          }
          break;
//.........这里部分代码省略.........
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:101,代码来源:ogrdodssequencelayer.cpp

示例10: ProvideDataDDS

bool OGRDODSGridLayer::ProvideDataDDS()

{
    if( bDataLoaded )
        return poTargetVar != NULL;

    const bool  bResult = OGRDODSLayer::ProvideDataDDS();

    if( !bResult )
        return bResult;

    for( int iArray=0; iArray < nArrayRefCount; iArray++ )
    {
        OGRDODSArrayRef *poRef = paoArrayRefs + iArray;
        BaseType *poTarget = poDataDDS->var( poRef->pszName );

        // Reset ref array pointer to point in DataDDS result.
        if( poTarget->type() == dods_grid_c )
        {
            Grid *poGrid = dynamic_cast<Grid *>( poTarget );
            poRef->poArray = dynamic_cast<Array *>(poGrid->array_var());

            if( iArray == 0 )
                poTargetGrid = poGrid;
        }
        else if( poTarget->type() == dods_array_c )
        {
            poRef->poArray = dynamic_cast<Array *>( poTarget );
        }
        else
        {
            CPLAssert( false );
            return false;
        }

        if( iArray == 0 )
            poTargetArray = poRef->poArray;

        // Allocate appropriate raw data array, and pull out data into it.
        poRef->pRawData = CPLMalloc( poRef->poArray->width() );
        poRef->poArray->buf2val( &(poRef->pRawData) );
    }

    // Setup pointers to each of the map objects.
    if( poTargetGrid != NULL )
    {
        int iMap = 0;
        Grid::Map_iter iterMap;

        for( iterMap = poTargetGrid->map_begin();
             iterMap != poTargetGrid->map_end();
             iterMap++, iMap++ )
        {
            paoDimensions[iMap].poMap = dynamic_cast<Array *>(*iterMap);
            if( paoDimensions[iMap].poMap == NULL )
                return false;
            paoDimensions[iMap].pRawData =
                CPLMalloc( paoDimensions[iMap].poMap->width() );
            paoDimensions[iMap].poMap->buf2val( &(paoDimensions[iMap].pRawData) );
        }
    }

    return bResult;
}
开发者ID:Mavrx-inc,项目名称:gdal,代码行数:64,代码来源:ogrdodsgrid.cpp

示例11: re

Instance MemoryDump::getNextInstance(const QString& component,
									 const Instance& instance,
									 KnowledgeSources src) const
{
	Instance result;
	QString typeString, symbol, offsetString, candidate, arrayIndexString;
	bool okay;
//    quint32 compatibleCnt = 0;

	// A component should have the form (symbol(-offset)?)?symbol(<candidate>)?([index])?
#define SYMBOL "[A-Za-z0-9_]+"
#define NUMBER "\\d+"
	QRegExp re(
				"^\\s*(?:"
					"\\(\\s*"
						"(" SYMBOL ")"
						"(?:"
							"\\s*-\\s*(" SYMBOL ")"
						")?"
					"\\s*\\)"
				")?"
				"\\s*(" SYMBOL ")\\s*"
				"(?:<\\s*(" NUMBER ")\\s*>\\s*)?"
				"((?:\\[\\s*" NUMBER "\\s*\\]\\s*)*)\\s*");
	 
	if (!re.exactMatch(component)) {
		queryError(QString("Could not parse a part of the query string: %1")
		            .arg(component));
    }
	
	// Set variables according to the matching
	typeString = re.cap(1);
	offsetString = re.cap(2).trimmed();
	symbol = re.cap(3);
	candidate = re.cap(4);
	arrayIndexString = re.cap(5).trimmed();

	int candidateIndex = candidate.isEmpty() ? -1 : candidate.toInt();

//	debugmsg(QString("1: %1, 2: %2, 3: %3, 4: %4, 5: %5")
//			 .arg(re.cap(1))
//			 .arg(re.cap(2))
//			 .arg(re.cap(3))
//			 .arg(re.cap(4))
//			 .arg(re.cap(5)));

	// A candidate index of 0 means to ignore the alternative types
	if (candidateIndex == 0)
		src = static_cast<KnowledgeSources>(src|ksNoAltTypes);

	// If the given instance is Null, we interpret this as the first component
	// in the query string and will therefore try to resolve the variable.
	if (!instance.isValid()) {
		 Variable* v = _factory->findVarByName(symbol);

		if (!v)
			queryError(QString("Variable does not exist: %1").arg(symbol));

		if (candidateIndex > 0) {
			if (v->altRefTypeCount() < candidateIndex)
				queryError(QString("Variable \"%1\" does not have a candidate "
								   "with index %2")
							.arg(symbol)
							.arg(candidateIndex));
			result = v->altRefTypeInstance(_vmem, candidateIndex - 1);
		}
		else {
			result = v->toInstance(_vmem, BaseType::trLexical, src);
		}
	}
	else {
		// Dereference any pointers/arrays first
		result = instance.dereference(BaseType::trAnyNonNull);

		// Did we get a null instance?
		if (!(result.type()->type() & StructOrUnion) &&
			(result.isNull() || !result.toPointer()))
			queryError(QString("Member \"%1\" is null")
					   .arg(result.fullName()));
		// We have a instance therefore we resolve the member
		if (!(result.type()->type() & StructOrUnion))
            queryError(QString("Member \"%1\" is not a struct or union")
                        .arg(result.fullName()));

        if (!result.memberExists(symbol))
            queryError(QString("Struct \"%1\" has no member named \"%2\"")
                        .arg(result.typeName())
                        .arg(symbol));

        // Do we have a candidate index?
        if (candidateIndex > 0) {
            if (result.memberCandidatesCount(symbol) < candidateIndex)
                queryError(QString("Member \"%1\" does not have a candidate "
                                   "with index %2")
                            .arg(symbol)
                            .arg(candidateIndex));
            result = result.memberCandidate(symbol, candidateIndex - 1);
        }
        else {
            result = result.member(symbol, BaseType::trLexical, 0, src);
//.........这里部分代码省略.........
开发者ID:wxdublin,项目名称:insight-vmi,代码行数:101,代码来源:memorydump.cpp

示例12: if

template <typename Iter, typename Traits> NEXTWEB_INLINE typename StreamBuffer<Iter, Traits>::PosType
StreamBuffer<Iter, Traits>::seekoff(typename StreamBuffer<Iter, Traits>::OffType off, std::ios::seekdir dir, std::ios::openmode which) {
	
	if (!(which & std::ios::in)) {
		return BAD_POSITION;
	}		
	
	DistanceType size = std::distance(begin_, end_);
	DistanceType dist = static_cast<DistanceType>(off);
	DistanceType position = static_cast<DistanceType>(-1);
	
	if ((std::ios::beg == dir) && (dist >= 0) && (dist < size)) {
		position = dist;
	}
	else if ((std::ios::end == dir) && (dist >= 0) && (dist < size)) {
		position = size - dist;
	}
	else if (std::ios::cur == dir) {
		position = std::distance(begin_, current_) - static_cast<DistanceType>(egptr() - gptr()) + dist;
		if ((position < 0) || (position >= size)) {
			return BAD_POSITION;
		}
	}
	if (static_cast<DistanceType>(-1) != position) {
		current_ = begin_;
		std::advance(current_, position);
		fill();
		return static_cast<PosType>(position);
	}
	return BAD_POSITION;
}
开发者ID:crnt,项目名称:nextweb,代码行数:31,代码来源:StreamBuffer.hpp

示例13: eof

template <typename Iter, typename Traits> NEXTWEB_INLINE typename StreamBuffer<Iter, Traits>::IntType
StreamBuffer<Iter, Traits>::underflow() {
	assert(gptr() == egptr());
	if (end_ == current_) {
		return Traits::eof();
	}
	return fill();
}
开发者ID:crnt,项目名称:nextweb,代码行数:8,代码来源:StreamBuffer.hpp

示例14: to_int_type

template <typename Iter, typename Traits> NEXTWEB_INLINE typename StreamBuffer<Iter, Traits>::IntType
StreamBuffer<Iter, Traits>::fill() {
	std::size_t size = 0;
	for (; end_ != current_ && size < BUFFER_SIZE; ++current_, ++size) {
		buffer_[size] = *current_;
	}
	setg(buffer_, buffer_, buffer_ + size);
	return Traits::to_int_type(buffer_[0]);
}
开发者ID:crnt,项目名称:nextweb,代码行数:9,代码来源:StreamBuffer.hpp

示例15: getPriority

 /**
  * Returns priority of outgoing transfers.
  * TODO: Make const.
  */
 TransferPriority getPriority()
 {
     // TODO probably TransferSender must be transformed into regular field?
     TransferSender* const ts = getTransferSender();
     if (ts != NULL)
     {
         return ts->getPriority();
     }
     else
     {
         return TransferPriorityNormal;  // This is default
     }
 }
开发者ID:basstubm,项目名称:uavcan,代码行数:17,代码来源:publisher.hpp


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