Wrapped OpenALPR library in "alpr" namespace. Resolves issue #60.

This commit is contained in:
Matt Hill
2014-10-27 20:12:57 -04:00
parent 83ed86c6b4
commit 85f52a6b8c
79 changed files with 7234 additions and 6968 deletions

View File

@@ -1,45 +1,50 @@
#include "platform.h"
void sleep_ms(int sleepMs)
namespace alpr
{
#ifdef WINDOWS
Sleep(sleepMs);
#else
usleep(sleepMs * 1000); // usleep takes sleep time in us (1 millionth of a second)
#endif
}
std::string getExeDir()
{
#ifdef WINDOWS
TCHAR szEXEPath[2048];
std::stringstream ss;
GetModuleFileName(NULL, szEXEPath, 2048);
ss << szEXEPath;
void sleep_ms(int sleepMs)
{
#ifdef WINDOWS
Sleep(sleepMs);
#else
usleep(sleepMs * 1000); // usleep takes sleep time in us (1 millionth of a second)
#endif
}
std::string exeFile = ss.str();
std::string directory;
const size_t last_slash_idx = exeFile.rfind('\\');
if (std::string::npos != last_slash_idx)
{
directory = exeFile.substr(0, last_slash_idx);
}
return directory;
#else
char buffer[2048];
readlink("/proc/self/exe", buffer, 2048);
std::stringstream ss;
ss << buffer;
std::string exeFile = ss.str();
std::string directory;
const size_t last_slash_idx = exeFile.rfind('/');
if (std::string::npos != last_slash_idx)
{
directory = exeFile.substr(0, last_slash_idx);
}
return directory;
#endif
std::string getExeDir()
{
#ifdef WINDOWS
TCHAR szEXEPath[2048];
std::stringstream ss;
GetModuleFileName(NULL, szEXEPath, 2048);
ss << szEXEPath;
std::string exeFile = ss.str();
std::string directory;
const size_t last_slash_idx = exeFile.rfind('\\');
if (std::string::npos != last_slash_idx)
{
directory = exeFile.substr(0, last_slash_idx);
}
return directory;
#else
char buffer[2048];
readlink("/proc/self/exe", buffer, 2048);
std::stringstream ss;
ss << buffer;
std::string exeFile = ss.str();
std::string directory;
const size_t last_slash_idx = exeFile.rfind('/');
if (std::string::npos != last_slash_idx)
{
directory = exeFile.substr(0, last_slash_idx);
}
return directory;
#endif
}
}