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
1
vote
2 answers

How often to derive from boost::signals::trackable?

When using Boost.Signals, boost allows you to derive from boost::signals::trackable in order to ease object/connection lifetime management (See the boost documentation). I am in an early stage of my project and I am thinking, whether to derive from…
Random Citizen
  • 1,272
  • 3
  • 14
  • 28
1
vote
1 answer

Connecting C++ Model to Controller with Signals2 in Objective-C/C++

I'm developing a cross-platform C++ data model with almost 1,000 different kinds of data items (but < 100 different data structures/classes). To handle the Model to Controller messages (i.e. notification for the Controller that some data item has…
SMGreenfield
  • 1,680
  • 19
  • 35
1
vote
1 answer

How to use Boost.Signals2 connect_extended?

I have a working Boost.Signals2 signal & slot combination in my C++ project & set up like so; //DECLARE SIGNAL signals2::signal signal; //CONNECT DATAUPDATE() OF…
GoFaster
  • 835
  • 1
  • 12
  • 23
1
vote
1 answer

Sigalrm (linux signal)

I'm new to Linux signals. If a process initializes multiple timers, then how does a process know which SIGALRM belongs to which timer?
marry
  • 307
  • 2
  • 7
  • 20
1
vote
2 answers

How can I resolve ambiguity of boost::signals2's slot_type and boost::bind, and why is it even ambiguous?

Considering this example: #include #include typedef boost::signals2::signal< void ( double ) > DoubleSignalType; typedef boost::signals2::signal< void ( void ) > VoidSignalType; class B { public: …
math
  • 8,514
  • 10
  • 53
  • 61
1
vote
1 answer

Why does boost::signals2::signal::connect require copy constructors?

I'm working on an object that represents normal data values that utilize functional reactive programming that change their values when a dependant value is changed. What i mean is, let's say you have an var3 = var1 + var2; and then when you change…
FatalCatharsis
  • 3,407
  • 5
  • 44
  • 74
1
vote
1 answer

Using Hypodermic with Boost.Signals2

In order to use Boost.Signals2 with Hypodermic, how would I go about connecting the slots? Would I place the connection code within the OnActivating block? Am I right in thinking they are not duplicating each others functionality even though…
1
vote
1 answer

How to use boost::is_same in c++ template along with boost::lambda::bind

I'm trying to connect a generic boost::function to many boost::signals2 of varying signature. I'm able to use boot::lambda::bind to do the binding part by passing the return value as part of the bind parameters, but have a problem when…
Sak
  • 269
  • 1
  • 4
  • 13
1
vote
2 answers

How to connect to a boost::signal with a generic function/slot?

Is it possible to connect a function with a different signature to a Boost::Signal which expects a certain signature? I have many signals (of varying signature) And from outside that module I want to be able to observe the signals without caring…
Sak
  • 269
  • 1
  • 4
  • 13
1
vote
1 answer

Specifying alternate defaults for boost signals2

Boost's signals2 library defines a nice way to pass through alternate parameters for some of its extended functionality (via its Parameters library). When one of these alternate parameters is fairly commonplace in my code then I want to make a…
Miral
  • 12,637
  • 4
  • 53
  • 93
1
vote
3 answers

Storing a boost::signals2 signal in a map?

I am facing the following problem: I want to store a number of boost::signals2 signal variables in a map. Since these signals are non-copyable, this obviously will not work. How can I work around this? I have already found this older question. In…
Gnosophilon
  • 1,340
  • 7
  • 24
0
votes
1 answer

Any way to cancel signal propagation in boost signals2 without exceptions?

I'd like to use boost::signals2 to handle event notification in my C++ app. I'm hoping to implement something with similar functionality to browser DOM events, specifically the ability to stop the propagation of an event so that the current…
RandomEtc
  • 1,976
  • 1
  • 18
  • 17
0
votes
1 answer

boost signal disconnect problem: slot can still be triggered after slot object has been destroyed

By far I've encountered the same problem. The document in boost web says that the disconnection occurs when 'An object tracked by the slot is destroyed.', however, I tested it doesn't work in that way. So I prefer to disconnect manually although…
0
votes
0 answers

Boost.Signals2 doesn't call connected slot

I have simple variant of testing program what processes some events. If I run code with same way I'll get different behaviour class EventBus : public std::enable_shared_from_this { using handlers =…
fenixD
  • 13
  • 2
0
votes
0 answers

Boost Signals2 return lambda from functor object

To connect Qt5 calls to a signal in my classes I usually use a lambda which calls the Qt functions. All calls to Qt must be in the GUI thread so I use the Qt::QueuedConnection to invoke a function. What I discovered is strange to me. This is what I…
Gustavo
  • 919
  • 11
  • 34