Thread: Custom-Events handling

  1. #1
    Registered User
    Join Date
    Oct 2002

    Custom-Events handling


    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.


  2. #2
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    New York
    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.

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


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, 10: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, 04:47 AM
  3. Custom Allocation
    By SevenThunders in forum C Programming
    Replies: 17
    Last Post: 04-09-2007, 04: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