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


C++ TypeInfo::GetId方法代码示例

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


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

示例1: execute

        void execute ()
        {
            namespace bmpl = boost::mpl;
            typedef StaticTypeInfo<Base> StaticBaseInfo;

            TypeManager& f = TypeManager::GetInst();

            TypeInfo const& baseInfo =  f.GetInfoFromId( StaticBaseInfo::GetTypeId() );

            info->AddInterface( baseInfo );
            f.AddTypeImplementation( baseInfo.GetId(), info->GetId() );

            // "from" info	 to type id	,	anyStaticCast<ToType, FromType>
            info->AddCast( baseInfo.GetId(), &AnyStaticCast<Base, D> );

            baseInfo.AddCast( info->GetId(), &AnyStaticCast<D, Base> );

            for_each_type< typename StaticBaseInfo::BaseTypes >( AddBase<D>(*info) );
        }
开发者ID:kanbang,项目名称:myexercise,代码行数:19,代码来源:CreateTypeInfo.hpp

示例2: registerType

    TypeId TypeManager::registerType( std::type_info const& typeId, TypeInfo info )
    {
        const TypeId id = info.GetId();

        assert( id <= impl_->nextTypeId_ ); // no funny business! can't make up your own ids!

        // grow list
        if( impl_->infos_.size() <= static_cast<size_t>( id ) )
            impl_->infos_.resize( id + 1, TypeInfo( INVALID_TYPE ) );

        impl_->infos_[id] = info;

        impl_->allTypes_[ typeId ] = id;

        assert( impl_->typeNames_.find( info.GetName() ) == impl_->typeNames_.end() \
                && "Re-registering type not supported" );

        impl_->typeNames_[info.GetName()] = id;

        return info.GetId();
    }
开发者ID:kanbang,项目名称:myexercise,代码行数:21,代码来源:TypeManager.cpp

示例3: CreateTypeInfo

    TypeInfo CreateTypeInfo(char const* typeName)
    {
        TypeInfo newInfo = TypeManager::GetInst().CreateTypeInfo();

        newInfo.SetSize(sizeof(T));
        newInfo.SetName(typeName);

        newInfo.SetReferenceType( !boost::is_pointer<T>::value ?
                                  newInfo.GetId()	:
                                  StaticTypeInfo< typename boost::remove_pointer<
                                  typename boost::remove_pointer<T>::type>::type >::GetTypeId() );

        for_each_type< BaseTypes >( AddBase<T> (newInfo) );

        newInfo.SetCreationFunctions(&Alloc::create, &Alloc::clone, &Alloc::destruct, &Alloc::destroy );

        newInfo.SetVariables( MemberVariableList<T>::GetVariablePtrs() );

        return newInfo;
    }
开发者ID:kanbang,项目名称:myexercise,代码行数:20,代码来源:CreateTypeInfo.hpp

示例4: FitsIndexCriteria

  bool AreaWayIndexGenerator::FitsIndexCriteria(const ImportParameter& parameter,
                                                Progress& progress,
                                                const TypeInfo& typeInfo,
                                                const TypeData& typeData,
                                                const CoordCountMap& cellFillCount)
  {
    if (typeData.indexCells==0) {
      return true;
    }

    size_t entryCount=0;
    size_t max=0;

    for (CoordCountMap::const_iterator cell=cellFillCount.begin();
         cell!=cellFillCount.end();
         ++cell) {
      entryCount+=cell->second;
      max=std::max(max,cell->second);
    }

    // Average number of entries per tile cell
    double average=entryCount*1.0/cellFillCount.size();

    // If the fill rate of the index is too low, we use this index level anyway
    if (typeData.indexCells/(1.0*typeData.cellXCount*typeData.cellYCount)<=
        parameter.GetAreaWayIndexMinFillRate()) {
      progress.Warning(typeInfo.GetName()+" ("+NumberToString(typeInfo.GetId())+") is not well distributed");
      return true;
    }

    // If average fill size and max fill size for tile cells
    // is within limits, store it now.
    if (max<=parameter.GetAreaWayIndexCellSizeMax() &&
        average<=parameter.GetAreaWayIndexCellSizeAverage()) {
      return true;
    }

    return false;
  }
开发者ID:fingon,项目名称:osmscout,代码行数:39,代码来源:GenAreaWayIndex.cpp


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