Questions tagged [boost-signals]

The Boost.Signals library is an implementation of a managed signals and slots system

Signals represent callbacks with multiple targets (also called events in similar systems). They 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 track all 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.

80 questions
65
votes
6 answers

Complete example using Boost::Signals for C++ Eventing

I’m aware of the tutorial at boost.org addressing this: Boost.org Signals Tutorial, but the examples are not complete and somewhat over simplified. The examples there don’t show the include files and some sections of the code are a little…
Chris Andrews
  • 1,881
  • 3
  • 21
  • 31
59
votes
5 answers

Can Qt signals return a value?

Boost.Signals allows various strategies of using the return values of slots to form the return value of the signal. E.g. adding them, forming a vector out of them, or returning the last one. The common wisdom (expressed in the Qt documentation) is…
Marc Mutz - mmutz
  • 24,485
  • 12
  • 80
  • 90
12
votes
2 answers

Signals vs Signals2

I have application that may benefit from using one of boost's signals libraries over a homegrown solution. The application is multithreaded but the part that does the signal processing is single threaded. Is there any reason to prefer Boost.Signals2…
deft_code
  • 57,255
  • 29
  • 141
  • 224
11
votes
2 answers

How to use boost::bind in C++/CLI to bind a member of a managed class

I am using boost::signal in a native C++ class, and I now I am writing a .NET wrapper in C++/CLI, so that I can expose the native C++ callbacks as .NET events. When I try to use boost::bind to take the address of a member function of my managed…
Brian Stewart
  • 9,157
  • 11
  • 54
  • 66
9
votes
2 answers

Boost: what exactly is not threadsafe in Boost.Signals?

I read at multiple places that Boost.Signals is not threadsafe but I haven't found much more details about it. This simple quote doesn't say really that much. Most applications nowadays have threads - even if they try to be single threaded, some of…
Albert
  • 65,406
  • 61
  • 242
  • 386
9
votes
4 answers

Can I create a software watchdog timer thread in C++ using Boost Signals2 and Threads?

I am running function Foo from somebody else's library in a single-threaded application currently. Most of the time, I make a call to Foo and it's really quick, some times, I make a call to Foo and it takes forever. I am not a patient man, if Foo…
Aron Ahmadia
  • 2,267
  • 2
  • 19
  • 22
7
votes
1 answer

Is there a way to connect a boost signal directly to another signal?

I was wondering if there is a nicer way to connect a Boost signal of one class directly to a signal of another class? For example imagine a facade class with a bunch of members which provide their own signals. Now assume that the facade wants to…
djf
  • 6,592
  • 6
  • 44
  • 62
6
votes
1 answer

Can not compile boost::signal tutorial using gcc 4.5 on ubuntu 11.04

I'm trying to complete the boost::signal tutorial at http://www.boost.org/doc/libs/1_47_0/doc/html/signals/tutorial.html#id2850736 However Eclipse CDT shows parsing errors with whichever syntax I use I have #include Preferred…
user486134
  • 405
  • 1
  • 6
  • 13
6
votes
2 answers

Are boost::signals slots called synchronously or asynchronously?

Can anyone tell me are boost::signals slots called synchronously or asynchronously? For example I have this piece of code: struct Hello { void operator()() const { std::cout << "Hello "; } }; struct World { void operator()() const { …
Jacob Krieg
  • 2,834
  • 15
  • 68
  • 140
4
votes
1 answer

error: function returning a function

Although there is at least one similar question, I still ask mine since that one hasn't got solved and seems more complicated. I'm trying to simplify mine. I have a .cpp file that uses .h as below, and compiling these sheds error as follows. Any…
IsaacS
  • 3,551
  • 6
  • 39
  • 61
4
votes
2 answers

Does the boost.signals2 library need to be built?

My system is having trouble building the boost libraries. I understand that most boost libraries are (fortunately) just headers that do not need to be build (with some exceptions). Does the boost :: signals2 library need to be built? Also is the…
ApprenticeHacker
  • 21,351
  • 27
  • 103
  • 153
4
votes
4 answers

Public boost::signal object

I make my boost::signals public because I'm lazy. class Button { public: signal clicked; }; int main() { Button btn; btn.clicked.connect(handleClick); } ... rather than encapsulating with a…
Iraimbilanja
4
votes
4 answers

What is the point of Boost::Signals?

Firstly, I am an absolute beginner in programming, so don't make fun of me too much. The only thing that I have seen signals used for are GUI toolkits, and GUI toolkits all come with their own signaling. So, can Boost:Signals even be used with these…
Patrick
  • 1,894
  • 3
  • 15
  • 17
4
votes
1 answer

Using a boost signal within boost::bind

I'm trying to wrap triggering for a boost::signal into a boost::bind object. So what I want is to invoke the signal with some pre-packaged arguments when the boost::function is called. What I have is this: boost::signals2::signal
Brian
  • 2,511
  • 20
  • 26
4
votes
1 answer

std::tr1::function::target and co-/contravariance

Since I love progamming in both C# and C++, I'm about to implementing a C#-like event system as a solid base for my planned C++ SFML-GUI. This is only an excerpt of my code and I hope this clarifies my concept: // Event.h // STL headers: #include…
Sebastian Graf
  • 3,602
  • 3
  • 27
  • 38
1
2 3 4 5 6