first commit
This commit is contained in:
161
lib/EventManager/trunk/include/EventManager/DateTime.h
Normal file
161
lib/EventManager/trunk/include/EventManager/DateTime.h
Normal file
@@ -0,0 +1,161 @@
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifndef CKG_LIB_EVENTMANAGER_DATETIME_H_
|
||||
#define CKG_LIB_EVENTMANAGER_DATETIME_H_
|
||||
|
||||
/** Includes ***********************/
|
||||
#include <time.h>
|
||||
|
||||
/** Macros *************************/
|
||||
#pragma warning(disable:4514)
|
||||
#define CKG_LIB_ALLOW_NON_CONST_OPERATORS 1
|
||||
|
||||
/** Forward Declarations ***********/
|
||||
namespace CKG
|
||||
{
|
||||
namespace Lib
|
||||
{
|
||||
namespace EventManager
|
||||
{
|
||||
/*!
|
||||
\brief
|
||||
*/
|
||||
class DateTime
|
||||
{
|
||||
public:
|
||||
/** Construction/Destruction **/
|
||||
inline DateTime();
|
||||
inline DateTime(const time_t &time);
|
||||
inline DateTime(const struct tm *tmStruct);
|
||||
inline ~DateTime();
|
||||
|
||||
/** Accessors **/
|
||||
inline const time_t &GetTime() const;
|
||||
|
||||
/** Overloads **/
|
||||
inline const DateTime operator+(const DateTime &rhs) const;
|
||||
inline const DateTime operator-(const DateTime &rhs) const;
|
||||
|
||||
#if CKG_LIB_ALLOW_NON_CONST_OPERATORS
|
||||
inline DateTime &operator+(const DateTime &rhs);
|
||||
inline DateTime &operator-(const DateTime &rhs);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
time_t mTime;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Implementations ****************/
|
||||
namespace CKG
|
||||
{
|
||||
namespace Lib
|
||||
{
|
||||
namespace EventManager
|
||||
{
|
||||
/*!
|
||||
\brief Default Constructor
|
||||
*/
|
||||
DateTime::DateTime()
|
||||
: mTime(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Constructs a DateTime using a time_t
|
||||
|
||||
\param time - Time to set
|
||||
\return - none.
|
||||
*/
|
||||
DateTime::DateTime(const time_t &time)
|
||||
: mTime(time)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Constructs a DateTime using a struct tm
|
||||
|
||||
\param tmStruct - Time to set
|
||||
\return - none.
|
||||
*/
|
||||
DateTime::DateTime(const struct tm *tmStruct)
|
||||
: mTime(0)
|
||||
{
|
||||
if (tmStruct)
|
||||
{
|
||||
mTime = mktime(const_cast<struct tm*>(tmStruct));
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Destroys the DateTime
|
||||
*/
|
||||
DateTime::~DateTime()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Get the time
|
||||
|
||||
\return - Time in time_t
|
||||
*/
|
||||
const time_t &DateTime::GetTime() const
|
||||
{
|
||||
return mTime;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Adds
|
||||
*/
|
||||
const DateTime DateTime::operator+(const DateTime &rhs) const
|
||||
{
|
||||
return DateTime(mTime + rhs.mTime);
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Subtract DateTime's to get relative time difference
|
||||
|
||||
\param rhs - right hand side Time
|
||||
\return - Time delta
|
||||
*/
|
||||
const DateTime DateTime::operator-(const DateTime &rhs) const
|
||||
{
|
||||
return DateTime(mTime - rhs.mTime);
|
||||
}
|
||||
|
||||
#if CKG_LIB_ALLOW_NON_CONST_OPERATORS
|
||||
/*!
|
||||
\brief Add times together
|
||||
*/
|
||||
DateTime &DateTime::operator+(const DateTime &rhs)
|
||||
{
|
||||
mTime += rhs.mTime;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief
|
||||
*/
|
||||
DateTime &DateTime::operator-(const DateTime &rhs)
|
||||
{
|
||||
mTime = mTime - rhs.mTime;
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Undefines **********************/
|
||||
#undef CKG_LIB_ALLOW_NON_CONST_OPERATORS
|
||||
|
||||
#endif
|
||||
61
lib/EventManager/trunk/include/EventManager/Event.h
Normal file
61
lib/EventManager/trunk/include/EventManager/Event.h
Normal file
@@ -0,0 +1,61 @@
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifndef EVENT_H_
|
||||
#define EVENT_H_
|
||||
|
||||
/** Includes ***********************/
|
||||
#include "string"
|
||||
#include "vector"
|
||||
#include "EventManager/Types.h"
|
||||
#include "EventManager/DateTime.h"
|
||||
|
||||
/** Macros *************************/
|
||||
|
||||
/** Forward Declarations ***********/
|
||||
namespace CKG
|
||||
{
|
||||
namespace Lib
|
||||
{
|
||||
namespace EventManager
|
||||
{
|
||||
/*!
|
||||
\brief Event
|
||||
*/
|
||||
class Event
|
||||
{
|
||||
public:
|
||||
Event(const Char *eventInfo, const int numTriggers, const DateTime *triggers);
|
||||
virtual ~Event();
|
||||
|
||||
void SetEventInformation(const Char *eventInfo);
|
||||
bool ShouldTrigger(const DateTime ¤tDateTime) const;
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
typedef stlport::vector<DateTime> TriggerList;
|
||||
TriggerList mTriggers;
|
||||
stlport::string mEventInformation;
|
||||
DateTime mEventTime;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Implementations ****************/
|
||||
namespace CKG
|
||||
{
|
||||
namespace Lib
|
||||
{
|
||||
namespace EventManager
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Undefines **********************/
|
||||
|
||||
#endif
|
||||
35
lib/EventManager/trunk/include/EventManager/EventLoader.h
Normal file
35
lib/EventManager/trunk/include/EventManager/EventLoader.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifndef CKG_LIB_EVENTMANAGER_EVENTLOADER_H_
|
||||
#define CKG_LIB_EVENTMANAGER_EVENTLOADER_H_
|
||||
|
||||
/** Includes ***********************/
|
||||
#include "EventManager/Event.h"
|
||||
|
||||
/** Macros *************************/
|
||||
|
||||
/** Forward Declarations ***********/
|
||||
namespace CKG
|
||||
{
|
||||
namespace Lib
|
||||
{
|
||||
namespace EventManager
|
||||
{
|
||||
class EventLoader
|
||||
{
|
||||
public:
|
||||
virtual ~EventLoader() {};
|
||||
|
||||
virtual bool IsFileValid(const FileName fileName) = 0;
|
||||
virtual void LoadEvents(const FileName fileName, int *outNumEvents, Event **outEvents) = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
/** Implementations ****************/
|
||||
|
||||
/** Undefines **********************/
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,42 @@
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifndef CKG_LIB_EVENTMANAGER_EVENTLOADERS_EVENTLOADERSIMPLE_H_
|
||||
#define CKG_LIB_EVENTMANAGER_EVENTLOADERS_EVENTLOADERSIMPLE_H_
|
||||
|
||||
/** Includes ***********************/
|
||||
#include "EventManager/EventLoader.h"
|
||||
|
||||
/** Macros *************************/
|
||||
|
||||
/** Forward Declarations ***********/
|
||||
namespace CKG
|
||||
{
|
||||
namespace Lib
|
||||
{
|
||||
namespace EventManager
|
||||
{
|
||||
namespace EventLoaders
|
||||
{
|
||||
class EventLoaderSimple
|
||||
: public ::CKG::Lib::EventManager::EventLoader
|
||||
{
|
||||
public:
|
||||
EventLoaderSimple();
|
||||
virtual ~EventLoaderSimple();
|
||||
|
||||
virtual bool IsFileValid(const FileName fileName);
|
||||
virtual void LoadEvents(const FileName fileName, int *outNumEvents, Event **outEvents);
|
||||
private:
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Implementations ****************/
|
||||
|
||||
/** Undefines **********************/
|
||||
|
||||
#endif
|
||||
41
lib/EventManager/trunk/include/EventManager/EventManager.h
Normal file
41
lib/EventManager/trunk/include/EventManager/EventManager.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifndef CKG_LIB_EVENTMANAGER_EVENTMANAGER_H_
|
||||
#define CKG_LIB_EVENTMANAGER_EVENTMANAGER_H_
|
||||
|
||||
/** Includes ***********************/
|
||||
|
||||
/** Macros *************************/
|
||||
|
||||
/** Forward Declarations ***********/
|
||||
namespace CKG
|
||||
{
|
||||
namespace Lib
|
||||
{
|
||||
namespace EventManager
|
||||
{
|
||||
/*!
|
||||
\brief The Event Manager handles storage of the different events based on differen times
|
||||
*/
|
||||
class EventManager
|
||||
{
|
||||
public:
|
||||
EventManager();
|
||||
~EventManager();
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Implementations ****************/
|
||||
|
||||
/** Undefines **********************/
|
||||
|
||||
#endif
|
||||
44
lib/EventManager/trunk/include/EventManager/Types.h
Normal file
44
lib/EventManager/trunk/include/EventManager/Types.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifndef CKG_LIB_EVENTMANAGER_TYPES_H_
|
||||
#define CKG_LIB_EVENTMANAGER_TYPES_H_
|
||||
|
||||
/** Includes ***********************/
|
||||
|
||||
/** Macros *************************/
|
||||
|
||||
/** Forward Declarations ***********/
|
||||
namespace CKG
|
||||
{
|
||||
namespace Lib
|
||||
{
|
||||
namespace EventManager
|
||||
{
|
||||
#if defined _MSC_VER
|
||||
// Int's
|
||||
typedef __int8 Int8;
|
||||
typedef __int16 Int16;
|
||||
typedef __int32 Int32;
|
||||
typedef __int64 Int64;
|
||||
|
||||
// UInt's
|
||||
typedef unsigned __int8 UInt8;
|
||||
typedef unsigned __int16 UInt16;
|
||||
typedef unsigned __int32 UInt32;
|
||||
typedef unsigned __int64 UInt64;
|
||||
|
||||
// Characters
|
||||
typedef char Char;
|
||||
|
||||
// File I/O
|
||||
typedef char* FileName;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Implementations ****************/
|
||||
|
||||
#endif
|
||||
32
lib/EventManager/trunk/project/EventManager.sln
Normal file
32
lib/EventManager/trunk/project/EventManager.sln
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EventManager", "EventManager\EventManager.vcxproj", "{56CCE188-0C6F-435B-8016-76D5DC6F0D8F}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "STLport", "..\..\..\..\extern\STLport\5.2.1\project\STLport\STLport.vcxproj", "{CB729638-6C1E-4AE7-8521-618E98A66A6F}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EventManagerTest", "EventManagerTest\EventManagerTest.vcxproj", "{8CBA5C2C-4930-4104-B6EF-D55B35492039}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{56CCE188-0C6F-435B-8016-76D5DC6F0D8F}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{56CCE188-0C6F-435B-8016-76D5DC6F0D8F}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{56CCE188-0C6F-435B-8016-76D5DC6F0D8F}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{56CCE188-0C6F-435B-8016-76D5DC6F0D8F}.Release|Win32.Build.0 = Release|Win32
|
||||
{CB729638-6C1E-4AE7-8521-618E98A66A6F}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{CB729638-6C1E-4AE7-8521-618E98A66A6F}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{CB729638-6C1E-4AE7-8521-618E98A66A6F}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{CB729638-6C1E-4AE7-8521-618E98A66A6F}.Release|Win32.Build.0 = Release|Win32
|
||||
{8CBA5C2C-4930-4104-B6EF-D55B35492039}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{8CBA5C2C-4930-4104-B6EF-D55B35492039}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{8CBA5C2C-4930-4104-B6EF-D55B35492039}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{8CBA5C2C-4930-4104-B6EF-D55B35492039}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
103
lib/EventManager/trunk/project/EventManager/EventManager.vcxproj
Normal file
103
lib/EventManager/trunk/project/EventManager/EventManager.vcxproj
Normal file
@@ -0,0 +1,103 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{56CCE188-0C6F-435B-8016-76D5DC6F0D8F}</ProjectGuid>
|
||||
<RootNamespace>EventManager</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<EnablePREfast>true</EnablePREfast>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\..\..\..\..\extern\STLport\5.2.1\stlport;$(ProjectDir)..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
<MultiProcessorCompilation>false</MultiProcessorCompilation>
|
||||
<PreprocessorDefinitions>_STLP_NO_IOSTREAMS;_STLP_DONT_USE_AUTO_LINK;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<Lib>
|
||||
<AdditionalDependencies>
|
||||
</AdditionalDependencies>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>EnableAllWarnings</WarningLevel>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<EnablePREfast>true</EnablePREfast>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\..\..\..\..\extern\STLport\5.2.1\stlport;$(ProjectDir)..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
<Lib>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\include\EventManager\DateTime.h" />
|
||||
<ClInclude Include="..\..\include\EventManager\Event.h" />
|
||||
<ClInclude Include="..\..\include\EventManager\EventLoader.h" />
|
||||
<ClInclude Include="..\..\include\EventManager\EventLoaders\EventLoaderSimple.h" />
|
||||
<ClInclude Include="..\..\include\EventManager\EventManager.h" />
|
||||
<ClInclude Include="..\..\include\EventManager\Types.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\source\DateTime.cpp" />
|
||||
<ClCompile Include="..\..\source\Event.cpp" />
|
||||
<ClCompile Include="..\..\source\EventLoaders\EventLoaderSimple.cpp" />
|
||||
<ClCompile Include="..\..\source\EventManager.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\EventLoaders">
|
||||
<UniqueIdentifier>{493e107a-238f-4f94-9b22-12d0095908dd}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\EventLoaders">
|
||||
<UniqueIdentifier>{28b4bdf3-a907-4aec-a229-f27efb0126c4}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\include\EventManager\EventManager.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\EventManager\Event.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\EventManager\Types.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\EventManager\DateTime.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\EventManager\EventLoader.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\EventManager\EventLoaders\EventLoaderSimple.h">
|
||||
<Filter>Header Files\EventLoaders</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\source\EventManager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\Event.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\DateTime.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\source\EventLoaders\EventLoaderSimple.cpp">
|
||||
<Filter>Source Files\EventLoaders</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{8CBA5C2C-4930-4104-B6EF-D55B35492039}</ProjectGuid>
|
||||
<RootNamespace>EventManagerTest</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>EnableAllWarnings</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\..\..\..\..\extern\STLport\5.2.1\stlport;$(ProjectDir)../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<EnablePREfast>true</EnablePREfast>
|
||||
<PreprocessorDefinitions>_STLP_NO_IOSTREAMS;_STLP_DONT_USE_AUTO_LINK;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>false</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>EnableAllWarnings</WarningLevel>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\..\..\..\..\extern\STLport\5.2.1\stlport;$(ProjectDir)../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<EnablePREfast>true</EnablePREfast>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<PreprocessorDefinitions>_STLP_NO_IOSTREAMS;_STLP_DONT_USE_AUTO_LINK;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\test\Test.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\test\Test.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
20
lib/EventManager/trunk/source/DateTime.cpp
Normal file
20
lib/EventManager/trunk/source/DateTime.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
/** Includes ***********************/
|
||||
#include "EventManager/DateTime.h"
|
||||
|
||||
/** Macros *************************/
|
||||
|
||||
/** Variables **********************/
|
||||
|
||||
/** Forward Declarations ***********/
|
||||
|
||||
/** Implementations ****************/
|
||||
namespace CKG
|
||||
{
|
||||
namespace Lib
|
||||
{
|
||||
namespace EventManager
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/** Includes ***********************/
|
||||
#include <stdio.h>
|
||||
#include "vector"
|
||||
|
||||
#include "EventManager/EventLoaders/EventLoaderSimple.h"
|
||||
|
||||
/** Macros *************************/
|
||||
|
||||
/** Variables **********************/
|
||||
|
||||
/** Forward Declarations ***********/
|
||||
|
||||
/** Implementations ****************/
|
||||
namespace CKG
|
||||
{
|
||||
namespace Lib
|
||||
{
|
||||
namespace EventManager
|
||||
{
|
||||
namespace EventLoaders
|
||||
{
|
||||
EventLoaderSimple::EventLoaderSimple()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
EventLoaderSimple::~EventLoaderSimple()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
*/
|
||||
bool EventLoaderSimple::IsFileValid(const FileName fileName)
|
||||
{
|
||||
FILE *fp = fopen(fileName, "r");
|
||||
|
||||
if (fp != NULL)
|
||||
{
|
||||
fclose(fp);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Loads an event in the simple format described below
|
||||
|
||||
\param fileName - file to load
|
||||
\param outNumEvents - [out] Number of events loaded
|
||||
\param outEvents - [out] Array of loaded events
|
||||
\return - void.
|
||||
|
||||
File Format:
|
||||
E:<value>:<description>
|
||||
T:<trigger, in seconds>:<TriggerDescription>
|
||||
<1 .. N triggers>
|
||||
<1 .. N Events>
|
||||
*/
|
||||
void EventLoaderSimple::LoadEvents(const FileName fileName, int *outNumEvents, Event **outEvents)
|
||||
{
|
||||
// Protect the function call
|
||||
if (!outNumEvents || !outEvents)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Open the file
|
||||
FILE *fp = fopen(fileName, "r");
|
||||
|
||||
if (fp != NULL)
|
||||
{
|
||||
fclose(fp);
|
||||
}
|
||||
else
|
||||
{
|
||||
outNumEvents = NULL;
|
||||
outEvents = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
34
lib/EventManager/trunk/source/EventManager.cpp
Normal file
34
lib/EventManager/trunk/source/EventManager.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
/** Includes ***********************/
|
||||
#include "EventManager/EventManager.h"
|
||||
|
||||
/** Macros *************************/
|
||||
|
||||
/** Variables **********************/
|
||||
|
||||
/** Forward Declarations ***********/
|
||||
|
||||
/** Implementations ****************/
|
||||
namespace CKG
|
||||
{
|
||||
namespace Lib
|
||||
{
|
||||
namespace EventManager
|
||||
{
|
||||
/*!
|
||||
\brief Default EventManager constructor
|
||||
*/
|
||||
EventManager::EventManager()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Destructs the Event Manager
|
||||
*/
|
||||
EventManager::~EventManager()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
25
lib/EventManager/trunk/test/Test.cpp
Normal file
25
lib/EventManager/trunk/test/Test.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
/** Includes ***********************/
|
||||
#include "EventManager/DateTime.h"
|
||||
#include "EventManager/EventLoaders/EventLoaderSimple.h"
|
||||
#include <stdio.h>
|
||||
|
||||
/** Macros *************************/
|
||||
|
||||
/** Variables **********************/
|
||||
|
||||
/** Forward Declarations ***********/
|
||||
|
||||
/** Implementations ****************/
|
||||
int main(int, char)
|
||||
{
|
||||
using namespace CKG::Lib;
|
||||
|
||||
EventManager::DateTime date(time(NULL));
|
||||
|
||||
EventManager::DateTime date2(time(NULL));
|
||||
|
||||
printf("Got Date: %u\n", (unsigned int)date.GetTime());
|
||||
printf("Subtraction: %u\n", (unsigned int)((date - date2).GetTime()));
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user