• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ id函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: setId

void Package::setId(const QString &i) {
    if (i != id()) {
        m_id = i;
        emit dataChanged(this, IdRole);
    }
}
开发者ID:marxoft,项目名称:qdl2,代码行数:6,代码来源:package.cpp


示例2:

void Texture2::destroy(){
	if(id()){
		glDeleteTextures(1, &mID);
		mID = 0;
	}
}
开发者ID:EQ4,项目名称:GLV,代码行数:6,代码来源:glv_texture.cpp


示例3: MakeTOFResMisAlignment

void MakeTOFResMisAlignment() {
  //
  // Create TClonesArray of residual misalignment objects for TOF
  //

  const char* macroname = "MakeTOFResMisAlignment.C";

  TClonesArray *array = new TClonesArray("AliAlignObjParams",2000);
  TClonesArray &alobj = *array;
   
  // Activate CDB storage and load geometry from CDB
  AliCDBManager* cdb = AliCDBManager::Instance();
  if (!cdb->IsDefaultStorageSet())
    cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
  cdb->SetRun(0);

  AliCDBStorage* storage;
  TString Storage;

  if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){
    Storage = gSystem->Getenv("STORAGE");
    if (!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
      return;
    }
    storage = cdb->GetStorage(Storage.Data());
    if (!storage) {
      Error(macroname,"Unable to open storage %s\n",Storage.Data());
      return;
    }
    AliCDBPath path("GRP","Geometry","Data");
    AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
    if (!entry)
      Fatal(macroname,"Could not get the specified CDB entry!");

    entry->SetOwner(0);
    TGeoManager* geom = (TGeoManager*) entry->GetObject();
    AliGeomManager::SetGeometry(geom);
  } else
    AliGeomManager::LoadGeometry(); //load geom from default CDB storage

  AliGeomManager::ELayerID idTOF = AliGeomManager::kTOF;
  Int_t j=0;
  Int_t nSectors=18;

  //Produce objects for TOF supermodules
  Int_t iIndex=0; //let all modules have index=0 in a layer with no LUT
  AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
  UShort_t dvoluid = AliGeomManager::LayerToVolUID(iLayer,iIndex); //dummy vol id 
  Double_t smdx, smdy, smdz=0., dpsi=0., dtheta, dphi=0.;
  for(Int_t isect=0; isect<nSectors; isect++) {
    TString symname(Form("TOF/sm%02d",isect));
    new(alobj[j++]) AliAlignObjParams(symname.Data(),
				      dvoluid,
				      smdx, smdy, smdz, dpsi, dtheta, dphi, kFALSE);
  }

  Int_t strId=-1;
  Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
  //TRandom *rnd   = new TRandom(4357);
  Double_t sigmatr = 0.1; // sigma (in cm) for shift w.r.t. local ideal RS

  Int_t nstrA=15;
  Int_t nstrB=19;
  Int_t nstrC=19;
  Int_t nStrips=nstrA+2*nstrB+2*nstrC;

  Double_t cuty=0., cutz=0., cut=3*sigmatr;
  for (Int_t isect = 0; isect < nSectors; isect++) {
    for (Int_t istr = 1; istr <= nStrips; istr++) {
      //dy = rnd->Gaus(0.,sigmatr);
      //dz = rnd->Gaus(0.,sigmatr);
      //strId++;

      switch (istr) {
      case 25:
      case 29:
      case 63:
      case 67:
	cuty = sigmatr*0.6;
	dy  = AliMathBase::TruncatedGaus(0., sigmatr, cut, cuty);
	dz  = AliMathBase::TruncatedGaus(0., sigmatr, cut);
	strId++;
	break;
	/*
      case 38:
	cuty = sigmatr*2.5;
	cutz = sigmatr*2.5;
	dy  = AliMathBase::TruncatedGaus(0., sigmatr, cut, cuty);
	dz  = AliMathBase::TruncatedGaus(0., sigmatr, cut, cutz);
	strId++;
	break;
      case 54:
	cuty = sigmatr*2.5;
	cutz = sigmatr*2.5;
	dy  = AliMathBase::TruncatedGaus(0., sigmatr, cut, cuty);
	dz  = AliMathBase::TruncatedGaus(0., sigmatr, cutz, cut);
	strId++;
	break;
	*/
//.........这里部分代码省略.........
开发者ID:alisw,项目名称:AliRoot,代码行数:101,代码来源:MakeTOFResMisAlignment.C


示例4: Q_ASSERT

void KisLensBlurFilter::process(KisPaintDeviceSP device,
                            const QRect& rect,
                            const KisFilterConfiguration* config,
                            KoUpdater* progressUpdater
                           ) const
{
    QPoint srcTopLeft = rect.topLeft();

    Q_ASSERT(device != 0);

    if (!config) config = new KisFilterConfiguration(id().id(), 1);

    QVariant value;
    config->getProperty("irisShape", value);
    QString irisShape = value.toString();
    config->getProperty("irisRadius", value);
    uint irisRadius = value.toUInt();
    config->getProperty("irisRotation", value);
    uint irisRotation = value.toUInt();

    if (irisRadius < 1)
        return;

    QBitArray channelFlags;
    if (config) {
        channelFlags = config->channelFlags();
    } 
    if (channelFlags.isEmpty() || !config) {
        channelFlags = QBitArray(device->colorSpace()->channelCount(), true);
    }
    
    QPolygonF irisShapePoly;

    int sides = 1;
    qreal angle = 0;

    if (irisShape == "Triangle") sides = 3;
    else if (irisShape == "Quadrilateral (4)") sides = 4;
    else if (irisShape == "Pentagon (5)") sides = 5;
    else if (irisShape == "Hexagon (6)") sides = 6;
    else if (irisShape == "Heptagon (7)") sides = 7;
    else if (irisShape == "Octagon (8)") sides = 8;
    else return;

    for (int i = 0; i < sides; ++i) {
        irisShapePoly << QPointF(0.5 * cos(angle), 0.5 * sin(angle));
        angle += 2 * M_PI / sides;
    }

    QTransform transform;
    transform.rotate(irisRotation);
    transform.scale(irisRadius * 2, irisRadius * 2);

    QPolygonF transformedIris;
    for (int i = 0; i < irisShapePoly.count(); ++i) {
        transformedIris << irisShapePoly[i] * transform;
    }

    // find extremes to determine kernel size required
    qreal minX = 0, maxX = 0, minY = 0, maxY = 0;
    for (int i = 0; i < transformedIris.count(); ++i) {
        if (transformedIris[i].x() < minX) minX = transformedIris[i].x();
        if (transformedIris[i].x() > maxX) maxX = transformedIris[i].x();
        if (transformedIris[i].y() < minY) minY = transformedIris[i].y();
        if (transformedIris[i].y() > maxY) maxY = transformedIris[i].y();
    }

    int kernelWidth = ceil(maxX) - ceil(minX);
    int kernelHeight = ceil(maxY) - ceil(minY);

    QImage kernelRepresentation(kernelWidth, kernelHeight, QImage::Format_RGB32);
    kernelRepresentation.fill(0);

    QPainter imagePainter(&kernelRepresentation);
    imagePainter.setRenderHint(QPainter::Antialiasing);
    imagePainter.setBrush(QColor::fromRgb(255, 255, 255));

    QTransform offsetTransform;
    offsetTransform.translate(-minX, -minY);
    imagePainter.setTransform(offsetTransform);
    imagePainter.drawPolygon(transformedIris, Qt::WindingFill);

    // construct kernel from image
    Matrix<qreal, Dynamic, Dynamic> irisKernel(kernelHeight, kernelWidth);
    for (int j = 0; j < kernelHeight; ++j) {
        for (int i = 0; i < kernelWidth; ++i) {
            irisKernel(j, i) = qRed(kernelRepresentation.pixel(i, j));
        }
    }

    // apply convolution
    KisConvolutionPainter painter(device);
    painter.setChannelFlags(channelFlags);
    painter.setProgress(progressUpdater);

    KisConvolutionKernelSP kernel = KisConvolutionKernel::fromMatrix(irisKernel, 0, irisKernel.sum());
    painter.applyMatrix(kernel, device, srcTopLeft, srcTopLeft, rect.size(), BORDER_REPEAT);
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:98,代码来源:kis_lens_blur_filter.cpp


示例5: M_backend

PreconditionerBlockMS<space_type>::PreconditionerBlockMS(space_ptrtype Xh,             // (u)x(p)
                                                         ModelProperties model,        // model
                                                         std::string const& p,         // prefix
                                                         sparse_matrix_ptrtype AA )    // The matrix
    :
        M_backend(backend()),           // the backend associated to the PC
        M_Xh( Xh ),
        M_Vh( Xh->template functionSpace<0>() ), // Potential
        M_Qh( Xh->template functionSpace<1>() ), // Lagrange
        M_Vh_indices( M_Vh->nLocalDofWithGhost() ),
        M_Qh_indices( M_Qh->nLocalDofWithGhost() ),
        M_uin( M_backend->newVector( M_Vh )  ),
        M_uout( M_backend->newVector( M_Vh )  ),
        M_pin( M_backend->newVector( M_Qh )  ),
        M_pout( M_backend->newVector( M_Qh )  ),
        U( M_Xh, "U" ),
        M_mass(M_backend->newMatrix(M_Vh,M_Vh)),
        M_L(M_backend->newMatrix(M_Qh,M_Qh)),
        M_er( 1. ),
        M_model( model ),
        M_prefix( p ),
        M_prefix_11( p+".11" ),
        M_prefix_22( p+".22" ),
        u(M_Vh, "u"),
        ozz(M_Vh, "ozz"),
        zoz(M_Vh, "zoz"),
        zzo(M_Vh, "zzo"),
        M_ozz(M_backend->newVector( M_Vh )),
        M_zoz(M_backend->newVector( M_Vh )),
        M_zzo(M_backend->newVector( M_Vh )),
        X(M_Qh, "X"),
        Y(M_Qh, "Y"),
        Z(M_Qh, "Z"),
        M_X(M_backend->newVector( M_Qh )),
        M_Y(M_backend->newVector( M_Qh )),
        M_Z(M_backend->newVector( M_Qh )),
        phi(M_Qh, "phi")
{
    tic();
    LOG(INFO) << "[PreconditionerBlockMS] setup starts";
    this->setMatrix( AA );
    this->setName(M_prefix);

    /* Indices are need to extract sub matrix */
    std::iota( M_Vh_indices.begin(), M_Vh_indices.end(), 0 );
    std::iota( M_Qh_indices.begin(), M_Qh_indices.end(), M_Vh->nLocalDofWithGhost() );

    M_11 = AA->createSubMatrix( M_Vh_indices, M_Vh_indices, true, true);

    /* Boundary conditions */
    BoundaryConditions M_bc = M_model.boundaryConditions();
    map_vector_field<FEELPP_DIM,1,2> m_dirichlet_u { M_bc.getVectorFields<FEELPP_DIM> ( "u", "Dirichlet" ) };
    map_scalar_field<2> m_dirichlet_p { M_bc.getScalarFields<2> ( "phi", "Dirichlet" ) };

    /* Compute the mass matrix (needed in first block, constant) */
    auto f2A = form2(_test=M_Vh, _trial=M_Vh, _matrix=M_mass);
    auto f1A = form1(_test=M_Vh);
    f2A = integrate(_range=elements(M_Vh->mesh()), _expr=inner(idt(u),id(u))); // M
    for(auto const & it : m_dirichlet_u )
    {
        LOG(INFO) << "Applying " << it.second << " on " << it.first << " for "<<M_prefix_11<<"\n";
        f2A += on(_range=markedfaces(M_Vh->mesh(),it.first), _expr=it.second,_rhs=f1A, _element=u, _type="elimination_symmetric");
    }
    
    /* Compute the L (= er * grad grad) matrix (the second block) */
    auto f2L = form2(_test=M_Qh,_trial=M_Qh, _matrix=M_L);
    for(auto it : M_model.materials() )
    { 
        f2L += integrate(_range=markedelements(M_Qh->mesh(),marker(it)), _expr=M_er*inner(gradt(phi), grad(phi)));
    }
    auto f1LQ = form1(_test=M_Qh);

    for(auto const & it : m_dirichlet_p)
    {
        LOG(INFO) << "Applying " << it.second << " on " << it.first << " for "<<M_prefix_22<<"\n";
        f2L += on(_range=markedfaces(M_Qh->mesh(),it.first),_element=phi, _expr=it.second, _rhs=f1LQ, _type="elimination_symmetric");
    }


    if(soption(_name="pc-type", _prefix=M_prefix_11) == "ams")
#if FEELPP_DIM == 3
    {
        M_grad  = Grad( _domainSpace=M_Qh, _imageSpace=M_Vh);

        // This preconditioner is linked to that backend : the backend will
        // automatically use the preconditioner.
        auto prec = preconditioner(_pc=pcTypeConvertStrToEnum(soption(M_prefix_11+".pc-type")),
                                   _backend=backend(_name=M_prefix_11),
                                   _prefix=M_prefix_11,
                                   _matrix=M_11
                                  );
        prec->setMatrix(M_11);
        prec->attachAuxiliarySparseMatrix("G",M_grad.matPtr());
        if(boption(M_prefix_11+".useEdge"))
        {
            LOG(INFO) << "[ AMS ] : using SetConstantEdgeVector \n";
            ozz.on(_range=elements(M_Vh->mesh()),_expr=vec(cst(1),cst(0),cst(0)));
            zoz.on(_range=elements(M_Vh->mesh()),_expr=vec(cst(0),cst(1),cst(0)));
            zzo.on(_range=elements(M_Vh->mesh()),_expr=vec(cst(0),cst(0),cst(1)));
            *M_ozz = ozz; M_ozz->close();
//.........这里部分代码省略.........
开发者ID:LANTZT,项目名称:feelpp,代码行数:101,代码来源:preconditionerblockms.hpp


示例6: MakeZDCFullMisAlignment

void MakeZDCFullMisAlignment(){
  // Create TClonesArray of full misalignment objects for ZDC
  //
  const char* macroname = "MakeZDCFullMisAlignment.C";

  TClonesArray *array = new TClonesArray("AliAlignObjParams",10);
  TClonesArray &alobj = *array;

  Double_t dx=0., dy=2., dz=0.;
  Double_t dpsi=0., dtheta=0., dphi=0.;

  const char *ZDCCn="ZDC/NeutronZDC_C";
  const char *ZDCCp="ZDC/ProtonZDC_C";
  const char *ZDCAn="ZDC/NeutronZDC_A";
  const char *ZDCAp="ZDC/ProtonZDC_A";

  Int_t iIndex=0; //let all modules have index=0 in a layer with no LUT
  AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
  UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);

  new(alobj[0]) AliAlignObjParams(ZDCCn, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
  new(alobj[1]) AliAlignObjParams(ZDCCp, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
  new(alobj[2]) AliAlignObjParams(ZDCAn, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
  new(alobj[3]) AliAlignObjParams(ZDCAp, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);

  if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
    // save in file
    const char* filename = "ZDCfullMisalignment.root";
    TFile f(filename,"RECREATE");
    if(!f){
      Error(macroname,"cannot open file for output\n");
      return;
    }
    Info(macroname,"Saving alignment objects to the file %s", filename);
    f.cd();
    f.WriteObject(array,"ZDCAlignObjs","kSingleKey");
    f.Close();
  }else{
    // save in CDB storage
    TString Storage = gSystem->Getenv("STORAGE");
    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
      return;
    }
    Info(macroname,"Saving alignment objects in CDB storage %s",
	 Storage.Data());
    AliCDBManager* cdb = AliCDBManager::Instance();
    AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
    if(!storage){
      Error(macroname,"Unable to open storage %s\n",Storage.Data());
      return;
    }
    AliCDBMetaData* md = new AliCDBMetaData();
    md->SetResponsible("Chiara Oppedisano");
    md->SetComment("Alignment objects for ZDC full misalignment");
    md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
    AliCDBId id("ZDC/Align/Data",0,AliCDBRunRange::Infinity());
    storage->Put(array,id,md);
  }

  array->Delete();

}
开发者ID:alisw,项目名称:AliRoot,代码行数:63,代码来源:MakeZDCFullMisAlignment.C


示例7: IFrameWindow

/******************************************************************************
* ASetCanvas :: ASetCanvas - Constructor for our main window                  *
******************************************************************************/
ASetCanvas::ASetCanvas(unsigned long windowId)
  : IFrameWindow( windowId )
  /*---------------------------------------------------------------------------|
  |  Create the ISplitCanvases                                                 |
  ----------------------------------------------------------------------------*/
  , horzCanvas1( ID_HORIZCANVAS1, this, this )
  , vertCanvas1( ID_VERTCANVAS1,  &horzCanvas1, &horzCanvas1 )
  , vertCanvas2( ID_VERTCANVAS2,  &horzCanvas1, &horzCanvas1 )
  , vertCanvas3( ID_VERTCANVAS3,  &horzCanvas1, &horzCanvas1 )
  /*---------------------------------------------------------------------------|
  |  Create the ISetCanvases                                                   |
  ----------------------------------------------------------------------------*/
  , setCanvas1( ID_SETCANVAS1, &vertCanvas1, &vertCanvas1 )
  , setCanvas2( ID_SETCANVAS2, &vertCanvas1, &vertCanvas1 )
  , setCanvas3( ID_SETCANVAS3, &vertCanvas2, &vertCanvas2 )
  , setCanvas4( ID_SETCANVAS4, &vertCanvas2, &vertCanvas2 )
  , setCanvas5( ID_SETCANVAS5, &vertCanvas3, &vertCanvas3 )
  , setCanvas6( ID_SETCANVAS6, &vertCanvas3, &vertCanvas3 )
  /*---------------------------------------------------------------------------|
  |  Create the radio buttons for each ISetCanvases                            |
  ----------------------------------------------------------------------------*/
  , vRadioGroup1( ID_VRADIO,      &setCanvas1, 5, AButtons::vertical )
  , vRadioGroup2( ID_VRADIO + 5,  &setCanvas3, 6, AButtons::vertical )
  , vRadioGroup3( ID_VRADIO + 11, &setCanvas5, 7, AButtons::vertical )
  , hRadioGroup1( ID_HRADIO,      &setCanvas2, 5, AButtons::horizontal )
  , hRadioGroup2( ID_HRADIO + 5,  &setCanvas4, 6, AButtons::horizontal )
  , hRadioGroup3( ID_HRADIO + 11, &setCanvas6, 7, AButtons::horizontal )
{
/*-----------------------------------------------------------------------------|
|  Set the icon for the main window and make the split canvas the client area  |
------------------------------------------------------------------------------*/
  setIcon( id() );
  setClient( &horzCanvas1 );

/*-----------------------------------------------------------------------------|
|  Set the split canvas orientation                                            |
------------------------------------------------------------------------------*/
  horzCanvas1.setOrientation( ISplitCanvas::horizontalSplit );
  vertCanvas1.setOrientation( ISplitCanvas::verticalSplit );
  vertCanvas2.setOrientation( ISplitCanvas::verticalSplit );
  vertCanvas3.setOrientation( ISplitCanvas::verticalSplit );

/*-----------------------------------------------------------------------------|
|  Set three ISetCanvases to have 3 vertical decks                             |
------------------------------------------------------------------------------*/
  setCanvas1.setDeckOrientation( ISetCanvas::vertical );
  setCanvas3.setDeckOrientation( ISetCanvas::vertical );
  setCanvas5.setDeckOrientation( ISetCanvas::vertical );

/*-----------------------------------------------------------------------------|
|  Set three ISetCanvases to have 3 horizontal decks                           |
------------------------------------------------------------------------------*/
  setCanvas2.setDeckOrientation( ISetCanvas::horizontal );
  setCanvas4.setDeckOrientation( ISetCanvas::horizontal );
  setCanvas6.setDeckOrientation( ISetCanvas::horizontal );

/*-----------------------------------------------------------------------------|
|  Set each ISetCanvases to have 3 decks                                       |
------------------------------------------------------------------------------*/
  setCanvas1.setDeckCount( 3 );
  setCanvas2.setDeckCount( 3 );
  setCanvas3.setDeckCount( 3 );
  setCanvas4.setDeckCount( 3 );
  setCanvas5.setDeckCount( 3 );
  setCanvas6.setDeckCount( 3 );

  show();

} /* end ASetCanvas :: ASetCanvas */
开发者ID:OS2World,项目名称:DEV-SAMPLES-VisualAgeCPP4_Samples,代码行数:72,代码来源:asetcv.cpp


示例8: AMessage

status_t WifiDisplaySource::resume() {
    sp<AMessage> msg = new AMessage(kWhatResume, id());

    sp<AMessage> response;
    return PostAndAwaitResponse(msg, &response);
}
开发者ID:G620S-HUAWEI,项目名称:platform_frameworks_av,代码行数:6,代码来源:WifiDisplaySource.cpp


示例9: switch

void WifiDisplaySource::onMessageReceived(const sp<AMessage> &msg) {
    switch (msg->what()) {
        case kWhatStart:
        {
            uint32_t replyID;
            CHECK(msg->senderAwaitsResponse(&replyID));

            AString iface;
            CHECK(msg->findString("iface", &iface));

            status_t err = OK;

            ssize_t colonPos = iface.find(":");

            unsigned long port;

            if (colonPos >= 0) {
                const char *s = iface.c_str() + colonPos + 1;

                char *end;
                port = strtoul(s, &end, 10);

                if (end == s || *end != '\0' || port > 65535) {
                    err = -EINVAL;
                } else {
                    iface.erase(colonPos, iface.size() - colonPos);
                }
            } else {
                port = kWifiDisplayDefaultPort;
            }

            if (err == OK) {
                if (inet_aton(iface.c_str(), &mInterfaceAddr) != 0) {
                    sp<AMessage> notify = new AMessage(kWhatRTSPNotify, id());

                    err = mNetSession->createRTSPServer(
                            mInterfaceAddr, port, notify, &mSessionID);
                } else {
                    err = -EINVAL;
                }
            }

            mState = AWAITING_CLIENT_CONNECTION;

            sp<AMessage> response = new AMessage;
            response->setInt32("err", err);
            response->postReply(replyID);
            break;
        }

        case kWhatRTSPNotify:
        {
            int32_t reason;
            CHECK(msg->findInt32("reason", &reason));

            switch (reason) {
                case ANetworkSession::kWhatError:
                {
                    int32_t sessionID;
                    CHECK(msg->findInt32("sessionID", &sessionID));

                    int32_t err;
                    CHECK(msg->findInt32("err", &err));

                    AString detail;
                    CHECK(msg->findString("detail", &detail));

                    ALOGE("An error occurred in session %d (%d, '%s/%s').",
                          sessionID,
                          err,
                          detail.c_str(),
                          strerror(-err));

                    mNetSession->destroySession(sessionID);

                    if (sessionID == mClientSessionID) {
                        mClientSessionID = 0;

                        mClient->onDisplayError(
                                IRemoteDisplayClient::kDisplayErrorUnknown);
                    }
                    break;
                }

                case ANetworkSession::kWhatClientConnected:
                {
                    int32_t sessionID;
                    CHECK(msg->findInt32("sessionID", &sessionID));

                    if (mClientSessionID > 0) {
                        ALOGW("A client tried to connect, but we already "
                              "have one.");

                        mNetSession->destroySession(sessionID);
                        break;
                    }

                    CHECK_EQ(mState, AWAITING_CLIENT_CONNECTION);

                    CHECK(msg->findString("client-ip", &mClientInfo.mRemoteIP));
//.........这里部分代码省略.........
开发者ID:G620S-HUAWEI,项目名称:platform_frameworks_av,代码行数:101,代码来源:WifiDisplaySource.cpp


示例10: message_login_fail

message *
message_login_fail::duplicate() {
    return new message_login_fail(id(), status());
}
开发者ID:ajalkane,项目名称:rvhouse,代码行数:4,代码来源:message_login_fail.cpp


示例11: CHECK_EQ

status_t WifiDisplaySource::onSetupRequest(
        int32_t sessionID,
        int32_t cseq,
        const sp<ParsedMessage> &data) {
    CHECK_EQ(sessionID, mClientSessionID);
    if (mClientInfo.mPlaybackSessionID != -1) {
        // We only support a single playback session per client.
        // This is due to the reversed keep-alive design in the wfd specs...
        sendErrorResponse(sessionID, "400 Bad Request", cseq);
        return ERROR_MALFORMED;
    }

    AString transport;
    if (!data->findString("transport", &transport)) {
        sendErrorResponse(sessionID, "400 Bad Request", cseq);
        return ERROR_MALFORMED;
    }

    RTPSender::TransportMode rtpMode = RTPSender::TRANSPORT_UDP;

    int clientRtp, clientRtcp;
    if (transport.startsWith("RTP/AVP/TCP;")) {
        AString interleaved;
        if (ParsedMessage::GetAttribute(
                    transport.c_str(), "interleaved", &interleaved)
                && sscanf(interleaved.c_str(), "%d-%d",
                          &clientRtp, &clientRtcp) == 2) {
            rtpMode = RTPSender::TRANSPORT_TCP_INTERLEAVED;
        } else {
            bool badRequest = false;

            AString clientPort;
            if (!ParsedMessage::GetAttribute(
                        transport.c_str(), "client_port", &clientPort)) {
                badRequest = true;
            } else if (sscanf(clientPort.c_str(), "%d-%d",
                              &clientRtp, &clientRtcp) == 2) {
            } else if (sscanf(clientPort.c_str(), "%d", &clientRtp) == 1) {
                // No RTCP.
                clientRtcp = -1;
            } else {
                badRequest = true;
            }

            if (badRequest) {
                sendErrorResponse(sessionID, "400 Bad Request", cseq);
                return ERROR_MALFORMED;
            }

            rtpMode = RTPSender::TRANSPORT_TCP;
        }
    } else if (transport.startsWith("RTP/AVP;unicast;")
            || transport.startsWith("RTP/AVP/UDP;unicast;")) {
        bool badRequest = false;

        AString clientPort;
        if (!ParsedMessage::GetAttribute(
                    transport.c_str(), "client_port", &clientPort)) {
            badRequest = true;
        } else if (sscanf(clientPort.c_str(), "%d-%d",
                          &clientRtp, &clientRtcp) == 2) {
        } else if (sscanf(clientPort.c_str(), "%d", &clientRtp) == 1) {
            // No RTCP.
            clientRtcp = -1;
        } else {
            badRequest = true;
        }

        if (badRequest) {
            sendErrorResponse(sessionID, "400 Bad Request", cseq);
            return ERROR_MALFORMED;
        }
#if 1
    // The older LG dongles doesn't specify client_port=xxx apparently.
    } else if (transport == "RTP/AVP/UDP;unicast") {
        clientRtp = 19000;
        clientRtcp = -1;
#endif
    } else {
        sendErrorResponse(sessionID, "461 Unsupported Transport", cseq);
        return ERROR_UNSUPPORTED;
    }

    int32_t playbackSessionID = makeUniquePlaybackSessionID();

    sp<AMessage> notify = new AMessage(kWhatPlaybackSessionNotify, id());
    notify->setInt32("playbackSessionID", playbackSessionID);
    notify->setInt32("sessionID", sessionID);

    sp<PlaybackSession> playbackSession =
        new PlaybackSession(
                mNetSession, notify, mInterfaceAddr, mHDCP, mMediaPath.c_str());

    looper()->registerHandler(playbackSession);

    AString uri;
    data->getRequestField(1, &uri);

    if (strncasecmp("rtsp://", uri.c_str(), 7)) {
        sendErrorResponse(sessionID, "400 Bad Request", cseq);
//.........这里部分代码省略.........
开发者ID:G620S-HUAWEI,项目名称:platform_frameworks_av,代码行数:101,代码来源:WifiDisplaySource.cpp


示例12: id

bool DeclarativeDataPluginItem::operator<( const AbstractDataPluginItem *other ) const
{
    return other->id()< id() ;
}
开发者ID:ashish173,项目名称:marble,代码行数:4,代码来源:DeclarativeDataPluginItem.cpp


示例13: setId

void cChar::Serialize(ISerialization &archive)
{
	if (archive.isReading())
	{
		archive.read("name",			orgname);
		archive.read("title",			title);
		archive.read("account",			account);
		archive.read("creationday",		creationday);
		archive.read("gmmoveeff",		gmMoveEff);
		archive.read("guildtype",		GuildType);
		archive.read("guildtraitor",	GuildTraitor);
		archive.read("dispz",			dispz);
		archive.read("cell",			cell);
		archive.read("dir",				dir);
		archive.read("race",			race);
		archive.read("body",			xid);	setId(xid);
		archive.read("skin",			skin);	xskin = skin;
		archive.read("priv",			priv);
		
		archive.read("priv3a",			priv3[0]);
		archive.read("priv3b",			priv3[1]);
		archive.read("priv3c",			priv3[2]);
		archive.read("priv3d",			priv3[3]);
		archive.read("priv3e",			priv3[4]);
		archive.read("priv3f",			priv3[5]);
		archive.read("priv3g",			priv3[6]);
		// end of meta-gm save
		
		archive.read("stablemaster",	stablemaster_serial);
		archive.read("npctype",			npc_type);
		archive.read("time_unused",		time_unused);
		
		archive.read("allmove",			priv2);
		archive.read("font",			fonttype);
		archive.read("say",				saycolor);
		archive.read("emote",			emotecolor);
		archive.read("strength",		st);
		archive.read("strength2",		st2);
		archive.read("dexterity",		dx);
		archive.read("dexterity2",		dx2);
		archive.read("intelligence",	in);
		archive.read("intelligence2",	in2);
		archive.read("hitpoints",		hp);
		archive.read("spawnregion",		spawnregion);
		archive.read("stamina",			stm);
		archive.read("mana",			mn);
		archive.read("npc",				npc);
		archive.read("holdgold",		holdg);
		archive.read("shop",			shop);
		archive.read("own",				ownserial);
		archive.read("robe",			robe);
		archive.read("karma",			karma);
		archive.read("fame",			fame);
		archive.read("kills",			kills);
		archive.read("deaths",			deaths);
		archive.read("dead",			dead);
		archive.read("packitem",		packitem);
		archive.read("fixedlight",		fixedlight);
		archive.read("speech",			speech);
		archive.read("trigger",			trigger);
		archive.read("trigword",		trigword);
		archive.read("disablemsg",		disabledmsg);
		unsigned int j;
		for (j=0;j<TRUESKILLS;j++)
		{
			char t[256] = {0,};
			numtostr(j, t);
			string temp = string("skill") + string(t);
			archive.read(temp, baseskill[j]);
			temp = string("skl") + string(t);
			archive.read(temp, lockSkill[j] );
		}
		archive.read("cantrain", cantrain);
		
		archive.read("att",				att);
		archive.read("def",				def);
		archive.read("lodamage",		lodamage);
		archive.read("hidamage",		hidamage);
		archive.read("war",				war);
		archive.read("npcwander",		npcWander);
		archive.read("oldnpcwander",	oldnpcWander);
		archive.read("carve",			carve);
		archive.read("fx1",				fx1);
		archive.read("fy1",				fy1);
		archive.read("fz1",				fz1);
		archive.read("fx2",				fx2);
		archive.read("fy2",				fy2);
		archive.read("spawn",			spawnserial);
		archive.read("hidden",			hidden);
		archive.read("hunger",			hunger);
		archive.read("npcaitype",		npcaitype);
		archive.read("spattack",		spattack);
		archive.read("spadelay",		spadelay);
		archive.read("taming",			taming);
		archive.read("summonremainingseconds", summontimer);
		if (summontimer != 0)
			summontimer += uiCurrentTime;
		archive.read("advobj",			advobj);
		archive.read("poison",			poison);
		archive.read("poisoned",		poisoned);
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:101,代码来源:chars.cpp


示例14: to_wkt

bool ogc_geod_datum :: to_wkt(
   char      buffer[],
   int       options,
   size_t    buflen) const
{
   OGC_UTF8_NAME buf_name;
   OGC_TBUF      buf_hdr;
   OGC_TBUF      buf_ellipsoid;
   OGC_TBUF      buf_anchor;
   OGC_TBUF      buf_id;
   int           opts  =  (options | OGC_WKT_OPT_INTERNAL);
   size_t        len   = 0;
   bool          rc    = true;
   const char *  opn   = "[";
   const char *  cls   = "]";
   const char *  kwd   = obj_kwd();

   if ( (options & OGC_WKT_OPT_PARENS) != 0 )
   {
      opn = "(";
      cls = ")";
   }

   if ( (opts & OGC_WKT_OPT_TOP_ID_ONLY) != 0 )
      opts |= OGC_WKT_OPT_NO_IDS;

   if ( buffer == OGC_NULL )
      return false;
   *buffer = 0;

   if ( !is_visible() )
      return true;

   rc &= ogc_ellipsoid :: to_wkt(_ellipsoid, buf_ellipsoid, opts, OGC_TBUF_MAX);
   rc &= ogc_anchor    :: to_wkt(_anchor,    buf_anchor,    opts, OGC_TBUF_MAX);

   ogc_string::escape_str(buf_name, _name, OGC_UTF8_NAME_MAX);
   sprintf(buf_hdr, "%s%s\"%s\"",
      kwd, opn, buf_name);

   OGC_CPY_TO_BUF( buf_hdr       );
   OGC_ADD_TO_BUF( buf_ellipsoid );
   OGC_ADD_TO_BUF( buf_anchor    );

   if ( _ids != OGC_NULL && (options & OGC_WKT_OPT_NO_IDS) == 0 )
   {
      for (int i = 0; i < id_count(); i++)
      {
         rc &= ogc_id :: to_wkt(id(i), buf_id, opts, OGC_TBUF_MAX);
         OGC_ADD_TO_BUF( buf_id );
         if ( (options & OGC_WKT_OPT_OLD_SYNTAX) != 0 )
            break;
      }
   }

   OGC_CPY_TO_BUF( cls );

   if ( (options & OGC_WKT_OPT_INTERNAL) == 0 &&
        (options & OGC_WKT_OPT_EXPAND)   != 0 )
   {
      rc &= ogc_utils :: expand_wkt(buffer, buffer, "", options, buflen);
   }

   return rc;
}
开发者ID:Esri,项目名称:ogc-crs-wkt-parser,代码行数:65,代码来源:ogc_geod_datum.cpp


示例15: TEST_F

TEST_F(PageIOTestEnv, test_alloc_one) {
    auto p = m_page_io->alloc();
    EXPECT_NE(0, p.id());
}
开发者ID:jia-kai,项目名称:uSQL,代码行数:4,代码来源:test_page_io.cpp


示例16: istrm

void nl_convert_rinf_t::convert(const pstring &contents)
{
	plib::pistringstream istrm(contents);
	plib::putf8_reader reader(istrm);
	tokenizer tok(*this, reader);
	auto lm = read_lib_map(s_lib_map);

	out("NETLIST_START(dummy)\n");
	add_term("GND", "GND");
	add_term("VCC", "VCC");
	tokenizer::token_t token = tok.get_token();
	while (true)
	{
		if (token.is_type(tokenizer::ENDOFFILE) || token.is(tok.m_tok_END))
		{
			dump_nl();
			// FIXME: Parameter
			out("NETLIST_END()\n");
			return;
		}
		else if (token.is(tok.m_tok_HEA))
		{
			/* seems to be start token - ignore */
			token = tok.get_token();
		}
		else if (token.is(tok.m_tok_APP))
		{
			/* version string */
			pstring app = tok.get_string();
			out("// APP: {}\n", app);
			token = tok.get_token();
		}
		else if (token.is(tok.m_tok_TIM))
		{
			/* time */
			out("// TIM:");
			for (int i=0; i<6; i++)
			{
				long x = tok.get_number_long();
				out(" {}", x);
			}
			out("\n");
			token = tok.get_token();
		}
		else if (token.is(tok.m_tok_TYP))
		{
			pstring id(tok.get_identifier());
			out("// TYP: {}\n", id);
			token = tok.get_token();
		}
		else if (token.is(tok.m_tok_ADDC))
		{
			std::unordered_map<pstring, pstring> attr;
			pstring id = tok.get_identifier();
			pstring s1 = tok.get_string();
			pstring s2 = tok.get_string();

			token = tok.get_token();
			while (token.is(tok.m_tok_ATTC))
			{
				pstring tid = tok.get_identifier();
				if (tid != id)
				{
					out("Error: found {} expected {} in {}\n", tid, id, token.str());
					return;
				}
				pstring at = tok.get_string();
				pstring val = tok.get_string();
				attr[at] = val;
				token = tok.get_token();
			}
			pstring sim = attr["Simulation"];
			pstring val = attr["Value"];
			pstring com = attr["Comment"];
			if (val == "")
				val = com;

			if (sim == "CAP")
			{
				add_device("CAP", id, get_sp_val(val));
			}
			else if (sim == "RESISTOR")
			{
				add_device("RES", id, get_sp_val(val));
			}
			else
			{
				pstring lib = attr["Library Reference"];
				auto f = lm.find(lib);
				if (f != lm.end())
					add_device(f->second.dev, id);
				else
					add_device(lib, id);
			}
		}
		else if (token.is(tok.m_tok_NET))
		{
			pstring dev = tok.get_identifier();
			pstring pin = tok.get_identifier_or_number();
			pstring net = tok.get_string();
//.........这里部分代码省略.........
开发者ID:MASHinfo,项目名称:mame,代码行数:101,代码来源:nl_convert.cpp


示例17: SetCalibDB

void SetCalibDB() {

  Int_t firstRun   =  0; // What is this                                                
  Int_t lastRun    = 9999999;
  Int_t beamPeriod =  1;
  char* objFormat  = "";

  TString DBFolder  ="local://$ALICE_ROOT/OCDB/EMCAL/beamtest07";
  firstRun  =  0;
  lastRun   =  999999999;
  objFormat = "EMCAL beam test 2007 gain factors and pedestals";

  AliEMCALCalibData *calibda=new AliEMCALCalibData("EMCAL");

  Float_t fADCpedestal = 0.009;
  Float_t fADCchannel  = 0.0153;  // 250 GeV / (16*1024)                               
  Float_t ped = 0.;
  Float_t cc = fADCchannel;

  Int_t nSMod  = 12;
  Int_t nCol   = 48;
  Int_t nRow   = 24;
  Int_t nRow2  = 12; //Modules 11 and 12 are half modules                          

  Int_t colOffset = 40;
  Int_t rowOffset = 8;

  Double_t gain_ratios[8][8] =
    {
      15.9289, 16.2141, 16.1204, 15.9118,
      15.9363, 15.9402, 16.2257, 16.0097,
      16.058, 16.1116, 16.039, 16.4167,
      16.2148, 16.1399, 16.1515, 16.2194,
      15.9082, 16.0776, 16.0496, 16.2353,
      15.8054, 16.2158, 16.2344, 16.1023,
      15.8903, 16.2387, 16.13, 16.157,
      16.0685, 16.172, 16.3495, 16.3887,
      16.2842, 16.049, 16.4328, 16.3954,
      16.4226, 15.7254, 16.1634, 16.3182,
      16.4216, 16.1201, 16.0000, 16.2305,
      16.0266, 16.3573, 16.1382, 16.237,
      16.2981, 16.1796, 15.854, 16.4189,
      15.6425, 16.287, 16.3293, 16.6308,
      16.2469, 16.0412, 16.252, 16.3367,
      16.1412, 16.0646, 16.3996, 16.3479
    };

  
  Float_t gains[8][8] =
    {
      4.43274, 6.7283, 8.23733, 3.59882,
      4.2717, 2.85658, 4.86389, 2.71961,
      3.05523, 3.02552, 3.50615, 3.26494,
      6.69024, 2.51058, 8.42275, 2.83824,
      8.05074, 5.36051, 4.36794, 4.73468,
      9.9684, 5.5, 6.42999, 5.6,
      7.37306, 5.28314, 5.27662, 5.26982,
      3.29468, 5.23107, 6.40948, 4.06855,
      4.09685, 5.37323, 5.32816, 5.89487,
      9.2395, 5.3, 4.77239, 5.0,
      4.85923, 3.44063, 4.74517, 5.28772,
      3.80171, 4.84878, 5.12039, 4.59205,
      2.34745, 3.16971, 3.61231, 3.65195,
      3.43496, 3.4, 3.65678, 2.9,
      2.71648, 3.39577, 3.40896, 3.31741,
      3.24286, 3.51346, 2.61503, 3.44246
    };

  for(Int_t supermodule=0; supermodule < nSMod; supermodule++) {
    for(Int_t column=0; column< nCol; column++) {
      if(supermodule >= 10)
        nRow = nRow2;
      for(Int_t row=0; row< nRow; row++) {
	if(supermodule < 2 && column > 39 && row > 7 && row < 16) {
	  cc = 1./gain_ratios[column-colOffset][row-rowOffset]/gains[column-colOffset][row-rowOffset];
	  cout << "column = " << column << " column - colOffset = " << column-colOffset << " row = " << " row Offset = " << row-rowOffset << endl;
	}
        calibda->SetADCchannel(supermodule,column,row,cc);
        calibda->SetADCpedestal(supermodule,column,row,ped);
      }
    }
  }

  //Store calibration data into database
  AliCDBMetaData md;
  md.SetComment(objFormat);
  md.SetBeamPeriod(beamPeriod);
  md.SetResponsible("David Silvermyr");
  AliCDBId id("EMCAL/Calib/Data",firstRun,lastRun); // create in
						    // EMCAL/Calib/Data DBFolder                     

  AliCDBManager* man = AliCDBManager::Instance();
  AliCDBStorage* loc = man->GetStorage(DBFolder.Data());
  loc->Put(calibda, id, &md);

}
开发者ID:alisw,项目名称:AliRoot,代码行数:96,代码来源:SetCalibDB.C


示例18:

connection_options connection_engine::container::make_options() {
    connection_options opts = options_;
    opt 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ id2string函数代码示例发布时间:2022-05-30
下一篇:
C++ icvFindWindowByName函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap