本文整理汇总了C++中sig函数的典型用法代码示例。如果您正苦于以下问题:C++ sig函数的具体用法?C++ sig怎么用?C++ sig使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sig函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
示例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));
}
示例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();
}
示例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);
}
}
}
}
示例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);
}
}
示例8: main
int main()
{
//[ hello_world_multi_code_snippet
boost::signals2::signal<void ()> sig;
sig.connect(Hello());
sig.connect(World());
sig();
//]
return 0;
};
示例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());
}
}
}
示例10: testReturnValuesFromSlotsWithCustomCombiner
void testReturnValuesFromSlotsWithCustomCombiner()
{
boost::signals2::signal<float (float, float), maximum<float>> sig;
sig.connect(&product);
sig.connect("ient);
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;
}
示例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];
}
}
示例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);
}
示例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;
}
}
示例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();
}
示例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;
}