Messaging question
-
I was wondering what would be the best way to implement the following: I have many types of objects that have a similar function the same. I want a main Messaging class to route commands to each respective object to do something when something specific happen related to the object. A use for this would be to have multiple graphs that would be plotting different thing with the same data. However the main difference is that I could change things at runtime by attaching this graph to this and that graph to that. Any ideas? Anything I can read to do what I would like? Appreciate any help. Thanks.
-
I was wondering what would be the best way to implement the following: I have many types of objects that have a similar function the same. I want a main Messaging class to route commands to each respective object to do something when something specific happen related to the object. A use for this would be to have multiple graphs that would be plotting different thing with the same data. However the main difference is that I could change things at runtime by attaching this graph to this and that graph to that. Any ideas? Anything I can read to do what I would like? Appreciate any help. Thanks.
I am not quite sure if it is what you want, but have a look at the 'signals and slots' library from boost[^]. Boost is a repository for libraries and tools that faciliate modern C++-programming, especially STL and templates. Many of the people at boost are activly participating at the C++ standardisation comitee.
My opinions may have changed, but not the fact that I am right.
-
I was wondering what would be the best way to implement the following: I have many types of objects that have a similar function the same. I want a main Messaging class to route commands to each respective object to do something when something specific happen related to the object. A use for this would be to have multiple graphs that would be plotting different thing with the same data. However the main difference is that I could change things at runtime by attaching this graph to this and that graph to that. Any ideas? Anything I can read to do what I would like? Appreciate any help. Thanks.
The best way to implement this is to use the OBSERVER pattern described in "Design Patterns" book. You can find here some example for that: http://www.codeproject.com/cpp/observer.asp http://www.codeproject.com/useritems/Observer\_with\_templates.asp http://www.codeproject.com/gen/design/ObserverPattern.asp
-
I am not quite sure if it is what you want, but have a look at the 'signals and slots' library from boost[^]. Boost is a repository for libraries and tools that faciliate modern C++-programming, especially STL and templates. Many of the people at boost are activly participating at the C++ standardisation comitee.
My opinions may have changed, but not the fact that I am right.
I was going to suggest Signals & Slots as well. Besides Boost there is also LibSigC++ which I'm using in ED. I tried to use Boost 'signals & slots' recently to compare it with LibSigC++ but had to give up because the signal was in a DLL and the slot in the Exe. LibSigC++ handles this without any problems. Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com