Thread: how to organize an event driven system

  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
    Ireland
    Posts
    8,446
    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.
    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, 03: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, 05:35 PM
  4. Best "Menu" method?
    By SSJMetroid in forum Game Programming
    Replies: 11
    Last Post: 12-08-2005, 12:05 AM
  5. BIOS system and memory allocation problem
    By beely in forum Tech Board
    Replies: 9
    Last Post: 11-25-2003, 07:12 AM