first commit
This commit is contained in:
72
lib/EventManager/trunk/source/Event.cpp
Normal file
72
lib/EventManager/trunk/source/Event.cpp
Normal file
@@ -0,0 +1,72 @@
|
||||
/** Includes ***********************/
|
||||
#include "EventManager/Event.h"
|
||||
|
||||
/** Macros *************************/
|
||||
|
||||
/** Variables **********************/
|
||||
|
||||
/** Forward Declarations ***********/
|
||||
|
||||
/** Implementations ****************/
|
||||
namespace CKG
|
||||
{
|
||||
namespace Lib
|
||||
{
|
||||
namespace EventManager
|
||||
{
|
||||
/*!
|
||||
\brief Default Event constructor
|
||||
*/
|
||||
Event::Event(const Char *eventInfo, const int numTriggers, const DateTime *triggers)
|
||||
: mEventInformation(eventInfo)
|
||||
{
|
||||
mTriggers.reserve(numTriggers);
|
||||
|
||||
for (int i = 0; i < numTriggers; i++)
|
||||
{
|
||||
mTriggers.push_back(triggers[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Destroys an event
|
||||
*/
|
||||
Event::~Event()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Sets the event information
|
||||
|
||||
\param eventInfo - Information for the event
|
||||
\return - void.
|
||||
*/
|
||||
void Event::SetEventInformation(const Char *eventInfo)
|
||||
{
|
||||
mEventInformation = stlport::string(eventInfo);
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Should this event be triggered
|
||||
|
||||
\param currentDateTime - Time to compare against
|
||||
\return - True if the event should trigger
|
||||
*/
|
||||
bool Event::ShouldTrigger(const DateTime ¤tDateTime) const
|
||||
{
|
||||
TriggerList::const_iterator iter = mTriggers.begin(), end = mTriggers.end();
|
||||
|
||||
for (; iter != end; ++iter)
|
||||
{
|
||||
if (currentDateTime.GetTime() < iter->GetTime())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user