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


C++ pin函数代码示例

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


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

示例1: password

QVariantMap NetworkManager::Security8021xSetting::secretsToMap() const
{
    QVariantMap secrets;

    if (!password().isEmpty()) {
        secrets.insert(QLatin1String(NM_SETTING_802_1X_PASSWORD), password());
    }

    if (!passwordRaw().isEmpty()) {
        secrets.insert(QLatin1String(NM_SETTING_802_1X_PASSWORD_RAW), passwordRaw());
    }

    if (!privateKeyPassword().isEmpty()) {
        secrets.insert(QLatin1String(NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD), privateKeyPassword());
    }

    if (!phase2PrivateKeyPassword().isEmpty()) {
        secrets.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD), phase2PrivateKeyPassword());
    }

    if (!pin().isEmpty()) {
        secrets.insert(QLatin1String(NM_SETTING_802_1X_PIN), pin());
    }

    return secrets;
}
开发者ID:KDE,项目名称:networkmanager-qt,代码行数:26,代码来源:security8021xsetting.cpp

示例2: pin

SkDeviceProfile::SkDeviceProfile(float gammaExp, float contrast,
                                 LCDConfig config, FontHintLevel level) {
    fGammaExponent = pin(gammaExp, 0, 10);
    fContrastScale = pin(contrast, 0, 1);
    fLCDConfig = config;
    fFontHintLevel = level;
}
开发者ID:webbjiang,项目名称:skia,代码行数:7,代码来源:SkDeviceProfile.cpp

示例3: initPainter

void PinNode::drawShape( QPainter & p )
{
	initPainter( p );

	double v = pin() ? pin()->voltage() : 0.0;
	QColor voltageColor = Component::voltageColor( v );

	QPen pen = p.pen();

	if ( isSelected() )
		pen = m_selectedColor;
	else if ( m_bShowVoltageColor )
		pen = voltageColor;

	if (m_pinPoint) {
		bool drawDivPoint;
		QPoint divPoint = findConnectorDivergePoint(&drawDivPoint);
		m_pinPoint->setVisible(drawDivPoint);
		m_pinPoint->move( divPoint.x()-1, divPoint.y()-1 );
		m_pinPoint->setBrush( pen.color() );
		m_pinPoint->setPen( pen.color() );
	}

	// Now to draw on our current/voltage bar indicators
	int length = calcLength( v );

	if ( (numPins() == 1) && m_bShowVoltageBars && length != 0 ) {
		// we can assume that v != 0 as length != 0
		double i = pin()->current();
		double iProp = calcIProp(i);
		int thickness = calcThickness(iProp);

		p.setPen( QPen( voltageColor, thickness ) );

		// The node line (drawn at the end of this function) will overdraw
		// some of the voltage bar, so we need to adapt the length
		if ( (v > 0) && (((225 < m_dir) && (m_dir < 315)) || ((45 < m_dir) && (m_dir < 135))) )
			length--;

		else if ( (v < 0) && (((135 < m_dir) && (m_dir < 225)) || ((315 < m_dir) || (m_dir < 45))) )
			length++;

		if ( (m_dir > 270) || (m_dir <= 90) )
			p.drawLine( 3, 0, 3, length );
		else	p.drawLine( 3, 0, 3, -length );
	}

	pen.setWidth( (numPins() > 1) ? 2 : 1 );
	p.setPen( pen );

	p.drawLine( 0, 0, m_length, 0 );

	deinitPainter( p );
}
开发者ID:ktechlab,项目名称:ktechlab-0.3,代码行数:54,代码来源:pinnode.cpp

示例4: analogWrite

void Animation::setOutput(unsigned char val)
{
    if (! _buzzer)
        analogWrite(pin(), val);
    else if (val == 0)
        noTone(pin());
    else {
        int note = 10*val;
        tone(pin(), note);
    }
}
开发者ID:UrLab,项目名称:hal-arduino,代码行数:11,代码来源:Animation.cpp

示例5: beep

// beep for a quarter of a second
void beep(void) {
  outputs(pin(0) | pin(1));
  pinOff(1);
  
  byte i = 0;
  while (i < 250) {
    delay(1);
    pinOn(pin(0));
    delay(1);
    pinOff(pin(0));
    i++;
  }
}
开发者ID:Chuckaluphagus,项目名称:micronucleus-t85,代码行数:14,代码来源:upgrade.c

示例6: MakeSingleTrackTemplateChunk

bool MakeSingleTrackTemplateChunk(WDL_FastString* _in, WDL_FastString* _out, bool _delItems, bool _delEnvs, int _tmpltIdx, bool _obeyOffset)
{
	if (_in && _in->GetLength() && _out && _in!=_out)
	{
		_out->Set("");

		// truncate to the track #_tmpltIdx found in the template
		SNM_ChunkParserPatcher pin(_in);
		if (pin.GetSubChunk("TRACK", 1, _tmpltIdx, _out) >= 0)
		{
			int* offsOpt = _obeyOffset ? (int*)GetConfigVar("templateditcursor") : NULL; // >= REAPER v4.15

			// remove receives from the template as we deal with a single track
			// note: possible with multiple tracks in a same template file (w/ routings between those tracks)
			SNM_TrackEnvParserPatcher pout(_out);
			pout.RemoveLine("TRACK", "AUXRECV", 1, -1, "MIDIOUT");

			if (_delItems) // remove items from template (in one go)
				pout.RemoveSubChunk("ITEM", 2, -1);
			else if (offsOpt && *offsOpt) { // or offset them if needed
				double add = GetCursorPositionEx(NULL);
				pout.ParsePatch(SNM_D_ADD, 2, "ITEM", "POSITION", -1, 1, &add);
			}

			if (_delEnvs) // remove all envs from template (in one go)
				pout.RemoveEnvelopes();
			else if (offsOpt && *offsOpt) // or offset them if needed
				pout.OffsetEnvelopes(GetCursorPositionEx(NULL));
			return true;
		}
	}
	return false;
}
开发者ID:AusRedNeck,项目名称:sws,代码行数:33,代码来源:SnM_Track.cpp

示例7: xdrrx_putbytes

static bool_t
xdrrx_putbytes(XDR *axdrs, caddr_t addr, u_int len)
{
    afs_int32 code;
    XDR * xdrs = (XDR *)axdrs;
    struct rx_call *call = ((struct rx_call *)(xdrs)->x_private);
#if	defined(KERNEL) && defined(AFS_AIX32_ENV)
    char *saddr = (char *)&code;
    saddr -= STACK_TO_PIN;
    /*
     * Hack of hacks: Aix3.2 only guarantees that the next 2K of stack in pinned. Under
     * splnet (disables interrupts), which is set throughout rx, we can't swap in stack
     * pages if we need so we panic. Since sometimes, under splnet, we'll use more than
     * 2K stack we could try to bring the next few stack pages in here before we call the rx
     * layer. Of course this doesn't guarantee that those stack pages won't be swapped
     * out between here and calling splnet. So we now pin (and unpin) them instead to
     * guarantee that they remain there.
     */
    if (pin(saddr, STACK_TO_PIN)) {
	/* XXX There's little we can do by continue XXX */
	saddr = NULL;
	rx_pin_failed++;
    }
#endif
    code = (rx_Write(call, addr, len) == len);
#if	defined(KERNEL) && defined(AFS_AIX32_ENV)
    if (saddr)
	unpin(saddr, STACK_TO_PIN);
#endif
    return code;
}
开发者ID:SimonWilkinson,项目名称:openafs,代码行数:31,代码来源:xdr_rx.c

示例8: osi_AllocSmallSpace

/* allocate space for sender */
void *
osi_AllocSmallSpace(size_t size)
{
    struct osi_packet *tp;

    AFS_STATCNT(osi_AllocSmallSpace);
    if (size > AFS_SMALLOCSIZ)
	osi_Panic("osi_AllocSmallS: size=%d\n", (int)size);

    if (!freeSmallList) {
	afs_stats_cmperf.SmallBlocksAlloced++;
	afs_stats_cmperf.SmallBlocksActive++;
	tp = afs_osi_Alloc(AFS_SMALLOCSIZ);
#ifdef KERNEL_HAVE_PIN
        pin((char *)tp, AFS_SMALLOCSIZ);
#endif
        return (char *)tp;
    }
    afs_stats_cmperf.SmallBlocksActive++;
    ObtainWriteLock(&osi_fsplock, 327);
    tp = freeSmallList;
    if (tp)
	freeSmallList = tp->next;
    ReleaseWriteLock(&osi_fsplock);
    return (char *)tp;
}
开发者ID:bagdxk,项目名称:openafs,代码行数:27,代码来源:afs_osi_alloc.c

示例9: Value

    Value DocumentSourceCursor::serialize(bool explain) const {
        // we never parse a documentSourceCursor, so we only serialize for explain
        if (!explain)
            return Value();

        Lock::DBRead lk(_ns);
        Client::Context ctx(_ns, storageGlobalParams.dbpath, /*doVersion=*/false);

        ClientCursorPin pin(_cursorId);
        ClientCursor* cursor = pin.c();

        uassert(17135, "Cursor deleted. Was the collection or database dropped?",
                cursor);

        Runner* runner = cursor->getRunner();
        runner->restoreState();

        return Value(DOC(getSourceName() <<
            DOC("query" << Value(_query)
             << "sort" << (!_sort.isEmpty() ? Value(_sort) : Value())
             << "limit" << (_limit ? Value(_limit->getLimit()) : Value())
             << "fields" << (!_projection.isEmpty() ? Value(_projection) : Value())
             // << "indexOnly" << canUseCoveredIndex(cursor)
             // << "cursorType" << cursor->c()->toString()
        ))); // TODO get more plan information
    }
开发者ID:Krolcom,项目名称:mongo,代码行数:26,代码来源:document_source_cursor.cpp

示例10: osi_AllocLargeSpace

/* allocate space for sender */
void *
osi_AllocLargeSpace(size_t size)
{
    struct osi_packet *tp;

    AFS_ASSERT_GLOCK();

    AFS_STATCNT(osi_AllocLargeSpace);
    if (size > AFS_LRALLOCSIZ)
	osi_Panic("osi_AllocLargeSpace: size=%d\n", (int)size);
    afs_stats_cmperf.LargeBlocksActive++;
    if (!freePacketList) {
	char *p;

	afs_stats_cmperf.LargeBlocksAlloced++;
	p = afs_osi_Alloc(AFS_LRALLOCSIZ);
#ifdef  KERNEL_HAVE_PIN
	/*
	 * Need to pin this memory since under heavy conditions this memory
	 * could be swapped out; the problem is that we could inside rx where
	 * interrupts are disabled and thus we would panic if we don't pin it.
	 */
	pin(p, AFS_LRALLOCSIZ);
#endif
	return p;
    }
    ObtainWriteLock(&osi_flplock, 324);
    tp = freePacketList;
    if (tp)
	freePacketList = tp->next;
    ReleaseWriteLock(&osi_flplock);
    return (char *)tp;
}
开发者ID:bagdxk,项目名称:openafs,代码行数:34,代码来源:afs_osi_alloc.c

示例11: NewtonBodyGetOmega

// rolling friction works as follow: the idealization of the contact of a spherical object 
// with a another surface is a point that pass by the center of the sphere.
// in most cases this is enough to model the collision but in insufficient for modeling 
// the rolling friction. In reality contact with the sphere with the other surface is not 
// a point but a contact patch. A contact patch has the property the it generates a fix 
// constant rolling torque that opposes the movement of the sphere.
// we can model this torque by adding a clamped torque aligned to the instantaneously axis 
// of rotation of the ball. and with a magnitude of the stopping angular acceleration.
void CustomDryRollingFriction::SubmitConstrainst (dFloat timestep, int threadIndex)
{
	dVector omega;
	dFloat omegaMag;
	dFloat torqueFriction;

	// get the omega vector
	NewtonBodyGetOmega(m_body0, &omega[0]);

	omegaMag = dSqrt (omega % omega);
	if (omegaMag > 0.1f) {
		// tell newton to used this the friction of the omega vector to apply the rolling friction
		dVector pin (omega.Scale (1.0f / omegaMag));
		NewtonUserJointAddAngularRow (m_joint, 0.0f, &pin[0]);

		// calculate the acceleration to stop the ball in one time step
		NewtonUserJointSetRowAcceleration (m_joint, -omegaMag / timestep);

		// set the friction limit proportional the sphere Inertia
		torqueFriction = m_frictionTorque * m_frictionCoef;
		NewtonUserJointSetRowMinimumFriction (m_joint, -torqueFriction);
		NewtonUserJointSetRowMaximumFriction (m_joint, torqueFriction);

	} else {
		// when omega is too low sheath a little bit and damp the omega directly
		omega = omega.Scale (0.2f);
		NewtonBodySetOmega(m_body0, &omega[0]);
	}
}
开发者ID:DerSaidin,项目名称:OpenWolf,代码行数:37,代码来源:CustomDryRollingFriction.cpp

示例12: pin

// 计时器设置为PWM捕获器,此时只能捕获1路
// eg: TIM5, CH2, 捕获PA1
void Timer::mode_pwm_input(PinTypedef p) {
  Pin pin(p); // 函数调用后变量就消失了
  uint8_t tmp = this->GPIO_AF_TIM(this->TIM);
  // 看看tmp有没有问题
  pin.mode_pwm_input(tmp);

  NVIC_InitTypeDef NVIC_InitStructure;  // 中断初始化器
  NVIC_InitStructure.NVIC_IRQChannel = this->IRQn;
  // 低频高优先级原则,20mS的捕获中断设为最高优先级
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; // IRQ 通道使能
  NVIC_Init(&NVIC_InitStructure);

  // 时钟预分频
  TIM_TimeBaseInitTypeDef TIM_TimeBaseStructrue; // 计时器分频初始化器
  TIM_TimeBaseStructrue.TIM_Prescaler = PRESCALER;
  TIM_TimeBaseStructrue.TIM_Prescaler = PRESCALER;
  switch (this->TIM_No) {
    case (1):
    case (8):
    case (9):
    case (10):
    case (11): {
      TIM_TimeBaseStructrue.TIM_Prescaler = PRESCALER_APB2;
      break;
    }
  }
  TIM_TimeBaseStructrue.TIM_CounterMode = TIM_CounterMode_Up;
  TIM_TimeBaseStructrue.TIM_Period = PERIOD;
  TIM_TimeBaseStructrue.TIM_ClockDivision = TIM_CKD_DIV1;
  TIM_TimeBaseInit(this->TIM, &TIM_TimeBaseStructrue);

  // 设置TIM5 CH2 pin为外部信号输入
  // CCR2测频率
  // CCR1测占空比
  TIM_ICInitTypeDef TIM_ICInitStructure; // 计时器模块初始化器
  TIM_ICInitStructure.TIM_Channel = TIM_Channel_2; // input channel 2
  TIM_ICInitStructure.TIM_ICPolarity = TIM_ICPolarity_Rising; // 上升沿中断
  TIM_ICInitStructure.TIM_ICSelection = TIM_ICSelection_DirectTI; // map IC1 to TI1
  TIM_ICInitStructure.TIM_ICPrescaler = TIM_ICPSC_DIV1; // 输入分频,不分频
  TIM_ICInitStructure.TIM_ICFilter = 0x00; //滤波设置,经历几个周期跳变认定波形稳定0x0~0xF

  TIM_PWMIConfig(this->TIM, &TIM_ICInitStructure);

  /* Select the TIM5 Input Trigger: TI2FP2 */
  TIM_SelectInputTrigger(this->TIM, TIM_TS_TI2FP2);

  TIM_SelectSlaveMode(this->TIM,TIM_SlaveMode_Reset);//TIM从模式:触发信号的上升沿重新初始化计数器和触发寄存器的更新事件
  TIM_SelectMasterSlaveMode(this->TIM,TIM_MasterSlaveMode_Enable); //启动定时器的被动触发

  TIM_Cmd(this->TIM, ENABLE); // run TIM5
  // 设置中断ISR为PWM Input模式中断
  // this->set_IRQHandler(Timer::PWM_Input_Handler_Dispatch);
  if ((TIM_No==1)||(TIM_No==8))
    TIM_ITConfig(this->TIM, TIM_IT_Update, ENABLE); // 打开中断,不要
  else
    TIM_ITConfig(this->TIM, TIM_IT_CC2, ENABLE); // 打开中断,TIM_IT_Update不要
}
开发者ID:Zasy,项目名称:STM32_Aircraft,代码行数:61,代码来源:Timer.cpp

示例13: handleCursorCommand

    static void handleCursorCommand(CursorId id, BSONObj& cmdObj, BSONObjBuilder& result) {
        BSONElement batchSizeElem = cmdObj.getFieldDotted("cursor.batchSize");
        const long long batchSize = batchSizeElem.isNumber()
                                    ? batchSizeElem.numberLong()
                                    : 101; // same as query

        ClientCursorPin pin(id);
        ClientCursor* cursor = pin.c();

        massert(16958, "Cursor shouldn't have been deleted",
                cursor);

        verify(cursor->isAggCursor);
        PipelineRunner* runner = dynamic_cast<PipelineRunner*>(cursor->getRunner());
        verify(runner);
        try {
            const string cursorNs = cursor->ns(); // we need this after cursor may have been deleted

            // can't use result BSONObjBuilder directly since it won't handle exceptions correctly.
            BSONArrayBuilder resultsArray;
            const int byteLimit = MaxBytesToReturnToClientAtOnce;
            BSONObj next;
            for (int objCount = 0; objCount < batchSize; objCount++) {
                // The initial getNext() on a PipelineRunner may be very expensive so we don't do it
                // when batchSize is 0 since that indicates a desire for a fast return.
                if (runner->getNext(&next, NULL) != Runner::RUNNER_ADVANCED) {
                    pin.deleteUnderlying();
                    id = 0;
                    cursor = NULL; // make it an obvious error to use cursor after this point
                    break;
                }

                if (resultsArray.len() + next.objsize() > byteLimit) {
                    // too big. next will be the first doc in the second batch
                    runner->pushBack(next);
                    break;
                }

                resultsArray.append(next);
            }

            if (cursor) {
                // If a time limit was set on the pipeline, remaining time is "rolled over" to the
                // cursor (for use by future getmore ops).
                cursor->setLeftoverMaxTimeMicros( cc().curop()->getRemainingMaxTimeMicros() );
            }

            BSONObjBuilder cursorObj(result.subobjStart("cursor"));
            cursorObj.append("id", id);
            cursorObj.append("ns", cursorNs);
            cursorObj.append("firstBatch", resultsArray.arr());
            cursorObj.done();
        }
        catch (...) {
            // Clean up cursor on way out of scope.
            pin.deleteUnderlying();
            throw;
        }
    }
开发者ID:DanilSerd,项目名称:mongo,代码行数:59,代码来源:pipeline_command.cpp

示例14: return

const char	*_graph_pin(t_graphical *graph,
			    const t_server *server,
			    const char *data)
{
  if (!graph || !server || !data || !data[0])
    return ("suc\n");
  return (pin(get_player_for_id(server, atoi(data))));
}
开发者ID:jlouazel,项目名称:zhappy,代码行数:8,代码来源:graph_pin.c

示例15: pin

void pin(int num)
{
	if(num>9)
	{
		pin(num/10);
	}
	printf("%d",num%10);
}
开发者ID:robertparley,项目名称:tryagit,代码行数:8,代码来源:hano.c


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