Event Handling using Design Patterns & some hard questions

Discussion in 'C Programming' started by firehead.satish, Jan 11, 2008.

  1. Hello Comp.Lang.C

    I have been reading some documentation on the QT 4.0 signalling
    systems. I read somewhere that the Signal/Slot systems is based on a
    Observer Pattern.

    This is where I do not understand. A slot is 'Prototype' that contains
    parametres that determines the behaviour of an object.
    In this context how can the pattern 'Prototype' become an object

    I am looking for algorithms for implementing an event-handling system
    using Design patterns without the use of templates or the use of third
    party software.

    I know that a Signal is an event which has state therefore an event is
    considered a 'State' patttern.
    A Command patterns executes a prototype/ slot.

    Can a Prototype object specify the behaviour of an event? That is, can
    a Prototype pattern specify what Signals/ events are available for an
    object such as TextBox or a Button?

    How can I specify using design patterns; what parametres are available
    for an method?
    For example:
    button_Clicked methods has no arguments but later on I want to modify
    the behaviour, How can I use the Prototype/Command pattern to modify
    the behaviour?

    The similarity between Signal and Slots with Design Pattern is as

    An observer patterns observes other Observers.
    A observer patterns contains many Signals ( State Pattern).
    A Signal can contains 1 or many Protoypes/ Command Pattern.

    When a observer asynchronously invokes different observer containing a
    Signal/State it would then invoke Slots particular to the Signal. For
    this to happen I would have to use a Proxy or a Delegate Pattern?

    Could someone help out please?

    firehead.satish, Jan 11, 2008
    1. Advertisements

  2. This is not really a C question... It more of an algorithm design question.
    You can try 'comp.programming' or something. Anyway, FWIW here is a very
    brief diagram of an overview for a multi-threaded event-distribution scheme
    I did for some ARM-based embedded devices running Quadros:


    I did this in C and ARM assembly language for the thread synchronization
    stuff. I used a simple abstract interface method in the implementation (for
    the delegate/event/observer data-structures):


    I think might be able to help you some wrt creating your event framework in
    C. Also, if you plan on using threads in this thing, be sure to post over in

    Chris Thomasson, Jan 11, 2008
    1. Advertisements

  3. [...]

    This uses a single distributor thread... If you want to learn how to use
    multiple distributors, ask over in 'comp.programming.threads'...
    Chris Thomasson, Jan 11, 2008
  4. firehead.satish

    Al Balmer Guest

    Suggestions for redirecting questions are ignored if you try to answer
    the question anyway. Let the questioner post in the proper forum and
    answer it there.
    Al Balmer, Jan 11, 2008
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.