how to organize an event driven system

This is a discussion on how to organize an event driven system within the C++ Programming forums, part of the General Programming Boards category; I'm look for advice or references to help me code a multi-layer event driven system. The software is broken up ...

  1. #1
    Registered User
    Join Date
    Feb 2005
    Posts
    46

    how to organize an event driven system

    I'm look for advice or references to help me code a multi-layer event driven system.

    The software is broken up into several layers:
    The bottom layer is in an infinite loop. It takes input from a device and calculates two doubles. When the doubles cross a certain threshold (which will happen repeatedly), I'd like this layer to pass messages up to the layer above it (such as an events).
    The intermediate layer will act as a state machine, taking the input events from the bottom layer. Based on the current state and the input, it will generate an event to update the top layer.
    The top layer will be a GUI. It should take events from the middle layer in order to update the display and functionality.

    This is the basic structure (there are actually more layers in between, but if I can figure out the 3 layers I should be able to add more). If it's important, I'm planning to use Qt for the GUI.

    So basically I'm just trying to figure out how I should organize this. Do I use callback functions, or messages, or something else? Are there any similar examples floating around?

    Thanks.

  2. #2
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,412
    I was recently reading an article on a similar issue you might find useful. http://www.artima.com/weblogs/viewpost.jsp?thread=84958

    However, do you need a GUI? There's many other uses for event-driven programming.

    Regardless, some other food for thought is the Observer pattern.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  3. #3
    Registered User
    Join Date
    Feb 2005
    Posts
    46
    Thanks,
    Yeah, the GUI needs to be part of the system. But I would still need event-driven programming even without the GUI.

    After reading some other threads, like http://www.gamedev.net/community/for...opic_id=448347, I've come to the conclusion that the way to get this done with the least amount of headaches is to use a signal library. Now, the question is which library to use?
    I'm thinking of either libsigc++, boost:: signals, or the Qt Signals and Slots library.

    Since I'm planning to use Qt for the GUI, perhaps using its signals and slots library makes the most sense.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Lame null append cause buffer to crash
    By cmoo in forum C Programming
    Replies: 8
    Last Post: 12-29-2008, 02:27 AM
  2. Actors, cues, event based logic.
    By Shamino in forum Game Programming
    Replies: 2
    Last Post: 04-27-2006, 10:58 PM
  3. measuring system resources used by a function
    By Aran in forum C Programming
    Replies: 1
    Last Post: 03-13-2006, 04:35 PM
  4. Best "Menu" method?
    By SSJMetroid in forum Game Programming
    Replies: 11
    Last Post: 12-07-2005, 11:05 PM
  5. BIOS system and memory allocation problem
    By beely in forum Tech Board
    Replies: 9
    Last Post: 11-25-2003, 06:12 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21