Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Messaging question

Messaging question

Scheduled Pinned Locked Moved C / C++ / MFC
questiondata-structureshelp
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Stan the man
    wrote on last edited by
    #1

    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.

    J I 2 Replies Last reply
    0
    • S Stan the man

      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.

      J Offline
      J Offline
      jhwurmbach
      wrote on last edited by
      #2

      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.

      N 1 Reply Last reply
      0
      • S Stan the man

        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 Offline
        I Offline
        iceage
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • J jhwurmbach

          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.

          N Offline
          N Offline
          Neville Franks
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups