Questions tagged [boost-signals2]

The Boost.Signals2 library is a thread-safe C++ implementation of a managed signals and slots system.

The Boost.Signals2 library is a thread-safe C++ implementation of a managed signals and slots system. Signals represent callbacks with multiple targets, and are also called publishers or events in similar systems. Signals are connected to some set of slots, which are callback receivers (also called event targets or subscribers), which are called when the signal is "emitted."

Signals and slots are managed, in that signals and slots (or, more properly, objects that occur as part of the slots) can track connections and are capable of automatically disconnecting signal/slot connections when either is destroyed. This enables the user to make signal/slot connections without expending a great effort to manage the lifetimes of those connections with regard to the lifetimes of all objects involved.

When signals are connected to multiple slots, there is a question regarding the relationship between the return values of the slots and the return value of the signals. Boost.Signals2 allows the user to specify the manner in which multiple return values are combined.

109 questions
0
votes
2 answers

How to send signal/data from a worker thread to main thread?

I'll preface this by saying that I'm delving into multithreading for the first time. Despite a lot of reading on concurrency and synchronization, I'm not readily seeing a solution for the requirements I've been given. Using C++11 and Boost, I'm…
jslmsca
  • 196
  • 1
  • 14
0
votes
1 answer

What is the correct way to reuse the return value of a boost::bind call?

I have to following code: class Timer; typedef boost::signals2::signal signal_type; void Timer::create(long expiration, signal_type::slot_type const& slot); The normal usage of that is to call, timer.create(2000,…
Carlo Wood
  • 5,648
  • 2
  • 35
  • 47
0
votes
2 answers

specific class in inheritance hierachy as type in boost::signal2 callback

I'm using a boost::signals2::signal inside a gui-class like this: class GuiElement { //... typedef boost::signals2::signal GuiElementSignal; virtual GuiElementSignal &getSignal() { return signal_; }; } All…
0ax1
  • 475
  • 3
  • 11
0
votes
1 answer

boost::signals2; no matching function for adding signal slot

I have a project where I have a problem with boost::signals2. To give a short example I've shortened the code to following three classes (All classes are simplified): class SignalArgs { int a_number_; }; class Plugin { protected: …
Felix
  • 2,531
  • 14
  • 25
0
votes
2 answers

C++ template class with boost signals2

I'm trying to use the boost signals and slots with C++ templates. Here is the example code: #include #include #include #include template class JBase { public: JBase(T &d) :…
0
votes
1 answer

boost::signals2 linker error with a simple program

In an experiment with Boost.Signals2, I tried to compile the following very naive program. The program did compile, but I got a linker error (see the bottom of this question for the error message). // hello.cpp #include int…
user740006
  • 1,759
  • 4
  • 20
  • 30
0
votes
1 answer

Boost Signals2 tracking

I am using Boost Signals2 in one of our project.In this I want automatic connection management,for this I am testing Boost Signals2 tracking but I am not getting slot invoked. After I run following code , slots are not called . Environment: VS…
Rushikesh
  • 21
  • 1
  • 3
0
votes
1 answer

boost::signal with arguments from static member function?

rtmidi library requires setting callback to static function, which should handle incoming midi messages. I found workaround (CinderMidiIn::callback function) but application crashes when I try to send signal after parsing. Here is shortened version…
sphere42
  • 156
  • 1
  • 11
0
votes
1 answer

clang++ will not build first example in boost signals2

Hey everyguys I've been taking a look at boost signals recently because I'd like to switch over to it from my own custom code for handling signal notification. I ran into a problem compiling the first example from here:…
Steve
  • 194
  • 11
0
votes
1 answer

How to get slot to bind function to signal?

I'm using signals2. I'm trying to setup a viewstate/view relationship with a view having a subscribed slot. I can't seem to trigger the handler function though. Is there something wrong with the binding? I'm new to c++ so maybe there's a misuse of…
FlavorScape
  • 13,301
  • 12
  • 75
  • 117
0
votes
1 answer

How to use a noncopyable object as a slot with boost::signals2::signal

I have an instance of a noncopyable object, that I want to use with a boost signal2. The connect method expects my functor to be copyable. Is there a way to work this around? How do I remove the comment in the code below? #include…
Anton Daneyko
  • 6,528
  • 5
  • 31
  • 59
0
votes
1 answer

C++ Boost Signals connecting two functions from two different classes in template

I'm trying to make a connection between a function in one class so that I can call it in another class. The answers I've found are either too specific or maybe I'm missing something because I cannot for the life of me figure out what I'm doing…
Ryan Bartley
  • 606
  • 8
  • 17
0
votes
1 answer

Using boost.signals2 how do I connect dynamically allocated objects to a signal

I have a class named Candidate containing a function named DataUpdate(). I intend to dynamically create many instances of Candidate and have each instance connect it's function DataUpdate() as a slot to a boost.signals2 signal; in readiness to…
GoFaster
  • 835
  • 1
  • 12
  • 23
0
votes
2 answers

wrapper for boost::signals2 with lifetime management for generic slots

I would like to create a wrapper class for boost::signals2 for modules (threads) that emits signals to slots. I.e. a module should gain typical simple signalling capabilities (e.g. a public connect(...) method) by inheriting from my Signal class. I…
spinxz
  • 401
  • 3
  • 13
0
votes
0 answers

Including signals2 header gives compile error

I have a project that compiles just fine, but I wanted to add some functionality using signals2. When including boost/signals2/signal.hpp to one of my classes, I get these two errors: Error 10 error C2338: found >= Align…
Walkingsteak
  • 329
  • 4
  • 16