Implementing a "state-machine" logic for methods required by an object in C++

Posted by user827992 on Programmers See other posts from Programmers or by user827992
Published on 2012-06-22T19:27:38Z Indexed on 2012/06/22 21:25 UTC
Read the original article Hit count: 410

Filed under:
|
|

What I have: 1 hypothetical object/class + other classes and related methods that gives me functionality.

What I want:

  1. linking this object to 0 to N methods in realtime on request when an event is triggered
  2. Each event is related to a single method or a class, so a single event does not necessarily mean "connect this 1 method only" but can also mean "connect all the methods from that class or a group of methods"
  3. Avoiding linked lists because I have to browse the entire list to know what methods are linked, because this does not ensure me that the linked methods are kept in a particular order (let's say an alphabetic order by their names or classes), and also because this involve a massive amount of pointers usage.

Example:

I have an object Employee Jon, Jon acquires knowledge and forgets things pretty easily, so his skills may vary during a period of time, I'm responsible for what Jon can add or remove from his CV, how can I implement this logic?

© Programmers or respective owner

Related posts about c++

Related posts about business-logic