mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-01 17:10:26 +08:00
Changed WIN32 to _WIN32 to handle some 64bits systems where WIN32 is not defined (_WIN32 should be defined both for 32bits and 64bits systems: http://msdn.microsoft.com/en-us/library/b0084kay.aspx).
git-svn-id: http://rtabmap.googlecode.com/svn/trunk/rtabmap@1830 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
@@ -236,7 +236,7 @@ std::string UTILITE_EXP uFormatv (const char *fmt, va_list ap);
|
||||
*/
|
||||
std::string UTILITE_EXP uFormat (const char *fmt, ...);
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
/**
|
||||
* Convert multi-byte string to unicode (wide-char) string.
|
||||
* Note that returned whar_t * must be deleted : delete [] wText;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include "rtabmap/utilite/Win32/UWin32.h"
|
||||
#else
|
||||
#include <pthread.h>
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
*/
|
||||
UMutex()
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
InitializeCriticalSection(&C);
|
||||
#else
|
||||
pthread_mutexattr_t attr;
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
|
||||
virtual ~UMutex()
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
DeleteCriticalSection(&C);
|
||||
#else
|
||||
pthread_mutex_unlock(&M); pthread_mutex_destroy(&M);
|
||||
@@ -86,14 +86,14 @@ public:
|
||||
*/
|
||||
int lock() const
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
EnterCriticalSection(&C); return 0;
|
||||
#else
|
||||
return pthread_mutex_lock(&M);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#if(_WIN32_WINNT >= 0x0400)
|
||||
int lockTry() const
|
||||
{
|
||||
@@ -112,7 +112,7 @@ public:
|
||||
*/
|
||||
int unlock() const
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
LeaveCriticalSection(&C); return 0;
|
||||
#else
|
||||
return pthread_mutex_unlock(&M);
|
||||
@@ -120,7 +120,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
mutable CRITICAL_SECTION C;
|
||||
#else
|
||||
mutable pthread_mutex_t M;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include "rtabmap/utilite/Win32/UWin32.h"
|
||||
#define SEM_VALUE_MAX ((int) ((~0u) >> 1))
|
||||
#else
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
*/
|
||||
USemaphore( int initValue = 0 )
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
S = CreateSemaphore(0,initValue,SEM_VALUE_MAX,0);
|
||||
#else
|
||||
_available = initValue;
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
|
||||
virtual ~USemaphore()
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
CloseHandle(S);
|
||||
#else
|
||||
pthread_cond_destroy(&_cond);
|
||||
@@ -84,7 +84,7 @@ public:
|
||||
* @see release()
|
||||
* @param n number to acquire
|
||||
*/
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
void acquire(int n = 1) const
|
||||
{
|
||||
while(n-- > 0)
|
||||
@@ -112,7 +112,7 @@ public:
|
||||
* Try to acquire the semaphore, not a blocking call.
|
||||
* @return false if the semaphore can't be taken without waiting (value <= 0), true otherwise
|
||||
*/
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
int acquireTry() const
|
||||
{
|
||||
return ((WaitForSingleObject((HANDLE)S,INFINITE)==WAIT_OBJECT_0)?0:EAGAIN);
|
||||
@@ -135,7 +135,7 @@ public:
|
||||
* Release the semaphore, increasing its value by 1 and
|
||||
* signaling waiting threads (which called acquire()).
|
||||
*/
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
int release(int n = 1) const
|
||||
{
|
||||
return (ReleaseSemaphore((HANDLE)S,n,0)?0:ERANGE);
|
||||
@@ -153,7 +153,7 @@ public:
|
||||
* Get the USempahore's value.
|
||||
* @return the semaphore's value
|
||||
*/
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
int value() const
|
||||
{
|
||||
LONG V = -1; ReleaseSemaphore((HANDLE)S,0,&V); return V;
|
||||
@@ -168,7 +168,7 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
/*
|
||||
* Reset the semaphore count.
|
||||
* @param init the initial value
|
||||
@@ -182,7 +182,7 @@ public:
|
||||
#endif
|
||||
|
||||
private:
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
HANDLE S;
|
||||
#else
|
||||
pthread_mutex_t _waitMutex;
|
||||
|
||||
@@ -255,7 +255,7 @@ private:
|
||||
State state_; /* The thread state. */
|
||||
Priority priority_; /* The thread priority. */
|
||||
Handle handle_; /* The thread handle. */
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
int threadId_; /* The thread id. */
|
||||
#else
|
||||
unsigned long threadId_; /* The thread id. */
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
* base form is not supported.
|
||||
* @see StateThread
|
||||
*/
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include "rtabmap/utilite/Win32/UThreadC.h"
|
||||
#else
|
||||
#include "rtabmap/utilite/Posix/UThreadC.h"
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include "rtabmap/utilite/UtiLiteExp.h" // DLL export/import defines
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
@@ -95,7 +95,7 @@ public:
|
||||
double ticks();
|
||||
|
||||
private:
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
LARGE_INTEGER startTimeRecorded_; /* When we start the timer, timeRecorded is copied over lastTimeRecorded.*/
|
||||
LARGE_INTEGER stopTimeRecorded_; /* When we stop the timer. */
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
@@ -262,7 +262,7 @@ std::string uFormatv (const char *fmt, va_list args)
|
||||
va_list argsTmp;
|
||||
|
||||
while (1) {
|
||||
#if defined(WIN32) && !defined(__MINGW32__)
|
||||
#if defined(_WIN32) && !defined(__MINGW32__)
|
||||
argsTmp = args;
|
||||
#else
|
||||
va_copy(argsTmp, args);
|
||||
@@ -299,7 +299,7 @@ std::string uFormat (const char *fmt, ...)
|
||||
return buf;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
// returned whar_t * must be deleted : delete [] wText;
|
||||
wchar_t * createWCharFromChar(const char * text)
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "rtabmap/utilite/UDirectory.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#include <direct.h>
|
||||
#include <algorithm>
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
#include "rtabmap/utilite/ULogger.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
|
||||
bool sortCallback(const std::string & a, const std::string & b)
|
||||
{
|
||||
@@ -118,7 +118,7 @@ void UDirectory::update()
|
||||
endOfDir = true;
|
||||
}
|
||||
fileNames_.clear();
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
WIN32_FIND_DATA fileInformation;
|
||||
#ifdef UNICODE
|
||||
wchar_t * pathAll = createWCharFromChar((path_+"\\*").c_str());
|
||||
@@ -300,7 +300,7 @@ std::string UDirectory::currentDir(bool trailingSeparator)
|
||||
std::string dir;
|
||||
char * buffer;
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
buffer = _getcwd(NULL, 0);
|
||||
#else
|
||||
buffer = getcwd(NULL, MAXPATHLEN);
|
||||
@@ -364,7 +364,7 @@ std::string UDirectory::homeDir()
|
||||
|
||||
std::string UDirectory::separator()
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
return "\\";
|
||||
#else
|
||||
return "/";
|
||||
|
||||
@@ -26,11 +26,11 @@
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#define COLOR_NORMAL FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED
|
||||
#define COLOR_RED FOREGROUND_RED | FOREGROUND_INTENSITY
|
||||
@@ -331,7 +331,7 @@ void ULogger::write(ULogger::Level level,
|
||||
|
||||
if(level >= level_)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
int color = 0;
|
||||
#else
|
||||
const char* color = NULL;
|
||||
@@ -427,12 +427,12 @@ void ULogger::write(ULogger::Level level,
|
||||
if(type_ != kTypeNoLog)
|
||||
{
|
||||
va_start(args, msg);
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
HANDLE H = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
#endif
|
||||
if(type_ == ULogger::kTypeConsole && printColored_)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
SetConsoleTextAttribute(H,color);
|
||||
#else
|
||||
if(buffered_)
|
||||
@@ -462,7 +462,7 @@ void ULogger::write(ULogger::Level level,
|
||||
}
|
||||
if(type_ == ULogger::kTypeConsole && printColored_)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
SetConsoleTextAttribute(H,COLOR_NORMAL);
|
||||
#else
|
||||
if(buffered_)
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "rtabmap/utilite/UProcessInfo.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include "Windows.h"
|
||||
#include "Psapi.h"
|
||||
#elif __APPLE__
|
||||
@@ -39,7 +39,7 @@ long int UProcessInfo::getMemoryUsage()
|
||||
{
|
||||
long int memoryUsage = -1;
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
HANDLE hProc = GetCurrentProcess();
|
||||
PROCESS_MEMORY_COUNTERS info;
|
||||
BOOL okay = GetProcessMemoryInfo(hProc, &info, sizeof(info));
|
||||
|
||||
@@ -163,7 +163,7 @@ void UThread::applyPriority()
|
||||
{
|
||||
if(handle_)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
int p = THREAD_PRIORITY_NORMAL;
|
||||
switch(priority_)
|
||||
{
|
||||
@@ -209,7 +209,7 @@ void UThread::applyAffinity()
|
||||
{
|
||||
if(cpuAffinity_>0)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#elif __APPLE__
|
||||
thread_affinity_policy_data_t affPolicy;
|
||||
affPolicy.affinity_tag = cpuAffinity_;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
///////////////////////
|
||||
UTimer::UTimer()
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
QueryPerformanceFrequency(&frequency_);
|
||||
#endif
|
||||
start(); // This will initialize the private counters
|
||||
@@ -33,7 +33,7 @@ UTimer::UTimer()
|
||||
|
||||
UTimer::~UTimer() {}
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
double UTimer::now()
|
||||
{
|
||||
LARGE_INTEGER count, freq;
|
||||
|
||||
Reference in New Issue
Block a user