Show
Ignore:
Timestamp:
01/30/10 13:18:29 (6 months ago)
Author:
trichards
Message:

Refactored the Event framework so that I_Event is created in EventService? instead of EventQueue?.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Core/branches/0075_TR_SCRIPTING/Event/src/EventQueue.cpp

    r3309 r3330  
    4646,   m_pScriptObject(NULL) 
    4747,   m_eventQueue() 
    48 ,   m_pEventsMutex(Threading::MutexFactory::create()) 
    4948{ 
    5049} 
     
    5352EventQueue::~EventQueue() 
    5453{ 
    55     Threading::MutexFactory::destroy(m_pEventsMutex); 
    56 } 
    57  
    58 //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ 
    59 I_Event& 
    60 EventQueue::createEvent(const std::string& _name) 
    61 { 
    62     // Since getEvent() will create the event if 
    63     // it doesn't exist, just call it. 
    64     return getEvent(_name); 
    65 } 
    66  
    67 //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ 
    68 I_Event& 
    69 EventQueue::getEvent(const std::string& _name) 
    70 { 
    71     Threading::CriticalSection guard(m_pEventsMutex); 
    72  
    73     // TODO Make sure the event has been created. 
    74     Events_type::iterator iter = m_events.find(_name); 
    75      
    76     if (iter == m_events.end()) 
    77     { 
    78         Event_impl* pEvent = new Event_impl(*this); 
    79  
    80         m_events[_name] = pEvent; 
    81  
    82         return *pEvent; 
    83     } 
    84     else 
    85     { 
    86         return *iter->second; 
    87     } 
    8854} 
    8955