473,657 Members | 2,479 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Best practises for boost:signal

What is the best practice for using boost::signal? Should the signal be
a public field? Should an accessor method be used? Should there be some
special connection methods for every signal, like the following:

private:
signal<void()x;
public:
void connectX(const signal<void()>: :slot_type& slot);
void disconnectX(con st signal<void()>: :slot_type& slot);

If you use boost:signal, how do you do it?

(Okay, actually connectX should return a connection object and
disconnectX should take the it as its parameter, but it's about the
general idea)

--
Memfis

Nov 14 '06 #1
3 2669
Memfis wrote:
What is the best practice for using boost::signal? Should the signal be
a public field? Should an accessor method be used? Should there be some
special connection methods for every signal, like the following:

private:
signal<void()x;
public:
void connectX(const signal<void()>: :slot_type& slot);
void disconnectX(con st signal<void()>: :slot_type& slot);

If you use boost:signal, how do you do it?

(Okay, actually connectX should return a connection object and
disconnectX should take the it as its parameter, but it's about the
general idea)
You should ask this on the Boost User list
(http://boost.org/more/mailing_lists.htm#users) or on a group dedicated
to OO/program design (comp.object, etc.). This group deals with the
Standard C++ language and libraries and their planned extensions
(http://www.parashift.com/c++-faq-lit....html#faq-5.9).

Cheers! --M

Nov 14 '06 #2
mlimber wrote:
You should ask this on the Boost User list
(http://boost.org/more/mailing_lists.htm#users) or on a group dedicated
to OO/program design (comp.object, etc.). This group deals with the
Standard C++ language and libraries and their planned extensions
(http://www.parashift.com/c++-faq-lit....html#faq-5.9).
Ok, I'm sorry. When reading the faq I got the feeling that it also
covers OO design to some extent (as in: using the right language
constructs, which isn't far from what I asked) so I assumed I could ask
this. But your right, again sorry, I'm on my way to more appropriate places.

--
Memfis
Nov 14 '06 #3
Memfis wrote:
mlimber wrote:
You should ask this on the Boost User list
(http://boost.org/more/mailing_lists.htm#users) or on a group dedicated
to OO/program design (comp.object, etc.). This group deals with the
Standard C++ language and libraries and their planned extensions
(http://www.parashift.com/c++-faq-lit....html#faq-5.9).

Ok, I'm sorry. When reading the faq I got the feeling that it also
covers OO design to some extent (as in: using the right language
constructs, which isn't far from what I asked) so I assumed I could ask
this. But your right, again sorry, I'm on my way to more appropriate places.
There's plenty of gray area here, but this seemed outside of the
boundaries to me. If you can rephrase your question more in terms of
the language, we'd be happy to take a whack at it.

Cheers! --M

Nov 14 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5901
by: James Mastro | last post by:
This one has been driving me nuts all day. In a function I have the following: std::list< boost::shared_ptr<MyObject> > * objectList; When debugging my code, the debugger (gdb) dies upon entering the function with this in it. It says "The Debugger has exited due to signal 11 (SIGSEGV).The Debugger has exited due to signal 11 (SIGSEGV)." My dev tools felt the need to say it twice for some reason. I pulled this out
4
2508
by: Steven T. Hatton | last post by:
I'm trying to create an baseclass that will serve as a parent for reference counted objects handled by boost::intrusive_ptr<>. The documentation didn't provide much in the way of describing what the functions intrusive_ptr_add_ref and intrusive_ptr_release should do, nor even what their signatures should be. There is one comment that has me a bit unsure about whether my approach is a good one:"On compilers that support argument-dependent...
2
2206
by: lpw | last post by:
I have dilligently reviewed FAQ-lite Section 3.2, "How do I pass a pointer-to-member-function to a signal handler, X event callback, system call that starts a thread/task, etc." The only suggestion on how to deliver a signal to an object is to do it via a global variable and a wrapper function, a technique that is generally a Bad Idea (due to the usage of a global variable). I understand that this ng is dedicated to the discussion of...
0
1934
by: Arnaud Debaene | last post by:
Hello all. I've got a bunch of existing, non managed, C++ DLLs that export types with, among other things, public events implemented using the boost::signals library. Now, I need to have these DLL interoperate with managed code. Among others things, the managed code need to be able to register for notification with the boost signals. I've tried different approaches (trying to register a pinned delegate with the boost::signal, etc...),
0
1006
by: Arnaud Debaene | last post by:
Could someone explain why the following code works when compiled without /clr but fails at runtime with a boost::bad_function_call exception when compiled with /clr? #include <iostream> using std::cout; using std::endl; #include <boost/signal.hpp> #include <functional>
3
1603
by: Matthias Kaeppler | last post by:
Hi, it might be a stupid question, but i'll take the chance and ask: void connect() { std::string str; // ...
9
3167
by: atomik.fungus | last post by:
g++ wont let me compile boost signals, not even the example that comes in the documentation. I have the libboost_signals.a binary but im not sure if im using it correctly. Here is the code #include "boost/signal.hpp" #include <iostream> int main() { struct HelloWorld {
7
2967
by: myfavdepo | last post by:
Hi all, I have a query regarding the exchanging of a boost::shared_ptr beween different threads. In my program i've two threads both of which having their own internal queues for storing the shared_ptr. one thread is meant to pass the shared_ptr to another after its processing. So when a message arrives i convert it into a class of my own called 'Msg' and i put the 'Msg' object pointer into a shared_ptr and put into the other thread's...
3
6401
by: Chris Jones | last post by:
Hi, I've experimenting with using boost::pool_allocator with std::vector and gcc (4.1)., and I am having problems with segmentation violations. Below I give a simple example of one way I am getting this // Include files #include <cmath> #include <iostream> #include <vector>
0
8844
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8742
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8518
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6177
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5643
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1971
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1734
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.