Author Topic: Add event order(high, mid and low)?  (Read 10605 times)

Offline mmkider

  • Almost regular
  • **
  • Posts: 150
Add event order(high, mid and low)?
« on: April 01, 2009, 06:10:54 am »
I think about event order is requirement.

If I use the same event  into my two plug-ins,I can't estimate this event order because that depend on the name of plugin.

I only force to change my  plug-in's name or create a new event to use.
However, I think it's not general if event order is important.

Any suggest ??

Thank you.
« Last Edit: April 01, 2009, 08:30:47 am by mmkider »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Add event order(high, mid and low)?
« Reply #1 on: April 10, 2009, 07:49:06 pm »
I think about event order is requirement. [...]
I am sorry to say this but (at least) I did not understand what you mean exactly. What events are you talking about? SDK events or self-made events? And why should the order of an event matter? Can you provide an example?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline mmkider

  • Almost regular
  • **
  • Posts: 150
Re: Add event order(high, mid and low)?
« Reply #2 on: April 10, 2009, 08:32:28 pm »
I think about event order is requirement. [...]
I am sorry to say this but (at least) I did not understand what you mean exactly. What events are you talking about? SDK events or self-made events? And why should the order of an event matter? Can you provide an example?

For the sdk of codeblocks, codeblocks event will be stored in the map.
sometime these events should have priority for some plug-in.

For some of the plug-in dependencies, call evnets need a more specific order.

My english is poor, I post some pesudo-code for my mind.

Thank you for your reply.  :lol:

Code
enum EVENT_PRIORITY
{
    LOW=0,
    MID,
   HIGH
};


void RegisterEventSink(wxEventType eventType, IEventFunctorBase<CodeBlocksEvent>* functor,EVENT_PRIORITY priority=EVENT_PRIORITY::LOW);


void Manager::RegisterEventSink(wxEventType eventType, IEventFunctorBase<CodeBlocksEvent>* functor,EVENT_PRIORITY priority)
{
m_EventSinks[priority][eventType].push_back(functor);
}


Code
        EventSinksMap m_EventSinks[2];

Code
Manager::Get()->RegisterEventSink(cbEVT_EDITOR_OPEN, new cbEventFunctor<DebuggerGDB, CodeBlocksEvent>(this, &DebuggerGDB::OnEditorOpened),EVENT_PRIORITY::MID);



« Last Edit: April 10, 2009, 08:59:22 pm by mmkider »