Custom-Events handling

This is a discussion on Custom-Events handling within the C++ Programming forums, part of the General Programming Boards category; Hi, i'm currently working on a system, which needs an eventhandling. One for a global-state of the system, one for ...

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    30

    Custom-Events handling

    Hi,

    i'm currently working on a system, which needs an eventhandling. One for a global-state of the system, one for an internal state.

    I thought of a class, that has a vector<string:string> that is being appended anytime, a new event is being produced. In this vector the first part would be the type of event (warning, exception etc) and the 2nd part a description. It is not seen as errorhandling, more likely than an eventhandling.
    I would use this class then two times, one as instance for the globalevents and one for the internalevents.

    Then I would think of implementing a search-function to search for a specific event, and functions for getting specific events, like the first/last/byIndex.

    I do not want you to program that thing for me. I just like to hear (more likely read) your opinion on that, or more likely if you have any better ideas.

    Thanks!

  2. #2
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    I think you could be more expressive and save a lotta work with something like an std::map<event_type, uint (*)(void *)> This would map an event to a callback routine handling it.

    ╔╗╔╦══╦╗╔╦══╦╗
    ║╚╝║╔╗║╚╝║╔╗║║
    ║╔╗║╠╣║╔╗║╠╣╠╣
    ╚╝╚╩╝╚╩╝╚╩╝╚╩╝

    codez http://code.google.com/p/zxcvbn/

  3. #3
    Registered User
    Join Date
    Oct 2002
    Posts
    30
    Could you explain that a bit more?

    Thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. signal handling and exception handling
    By lehe in forum C++ Programming
    Replies: 2
    Last Post: 06-15-2009, 11:01 PM
  2. event handling is serialized in MS Visual Studio C++ 2005 ??
    By mynickmynick in forum Windows Programming
    Replies: 3
    Last Post: 08-07-2008, 05:47 AM
  3. Custom Allocation
    By SevenThunders in forum C Programming
    Replies: 17
    Last Post: 04-09-2007, 05:10 PM
  4. seismic events program
    By santaclaus in forum C Programming
    Replies: 16
    Last Post: 11-23-2003, 03:23 PM
  5. handling mouse events in c++
    By irulet in forum C++ Programming
    Replies: 3
    Last Post: 12-10-2002, 01:41 AM

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