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


C++ Dimensions类代码示例

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


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

示例1: inferSchema

    ArrayDesc inferSchema(std::vector<ArrayDesc> schemas, boost::shared_ptr<Query> query)
    {
        Attributes atts;
        atts.push_back(AttributeDesc(0, "attribute_name", TID_STRING, 0, 0));
        atts.push_back(AttributeDesc(1, "min", TID_STRING, 0, 0));
        atts.push_back(AttributeDesc(2, "max", TID_STRING, 0, 0));
        atts.push_back(AttributeDesc(3, "distinct_count", TID_UINT64, 0, 0));
        atts.push_back(AttributeDesc(4, "non_null_count", TID_UINT64, 0, 0));

        const AttributeDesc *emptyIndicator = schemas[0].getEmptyBitmapAttribute();

        set<string> a_s;
        for (size_t i = 0; i < _parameters.size(); i++)
        {
            string attName = ((boost::shared_ptr<OperatorParamReference>&)_parameters[i])->getObjectName();
                        
            if (emptyIndicator && emptyIndicator->getName() == attName)
                continue;

            a_s.insert(attName);
        }

        size_t attsCount = (a_s.size() == 0 ? (emptyIndicator ? schemas[0].getAttributes().size() - 1 : schemas[0].getAttributes().size()) : a_s.size()) - 1;

        Dimensions dims;
        dims.push_back(DimensionDesc("attribute_number", 0, attsCount, ANALYZE_CHUNK_SIZE, 0));

        return ArrayDesc(schemas[0].getName() + "_analyze", atts, dims);
	}
开发者ID:hansmire,项目名称:scidb-osx-12.10-mountain-lion,代码行数:29,代码来源:LogicalAnalyze.cpp

示例2: setDimensions

void
Region::setDimensions(Dimensions& newDims)
{
  // Can only set dimensions one time
  if (dims_ == newDims)
    return;
  
  if (dims_.isUnspecified())
  {
    if (newDims.isDontcare())
    {
      NTA_THROW << "Invalid attempt to set region dimensions to dontcare value";
    }

    if (! newDims.isValid())
    {
      NTA_THROW << "Attempt to set region dimensions to invalid value:"
                << newDims.toString();
    }

    dims_ = newDims;
    dimensionInfo_ = "Specified explicitly in setDimensions()";
  } else {
    NTA_THROW << "Attempt to set dimensions of region " << getName() 
              << " to " << newDims.toString()
              << " but region already has dimensions " << dims_.toString();
  }
  
  // can only create the enabled node set after we know the number of dimensions
  setupEnabledNodeSet();

}
开发者ID:AndreCAndersen,项目名称:nupic,代码行数:32,代码来源:Region.cpp

示例3: initialize

void ConstRLEChunk::initialize(ArrayDesc const * desc, const Address &address, int compMethod)
{
    _hasOverlap = false;
    _compressionMethod = compMethod;
    _arrayDesc = desc;
    _firstPositionNoOlap = address.coords;
    _addr = address;
    Dimensions dim = desc->getDimensions();

    _firstPosition.clear();
    _lastPositionNoOlap.clear();
    _lastPosition.clear();
    _chunkIntervals.clear();

    for (uint32_t i = 0; i < dim.size(); ++i)
    {
        if (dim[i].getChunkOverlap())
        {
            _hasOverlap = true;
        }

        _firstPosition.push_back( std::max<Coordinate>(_firstPositionNoOlap[i] - dim[i].getChunkOverlap(), dim[i].getStart()));
        _lastPosition.push_back( std::min<Coordinate>(_firstPositionNoOlap[i] + dim[i].getChunkInterval() + 2 * dim[i].getChunkOverlap() - 1, dim[i].getEndMax()));
        _lastPositionNoOlap.push_back( std::min<Coordinate>(_firstPositionNoOlap[i] + dim[i].getChunkInterval() - 1, dim[i].getEndMax()));

        _chunkIntervals.push_back(_lastPosition[i] - _firstPosition[i] + 1);
    }

}
开发者ID:tshead,项目名称:scidb-osx-12.3-snow-leopard,代码行数:29,代码来源:RLEArray.cpp

示例4: ReadDataSetDimensions

//-*****************************************************************************
// Get the dimensions directly off of the dataspace on the dataset
// This isn't suitable for string and wstring
void
ReadDataSetDimensions( hid_t iParent,
                       const std::string &iName,
                       hsize_t iExtent,
                       Dimensions &oDims )
{
    // Open the data set.
    hid_t dsetId = H5Dopen( iParent, iName.c_str(), H5P_DEFAULT );
    ABCA_ASSERT( dsetId >= 0, "Cannot open dataset: " << iName );
    DsetCloser dsetCloser( dsetId );

    // Read the data space.
    hid_t dspaceId = H5Dget_space( dsetId );
    ABCA_ASSERT( dspaceId >= 0, "Could not get dataspace for dataSet: "
                 << iName );
    DspaceCloser dspaceCloser( dspaceId );

    H5S_class_t dspaceClass = H5Sget_simple_extent_type( dspaceId );
    if ( dspaceClass == H5S_SIMPLE )
    {
        // Get the dimensions
        int rank = H5Sget_simple_extent_ndims( dspaceId );
        ABCA_ASSERT( rank == 1, "H5Sget_simple_extent_ndims() must be 1." );

        hsize_t hdim = 0;
        rank = H5Sget_simple_extent_dims( dspaceId, &hdim, NULL );
        oDims.setRank(1);
        oDims[0] = hdim / iExtent;
    }
    else
    {
        oDims.setRank(1);
        oDims[0] = 0;
    }
}
开发者ID:AWhetter,项目名称:alembic,代码行数:38,代码来源:ReadUtil.cpp

示例5: range_check

unsigned Pulsar::Transposer::get_ndim (unsigned idim)
{
  range_check (idim, "Pulsar::Transposer::get_ndim");

  Dimensions dims (archive);
  return dims.get_ndim( dim[idim] );
}
开发者ID:SkyTian13,项目名称:psrchive,代码行数:7,代码来源:Transposer.C

示例6: name_

// Deserialize region
Region::Region(const std::string& name, 
               const std::string& nodeType,
               const Dimensions& dimensions,
               BundleIO& bundle,
               Network * network) :
  name_(name), 
  type_(nodeType), 
  initialized_(false), 
  enabledNodes_(NULL),
  network_(network)
{
  // Set region info before creating the RegionImpl so that the 
  // Impl has access to the region info in its constructor.
  RegionImplFactory & factory = RegionImplFactory::getInstance();
  spec_ = factory.getSpec(nodeType);

  // Dimensions start off as unspecified, but if
  // the RegionImpl only supports a single node, we 
  // can immediately set the dimensions. 
  if (spec_->singleNodeOnly)
    if (!dimensions.isDontcare() && !dimensions.isUnspecified() &&
        !dimensions.isOnes())
      NTA_THROW << "Attempt to deserialize region of type " << nodeType
                << " with dimensions " << dimensions
                << " but region supports exactly one node.";

  dims_ = dimensions;

  impl_ = factory.deserializeRegionImpl(nodeType, bundle, this);
  createInputsAndOutputs_();
}
开发者ID:AndreCAndersen,项目名称:nupic,代码行数:32,代码来源:Region.cpp

示例7: writeAttribute

    void DCAttribute::writeAttribute(const char* name, const hid_t type, hid_t parent,
                                     uint32_t ndims, const Dimensions dims, const void* src)
    throw (DCException)
    {
        hid_t attr = -1;
        if (H5Aexists(parent, name))
            attr = H5Aopen(parent, name, H5P_DEFAULT);
        else
        {
            hid_t dsp;
            if( ndims == 1 && dims.getScalarSize() == 1 )
                dsp = H5Screate(H5S_SCALAR);
            else
                dsp = H5Screate_simple( ndims, dims.getPointer(), dims.getPointer() );

            attr = H5Acreate(parent, name, type, dsp, H5P_DEFAULT, H5P_DEFAULT);
            H5Sclose(dsp);
        }

        if (attr < 0)
            throw DCException(getExceptionString(name, "Attribute could not be opened or created"));

        if (H5Awrite(attr, type, src) < 0)
        {
            H5Aclose(attr);
            throw DCException(getExceptionString(name, "Attribute could not be written"));
        }

        H5Aclose(attr);
    }
开发者ID:Flamefire,项目名称:libSplash,代码行数:30,代码来源:DCAttribute.cpp

示例8: Resize

void SwapChain::Resize(const Dimensions& dimensions)
{
    // Release outdated resources
    backBuffer_.reset();
    depthStencilTexture_.reset();
    depthStencilView_.reset();

    e_throw_com_ret_error(dxgiSwapChain_
        ->ResizeBuffers(dxgiSwapChainDesc_.BufferCount,
                        dimensions.GetWidth(), dimensions.GetHeight(),
                        dxgiSwapChainDesc_.BufferDesc.Format,
                        dxgiSwapChainDesc_.Flags), "IDXGISwapChain::ResizeBuffers");

    // Temporarily grab the back buffer to get the view
    boost::intrusive_ptr<ID3D11Texture2D> tempBackBuffer;
    e_throw_com_ret_error(dxgiSwapChain_->GetBuffer(0, 
                                                    __uuidof(ID3D11Texture2D),
                                                    ReceiveCOM(tempBackBuffer)), "IDXGISwapChain::GetBuffer");

    // Now get the view
    e_throw_com_ret_error(device_.GetD3DDevice()
        .CreateRenderTargetView(tempBackBuffer.get(), 
                                0, 
                                ReceiveCOM(backBuffer_)), "ID3D11Device::CreateRenderTargetView");

    // Create depth/stencil views
    D3D11_TEXTURE2D_DESC depthTextureDesc = {0};
    depthTextureDesc.Width = dimensions.GetWidth();
    depthTextureDesc.Height = dimensions.GetHeight();
    depthTextureDesc.MipLevels = 1;
    depthTextureDesc.ArraySize = 1;
    depthTextureDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
    depthTextureDesc.SampleDesc.Count = 1;
    depthTextureDesc.SampleDesc.Quality = 0;
    depthTextureDesc.Usage = D3D11_USAGE_DEFAULT;
    depthTextureDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
    depthTextureDesc.CPUAccessFlags = 0;
    depthTextureDesc.MiscFlags = 0;

    e_throw_com_ret_error(device_.GetD3DDevice()
        .CreateTexture2D(&depthTextureDesc,
                         NULL,
                         ReceiveCOM(depthStencilTexture_)), "ID3D11Device::CreateTexture2D");

    D3D11_DEPTH_STENCIL_VIEW_DESC depthStencilViewDesc;
    memset(&depthStencilViewDesc, 0, sizeof(depthStencilViewDesc));
    depthStencilViewDesc.Format = depthTextureDesc.Format;
    depthStencilViewDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
    //depthStencilViewDesc.Texture2D.MipSlice = 0;

    e_throw_com_ret_error(device_.GetD3DDevice()
        .CreateDepthStencilView(depthStencilTexture_.get(),
                                &depthStencilViewDesc,
                                ReceiveCOM(depthStencilView_)), "ID3D11Device::CreateDepthStencilView");
    
    e_throw_com_ret_error(dxgiSwapChain_
        ->SetFullscreenState(window_.GetWindowProperties().windowType == WindowType::FULLSCREEN ? TRUE : FALSE,
                             NULL), "IDXGISwapChain::SetFullscreenState");
}
开发者ID:kaylynb,项目名称:Sunflower,代码行数:59,代码来源:SwapChain.cpp

示例9:

 const Dimensions<int> Renderer::getOutputSize() const
 {
     Dimensions<int> ret;
     if(isLoaded())
        if(SDL_GetRendererOutputSize(ren, ret.x().getPtr(), ret.y().getPtr()) < 0)
            return Dimensions<int>(-1, -1);
     return ret;
 }
开发者ID:JERlabs,项目名称:JERonimo,代码行数:8,代码来源:Renderer.cpp

示例10: inferSchema

 ArrayDesc inferSchema(std::vector< ArrayDesc> schemas, boost::shared_ptr< Query> query)
 {
     Attributes outputAttrs;
     outputAttrs.push_back(AttributeDesc(0, "dummy", TID_DOUBLE, AttributeDesc::IS_NULLABLE, 0));
     Dimensions outputDims;
     outputDims.push_back(DimensionDesc("i",0,0,1,0));
     return ArrayDesc("test_cache", outputAttrs, outputDims);
 }
开发者ID:Goon83,项目名称:scidb,代码行数:8,代码来源:LogicalTestCache.cpp

示例11: inferSchema

    ArrayDesc inferSchema(std::vector< ArrayDesc> schemas, boost::shared_ptr< Query> query)
    {
        assert(schemas.size() == 2);

        ArrayDesc  const& patternDesc = schemas[0];
        ArrayDesc  const& catalogDesc = schemas[1];
        Attributes const& catalogAttributes = catalogDesc.getAttributes(true);
        Dimensions const& catalogDimensions = catalogDesc.getDimensions();
        Attributes const& patternAttributes = patternDesc.getAttributes(true);
        Dimensions resultDimensions = patternDesc.getDimensions();
        size_t totalAttributes = catalogAttributes.size() + patternAttributes.size() + 1 + catalogDimensions.size();
        Attributes matchAttributes(totalAttributes);

        if (catalogDimensions.size() != resultDimensions.size())
        {
            stringstream left, right;
            printDimNames(left, resultDimensions);
            printDimNames(right, catalogDimensions);
            throw USER_EXCEPTION(SCIDB_SE_INFER_SCHEMA, SCIDB_LE_DIMENSION_COUNT_MISMATCH)
                << "match" << left.str() << right.str();
        }
        for (size_t i = 0, n = catalogDimensions.size(); i < n; i++) {
            if (!(catalogDimensions[i].getStartMin() == resultDimensions[i].getStartMin()
                  && catalogDimensions[i].getChunkInterval() == resultDimensions[i].getChunkInterval()
                  && catalogDimensions[i].getChunkOverlap() == resultDimensions[i].getChunkOverlap()))
            {
                // XXX To do: implement requiresRepart() method, remove interval/overlap checks
                // above, use SCIDB_LE_START_INDEX_MISMATCH here.
                throw USER_EXCEPTION(SCIDB_SE_INFER_SCHEMA, SCIDB_LE_ARRAYS_NOT_CONFORMANT);
            }
        }

        size_t j = 0;
        for (size_t i = 0, n = patternAttributes.size(); i < n; i++, j++) {
            AttributeDesc const& attr = patternAttributes[i];
            matchAttributes[j] = AttributeDesc(j, attr.getName(), attr.getType(), attr.getFlags(),
                                               attr.getDefaultCompressionMethod(), attr.getAliases(), &attr.getDefaultValue(),
                                               attr.getDefaultValueExpr());
        }
        for (size_t i = 0, n = catalogAttributes.size(); i < n; i++, j++) {
            AttributeDesc const& attr = catalogAttributes[i];
            matchAttributes[j] = AttributeDesc(j, "match_" + attr.getName(), attr.getType(), attr.getFlags(),
                                               attr.getDefaultCompressionMethod(), attr.getAliases(), &attr.getDefaultValue(),
                                               attr.getDefaultValueExpr());
        }
        for (size_t i = 0, n = catalogDimensions.size(); i < n; i++, j++) {
            matchAttributes[j] = AttributeDesc(j, "match_" + catalogDimensions[i].getBaseName(), TID_INT64, 0, 0);
        }
        matchAttributes[j] = AttributeDesc(j, DEFAULT_EMPTY_TAG_ATTRIBUTE_NAME, TID_INDICATOR, AttributeDesc::IS_EMPTY_INDICATOR, 0);

        int64_t maxCollisions = evaluate(((boost::shared_ptr<OperatorParamLogicalExpression>&)_parameters[1])->getExpression(),
                                          query, TID_INT64).getInt64();
        if (maxCollisions <= 0 || (int32_t)maxCollisions != maxCollisions)  { 
            throw USER_EXCEPTION(SCIDB_SE_INFER_SCHEMA, SCIDB_LE_WRONG_OPERATOR_ARGUMENT2) << "positive";
        }
        resultDimensions.push_back(DimensionDesc("collision", 0, 0, maxCollisions-1, maxCollisions-1, (uint32_t)maxCollisions, 0));
        return ArrayDesc("match", matchAttributes, resultDimensions);
    }
开发者ID:Goon83,项目名称:scidb,代码行数:58,代码来源:LogicalMatch.cpp

示例12: getOutputBoundaries

    virtual PhysicalBoundaries getOutputBoundaries(
            std::vector<PhysicalBoundaries> const& inputBoundaries,
            std::vector< ArrayDesc> const& inputSchemas) const
    {
        if (inputBoundaries[0].isEmpty()) {
            return PhysicalBoundaries::createEmpty(_schema.getDimensions().size());
        }


        Coordinates newStart, newEnd;
        Coordinates inStart = inputBoundaries[0].getStartCoords();
        Coordinates inEnd = inputBoundaries[0].getEndCoords();
        Dimensions dims = inputSchemas[0].getDimensions();
        size_t nDims = dims.size();

        size_t nParams = _parameters.size();
        std::vector<std::string> sliceDimName(nParams/2);
        for (size_t i = 0; i < nParams; i+=2) {
            sliceDimName[i >> 1]  = ((std::shared_ptr<OperatorParamReference>&)_parameters[i])->getObjectName();
        }

        for (size_t i = 0; i < nDims; i++) {
            const std::string dimName = dims[i].getBaseName();
            int k = safe_static_cast<int>(sliceDimName.size());
            while (--k >= 0
                   && sliceDimName[k] != dimName
                   && !(sliceDimName[k][0] == '_' && (size_t)atoi(sliceDimName[k].c_str()+1) == i+1))
                ;

            if (k < 0) {
                //dimension i is present in output
                newStart.push_back(inStart[i]);
                newEnd.push_back(inEnd[i]);
            } else {
                //dimension i is not present in output; check value
                Coordinate slice = ((std::shared_ptr<OperatorParamPhysicalExpression>&)_parameters[k*2+1])->getExpression()->evaluate().getInt64();
                if (!inputBoundaries[0].isInsideBox(slice,i))
                {
                    //the slice value is outside the box; guess what - the result is an empty array
                    return PhysicalBoundaries::createEmpty(_schema.getDimensions().size());
                }
            }
        }

        // This does nothing but calculate a few local values
        // and then discard them.
        // 
        // double resultCells = PhysicalBoundaries::getNumCells(newStart, newEnd);
        // double origCells = inputBoundaries[0].getNumCells();
        // double newDensity = 1.0;
        // if (resultCells > 0.0)
        // {
        //     newDensity = inputBoundaries[0].getDensity() * origCells / resultCells;
        //     newDensity = newDensity > 1.0 ? 1.0 : newDensity;
        // }

        return PhysicalBoundaries(newStart, newEnd);
    }
开发者ID:cerbo,项目名称:scidb,代码行数:58,代码来源:PhysicalSlice.cpp

示例13: openH5File

    void openH5File()
    {

        if (dataCollector == NULL)
        {
            DataSpace<simDim> mpi_pos;
            DataSpace<simDim> mpi_size;

            Dimensions splashMpiPos;
            Dimensions splashMpiSize;

            GridController<simDim> &gc = Environment<simDim>::get().GridController();

            mpi_pos = gc.getPosition();
            mpi_size = gc.getGpuNodes();

            splashMpiPos.set(0, 0, 0);
            splashMpiSize.set(1, 1, 1);

            for (uint32_t i = 0; i < simDim; ++i)
            {
                splashMpiPos[i] = mpi_pos[i];
                splashMpiSize[i] = mpi_size[i];
            }


            const uint32_t maxOpenFilesPerNode = 1;
            dataCollector = new ParallelDomainCollector(
                                                        gc.getCommunicator().getMPIComm(),
                                                        gc.getCommunicator().getMPIInfo(),
                                                        splashMpiSize,
                                                        maxOpenFilesPerNode);
            // set attributes for datacollector files
            DataCollector::FileCreationAttr h5_attr;
            h5_attr.enableCompression = false;
            h5_attr.fileAccType = DataCollector::FAT_CREATE;
            h5_attr.mpiPosition.set(splashMpiPos);
            h5_attr.mpiSize.set(splashMpiSize);
        }


        // open datacollector
        try
        {
            std::string filename = (foldername + std::string("/makroParticlePerSupercell"));
            log<picLog::INPUT_OUTPUT > ("HDF5 open DataCollector with file: %1%") %
                filename;
            dataCollector->open(filename.c_str(), h5_attr);
        }
        catch (DCException e)
        {
            std::cerr << e.what() << std::endl;
            throw std::runtime_error("Failed to open datacollector");
        }
    }
开发者ID:Sanjay-Kamalapuri,项目名称:picongpu,代码行数:55,代码来源:PerSuperCell.hpp

示例14: inferSchema

    ArrayDesc inferSchema(std::vector< ArrayDesc> schemas, boost::shared_ptr< Query> query)
    {
        assert(schemas.size() >= 2);
        assert(_parameters.size() == 0);

        Attributes const& leftAttributes = schemas[0].getAttributes();
        Dimensions const& leftDimensions = schemas[0].getDimensions();
        Attributes const* newAttributes = &leftAttributes;
        Dimensions newDims = leftDimensions;
        size_t nDims = newDims.size();

        for (size_t j = 1; j < schemas.size(); j++) {
            Attributes const& rightAttributes = schemas[j].getAttributes();
            Dimensions const& rightDimensions = schemas[j].getDimensions();

            if (nDims != rightDimensions.size())
                throw USER_EXCEPTION(SCIDB_SE_INFER_SCHEMA, SCIDB_LE_ARRAYS_NOT_CONFORMANT);

            for (size_t i = 0; i < nDims; i++) {
                if (   leftDimensions[i].getStart() != rightDimensions[i].getStart()
                        || leftDimensions[i].getChunkInterval() != rightDimensions[i].getChunkInterval()
                        || leftDimensions[i].getChunkOverlap() != rightDimensions[i].getChunkOverlap())
                {
                    throw USER_EXCEPTION(SCIDB_SE_INFER_SCHEMA, SCIDB_LE_ARRAYS_NOT_CONFORMANT);
                }

                DimensionDesc& dim = newDims[i];
                dim = DimensionDesc(dim.getBaseName(),
                                    dim.getNamesAndAliases(),
                                    min(dim.getStartMin(), rightDimensions[i].getStartMin()),
                                    min(dim.getCurrStart(), rightDimensions[i].getCurrStart()),
                                    max(dim.getCurrEnd(), rightDimensions[i].getCurrEnd()),
                                    max(dim.getEndMax(), rightDimensions[i].getEndMax()),
                                    dim.getChunkInterval(),
                                    dim.getChunkOverlap());
            }
            if (leftAttributes.size() != rightAttributes.size()
                    && (leftAttributes.size() != rightAttributes.size()+1
                        || !leftAttributes[leftAttributes.size()-1].isEmptyIndicator())
                    && (leftAttributes.size()+1 != rightAttributes.size()
                        || !rightAttributes[rightAttributes.size()-1].isEmptyIndicator()))
                throw USER_EXCEPTION(SCIDB_SE_INFER_SCHEMA, SCIDB_LE_ARRAYS_NOT_CONFORMANT);
            size_t nAttrs = min(leftAttributes.size(), rightAttributes.size());
            if (rightAttributes.size() > newAttributes->size()) {
                newAttributes = &rightAttributes;
            }
            for (size_t i = 0; i < nAttrs; i++)
            {
                if (leftAttributes[i].getType() != rightAttributes[i].getType()
                        || leftAttributes[i].getFlags() != rightAttributes[i].getFlags())
                    throw USER_EXCEPTION(SCIDB_SE_INFER_SCHEMA, SCIDB_LE_ARRAYS_NOT_CONFORMANT);
            }
        }
        return ArrayDesc(schemas[0].getName(), *newAttributes, newDims);
    }
开发者ID:Myasuka,项目名称:scidb,代码行数:55,代码来源:LogicalMerge.cpp

示例15: inferSchema

    ArrayDesc inferSchema(std::vector<ArrayDesc> schemas, boost::shared_ptr<Query> query)
    {
        ArrayDesc const& input = schemas[0];

        assert(schemas.size() == 1);

        string attName = _parameters.size() > 0 ? ((boost::shared_ptr<OperatorParamReference>&)_parameters[0])->getObjectName() :
                                                    input.getAttributes()[0].getName();

        AttributeID inputAttributeID = 0;
        bool found = false;
        BOOST_FOREACH(const AttributeDesc& att, input.getAttributes())
        {
            if (att.getName() == attName)
            {
                found = true;
                inputAttributeID = att.getId();
            }
        }

        if (!found) {
            throw USER_EXCEPTION(SCIDB_SE_INFER_SCHEMA, SCIDB_LE_DLA_ERROR14);
        }

        AttributeDesc rankedAttribute = input.getAttributes()[inputAttributeID];
        if (rankedAttribute.isEmptyIndicator()) {
            throw USER_EXCEPTION(SCIDB_SE_INFER_SCHEMA, SCIDB_LE_DLA_ERROR15);
        }

        Dimensions dims = input.getDimensions();
        if (_parameters.size()>1)
        {
            vector<int> groupBy(_parameters.size()-1);
            size_t i, j;
            for (i = 0; i < _parameters.size() - 1; i++)
            {
                const string& dimName = ((boost::shared_ptr<OperatorParamReference>&)_parameters[i + 1])->getObjectName();
                const string& dimAlias = ((boost::shared_ptr<OperatorParamReference>&)_parameters[i + 1])->getArrayName();
                for (j = 0; j < dims.size(); j++)
                {
                    if (dims[j].hasNameAndAlias(dimName, dimAlias))
                    {
                        break;
                    }
                }

                if (j >= dims.size())
                    throw USER_EXCEPTION(SCIDB_SE_INFER_SCHEMA, SCIDB_LE_DIMENSION_NOT_EXIST) << dimName;
            }
        }

        return getRankingSchema(input, inputAttributeID);
    }
开发者ID:Myasuka,项目名称:scidb,代码行数:53,代码来源:LogicalAverageRank.cpp


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