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


C++ descriptor函数代码示例

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


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

示例1: content

 /// Retrieve a pointer to the data content of a given microslice
 const uint8_t* content(uint64_t component, uint64_t microslice) const {
   return data_ptr_[component] +
          desc_ptr_[component]->num_microslices *
              sizeof(MicrosliceDescriptor) +
          descriptor(component, microslice).offset -
          descriptor(component, 0).offset;
 }
开发者ID:PALoizeau,项目名称:flesnet,代码行数:8,代码来源:Timeslice.hpp

示例2: deferGC

bool InferredType::set(const ConcurrentJSLocker& locker, VM& vm, Descriptor newDescriptor)
{
    // We will trigger write barriers while holding our lock. Currently, write barriers don't GC, but that
    // could change. If it does, we don't want to deadlock. Note that we could have used
    // GCSafeConcurrentJSLocker in the caller, but the caller is on a fast path so maybe that wouldn't be
    // a good idea.
    DeferGCForAWhile deferGC(vm.heap);
    
    // Be defensive: if we're not really changing the type, then we don't have to do anything.
    if (descriptor(locker) == newDescriptor)
        return false;

    bool shouldFireWatchpointSet = false;
    
    // The new descriptor must be more general than the previous one.
    ASSERT(newDescriptor.subsumes(descriptor(locker)));

    // If the new descriptors have different structures, then it can only be because one is null.
    if (descriptor(locker).structure() != newDescriptor.structure())
        ASSERT(!descriptor(locker).structure() || !newDescriptor.structure());

    // We are changing the type, so make sure that if anyone was watching, they find out about it now. If
    // anyone is watching, we make sure to go to Top so that we don't do this sort of thing again.
    if (m_watchpointSet.state() != ClearWatchpoint) {
        // We cannot have been invalidated, since if we were, then we'd already be at Top.
        ASSERT(m_watchpointSet.state() != IsInvalidated);

        // We're about to do expensive things because some compiler thread decided to watch this type and
        // then the type changed. Assume that this property is crazy, and don't ever do any more things for
        // it.
        newDescriptor = Top;

        shouldFireWatchpointSet = true;
    }

    // Remove the old InferredStructure object if we no longer need it.
    if (!newDescriptor.structure())
        m_structure = nullptr;

    // Add a new InferredStructure object if we need one now.
    if (newDescriptor.structure()) {
        if (m_structure) {
            // We should agree on the structures if we get here.
            ASSERT(newDescriptor.structure() == m_structure->structure());
        } else {
            m_structure = adoptRef(new InferredStructure(vm, this, newDescriptor.structure()));
            newDescriptor.structure()->addTransitionWatchpoint(&m_structure->m_watchpoint);
        }
    }

    // Finally, set the descriptor kind.
    m_kind = newDescriptor.kind();

    // Assert that we did things.
    ASSERT(descriptor(locker) == newDescriptor);

    return shouldFireWatchpointSet;
}
开发者ID:caiolima,项目名称:webkit,代码行数:58,代码来源:InferredType.cpp

示例3: descriptor

 const field_desc_type *find_field( const std::string &name ) const
 {
     const field_desc_type *fld(descriptor()->FindFieldByName(name));
     if( fld ) return fld;
     fld = descriptor()->FindFieldByLowercaseName( name );
     if( fld ) return fld;
     fld = descriptor()->FindFieldByCamelcaseName( name );
     if( fld ) return fld;
     return NULL;
 }
开发者ID:malchemist,项目名称:vtrc,代码行数:10,代码来源:message-helper.cpp

示例4: TEST

TEST(CustomElementDescriptorTest,
    matches_customizedBuiltIn_shouldNotMatchAutonomousElement)
{
    CustomElementDescriptor descriptor("a-b", "button");
    Element* element = CreateElement("a-b");
    EXPECT_FALSE(descriptor.matches(*element));
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:7,代码来源:CustomElementDescriptorTest.cpp

示例5: IPC_OK

mozilla::ipc::IPCResult
WebRenderBridgeParent::RecvAddBlobImage(const wr::ImageKey& aImageKey,
                                        const gfx::IntSize& aSize,
                                        const uint32_t& aStride,
                                        const gfx::SurfaceFormat& aFormat,
                                        const ByteBuffer& aBuffer)
{
  if (mDestroyed) {
    return IPC_OK();
  }

  // Check if key is obsoleted.
  if (aImageKey.mNamespace != mIdNamespace) {
    return IPC_OK();
  }

  MOZ_ASSERT(mApi);
  MOZ_ASSERT(mActiveImageKeys.find(wr::AsUint64(aImageKey)) == mActiveImageKeys.end());

  wr::ImageDescriptor descriptor(aSize, aStride, aFormat);
  mActiveImageKeys.insert(wr::AsUint64(aImageKey));
  mApi->AddBlobImage(aImageKey, descriptor,
                     aBuffer.AsSlice());

  return IPC_OK();
}
开发者ID:yrliou,项目名称:gecko-dev,代码行数:26,代码来源:WebRenderBridgeParent.cpp

示例6: construct_graph

void construct_graph( const Points& points, 
		      const double epsilon,
		      Graph& graph) {
    typedef typename boost::graph_traits<Graph> graph_traits;
    typedef typename graph_traits::vertex_iterator vertex_iterator;
    typedef typename boost::graph_traits< Graph>::vertex_descriptor vertex_descriptor; 
    typedef typename boost::property_map< Graph,
					  boost::vertex_name_t>::type name_map_t;
    typedef typename boost::property_traits< name_map_t>::value_type  vertex_name_t;
    typedef std::unordered_map< vertex_name_t, vertex_descriptor> Name_to_descriptor_map;

    name_map_t name_map = boost::get( boost::vertex_name, graph);
    Name_to_descriptor_map descriptor( points.size());

    // add vertices
    for( std::size_t i = 0; i < points.size(); ++i) {
	vertex_descriptor v_descriptor = boost::add_vertex( graph);
	name_map[ v_descriptor] = i;
	descriptor.emplace( i, v_descriptor);
    }

    // add edges
    vertex_iterator vi, vj, vlast;
    double epsilon_squared = epsilon*epsilon;
    for ( std::tie( vi, vlast) = boost::vertices( graph); vi != vlast; ++vi) {
      for ( std::tie( vj, vlast) = boost::vertices (graph); vj != vi; ++vj) {
       
	if( lp(points.begin(name_map[*vi]), 
	       points.end(name_map[*vi]), 
	       points.begin(name_map[*vj])) < epsilon_squared){
             boost::add_edge(*vi, *vj, graph);
       }
      } 
    }
} 
开发者ID:albertasd,项目名称:ctl,代码行数:35,代码来源:all_pairs.hpp

示例7: GetBulkData

      virtual QPair<QByteArray, bool> GetBulkData(int)
      {
        QByteArray data(1024, 0);
        CreateDescriptor(data);

        SetTriggered();
        int my_idx = GetGroup().GetIndex(GetLocalId());
        int bad = Random::GetInstance().GetInt(0, GetGroup().Count());
        while(bad == my_idx) {
          bad = Random::GetInstance().GetInt(0, GetGroup().Count());
        }

        qDebug() << my_idx << "setting bad hash at" << bad;
        const Descriptor &cdes = GetMyDescriptor();
        QVector<QByteArray> hashes = cdes.XorMessageHashes();

        hashes[bad] = Hash().ComputeHash(data);

        Descriptor descriptor(cdes.Length(), cdes.PublicDh(), hashes,
            cdes.CleartextHash());
        SetMyDescriptor(descriptor);

        QByteArray my_desc;
        QDataStream desstream(&my_desc, QIODevice::WriteOnly);
        desstream << GetMyDescriptor();
        return QPair<QByteArray, bool>(my_desc, false);
      }
开发者ID:ASchurman,项目名称:Dissent,代码行数:27,代码来源:BulkRoundHelpers.hpp

示例8: assert

template <typename PointInT, typename PointNT, typename PointOutT> void
pcl::ShapeContext3DEstimation<PointInT, PointNT, PointOutT>::computeFeature (PointCloudOut &output)
{
  assert (descriptor_length_ == 1980);

  output.is_dense = true;
  // Iterate over all points and compute the descriptors
	for (size_t point_index = 0; point_index < indices_->size (); point_index++)
  {
    //output[point_index].descriptor.resize (descriptor_length_);

    // If the point is not finite, set the descriptor to NaN and continue
    if (!isFinite ((*input_)[(*indices_)[point_index]]))
    {
      for (size_t i = 0; i < descriptor_length_; ++i)
        output[point_index].descriptor[i] = std::numeric_limits<float>::quiet_NaN ();

      memset (output[point_index].rf, 0, sizeof (output[point_index].rf[0]) * 9);
      output.is_dense = false;
      continue;
    }

    std::vector<float> descriptor (descriptor_length_);
    if (!computePoint (point_index, *normals_, output[point_index].rf, descriptor))
      output.is_dense = false;
    for (size_t j = 0; j < descriptor_length_; ++j)
      output[point_index].descriptor[j] = descriptor[j];
  }
}
开发者ID:ShiningPluto,项目名称:pcl,代码行数:29,代码来源:3dsc.hpp

示例9: keys

  void ODFeatureDetector2D::findSiftGPUDescriptors(char const *image_name, cv::Mat &descriptors, vector<cv::KeyPoint> &keypoints)
  {
    sift_gpu_->RunSIFT(image_name);

    int nFeat = sift_gpu_->GetFeatureNum();//get feature count
    //allocate memory for readback
    vector<SiftGPU::SiftKeypoint> keys(nFeat);
    //read back keypoints and normalized descritpros
    //specify NULL if you don’t need keypoints or descriptors
    vector<float> imageDescriptors(128 * nFeat);
    sift_gpu_->GetFeatureVector(&keys[0], &imageDescriptors[0]);

    sift_gpu_->SaveSIFT("1.sift");

    //to opencv format
    keypoints.clear();
    descriptors.create(0, 128, CV_32FC1);
    for(int i = 0; i < nFeat; ++i) {
      cv::KeyPoint key(keys[i].x, keys[i].y, keys[i].s, keys[i].o);
      keypoints.push_back(key);
      cv::Mat descriptor(1, 128, CV_32FC1);
      for(int x = 0; x < 128; x++) descriptor.at<float>(x) = floor(0.5 + 512.0f * imageDescriptors[(i << 7) + x]);
      descriptors.push_back(descriptor);
    }
    cv::Mat image = cv::imread(image_name);
  }
开发者ID:Aravind-Suresh,项目名称:opendetection,代码行数:26,代码来源:ODFeatureDetector2D.cpp

示例10: typeptr

// -----------------------------------------------------------------------------
// RDRMHelper::IsAutomated
// -----------------------------------------------------------------------------
//
TInt RDRMHelper::IsAutomated(
    const TDesC8& aUri,
    TInt aAutomatedType,
    TInt aIntent,
    TBool& aAutomated,
    TInt& aType ) const
{
    TPtr8 typeptr( reinterpret_cast< TUint8* >( &aType ), 0, sizeof( TInt ) );
    TPtr8 flag( reinterpret_cast< TUint8* >( &aAutomated ), 0, sizeof( TInt ) );
    TInt ret( 0 );
    TInt type = CDRMHelperServer::EActive;

    // Create descriptor to enable copying data between
    // client and server. Note: This can be local since
    // this is a synchronous call.
    // Note : Using TPtr8 since this is binary information
    TPtrC8 descriptor( aUri );

    // This call waits for the server to complete the request before
    // proceeding.
    ret = SendReceive(
              EIsRegistered,
              TIpcArgs( aIntent, type, aAutomatedType, &descriptor ) );
    if ( !ret )
    {
        type = CDRMHelperServer::EPassive;
        ret = SendReceive(
                  EIsRegistered,
                  TIpcArgs( aIntent, type, aAutomatedType, &descriptor ) );
    }
    aAutomated = ret > 0 ? ETrue : EFalse;
    aType = type;
    return KErrNone;
}
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:38,代码来源:RDRMHelper.cpp

示例11: descriptor

bool InferredType::canWatch(const ConcurrentJSLocker& locker, const Descriptor& expected)
{
    if (expected.kind() == Top)
        return false;
    
    return descriptor(locker) == expected;
}
开发者ID:caiolima,项目名称:webkit,代码行数:7,代码来源:InferredType.cpp

示例12: descriptor

// -----------------------------------------------------------------------------
// RDRMHelper::RemoveAutomatedAll
//
// Unregister one content uri
// -----------------------------------------------------------------------------
//
TInt RDRMHelper::RemoveAutomatedAll(
    const TDesC8& aUri,
    TBool aActive,
    TInt aAutomatedType,
    TInt aIntent ) const
{
    TPtrC8 descriptor( aUri );
    TInt ret;
    TInt mode(
        aActive ? CDRMHelperServer::EActive : CDRMHelperServer::EPassive );
    TBool automated = EFalse;
    TInt tempMode( 0 );

    // This call waits for the server to complete the request before
    // proceeding.
    ret = SendReceive(
              ERemove, TIpcArgs( aIntent, mode, aAutomatedType, &descriptor ) );
    IsAutomated( aUri, aAutomatedType, aIntent, automated, tempMode );
    while ( automated && tempMode == mode )
    {
        // unregister all
        ret = SendReceive(
                  ERemove, TIpcArgs( aIntent, mode, aAutomatedType, &descriptor ) );
        IsAutomated( aUri, aAutomatedType, aIntent, automated, tempMode );
    }

    if ( ret == KErrNotFound )
    {
        ret = KErrNone;
    }
    return ret;
}
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:38,代码来源:RDRMHelper.cpp

示例13: ret

// -----------------------------------------------------------------------------
// RDRMHelper::RemoveAutomated
//
// Unregister one content uri
// -----------------------------------------------------------------------------
//
TInt RDRMHelper::RemoveAutomated(
    const TDesC8& aUri,
    TBool aActive,
    TInt aAutomatedType,
    TInt aIntent ) const
{
    TInt ret( 0 );
    TInt mode(
        aActive ? CDRMHelperServer::EActive : CDRMHelperServer::EPassive );

    // Create descriptor to enable copying data between
    // client and server. Note: This can be local since
    // this is a synchronous call.
    // Note : Using TPtr8 since this is binary information
    TPtrC8 descriptor( aUri );

    // This call waits for the server to complete the request before
    // proceeding.
    ret = SendReceive(
              ERemove, TIpcArgs( aIntent, mode, aAutomatedType, &descriptor ) );

    if ( ret == KErrNotFound )
    {
        // content was never actually registered
        ret = KErrNone;
    }
    return ret;
}
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:34,代码来源:RDRMHelper.cpp

示例14: ac

SkTypeface* SkFontHost::Deserialize(SkStream* stream) {
    {
        SkAutoMutexAcquire  ac(gFamilyMutex);
        load_system_fonts();
    }

    SkFontDescriptor descriptor(stream);
    const char* familyName = descriptor.getFamilyName();
    const char* typefaceName = descriptor.getFontFileName();
    const SkTypeface::Style style = descriptor.getStyle();

    const uint32_t customFontDataLength = stream->readPackedUInt();
    if (customFontDataLength > 0) {

        // generate a new stream to store the custom typeface
        SkMemoryStream* fontStream = new SkMemoryStream(customFontDataLength - 1);
        stream->read((void*)fontStream->getMemoryBase(), customFontDataLength - 1);

        SkTypeface* face = CreateTypefaceFromStream(fontStream);

        fontStream->unref();
        return face;
    }

    return SkFontHost::CreateTypeface(NULL, familyName, style);
}
开发者ID:jamorton,项目名称:blix,代码行数:26,代码来源:SkFontHost_linux.cpp

示例15: assert

void
NewNet::TcpClientSocket::connect(const std::string & host, unsigned int port)
{
  assert((descriptor() == -1) || (socketState() == SocketUninitialized));

  setSocketState(SocketConnecting);

  NNLOG("newnet.net.debug", "Resolving host '%s'.", host.c_str());
  struct hostent *h = gethostbyname(host.c_str());
  if(! h)
  {
    NNLOG("newnet.net.warn", "Cannot resolve host '%s'.", host.c_str());
    setSocketError(ErrorCannotResolve);
    cannotConnectEvent(this);
    return;
  }

  struct sockaddr_in address;
  memset(&address, 0, sizeof(address));
  address.sin_family = AF_INET;
  memcpy(&(address.sin_addr.s_addr), *(h->h_addr_list), sizeof(address.sin_addr.s_addr));
  address.sin_port = htons(port);

  NNLOG("newnet.net.debug", "Connecting to host '%s:%u'.", host.c_str(), port);

  int s = socket(PF_INET, SOCK_STREAM, 0);
  if (!setnonblocking(s))
    NNLOG("newnet.net.warn", "Couldn't set socket %i to non blocking (errno: %i)", s, errno);
  setDescriptor(s);

  if(s < 0)
    {
      NNLOG("newnet.net.warn", "Cannot connect to host '%s:%u', error: %i.", host.c_str(), port, WSAGetLastError());
      setSocketError(ErrorCannotConnect);
      cannotConnectEvent(this);
      return;
    }

  // Add a connection timeout
  if (reactor()) {
    m_ConnectionTimeout = reactor()->addTimeout(120000, this, &TcpClientSocket::onConnectionTimeout);
  }

  connectedEvent.connect(this, &TcpClientSocket::onConnected);

  if(::connect(s, (struct sockaddr *)&address, sizeof(struct sockaddr_in)) == 0)
  {
    // When using non blocking socket (most of the time), we don't get here.
    NNLOG("newnet.net.debug", "Connected to host '%s:%u'.", host.c_str(), port);
    setSocketState(SocketConnected);
    connectedEvent(this);
  }
  else if(WSAGetLastError() != WSAEWOULDBLOCK)
  {
    // When using non blocking socket (most of the time), we don't get here.
    NNLOG("newnet.net.warn", "Cannot connect to host '%s:%u', error: %i.", host.c_str(), port, WSAGetLastError());
    setSocketError(ErrorCannotConnect);
    cannotConnectEvent(this);
  }
}
开发者ID:KenjiTakahashi,项目名称:newsoul,代码行数:60,代码来源:nntcpclientsocket.cpp


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