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

C++ sig函数代码示例

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

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



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

示例1: main

int
main(int, char *[])
{
    hello x(0);
    hello y(1);

    more::signal<int(int)> sig;

    sig.connect(x.method);
    sig.connect(y.method);

    // assert(x.method(0) == 1);

    sig(0);

    sig.disconnect(y.method);

    sig(1);

    return 0;
}
开发者ID:awgn,项目名称:codes,代码行数:21,代码来源:signal_slot-test.cpp


示例2: sig

QByteArray QtBoostIntegrationBindingObject::buildAdapterSignature
    (int nrArguments, int argumentMetaTypeList[])
{
    QByteArray sig("lambda(");
    for (int i = 0; i < nrArguments; i++) {
        sig += QMetaType::typeName(argumentMetaTypeList[i]);
        if (i != nrArguments-1)
            sig += ",";
    }
    sig += ")";
    return sig;
}
开发者ID:AlexeyProkhin,项目名称:QtBoostIntegration,代码行数:12,代码来源:qtboostintegrationbindingobject.cpp


示例3: wxGetApp

void YardCustomer::OnChange(wxTreeEvent& event)
{
    m_loading = true;
    custItemData * data = static_cast<custItemData *>(m_tree->GetItemData(event.GetItem()));

    if (!data)
        return;
    
    try {
        m_cust = wxGetApp().DB().CustomerGet(data->GetID());
    }
    catch (YardDBException& e)
    {
        wxLogDebug(wxT("Error (customer not loaded): %s, %s"),e.what(), e.GetSQL().c_str());
        return;
    }
        
    if (m_cust.GetPicLocal() != "")
    {
        wxImage pic(m_cust.GetPicLocal().c_str());
        if (pic.Ok())
            m_pic->SetBitmap(pic);
        else
            wxLogDebug(wxT("Bad image data (pic)."));
    }
    else
        m_pic->SetBitmap(wxImage("res/personal.png"));
    
    if (m_cust.GetSigLocal() != "")
    {
        wxImage sig(m_cust.GetSigLocal().c_str());
        if (sig.Ok())
            m_sig->SetBitmap(sig);
        else
            wxLogDebug(wxT("Bad image data (sig)."));
    }
    else
        m_sig->SetBitmap(wxNullBitmap);
    
    m_first->SetValue(m_cust.GetFirstName().c_str());
    m_middle->SetValue(m_cust.GetMiddleName().c_str());
    m_last->SetValue(m_cust.GetLastName().c_str());
    m_address->SetValue(m_cust.GetAddress().c_str());
    m_ccNum->SetValue(m_cust.GetCreditCardNumber().c_str());
    m_ccName->SetValue(m_cust.GetCreditCardName().c_str());
    m_ccExp->SetValue(m_cust.GetCreditCardExpiration().c_str());
    m_phone->SetValue(m_cust.GetPhone().c_str());
    wxString pos;
    pos.Printf(wxT("Customer Since: %s"), m_cust.GetSince().c_str());
    m_custSince->SetLabel(pos);
    
    m_loading = false;
}
开发者ID:mentat,项目名称:YardSale,代码行数:53,代码来源:ys_customer.cpp


示例4: BRR_LOGI

//! ************************************************************************************************
//!
//! ************************************************************************************************
void rdmp::SimpleReturnedValue()
{
    boost::signals2::signal<float(float,float)> sig;
    sig.connect(3, &RetSumArguments);
    sig.connect(2, &RetProductArguments);
    sig.connect(1, &RetDifferenceArguments);
    sig.connect(0, &RetQuotient);

    //! @brief The default combiner returns a boost::optional containing the return
    //!        value of the last slot in the slot list, in this case the
    BRR_LOGI("return %.2f", *sig(3.2, 6.8));
}
开发者ID:gyllidor,项目名称:roadmap_2015-2,代码行数:15,代码来源:signals2.cpp


示例5: testSingleSlotConnection

    void testSingleSlotConnection()
    {
        // Signal with no arguments and a void return value
        boost::signals2::signal<void ()> sig;

        // Connect to HelloWorld::operator()
        HelloWorld hello;
        sig.connect(hello);

        // Call all of the slots
        sig();
    }
开发者ID:MarkoFilipovic,项目名称:Playground,代码行数:12,代码来源:signalsTest.cpp


示例6: TEST_F

TEST_F(ThreeIndexTestGF,Operators)
{
    namespace g=alps::gf;

    for (g::matsubara_index om=g::matsubara_index(0); om<gf.mesh1().extent(); ++om) {
        for (g::momentum_index ii=g::momentum_index(0); ii<gf.mesh2().extent(); ++ii) {
            for (g::index sig=g::index(0); sig<gf.mesh3().extent(); ++sig) {
                std::complex<double> v1(1+om()+ii(), 1+sig());
                std::complex<double> v2=1./v1;
                gf(om,ii,sig)=v1;
                gf2(om,ii,sig)=v2;
            }
        }
    }


    gf_type g_plus=gf+gf2;
    gf_type g_minus=gf-gf2;

    const double tol=1E-8;
                    
    for (g::matsubara_index om=g::matsubara_index(0); om<gf.mesh1().extent(); ++om) {
        for (g::momentum_index ii=g::momentum_index(0); ii<gf.mesh2().extent(); ++ii) {
            for (g::index sig=g::index(0); sig<gf.mesh3().extent(); ++sig) {

                std::complex<double> v1(1+om()+ii(), 1+sig());
                std::complex<double> v2=1./v1;
                
                std::complex<double> r1=v1+v2;
                std::complex<double> r2=v1-v2;
                
                ASSERT_NEAR(r1.real(),g_plus(om,ii,sig).real(),tol);
                ASSERT_NEAR(r1.imag(),g_plus(om,ii,sig).imag(),tol);

                ASSERT_NEAR(r2.real(),g_minus(om,ii,sig).real(),tol);
                ASSERT_NEAR(r2.imag(),g_minus(om,ii,sig).imag(),tol);
            }
        }
    }
}
开发者ID:DalInar,项目名称:GFTools-1,代码行数:40,代码来源:three_index_gf_test.cpp


示例7: test_extended_slot

  void test_extended_slot()
{
  {
    typedef boost::signals2::signal1<ResultType, int> signal_type;
    typedef typename signal_type::extended_slot_type slot_type;
    signal_type sig;
    // attempting to work around msvc 7.1 bug by explicitly assigning to a function pointer
    ResultType (*fp)(const boost::signals2::connection &conn, int) = &disconnecting_slot<ResultType>;
    slot_type myslot(fp);
    sig.connect_extended(myslot);
    BOOST_CHECK(sig.num_slots() == 1);
    sig(0);
    BOOST_CHECK(sig.num_slots() == 0);
  }
  { // test 0 arg signal
    typedef boost::signals2::signal0<ResultType> signal_type;
    typedef typename signal_type::extended_slot_type slot_type;
    signal_type sig;
    // attempting to work around msvc 7.1 bug by explicitly assigning to a function pointer
    ResultType (*fp)(const boost::signals2::connection &conn, int) = &disconnecting_slot<ResultType>;
    slot_type myslot(fp, _1, 0);
    sig.connect_extended(myslot);
    BOOST_CHECK(sig.num_slots() == 1);
    sig();
    BOOST_CHECK(sig.num_slots() == 0);
  }
  // test disconnection by slot
  {
    typedef boost::signals2::signal1<ResultType, int> signal_type;
    typedef typename signal_type::extended_slot_type slot_type;
    signal_type sig;
    // attempting to work around msvc 7.1 bug by explicitly assigning to a function pointer
    ResultType (*fp)(const boost::signals2::connection &conn, int) = &disconnecting_slot<ResultType>;
    slot_type myslot(fp);
    sig.connect_extended(myslot);
    BOOST_CHECK(sig.num_slots() == 1);
    sig.disconnect(fp);
    BOOST_CHECK(sig.num_slots() == 0);
  }
}
开发者ID:Ruinland,项目名称:boost-doc-zh,代码行数:40,代码来源:signal_n_test.cpp


示例8: main

int main()
{
//[ hello_world_multi_code_snippet
  boost::signals2::signal<void ()> sig;

  sig.connect(Hello());
  sig.connect(World());

  sig();
//]

  return 0;
};
开发者ID:Ruinland,项目名称:boost-doc-zh,代码行数:13,代码来源:hello_world_multi_slot.cpp


示例9: assert

void SMTSolver_eq::merge(int s1, int s2)
{
	assert(settings_s.smtc_s);

	fprintf(stderr, "Merging %d and %d.\n", s1, s2);

	if(s1 == s2)
		return;
	assert(connectivity_check.find(s1) != nullptr && connectivity_check.find(s2) != nullptr);
	connectivity_check.make_union(s1,s2);
	for(int good_term: has_as_arg[s1])
	{
		fprintf(stderr, "%d has %d as arg.\n", good_term, s1);
		for(auto y : solver->terms_mapping)
			if(y.first != 0 && sig(good_term, y.first))
			{
				if(connectivity_check.find(y.first) == nullptr)
					connectivity_check.add(y.first);
				if(connectivity_check.find(good_term) == nullptr)
					connectivity_check.add(good_term);
				merge(connectivity_check.find(good_term)->getValue(), connectivity_check.find(y.first)->getValue());
			}
	}

	for(int good_term: has_as_arg[s2])
	{
		fprintf(stderr, "%d has %d as arg.\n", good_term, s1);
		for(auto y : solver->terms_mapping)
			if(y.first != 0 && sig(good_term, y.first))
			{
				if(connectivity_check.find(y.first) == nullptr)
					connectivity_check.add(y.first);
				if(connectivity_check.find(good_term) == nullptr)
					connectivity_check.add(good_term);
				merge(connectivity_check.find(good_term)->getValue(), connectivity_check.find(y.first)->getValue());
			}
	}

}
开发者ID:Oxmose,项目名称:SATSolver,代码行数:39,代码来源:SMTSolver_eq.cpp


示例10: testReturnValuesFromSlotsWithCustomCombiner

    void testReturnValuesFromSlotsWithCustomCombiner()
    {
        boost::signals2::signal<float (float, float), maximum<float>> sig;

        sig.connect(&product);
        sig.connect(&quotient);
        sig.connect(&sum);
        sig.connect(&difference);

        // Outputs the maximum value returned by the connected slots,
        // in this case 15 from the product function.
        std::cout << "maximum: " << sig(5, 3) << std::endl;
    }
开发者ID:MarkoFilipovic,项目名称:Playground,代码行数:13,代码来源:signalsTest.cpp


示例11: fixmatrix

void fixmatrix(transmatrix& T) {
  if(euclid) {
    for(int x=0; x<2; x++) for(int y=0; y<=x; y++) {
      ld dp = 0;
      for(int z=0; z<2; z++) dp += T[z][x] * T[z][y];
      
      if(y == x) dp = 1 - sqrt(1/dp);
      
      for(int z=0; z<2; z++) T[z][x] -= dp * T[z][y];
      }
    for(int x=0; x<2; x++) T[2][x] = 0;
    T[2][2] = 1;
    }
  else for(int x=0; x<3; x++) for(int y=0; y<=x; y++) {
    ld dp = 0;
    for(int z=0; z<3; z++) dp += T[z][x] * T[z][y] * sig(z);
    
    if(y == x) dp = 1 - sqrt(sig(x)/dp);
    
    for(int z=0; z<3; z++) T[z][x] -= dp * T[z][y];
    }
  }
开发者ID:LibreGames,项目名称:hyperrogue,代码行数:22,代码来源:hyperpoint.cpp


示例12: BOOST_ASSERT

void ObjectSize::updateResolution(const boost::uuids::uuid resolutionId) const {
	if(this->resolutionId == resolutionId) {
		return;
	}
	this->resolutionId = resolutionId;

	const std::map<const boost::uuids::uuid, const Size>::const_iterator i = sizeMap.find(resolutionId);
	
	BOOST_ASSERT(i != sizeMap.end());

	size = i->second;
	sig(size);
}
开发者ID:LodePublishing,项目名称:GUI,代码行数:13,代码来源:objectsize.cpp


示例13: sig

bool
SecRuleRelative::matchSignerName (const Data& data)
{    
  try{
    SignatureSha256WithRsa sig(data.getSignature());
    Name signerName = sig.getKeyLocator().getName ();
    return m_signerNameRegex.match(signerName); 
  }catch(SignatureSha256WithRsa::Error &e){
    return false;
  }catch(KeyLocator::Error &e){
    return false;
  }
}
开发者ID:bruinfish,项目名称:ndn-cpp.external-security-library,代码行数:13,代码来源:sec-rule-relative.cpp


示例14: show

std::string show(const DexDebugInstruction* insn) {
  if (!insn) return "";
  std::ostringstream ss;
  switch (insn->opcode()) {
  case DBG_END_SEQUENCE:
    ss << "DBG_END_SEQUENCE";
    break;
  case DBG_ADVANCE_PC:
    ss << "DBG_ADVANCE_PC " << insn->uvalue();
    break;
  case DBG_ADVANCE_LINE:
    ss << "DBG_ADVANCE_LINE " << insn->value();
    break;
  case DBG_START_LOCAL: {
    auto sl = static_cast<const DexDebugOpcodeStartLocal*>(insn);
    ss << "DBG_START_LOCAL v" << sl->uvalue() << " " << show(sl->name())
        << ":" << show(sl->type());
    break;
  }
  case DBG_START_LOCAL_EXTENDED: {
    auto sl = static_cast<const DexDebugOpcodeStartLocal*>(insn);
    ss << "DBG_START_LOCAL v" << sl->uvalue() << " " << show(sl->name())
        << ":" << show(sl->type()) << ";" << show(sl->sig());
    break;
  }
  case DBG_END_LOCAL:
    ss << "DBG_END_LOCAL v" << insn->uvalue();
    break;
  case DBG_RESTART_LOCAL:
    ss << "DBG_RESTART_LOCAL v" << insn->uvalue();
    break;
  case DBG_SET_PROLOGUE_END:
    ss << "DBG_SET_PROLOGUE_END";
    break;
  case DBG_SET_EPILOGUE_BEGIN:
    ss << "DBG_SET_EPILOGUE_BEGIN";
    break;
  case DBG_SET_FILE: {
    auto sf = static_cast<const DexDebugOpcodeSetFile*>(insn);
    ss << "DBG_SET_FILE " << show(sf->file());
    break;
  }
  default: {
    auto adjusted_opcode = insn->opcode() - DBG_FIRST_SPECIAL;
    auto line = DBG_LINE_BASE + (adjusted_opcode % DBG_LINE_RANGE);
    auto address = (adjusted_opcode / DBG_LINE_RANGE);
    ss << "DBG_SPECIAL line+=" << line << " addr+=" << address;
  }
  }
  return ss.str();
}
开发者ID:plast-lab,项目名称:redex,代码行数:51,代码来源:Show.cpp


示例15: CirclePolygon

//圆与一般多边形面积交
double CirclePolygon(Point *ps, int n, Point o, double radius) {
	//保证逆时针
	if (area(ps, n) < 0) reverse(ps, ps + n);

	ps[n] = ps[0];
	double res = 0;
	for (int i = 0; i < n; i++) {
		int sgn = sig(ps[i].x * ps[i + 1].y - ps[i].y * ps[i + 1].x);
		if (sgn != 0) {
			res += sgn * CircleTrianlge(ps[i], ps[i + 1], o, radius);
		}
	}
	return res;
}
开发者ID:zjsxzy,项目名称:algo,代码行数:15,代码来源:Circle.cpp


示例16: unsub

 int unsub()
 {
     std::string sig(cmd + UNSUB_LEN);
     if (subs.count(sig) > 0)
     {
         subs.at(sig).erase(socket);
         if (subs.at(sig).size() == 0)
         {
             subs.erase(sig);
             signals.erase(sig);
         }
     }
     return sig.length();
 }
开发者ID:shagal239,项目名称:os,代码行数:14,代码来源:sigd.cpp


示例17: main

// ////////////////////////////////////////////////////////
int main (int argc, char* argv[]) {

  boost::signals2::signal<void (float, float)> sig;

  sig.connect (&print_args);
  sig.connect (&print_sum);
  sig.connect (&print_product);
  sig.connect (&print_difference);
  sig.connect (&print_quotient);

  sig (5.0, 3.0);
  
  return 0;
};
开发者ID:mvancompernolle,项目名称:ai_project,代码行数:15,代码来源:multislots.cpp


示例18: PSmoments4D

SliceMacroParticle::SliceMacroParticle(const PSmoments& S, double z1, double dp1, double q1)
	: PSmoments4D(),q(q1)
{
	for(int i=0; i<4; i++)
	{
		mean(i)=S[i];
		for(int j=0; j<=i; j++)
		{
			sig(i,j) = S(i,j);
		}
	}
	mean(ps_CT)=z1;
	mean(ps_DP)=dp1;
}
开发者ID:MERLIN-Collaboration,项目名称:MERLIN,代码行数:14,代码来源:SliceMacroParticle.cpp


示例19: main

int main()
{
  boost::signal2<void, int, int> sig;

  sig.connect(print_sum());
  sig.connect(print_product());

  sig(3, 5);

  boost::signals::connection print_diff_con = sig.connect(print_difference());

  // sig is still connected to print_diff_con
  assert(print_diff_con.connected());
  
  sig(5, 3); // prints 8, 15, and 2
  
  print_diff_con.disconnect(); // disconnect the print_difference slot
  
  sig(5, 3); // now prints 8 and 15, but not the difference
  
  assert(!print_diff_con.connected()); // not connected any more
  return 0;
}
开发者ID:NeoAnomaly,项目名称:xray,代码行数:23,代码来源:difference_connection.cpp


示例20: properties

// The option's defining parameters
SimplePropertySet<string, double> properties() 
{
	SimplePropertySet<string, double> result;

	result.add (Property<string, double> (r.name(), r() ) );
	result.add (Property<string, double> (sig.name(), sig() ) );
	result.add (Property<string, double> (K.name(), K() ) );
	result.add (Property<string, double> (T.name(), T() ) );
	result.add (Property<string, double> (U.name(), U() ) );
	result.add (Property<string, double> (b.name(), b() ) );

	return result;

}
开发者ID:JinhuiAchilles,项目名称:C_Github,代码行数:15,代码来源:OptionExtras.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ sigaction函数代码示例发布时间:2022-05-30
下一篇:
C++ siftDown函数代码示例发布时间: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