This commit is contained in:
Michael Fabain Dirks
2016-05-08 22:47:15 +02:00
parent 2b82733b4b
commit e77dfd17eb
42 changed files with 5660 additions and 5560 deletions
+53 -53
View File
@@ -1,53 +1,53 @@
// BlitzUtility - Expanding the normal Blitz functionality.
// Copyright (C) 2015 Xaymar (Michael Fabian Dirks)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "HighResolutionClock.h"
using namespace std;
using namespace std::chrono;
DLL_FUNCTION(high_resolution_clock::time_point*) BU_HighResolutionClock_Now() {
#pragma comment(linker, "/EXPORT:BU_HighResolutionClock_Now=_BU_HighResolutionClock_Now@0")
return new high_resolution_clock::time_point(high_resolution_clock::now());
}
DLL_FUNCTION(void) BU_HighResolutionClock_Destroy(high_resolution_clock::time_point* pThis) {
#pragma comment(linker, "/EXPORT:BU_HighResolutionClock_Destroy=_BU_HighResolutionClock_Destroy@4")
delete pThis;
}
DLL_FUNCTION(int32_t) BU_HighResolutionClock_Duration(high_resolution_clock::time_point* pThis, high_resolution_clock::time_point* pOther) {
#pragma comment(linker, "/EXPORT:BU_HighResolutionClock_Duration=_BU_HighResolutionClock_Duration@8")
duration<int32_t, std::nano> temp = chrono::duration_cast<duration<int32_t, std::nano>>(*pThis - *pOther);
return temp.count();
}
DLL_FUNCTION(int64_t*) BU_HighResolutionClock_DurationLL(high_resolution_clock::time_point* pThis, high_resolution_clock::time_point* pOther) {
#pragma comment(linker, "/EXPORT:BU_HighResolutionClock_DurationLL=_BU_HighResolutionClock_DurationLL@8")
duration<int64_t, std::nano> temp = (*pThis - *pOther);
return new int64_t(temp.count());
}
DLL_FUNCTION(float_t) BU_HighResolutionClock_DurationF(high_resolution_clock::time_point* pThis, high_resolution_clock::time_point* pOther) {
#pragma comment(linker, "/EXPORT:BU_HighResolutionClock_DurationF=_BU_HighResolutionClock_DurationF@8")
double_t duration = (chrono::duration_cast<chrono::duration<double_t>>(*pThis - *pOther)).count();
return (float_t)(duration);
}
DLL_FUNCTION(double_t*) BU_HighResolutionClock_DurationD(high_resolution_clock::time_point* pThis, high_resolution_clock::time_point* pOther) {
#pragma comment(linker, "/EXPORT:BU_HighResolutionClock_DurationD=_BU_HighResolutionClock_DurationD@8")
double_t duration = (chrono::duration_cast<chrono::duration<double_t>>(*pThis - *pOther)).count();
return new double_t(duration);
}
// BlitzUtility - Expanding the normal Blitz functionality.
// Copyright (C) 2015 Xaymar (Michael Fabian Dirks)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "HighResolutionClock.h"
using namespace std;
using namespace std::chrono;
DLL_FUNCTION(high_resolution_clock::time_point*) BU_HighResolutionClock_Now() {
#pragma comment(linker, "/EXPORT:BU_HighResolutionClock_Now=_BU_HighResolutionClock_Now@0")
return new high_resolution_clock::time_point(high_resolution_clock::now());
}
DLL_FUNCTION(void) BU_HighResolutionClock_Destroy(high_resolution_clock::time_point* pThis) {
#pragma comment(linker, "/EXPORT:BU_HighResolutionClock_Destroy=_BU_HighResolutionClock_Destroy@4")
delete pThis;
}
DLL_FUNCTION(int32_t) BU_HighResolutionClock_Duration(high_resolution_clock::time_point* pThis, high_resolution_clock::time_point* pOther) {
#pragma comment(linker, "/EXPORT:BU_HighResolutionClock_Duration=_BU_HighResolutionClock_Duration@8")
duration<int32_t, std::nano> temp = chrono::duration_cast<duration<int32_t, std::nano>>(*pThis - *pOther);
return temp.count();
}
DLL_FUNCTION(int64_t*) BU_HighResolutionClock_DurationLL(high_resolution_clock::time_point* pThis, high_resolution_clock::time_point* pOther) {
#pragma comment(linker, "/EXPORT:BU_HighResolutionClock_DurationLL=_BU_HighResolutionClock_DurationLL@8")
duration<int64_t, std::nano> temp = (*pThis - *pOther);
return new int64_t(temp.count());
}
DLL_FUNCTION(float_t) BU_HighResolutionClock_DurationF(high_resolution_clock::time_point* pThis, high_resolution_clock::time_point* pOther) {
#pragma comment(linker, "/EXPORT:BU_HighResolutionClock_DurationF=_BU_HighResolutionClock_DurationF@8")
double_t duration = (chrono::duration_cast<chrono::duration<double_t>>(*pThis - *pOther)).count();
return (float_t)(duration);
}
DLL_FUNCTION(double_t*) BU_HighResolutionClock_DurationD(high_resolution_clock::time_point* pThis, high_resolution_clock::time_point* pOther) {
#pragma comment(linker, "/EXPORT:BU_HighResolutionClock_DurationD=_BU_HighResolutionClock_DurationD@8")
double_t duration = (chrono::duration_cast<chrono::duration<double_t>>(*pThis - *pOther)).count();
return new double_t(duration);
}
+25 -25
View File
@@ -1,26 +1,26 @@
// BlitzUtility - Expanding the normal Blitz functionality.
// Copyright (C) 2015 Xaymar (Michael Fabian Dirks)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
#include "BlitzUtility.h"
#include <chrono>
DLL_FUNCTION(std::chrono::high_resolution_clock::time_point*) BU_HighResolutionClock_Now();
DLL_FUNCTION(void) BU_HighResolutionClock_Destroy(std::chrono::high_resolution_clock::time_point* pThis);
DLL_FUNCTION(int32_t) BU_HighResolutionClock_Duration(std::chrono::high_resolution_clock::time_point* pThis, std::chrono::high_resolution_clock::time_point* pOther);
DLL_FUNCTION(int64_t*) BU_HighResolutionClock_DurationLL(std::chrono::high_resolution_clock::time_point* pThis, std::chrono::high_resolution_clock::time_point* pOther);
DLL_FUNCTION(float_t) BU_HighResolutionClock_DurationF(std::chrono::high_resolution_clock::time_point* pThis, std::chrono::high_resolution_clock::time_point* pOther);
// BlitzUtility - Expanding the normal Blitz functionality.
// Copyright (C) 2015 Xaymar (Michael Fabian Dirks)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
#include "BlitzUtility.h"
#include <chrono>
DLL_FUNCTION(std::chrono::high_resolution_clock::time_point*) BU_HighResolutionClock_Now();
DLL_FUNCTION(void) BU_HighResolutionClock_Destroy(std::chrono::high_resolution_clock::time_point* pThis);
DLL_FUNCTION(int32_t) BU_HighResolutionClock_Duration(std::chrono::high_resolution_clock::time_point* pThis, std::chrono::high_resolution_clock::time_point* pOther);
DLL_FUNCTION(int64_t*) BU_HighResolutionClock_DurationLL(std::chrono::high_resolution_clock::time_point* pThis, std::chrono::high_resolution_clock::time_point* pOther);
DLL_FUNCTION(float_t) BU_HighResolutionClock_DurationF(std::chrono::high_resolution_clock::time_point* pThis, std::chrono::high_resolution_clock::time_point* pOther);
DLL_FUNCTION(double_t*) BU_HighResolutionClock_DurationD(std::chrono::high_resolution_clock::time_point* pThis, std::chrono::high_resolution_clock::time_point* pOther);
+36 -36
View File
@@ -1,37 +1,37 @@
// BlitzUtility - Expanding the normal Blitz functionality.
// Copyright (C) 2015 Xaymar (Michael Fabian Dirks)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "SystemClock.h"
DLL_FUNCTION(std::chrono::system_clock::time_point*) BU_SystemClock_Now() {
#pragma comment(linker, "/EXPORT:BU_SystemClock_Now=_BU_SystemClock_Now@0")
return new std::chrono::system_clock::time_point(std::chrono::system_clock::now());
}
DLL_FUNCTION(void) BU_SystemClock_Destroy(std::chrono::system_clock::time_point* pThis) {
#pragma comment(linker, "/EXPORT:BU_SystemClock_Destroy=_BU_SystemClock_Destroy@4")
delete pThis;
}
DLL_FUNCTION(std::chrono::system_clock::time_point*) BU_SystemClock_FromTime(time_t* pTime) {
#pragma comment(linker, "/EXPORT:BU_SystemClock_FromTime=_BU_SystemClock_FromTime@4")
return new std::chrono::system_clock::time_point(std::chrono::system_clock::from_time_t(*pTime));
}
DLL_FUNCTION(time_t*) BU_SystemClock_AsTime(std::chrono::system_clock::time_point* pThis) {
#pragma comment(linker, "/EXPORT:BU_SystemClock_AsTime=_BU_SystemClock_AsTime@4")
return new time_t(std::chrono::system_clock::to_time_t(*pThis));
// BlitzUtility - Expanding the normal Blitz functionality.
// Copyright (C) 2015 Xaymar (Michael Fabian Dirks)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "SystemClock.h"
DLL_FUNCTION(std::chrono::system_clock::time_point*) BU_SystemClock_Now() {
#pragma comment(linker, "/EXPORT:BU_SystemClock_Now=_BU_SystemClock_Now@0")
return new std::chrono::system_clock::time_point(std::chrono::system_clock::now());
}
DLL_FUNCTION(void) BU_SystemClock_Destroy(std::chrono::system_clock::time_point* pThis) {
#pragma comment(linker, "/EXPORT:BU_SystemClock_Destroy=_BU_SystemClock_Destroy@4")
delete pThis;
}
DLL_FUNCTION(std::chrono::system_clock::time_point*) BU_SystemClock_FromTime(time_t* pTime) {
#pragma comment(linker, "/EXPORT:BU_SystemClock_FromTime=_BU_SystemClock_FromTime@4")
return new std::chrono::system_clock::time_point(std::chrono::system_clock::from_time_t(*pTime));
}
DLL_FUNCTION(time_t*) BU_SystemClock_AsTime(std::chrono::system_clock::time_point* pThis) {
#pragma comment(linker, "/EXPORT:BU_SystemClock_AsTime=_BU_SystemClock_AsTime@4")
return new time_t(std::chrono::system_clock::to_time_t(*pThis));
}
+23 -23
View File
@@ -1,24 +1,24 @@
// BlitzUtility - Expanding the normal Blitz functionality.
// Copyright (C) 2015 Xaymar (Michael Fabian Dirks)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
#include "BlitzUtility.h"
#include <chrono>
DLL_FUNCTION(std::chrono::system_clock::time_point*) BU_SystemClock_Now();
DLL_FUNCTION(void) BU_SystemClock_Destroy(std::chrono::system_clock::time_point* pThis);
DLL_FUNCTION(std::chrono::system_clock::time_point*) BU_SystemClock_FromTime(time_t* pTime);
// BlitzUtility - Expanding the normal Blitz functionality.
// Copyright (C) 2015 Xaymar (Michael Fabian Dirks)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
#include "BlitzUtility.h"
#include <chrono>
DLL_FUNCTION(std::chrono::system_clock::time_point*) BU_SystemClock_Now();
DLL_FUNCTION(void) BU_SystemClock_Destroy(std::chrono::system_clock::time_point* pThis);
DLL_FUNCTION(std::chrono::system_clock::time_point*) BU_SystemClock_FromTime(time_t* pTime);
DLL_FUNCTION(time_t*) BU_SystemClock_AsTime(std::chrono::system_clock::time_point* pThis);
+60 -60
View File
@@ -1,61 +1,61 @@
// BlitzUtility - Expanding the normal Blitz functionality.
// Copyright (C) 2015 Xaymar (Michael Fabian Dirks)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Time.h"
DLL_FUNCTION(time_t*) BU_Time_Now() {
#pragma comment(linker, "/EXPORT:BU_Time_Now=_BU_Time_Now@0")
time_t* pTime = new time_t();
time(pTime);
return pTime;
}
DLL_FUNCTION(time_t*) BU_Time_Create(uint32_t seconds, uint32_t minutes, uint32_t hours, uint32_t days, uint32_t months, uint32_t years, uint32_t isDaylightSavings) {
#pragma comment(linker, "/EXPORT:BU_Time_Create=_BU_Time_Create@28")
tm* pTM = new tm();
pTM->tm_sec = seconds;
pTM->tm_min = minutes;
pTM->tm_hour = hours;
pTM->tm_mday = days;
pTM->tm_mon = months;
pTM->tm_year = years;
pTM->tm_isdst = isDaylightSavings;
time_t* pTime = new time_t(mktime(pTM));
delete pTM;
return pTime;
}
DLL_FUNCTION(void) BU_Time_Destroy(time_t* pTime) {
#pragma comment(linker, "/EXPORT:BU_Time_Destroy=_BU_Time_Destroy@4")
delete pTime;
}
DLL_FUNCTION(const char*) BU_Time_Format(time_t* pTime, const char* pchFormatString) {
#pragma comment(linker, "/EXPORT:BU_Time_Format=_BU_Time_Format@8")
std::string buffer;
tm* pTM = new tm;
localtime_s(pTM, pTime);
uint32_t length = strlen(pchFormatString);
buffer.resize(length);
while (strftime(&buffer[0], buffer.size(), pchFormatString, pTM) == 0) {
buffer.resize(buffer.size() * 2);
}
delete pTM;
return buffer.c_str();
// BlitzUtility - Expanding the normal Blitz functionality.
// Copyright (C) 2015 Xaymar (Michael Fabian Dirks)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Time.h"
DLL_FUNCTION(time_t*) BU_Time_Now() {
#pragma comment(linker, "/EXPORT:BU_Time_Now=_BU_Time_Now@0")
time_t* pTime = new time_t();
time(pTime);
return pTime;
}
DLL_FUNCTION(time_t*) BU_Time_Create(uint32_t seconds, uint32_t minutes, uint32_t hours, uint32_t days, uint32_t months, uint32_t years, uint32_t isDaylightSavings) {
#pragma comment(linker, "/EXPORT:BU_Time_Create=_BU_Time_Create@28")
tm* pTM = new tm();
pTM->tm_sec = seconds;
pTM->tm_min = minutes;
pTM->tm_hour = hours;
pTM->tm_mday = days;
pTM->tm_mon = months;
pTM->tm_year = years;
pTM->tm_isdst = isDaylightSavings;
time_t* pTime = new time_t(mktime(pTM));
delete pTM;
return pTime;
}
DLL_FUNCTION(void) BU_Time_Destroy(time_t* pTime) {
#pragma comment(linker, "/EXPORT:BU_Time_Destroy=_BU_Time_Destroy@4")
delete pTime;
}
DLL_FUNCTION(const char*) BU_Time_Format(time_t* pTime, const char* pchFormatString) {
#pragma comment(linker, "/EXPORT:BU_Time_Format=_BU_Time_Format@8")
std::string buffer;
tm* pTM = new tm;
localtime_s(pTM, pTime);
uint32_t length = strlen(pchFormatString);
buffer.resize(length);
while (strftime(&buffer[0], buffer.size(), pchFormatString, pTM) == 0) {
buffer.resize(buffer.size() * 2);
}
delete pTM;
return buffer.c_str();
}
+24 -24
View File
@@ -1,25 +1,25 @@
// BlitzUtility - Expanding the normal Blitz functionality.
// Copyright (C) 2015 Xaymar (Michael Fabian Dirks)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
#include "BlitzUtility.h"
#include <chrono>
#include <time.h>
DLL_FUNCTION(time_t*) BU_Time_Now();
DLL_FUNCTION(time_t*) BU_Time_Create(uint32_t seconds, uint32_t minutes, uint32_t hours, uint32_t days, uint32_t months, uint32_t years, uint32_t isDaylightSavings);
DLL_FUNCTION(void) BU_Time_Destroy(time_t* pTime);
// BlitzUtility - Expanding the normal Blitz functionality.
// Copyright (C) 2015 Xaymar (Michael Fabian Dirks)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
#include "BlitzUtility.h"
#include <chrono>
#include <time.h>
DLL_FUNCTION(time_t*) BU_Time_Now();
DLL_FUNCTION(time_t*) BU_Time_Create(uint32_t seconds, uint32_t minutes, uint32_t hours, uint32_t days, uint32_t months, uint32_t years, uint32_t isDaylightSavings);
DLL_FUNCTION(void) BU_Time_Destroy(time_t* pTime);
DLL_FUNCTION(const char*) BU_Time_Format(time_t* pTime, const char* pchFormatString);