untested fix for compiling waves audiobackend on case-sensitive FS with mingw.

This commit is contained in:
Robin Gareus 2014-10-01 04:02:30 +02:00
parent d75d6a833a
commit cd60fd9dfe
16 changed files with 20 additions and 10 deletions

View file

@ -0,0 +1,114 @@
#ifndef __MinMaxUtilities_h__
#define __MinMaxUtilities_h__
/* copy to include
#include "MiscUtils/MinMaxUtilities.h"
*/
#include "BasicTypes/WUDefines.h"
#include "BasicTypes/WUMathConsts.h"
#include "WavesPublicAPI/wstdint.h"
#ifdef __GNUC__
#undef round
#endif
// New accelerated templates
#if defined ( __cplusplus ) && !defined (__WUMinMax)
#define __WUMinMax // Also defined in Nativepr.h
template<class T> inline T WUMin(const T &a, const T &b) {return (a < b) ? a : b;} // requires only < to be defined for T
template<class T> inline T WUMax(const T &a,const T &b) {return (a < b) ? b : a;} // requires only < to be defined for T
template<class T> inline T WUMinMax(const T &Smallest, const T &Biggest, const T &Val) // requires only < to be defined for T
{
return ((Val < Smallest) ? Smallest : ((Biggest < Val) ? Biggest : Val));
}
/*
// Min and Max
template<class T> inline T WUMin(T a,T b) {return (a < b) ? a : b;} // requires only < to be defined for T
template<class T> inline T WUMax(T a,T b) {return (a < b) ? b : a;} // requires only < to be defined for T
template<class T> inline T WUMinMax(T SMALLEST, T BIGGEST, T X) // requires only < to be defined for T
{
return ((X < SMALLEST) ? SMALLEST : ((BIGGEST < X) ? BIGGEST : X));
}
*/
// Absolute value
#ifdef PLATFORM_WINDOWS
#include <math.h>
#ifndef __GNUC__
#define __abs(x) abs(x)
#define __labs(x) labs(x)
#define __fabs(x) fabs(x)
#endif
#endif
#ifdef __GNUC__
#include <iostream> // why don't know makes it work need to check
#include <cstdlib>
#include <cmath>
#define __abs(x) std::abs(x)
#define __labs(x) std::labs(x)
#define __fabs(x) std::fabs(x)
#endif
#ifdef __APPLE__
#ifdef __GNUC__
#include <iostream> // why don't know makes it work need to check
#include <cmath>
#define __abs(x) std::abs(x)
#define __labs(x) std::labs(x)
#define __fabs(x) std::fabs(x)
#endif
#endif
// log2: on Windows there's no proper definition for log2, whereas on other platform there is.
#ifndef WUlog2
#if defined(PLATFORM_WINDOWS)
#define WUlog2(x) (kdOneOverLog2 * log10((x)))
#else
#define WUlog2(x) log2(x)
#endif
#endif
template <class T> inline T WUAbs(const T &xA)
{
return (xA > T(0))? xA: -xA;
}
template <> inline int WUAbs(const int &xA)
{
return __abs(xA);
}
//template <> inline int32_t WUAbs(const int32_t &xA)// 64BitConversion
//{
// return __labs(xA);
//}
template <> inline float WUAbs(const float &xA)
{
return (float) __fabs(xA);
}
template <> inline double WUAbs(const double &xA)
{
return __fabs(xA);
}
#endif
int32_t DllExport WURand(intptr_t in_Seed);
int32_t DllExport WURand();
int32_t DllExport rand_gen_formula(int32_t rndSeed);
template <class T> inline bool WUIsEqualWithTolerance(const T &xA, const T &xB, const T &xTolerance)
{
return (WUAbs(xA - xB) < xTolerance) ? true : false;
}
#endif

View file

@ -0,0 +1,77 @@
#ifdef PLATFORM_WINDOWS
#include "IncludeWindows.h"
#endif
#if defined(__linux__) || defined(__APPLE__)
#include <sys/time.h>
#endif
#include "UMicroseconds.h"
namespace wvNS {
UMicroseconds& UMicroseconds::ReadTime()
{
// Note: g_get_monotonic_time() may be a viable alternative
// (it is on Linux and OSX); if not, this code should really go into libpbd
#ifdef PLATFORM_WINDOWS
LARGE_INTEGER Frequency, Count ;
QueryPerformanceFrequency(&Frequency) ;
QueryPerformanceCounter(&Count);
theTime = uint64_t((Count.QuadPart * 1000000.0 / Frequency.QuadPart));
#elif defined __MACH__ // OSX, BSD..
clock_serv_t cclock;
mach_timespec_t mts;
host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &cclock);
clock_get_time(cclock, &mts);
mach_port_deallocate(mach_task_self(), cclock);
theTime = (uint64_t)mts.tv_sec * 1e6 + (uint64_t)mts.tv_nsec / 1000;
#else // Linux, POSIX
struct timespec *ts
clock_gettime(CLOCK_MONOTONIC, ts);
theTime = (uint64_t)ts.tv_sec * 1e6 + (uint64_t)buf.tv_nsec / 1000;
#endif
return *this;
}
/*
Removed in favor of the posix implementation.
#ifdef __APPLE__
uint32_t UMicroseconds::hi() {return reinterpret_cast<UnsignedWide*>(&theTime)->hi;}
uint32_t UMicroseconds::lo() {return reinterpret_cast<UnsignedWide*>(&theTime)->lo;}
#endif
*/
void UMicrosecondsAccumulator::Start()
{
m_start_time.ReadTime();
}
void UMicrosecondsAccumulator::Stop()
{
UMicroseconds stop_time;
m_accumulator += stop_time.GetNativeTime() - m_start_time.GetNativeTime();
}
void UMicrosecondsAccumulator::Clear()
{
m_start_time = 0;
m_accumulator = 0;
}
UMicroseconds UMicrosecondsAccumulator::GetAccumulatedTime() const
{
return m_accumulator;
}
UMicrosecondsAccumulator& UMicrosecondsAccumulator::operator+=(const UMicrosecondsAccumulator& inaccum_to_add)
{
m_accumulator += inaccum_to_add.GetAccumulatedTime();
return *this;
}
} // namespace wvNS {

View file

@ -0,0 +1,105 @@
#ifndef __UMicroseconds_h__
#define __UMicroseconds_h__
/* Copy to include
#include "UMicroseconds.h"
*/
#include "BasicTypes/WUDefines.h"
#include "BasicTypes/WUTypes.h"
namespace wvNS {
// a wraper for Microseconds function from Timer.h
class DllExport UMicroseconds
{
public:
#ifdef PLATFORM_WINDOWS
typedef int64_t TimeKeeper;
#endif
#ifdef __APPLE__
typedef uint64_t TimeKeeper;
#endif
#ifdef __linux__
typedef uint64_t TimeKeeper;
#endif
private:
TimeKeeper theTime;
public:
UMicroseconds()
{
ReadTime();
}
UMicroseconds(const TimeKeeper in_initVal) : theTime(in_initVal) {}
UMicroseconds(const UMicroseconds& inUM) : theTime(inUM.theTime) {}
UMicroseconds& operator=(const UMicroseconds& inUM) {theTime = inUM.theTime; return *this;}
UMicroseconds& operator+=(const TimeKeeper in_timeToAdd) {theTime += in_timeToAdd; return *this;}
UMicroseconds& ReadTime();
TimeKeeper GetNativeTime() const {return theTime;}
operator uint64_t () {return static_cast<uint64_t>(theTime);}
operator double () const {return static_cast<const double>(theTime);}
double Seconds() const {return static_cast<double>(theTime) / double(1000000);}
double MilliSeconds() const {return static_cast<double>(theTime) / double(1000);}
double MicroSeconds() const {return static_cast<double>(theTime);}
#ifdef __APPLE__
uint32_t hi();
uint32_t lo();
#endif
};
inline UMicroseconds operator-(const UMicroseconds& in_one, const UMicroseconds& in_two)
{
UMicroseconds retVal(in_one.GetNativeTime() - in_two.GetNativeTime());
return retVal;
}
class UMicrosecondsAccumulator
{
public:
UMicrosecondsAccumulator() : m_start_time(0), m_accumulator(0) {}
void Start();
void Stop();
void Clear();
UMicroseconds GetAccumulatedTime() const;
UMicrosecondsAccumulator& operator+=(const UMicrosecondsAccumulator&);
protected:
UMicroseconds m_start_time;
UMicroseconds m_accumulator;
};
inline UMicroseconds operator-(const UMicrosecondsAccumulator& in_one, const UMicrosecondsAccumulator& in_two)
{
UMicroseconds retVal(in_one.GetAccumulatedTime() - in_two.GetAccumulatedTime());
return retVal;
}
//=========================================================================================//
inline void MicrosecondDelay(double amt)
//=========================================================================================//
{
UMicroseconds than;
UMicroseconds now;
do
{
now.ReadTime();
} while ((now.MicroSeconds() - than.MicroSeconds()) < amt);
}
} // namespace wvNS {
#endif //#ifndef __UMicroseconds_h__

View file

@ -0,0 +1,885 @@
#ifndef __WCFixedString_h__
#define __WCFixedString_h__
/* Copy to include.
#include "WCFixedString.h"
*/
// do not #include anything else here but standard C++ library files, this file should be free from any and all depandencies
// do not put any DEBUG_s or TRACE_s in this file, since it is used in BgkConsole functions
#include <algorithm>
#include <cctype>
#include <cstring>
#include <cstdio>
#ifdef __APPLE__
#include <strings.h>
#endif
#include "BasicTypes/WUDefines.h"
#include "BasicTypes/WTByteOrder.h"
#include "WavesPublicAPI/wstdint.h"
#include "MiscUtils/MinMaxUtilities.h"
// use this macro instead of std :: string to mark the that use of std :: string could not be replaced
// by WFixedString.
#define std_string_approved std::string
#ifdef __POSIX__
const char* const kStrNewLine = "\n";
#endif
#ifdef PLATFORM_WINDOWS
const char* const kStrNewLine = "\r\n";
#endif
class DllExport WCFixedStringBase
{
public:
typedef size_t pos_t;
typedef intptr_t spos_t; // signed position, defined to intptr_t because Windows does not have ssize_t
static const pos_t npos = UINTPTR_MAX; // Same as size_max
WCFixedStringBase(char* const in_begin, const size_t in_MaxFixedStringLength) :
m_begin(in_begin),
m_MaxFixedStringLength(in_MaxFixedStringLength),
m_end(in_begin)
{
*m_end = '\0';
}
inline WCFixedStringBase& operator=(const WCFixedStringBase& in_fixedStrToAssign)
{
if (this != &in_fixedStrToAssign)
{
clear();
operator<<(in_fixedStrToAssign);
}
return *this;
}
inline WCFixedStringBase& operator=(const char* in_CStrToAssign)
{
clear();
operator<<(in_CStrToAssign);
return *this;
}
inline WCFixedStringBase& operator=(const char in_charToAssign)
{
clear();
operator<<(in_charToAssign);
return *this;
}
char operator[](const pos_t in_index) const
{
if (in_index < m_MaxFixedStringLength)
return m_begin[in_index];
else
return m_begin[m_MaxFixedStringLength]; // in_index was too big
}
char& operator[](const pos_t in_index)
{
if (in_index < m_MaxFixedStringLength)
return m_begin[in_index];
else
return m_begin[m_MaxFixedStringLength]; // in_index was too big
}
inline size_t resize(const size_t in_newSize)
{
m_end = m_begin + WUMin<size_t>(in_newSize, m_MaxFixedStringLength);
*m_end = '\0';
return size();
}
size_t max_size()
{
return m_MaxFixedStringLength;
}
size_t capacity()
{
return m_MaxFixedStringLength;
}
inline char * peek()
{
return m_begin;
}
inline const char * c_str() const
{
*m_end = '\0';
return m_begin;
}
inline void clear()
{
m_end = m_begin;
*m_end = '\0';
}
inline size_t size() const
{
return m_end - m_begin;
}
inline char* begin() const
{
return m_begin;
}
inline char* end() const
{
return m_end;
}
inline size_t length() const
{
return size();
}
inline bool empty() const
{
return m_begin == m_end;
}
inline void reverse(char* in_left, char* in_right)
{
char* left = in_left;
char* right = in_right;
while (left < right)
{
char temp = *--right;
*right = *left;
*left++ = temp;
}
}
inline void reverse()
{
reverse(m_begin, m_end);
}
inline void to_lower()
{
char* pToDo = m_begin;
while (pToDo < m_end)
{
*pToDo = static_cast<char>(std::tolower(*pToDo));
++pToDo;
}
}
inline void to_upper()
{
char* pToDo = m_begin;
while (pToDo < m_end)
{
*pToDo = static_cast<char>(std::toupper(*pToDo));
++pToDo;
}
}
// append a single char in_count times
inline void append(const char in_charToAppend, const size_t in_count)
{
size_t counter = 0;
while ((m_end < m_begin+m_MaxFixedStringLength) && counter++ < in_count)
*m_end++ = in_charToAppend;
#if kEnableDebug == 1
if (counter < in_count) // if there wasn't enough room for some appended chars
{
m_begin[0] = '@'; // mark the string as overflowed
}
#endif
*m_end = '\0';
}
inline void append(const char* in_chars)
{
operator<<(in_chars);
}
// append "iterator style"
inline void append(const char* in_chars_begin, const char* in_chars_end)
{
const char* curr_char = in_chars_begin;
while ((m_end < m_begin+m_MaxFixedStringLength) && curr_char < in_chars_end && *curr_char != '\0')
*m_end++ = *curr_char++;
#if kEnableDebug == 1
if (curr_char < in_chars_end) // if there wasn't enough room for some appended chars
{
m_begin[0] = '@'; // mark the string as overflowed
}
#endif
*m_end = '\0';
}
// append from a char* in_count chars, (no \0 is required to terminate the input string)
inline void append(const char* in_chars_begin, const size_t in_count)
{
append(in_chars_begin, in_chars_begin + in_count);
}
// assign from a char* in_count chars, (no \0 is required to terminate the input string)
inline void assign(const char* in_chars_begin, const size_t in_count)
{
clear();
append(in_chars_begin, in_chars_begin + in_count);
}
// assign from a char* , (a \0 is required to terminate the input string)
inline void assign(const char* in_chars_ptr)
{
clear();
operator<<(in_chars_ptr);
}
// assign from a char* to a char*
inline void assign(const char* in_begin, const char* in_end)
{
assign(in_begin, size_t(in_end - in_begin));
}
inline void append_double_with_precision(const double in_double, const int in_precision)
{
const unsigned int tempBufSize = 32;
char buf[tempBufSize];
#ifdef PLATFORM_WINDOWS
_snprintf_s(buf, tempBufSize, tempBufSize - 1, "%.*f", in_precision, in_double);
#endif
#ifdef __APPLE__
std::snprintf(buf, tempBufSize, "%.*f", in_precision, in_double);
#endif
#ifdef __linux__
snprintf(buf, tempBufSize, "%.*f", in_precision, in_double);
#endif
operator<<(buf);
}
inline void append_uint(const uint64_t in_uint, const int_fast16_t in_base = 10)
{
uint_fast64_t num = in_uint;
char* lasr_char_before = m_end;
do {
char remainder(static_cast<char>(num % in_base));
if ( remainder < 10 )
operator<<(char(remainder + '0'));
else
operator<<(char(remainder - 10 + 'A'));
num /= in_base;
} while (num != 0);
reverse(lasr_char_before, m_end);
}
inline void append_hex_binary(const uint8_t* in_binary, const size_t in_size)
{
static const char hexdigits[] = "0123456789ABCDEF";
#if _BYTEORDER_BIG_ENDIAN==1
for (size_t ibyte = 0; ibyte < in_size; ++ibyte)
#elif _BYTEORDER_BIG_ENDIAN==0
for (size_t ibyte = in_size; ibyte > 0; --ibyte)
#endif
{
operator<<(hexdigits[in_binary[ibyte - 1] >> 4]);
operator<<(hexdigits[in_binary[ibyte - 1] & 0x0F]);
}
}
inline WCFixedStringBase& operator<<(const char in_charToAppend)
{
if (m_end < m_begin+m_MaxFixedStringLength)
*m_end++ = in_charToAppend;
#if kEnableDebug == 1
else // if there wasn't enough room for the appended char
{
m_begin[0] = '@'; // mark the string as overflowed
}
#endif
*m_end = '\0';
return *this;
}
inline WCFixedStringBase& operator<<(const char* const in_strToAppend)
{
if (0 != in_strToAppend)
{
const char* pSource = in_strToAppend;
while (*pSource != '\0' && m_end < m_begin+m_MaxFixedStringLength)
*m_end++ = *pSource++;
#if kEnableDebug == 1
if (*pSource != '\0') // if there wasn't enough room for some appended chars
{
m_begin[0] = '@'; // mark the string as overflowed
}
#endif
*m_end = '\0';
}
return *this;
}
WCFixedStringBase& operator<<(const uint64_t in_uint)
{
append_uint(in_uint, 10);
return *this;
}
// Warning prevention: the operator<< function overload for unsigneds used to create lots
// of warnings once size_t usage was becoming widespread. So for each OS we define only
// those overloads that are actually needed. On Windows 32 bit we still get
// 'warning C4267: 'argument' : conversion from 'size_t' to 'const unsigned int', possible loss of data'
// warning which we do not know how to solve yet. The function DummyFunctionsForWarningTest
// in file WCFixedStringStream.cpp calls all combinations of operator<<(unsigned something)
// And should produce no warnings - (except the C4267 on windows).
#if defined(__APPLE__) // both 32 & 64 bit
WCFixedStringBase& operator<<(const size_t in_uint) {
return operator<<(static_cast<unsigned long long>(in_uint));
}
#endif
// WCFixedStringBase& operator<<(const unsigned char in_uint) {
// return operator<<(static_cast<const unsigned long long>(in_uint));
// }
//
// WCFixedStringBase& operator<<(const size_t in_uint) {
// return operator<<(static_cast<const uint64_t>(in_uint));
// }
//
#if defined(__APPLE__) || defined(PLATFORM_WINDOWS) || defined(__linux__) // both 32 & 64 bit
WCFixedStringBase& operator<<(const unsigned int in_uint) {
return operator<<(static_cast<uint64_t>(in_uint));
}
#endif
//
#if defined(PLATFORM_WINDOWS) || defined(__linux__) // both 32 & 64 bit
WCFixedStringBase& operator<<(const unsigned long in_uint) {
return operator<<(static_cast<uint64_t>(in_uint));
}
#endif
WCFixedStringBase& operator<<(const long long in_int)
{
if (in_int < 0)
operator<<('-');
#ifdef PLATFORM_WINDOWS
// uintmax_t unsigned_in_num = _abs64(in_int);
uintmax_t unsigned_in_num = in_int < 0 ? static_cast<uintmax_t>(-in_int) : static_cast<uintmax_t>(in_int);
#else
uintmax_t unsigned_in_num = std::abs(in_int);
#endif
append_uint(unsigned_in_num, 10);
return *this;
}
WCFixedStringBase& operator<<(const short in_int) {
return operator<<(static_cast<int64_t>(in_int));
}
WCFixedStringBase& operator<<(const int in_int) {
return operator<<(static_cast<int64_t>(in_int));
}
WCFixedStringBase& operator<<(const long in_int) {
return operator<<(static_cast<int64_t>(in_int));
}
WCFixedStringBase& operator<<(const double in_doubleToWrite)
{
append_double_with_precision(in_doubleToWrite, 10);
return *this;
}
WCFixedStringBase& operator<<(const float in_floatToWrite)
{
append_double_with_precision(double(in_floatToWrite), 5);
return *this;
}
inline WCFixedStringBase& operator<<(const WCFixedStringBase& in_fixedStrToAppend)
{
operator<<(in_fixedStrToAppend.c_str());
return *this;
}
WCFixedStringBase& operator<< (bool abool)
{
return abool ? operator<<("true") : operator<<("false");
}
template<typename T> WCFixedStringBase& operator+=(T in_type)
{
return operator<<(in_type);
}
ptrdiff_t compare(const char* in_to_compare) const
{
ptrdiff_t retVal = 1;
if (0 != in_to_compare)
{
retVal = strcmp(c_str(), in_to_compare);
}
return retVal;
}
ptrdiff_t compare(const WCFixedStringBase& in_to_compare) const
{
ptrdiff_t retVal = compare(in_to_compare.c_str());
return retVal;
}
ptrdiff_t case_insensitive_compare(const char* in_to_compare) const
{
ptrdiff_t retVal = 1;
if (0 != in_to_compare)
{
#ifdef PLATFORM_WINDOWS
retVal = _stricmp(c_str(), in_to_compare);
#endif
#if defined(__linux__) || defined(__APPLE__)
retVal = strcasecmp(c_str(), in_to_compare);
#endif
}
return retVal;
}
ptrdiff_t case_insensitive_compare(const WCFixedStringBase& in_to_compare) const
{
ptrdiff_t retVal = case_insensitive_compare(in_to_compare.c_str());
return retVal;
}
pos_t find(const char in_char_to_find) const
{
const char* pCurrChar = m_begin;
while (pCurrChar < m_end && *pCurrChar != in_char_to_find)
++pCurrChar;
return (pCurrChar < m_end) ? (pCurrChar - m_begin) : npos;
}
pos_t rfind(const char in_char_to_find) const
{
pos_t retVal = npos;
const char* pCurrChar = m_end;
while (pCurrChar != m_begin)
{
--pCurrChar;
if (*pCurrChar == in_char_to_find)
{
retVal = pCurrChar - m_begin;
break;
}
}
return retVal;
}
pos_t find(const char* in_chars_to_find, const pos_t in_start_from = 0) const
{
pos_t retVal = npos;
size_t to_find_size = ::strlen(in_chars_to_find);
if (to_find_size > 0 && to_find_size <= size() && in_start_from < size())
{
const char* pCurrChar = m_begin + in_start_from;
while ((m_end - pCurrChar) >= (ptrdiff_t)to_find_size)
{
int found = ::memcmp(pCurrChar, in_chars_to_find, to_find_size);
if (0 == found)
{
retVal = (pCurrChar - m_begin);
break;
}
++pCurrChar;
}
}
return retVal;
}
pos_t rfind(const char* in_chars_to_find) const
{
pos_t retVal = npos;
size_t to_find_size = ::strlen(in_chars_to_find);
if (to_find_size > 0 && to_find_size <= size())
{
const char* pCurrChar = m_end - to_find_size;
while (m_begin <= pCurrChar)
{
int found = ::memcmp(pCurrChar, in_chars_to_find, to_find_size);
if (0 == found)
{
retVal = (pCurrChar - m_begin);
break;
}
--pCurrChar;
}
}
return retVal;
}
pos_t find_case_insensitive(const char* in_chars_to_find, const pos_t in_start_from = 0) const
{
pos_t retVal = npos;
size_t to_find_size = ::strlen(in_chars_to_find);
if (to_find_size > 0 && to_find_size <= size() && in_start_from < size())
{
const char* pCurrChar = m_begin + in_start_from;
while ((m_end - pCurrChar) >= (ptrdiff_t)to_find_size)
{
size_t i;
for (i = 0; i < to_find_size; ++i)
{
if (tolower(*(pCurrChar+i)) != tolower(in_chars_to_find[i]))
break;
}
if (i == to_find_size)
{
retVal = (pCurrChar - m_begin);
break;
}
++pCurrChar;
}
}
return retVal;
}
pos_t find_first_of(const char* in_possibe_chars_to_find, const pos_t in_start_from = 0) const
{
pos_t retVal = npos;
if (in_start_from < size())
{
const char* pFoundChar = strpbrk(m_begin + in_start_from, in_possibe_chars_to_find);
if (0 != pFoundChar)
{
retVal = (pFoundChar - m_begin);
}
}
return retVal;
}
pos_t find_last_of(const char* in_possibe_chars_to_find, const pos_t in_start_from = 0) const
{
pos_t retVal = npos;
pos_t curr_location = in_start_from;
while (size() > curr_location)
{
pos_t found = find_first_of(in_possibe_chars_to_find, curr_location);
if (npos != found)
{
retVal = found;
curr_location = found + 1;
}
else
break;
}
return retVal;
}
pos_t find_first_not_of(const char* in_acceptable_chars, const pos_t in_start_from = 0) const
{
pos_t retVal = npos;
if (in_start_from < size())
{
retVal = (strspn(m_begin + in_start_from, in_acceptable_chars));
if (size() <= retVal + in_start_from)
{
retVal = npos;
}
else
{
retVal += in_start_from;
}
}
return retVal;
}
pos_t find_last_not_of(const char* in_acceptable_chars, const pos_t in_start_from = 0) const
{
pos_t retVal = npos;
pos_t curr_location = in_start_from;
while (size() > curr_location)
{
pos_t found = find_first_not_of(in_acceptable_chars, curr_location);
if (npos != found)
{
retVal = found;
curr_location = found + 1;
}
else
break;
}
return retVal;
}
// return true if in_begin_text is found at position 0 OR if in_begin_text is empty
bool begins_with(const char* in_begin_text) const
{
pos_t where = find(in_begin_text, 0);
bool retVal = (0 == where) || (0 == ::strlen(in_begin_text));
return retVal;
}
// return true if in_end_text is found at th end OR if in_end_text is empty
bool ends_with(const char* in_end_text) const
{
pos_t where = rfind(in_end_text);
bool retVal = ((size() - strlen(in_end_text)) == where) || (0 == ::strlen(in_end_text));
return retVal;
}
size_t replace(const char in_look_for, const char in_replace_with)
{
size_t retVal = 0;
char* pCurrChar = m_begin;
while (pCurrChar < m_end)
{
if (*pCurrChar == in_look_for)
{
*pCurrChar = in_replace_with;
++retVal;
}
++pCurrChar;
}
return retVal;
}
// erase in_size chars starting from in_location
void erase(const pos_t in_location, const size_t in_num_chars = 1)
{
if (size() > in_location && in_num_chars > 0)
{
size_t actual_num_chars = WUMin(in_num_chars, size_t(size() - in_location));
char* pTo = m_begin + in_location;
char* pFrom = pTo + actual_num_chars;
while (pFrom < m_end)
*pTo++ = *pFrom++;
resize(size() - actual_num_chars);
}
}
// erase any char that appear in in_forbidden_chars
void erase_all_of(const char* in_forbidden_chars)
{
pos_t curr_location = 0;
while (npos != curr_location)
{
curr_location = find_first_of(in_forbidden_chars, curr_location);
if (npos != curr_location)
erase(curr_location);
}
}
// erase any char that do not appear in in_allowed_chars
void erase_all_not_of(const char* in_allowed_chars)
{
pos_t curr_location = 0;
while (npos != curr_location)
{
curr_location = find_first_not_of(in_allowed_chars, curr_location);
if (npos != curr_location)
erase(curr_location);
}
}
//! Copy the content of fixed string to a buffer appending a '\0' at the end.
//! If in_buffer_size is more than the allocated buffer size memory over write will happen!
void copy_to_buffer(const size_t in_buffer_size, char* out_buffer)
{
if (in_buffer_size > 0 && 0 != out_buffer)
{
char* cur_buffer = out_buffer;
const char* cur_fixed = m_begin;
const char* end_buffer = out_buffer + (WUMin<size_t>(in_buffer_size - 1, m_end - m_begin));
while (cur_buffer < end_buffer)
*cur_buffer++ = *cur_fixed++;
*cur_buffer = '\0';
}
}
protected:
~WCFixedStringBase() {}
char* const m_begin;
const size_t m_MaxFixedStringLength;
char* m_end;
private:
WCFixedStringBase();
WCFixedStringBase(const WCFixedStringBase& in_fixedStrToCopy);
#if 0
:
m_begin(in_fixedStrToCopy.m_begin),
m_MaxFixedStringLength(in_fixedStrToCopy.m_MaxFixedStringLength),
m_end(in_fixedStrToCopy.m_end)
{
}
#endif
};
template<size_t kMaxFixedStringLength> class DllExport WCFixedString : public WCFixedStringBase
{
public:
inline WCFixedString() :
WCFixedStringBase(m_fixedString, kMaxFixedStringLength)
{
}
inline WCFixedString(const char* const in_strToAssign) :
WCFixedStringBase(m_fixedString, kMaxFixedStringLength)
{
operator<<(in_strToAssign);
}
inline WCFixedString(const WCFixedStringBase& in_fixedStrToAssign) :
WCFixedStringBase(m_fixedString, kMaxFixedStringLength)
{
operator<<(in_fixedStrToAssign);
}
inline WCFixedString(const WCFixedString& in_fixedStrToAssign) :
WCFixedStringBase(m_fixedString, kMaxFixedStringLength)
{
operator<<(in_fixedStrToAssign);
}
inline WCFixedString(const char in_char, const size_t in_count = 1) :
WCFixedStringBase(m_fixedString, kMaxFixedStringLength)
{
append(in_char, in_count);
}
inline WCFixedString(const char* in_chars, const size_t in_count) :
WCFixedStringBase(m_fixedString, kMaxFixedStringLength)
{
append(in_chars, in_count);
}
// substr now supports negative in_length, which means "from the end" so
// "abcdefg".substr(1, -1) == "bcdef"
inline const WCFixedString substr(const pos_t in_pos = 0, const spos_t in_length = kMaxFixedStringLength) const
{
pos_t adjusted_pos = WUMin<size_t>(in_pos, size());
size_t adjusted_length = 0;
if (in_length < 0)
{
adjusted_length = size_t(WUMax<spos_t>(0, spos_t(size() - adjusted_pos) + in_length));
}
else
adjusted_length = WUMin<size_t>(in_length, size() - adjusted_pos);
WCFixedString retVal;
retVal.append(m_begin + adjusted_pos, adjusted_length);
return retVal;
}
protected:
char m_fixedString[kMaxFixedStringLength + 1]; // the "+ 1" is so that *m_end is always valid, and we can put the '\0' there};
};
inline bool operator==(const WCFixedStringBase& in_left, const WCFixedStringBase& in_right)
{
return 0 == in_left.compare(in_right.c_str());
}
inline bool operator==(const WCFixedStringBase& in_left, const char* const in_right)
{
return 0 == in_left.compare(in_right);
}
inline bool operator!=(const WCFixedStringBase& in_left, const WCFixedStringBase& in_right)
{
return 0 != in_left.compare(in_right.c_str());
}
inline bool operator!=(const WCFixedStringBase& in_left, const char* const in_right)
{
return 0 != in_left.compare(in_right);
}
// class WCFixedStringBase
typedef WCFixedString<4> WCFixedString4;
typedef WCFixedString<15> WCFixedString15;
typedef WCFixedString<31> WCFixedString31;
typedef WCFixedString<63> WCFixedString63;
typedef WCFixedString<127> WCFixedString127;
typedef WCFixedString<255> WCFixedString255;
typedef WCFixedString<511> WCFixedString511;
typedef WCFixedString<1023> WCFixedString1023;
typedef WCFixedString<2047> WCFixedString2047;
template<size_t kSizeOfFirst, size_t kSizeOfSecond>
class WCFixedStringPair : public std::pair< WCFixedString<kSizeOfFirst>, WCFixedString<kSizeOfSecond> >
{
public:
WCFixedStringPair(const char* const in_firstStr = 0, const char* const in_secondStr = 0) :
std::pair< WCFixedString<kSizeOfFirst>, WCFixedString<kSizeOfSecond> >(in_firstStr, in_secondStr) {}
WCFixedStringPair(const WCFixedStringBase& in_firstStr, const char* const in_secondStr = 0) :
std::pair< WCFixedString<kSizeOfFirst>, WCFixedString<kSizeOfSecond> >(in_firstStr, in_secondStr) {}
WCFixedStringPair(const WCFixedStringBase& in_firstStr, const WCFixedStringBase& in_secondStr) :
std::pair< WCFixedString<kSizeOfFirst>, WCFixedString<kSizeOfSecond> >(in_firstStr, in_secondStr) {}
};
#endif // #ifndef __WCFixedString_h__

View file

@ -0,0 +1,317 @@
#ifndef __WUErrors_h__
#define __WUErrors_h__
/* Copy to include:
#include "WUErrors.h"
*/
#include "BasicTypes/WUTypes.h"
// General errors
//const WTErr eNoErr = 0; // moved to #include "WavesPublicAPI/WTErr.h"
const WTErr eGenericErr = -1;
const WTErr eUserCanceled = -2;
const WTErr eUnknownErr = -3;
const WTErr eExceptionErr = -4;
const WTErr eEndianError = -5;
const WTErr eThreadSafeError = -6;
const WTErr eSomeThingNotInitailzed = -7;
const WTErr eWrongObjectState = -8; //!< object was not in an acceptable state
const WTErr eUninitalized = -9;
const WTErr eDeprecated = -10;
const WTErr eCommandLineParameter = -11;
const WTErr eNotANumber = -12; //!< expected a number but none was found
const WTErr eNotJustANumber = -13; //!< expected a number and found one but also other stuff (e.g. "123XYZ")
const WTErr eNegativeNumber = -14; //!< expected a positive number and found a negative
const WTErr eTimeOut = -15; //!< something timed out
const WTErr eCoreAudioFailed = -16; //!< Error in a core audio call
const WTErr eSomeThingInitailzedTwice = -17;
const WTErr eGenerateHelpInfo = -18;
const WTErr eOutOfRangeNumber = -19;
const WTErr eMacOnlyCode = -20;
const WTErr eWinOnlyCode = -21;
const WTErr eAppLaunchFailed = -22; //!< failed to launch an application
const WTErr eAppTerminateFailed = -23; //!< failed to terminate an application
const WTErr eAppReturnedError = -24; //!< Non zero exit code from application
const WTErr eNotImplemented = -25; //!< Function is not implmemented
const WTErr eNotEmpty = -26; //!< Something was expected to be empty but is not
const WTErr eAsioFailed = -27;
// File Manager errors
const WTErr eFMNoSuchVolume = -1001;
const WTErr eFMFileNotFound = -1002;
const WTErr eFMFileAllreadyExists = -1003;
const WTErr eFMAllreadyOpenWithWritePerm = -1004;
const WTErr eFMEndOfFile = -1005;
const WTErr eFMPermissionErr = -1006;
const WTErr eFMBusyErr = -1007;
const WTErr eFMOpenFailed = -1008;
const WTErr eFMTranslateFileNameFailed = -1009;
const WTErr eFMWTPathRefCreationFailed = -1010;
const WTErr eFMReadFailed = -1011;
const WTErr eFMIllegalPathRef = -1012;
const WTErr eFMFileNotOpened = -1013;
const WTErr eFMFileSizeTooBig = -1014;
const WTErr eFMNoSuchDomain = -1015;
const WTErr eFMNoSuchSystemFolder = -1016;
const WTErr eFMWrongParameters = -1017;
const WTErr eFMIsNotAFolder = -1018;
const WTErr eFMIsAFolder = -1019;
const WTErr eFMIsNotAFile = -1020;
const WTErr eFMIsAFile = -1021;
const WTErr eFMDeleteFailed = -1022;
const WTErr eFMCreateFailed = -1023;
const WTErr eFMPathTooLong = -1024;
const WTErr eFMIOError = -1025;
const WTErr eFMIllegalOpenFileRef = -1026;
const WTErr eFMDiskFull = -1027;
const WTErr eFMFileNotEmpty = -1028;
const WTErr eFMEndOfFolder = -1029;
const WTErr eFMSamePath = -1030;
const WTErr eFMPathTooShort = -1031;
const WTErr eFMIncompletePath = -1032;
const WTErr eFMIsNoAFileSystemLink = -1033;
const WTErr eFMSymlinkBroken = -1034;
const WTErr eFMMoveFailed = -1035;
const WTErr eFMWriteFailed = -1036;
const WTErr eFMTooManyOpenFiles = -1037;
const WTErr eFMTooManySymlinks = -1038;
// System errors
const WTErr eGenericSystemError = -2000;
const WTErr eSysNoEnvironmentVariable = -2001;
const WTErr eDLLLoadingFailed = -2002;
const WTErr eFuncPoinerNotFound = -2003;
const WTErr eDLLNotFound = -2004;
const WTErr eBundleNotLoaded = -2005;
const WTErr eBundleCreateFailed = -2006;
const WTErr eBundleExecutableNotFound = -2007;
const WTErr eNotABundle = -2008;
const WTErr eInvalideDate = -2009;
const WTErr eNoNetDevice = -2010;
const WTErr eCacheCreatedFromResource = -2011;
const WTErr eNotAValidApplication = -2012;
// Resource Manager errors
const WTErr eRMResNotFound = -3000;
const WTErr eRMResExists = -3001; //!< a resource exist even though it's not expected to
const WTErr eRMContainerNotFound = -3002; //!< The container was not found in the list of containers
const WTErr eRMResRefNotFound = -3003; //!< The resRef was not found in container's resource list
const WTErr eRMInvalidResRef = -3004;
const WTErr eRMInvalidResContainer = -3005;
const WTErr eRMInvalidNativeResContainer = -3006;
const WTErr eRMAttachResContainerFailed = -3007;
const WTErr eRMInvalidResID = -3008;
const WTErr eRMResUpdateFailed = -3009;
// Graphic Manager & GUI errors
const WTErr eGMIsNotInitailzed = -3500;
const WTErr eGMInvalidImage = -3501;
const WTErr eGMGenericErr = -3502;
const WTErr eGMNoCurrentContext = -3503;
const WTErr eGUISkinNotFound = -3504;
const WTErr eGMNoVertices = -3505;
const WTErr eGMNoColors = -3506;
const WTErr eGMNoTexture = -3507;
const WTErr eGMIncompatibleOGLVersion = -3508;
const WTErr eGMNoDeviceContext = -3509;
const WTErr eGMNoPixelFormat = -3510;
const WTErr eGMNoOGLContext = -3511;
const WTErr eGMNoOGLContextSharing = -3512;
const WTErr eGMUnsupportedImageFormat = -3513;
const WTErr eGMUninitializedContext = -3514;
const WTErr eControlOutOfRange = -3515;
const WTErr eGMUninitializedFont = -3516;
const WTErr eGMInvalidFontDrawMethod = -3517;
const WTErr eGMUnreleasedTextures = -3518;
const WTErr eGMWrongThread = -3519;
const WTErr eGMDontCommitDraw = -3520;
// Errors in the -5000 -> -5999 are defined in Waves-incs.h
// Memory errors
const WTErr eMemNewFailed = -4001; //!< Something = new CSomething, returned null
const WTErr eMemNewTPtrFailed = -4002; //!< NewTPtr or NewTPtrClear failed
const WTErr eMemNullPointer = -4003; //!< a null pointer was encountered where it should not
const WTErr eMemObjNotInitialized = -4004;
const WTErr eMemBuffTooShort = -4005; //!< the buffer in question did not have enough space for the operation
const WTErr eInstanciationFailed = -4006;
const WTErr eMemAddressSpaceError = -4007; //!< memory falls outside the legal address space
const WTErr eMemBadPointer = -4008;
const WTErr eMemOutOfMemory = -4009;
// XML Errors
const WTErr eXMLParserFailed = -6001;
const WTErr eXMLTreeNotValid = -6002;
const WTErr eXMLTreeEmpty = -6003;
const WTErr eXMLElementMissing = -6004;
const WTErr eXMLElementUninitalized = -6005; //!< element was default constructed it has not element name, etc..
const WTErr eXMLElementIncomplete = -6006; //!< XML parser did not complete building the element
const WTErr eXMLAttribMissing = -6007;
// Preset errors
const WTErr ePresetFileProblem = -7860;
const WTErr eInvalidFileFormatProblem = -7861;
const WTErr ePresetLockedProblem = -7862;
const WTErr ePresetInfoNotFound = -7863;
const WTErr eDuplicatePluginSpecificTag = -7959;
const WTErr ePluginSpecifcNotExisting = -7960;
const WTErr eBuffSizeToSmall = -7961;
const WTErr eCreatingPopupWhereAnItemExists = -7962;
const WTErr eDeletePluginSpecifcFailed = -7963;
const WTErr eFactoryPresetNumOutOfRange = -7964;
const WTErr eNoFactoryPresets = -7965;
const WTErr eLoadPresetToPlugin_vec_empty = -7966;
const WTErr eFactoryPresetNotFound = -7967;
const WTErr eCantCreateUserPrefFile = -7968;
const WTErr eDataFormatNotSupported = -7969;
const WTErr eCantLoadProcessFunction = -7970;
const WTErr eIllegalChunkIndex = -7971;
const WTErr eIllegalChunkID = -7972;
const WTErr eIllegalChunkVersion = -7973;
// Shell errors
const WTErr eNotAPluginFile = -8001;
const WTErr eFaildToLoadPluginDLL = -8002;
const WTErr eNoPluginManager = -8003;
const WTErr eGetAvailablePluginsFailed = -8004;
const WTErr eNoPluginsAvailable = -8005;
const WTErr ePluginSubComponentNotFound = -8006;
const WTErr ePluginOpenFailed = -8007;
const WTErr eSubComponentRejected = -8009; //!< user did not want this sub-component - probably through preferences
const WTErr eIncompatibleNumOfIOs = -8010; //!< e.g. surround sub-component in stereo only shell
const WTErr eStemProblem = -8011; //!< Some problem with stems
const WTErr eComponentTypeNotSupported = -8012;
const WTErr ePluginNotLoaded = -8013;
const WTErr ePluginInstanceNotCreate = -8014;
const WTErr ePluginAlgNotCreate = -8015;
const WTErr ePluginGUINotCreate = -8016;
const WTErr eMissmatchChannelCount = -8017;
const WTErr eIncompatibleVersion = -8018;
const WTErr eIncompatibleAffiliation = -8019;
const WTErr eNoSubComponentsFound = -8020;
// Net-shell errors
const WTErr eNetShellInitFailed = -9001;
// Protection errors
const WTErr eWLSLicenseFileNotFound = -10001;
const WTErr eWLSPluginNotAuthorized = -10002;
const WTErr eWLSNoLicenseForPlugin = -10003;
const WTErr eWLSInvalidLicenseFileName = -10004;
const WTErr eWLSInvalidLicenseFileContents = -10005;
const WTErr eWLSInvalidDeviceID = -10006;
const WTErr eWLSInvalidClientID = -10007;
const WTErr eWLSLicenseFileDownloadFailed = -10008;
const WTErr eWLSNoLicensesForClientOrDevice = -10009;
const WTErr eWLSNoLicensesForSomePlugins = -10010;
// Communication errors
const WTErr eCommEndOfRecievedMessage = -11001;
const WTErr eCommSocketDisconnected = -11002;
// Window Manager Errors
const WTErr eWMEventNotHandled = -12001;
const WTErr eWMDisposeViewFailed = -12002;
// Plugin View Manager Errors
const WTErr ePVMPlatformNotSupported = -13001;
const WTErr ePVMAlreadyInitialized = -13002;
const WTErr ePVMIllegalParent = -13003;
const WTErr ePVMCannotCreateView = -13004;
const WTErr ePVMNothingSelected = -13005;
const WTErr ePVMDisabledItemChosen = -13006;
const WTErr ePVMMenuItemNotFound = -13007;
const WTErr ePVMMenuItemNotASubMenu = -13008;
const WTErr ePVMUnknownMenu = -13009;
const WTErr ePVMEmptyNativeViewRef = -13010;
const WTErr ePVMGenericError = -13011;
const WTErr ePVMFunctionNotImplemented = -13012;
// Plugin View Manager - Menu Errors
const WTErr ePVMCannotCreateMenu = -13501;
const WTErr ePVMCannotSetMenuFont = -13502;
const WTErr ePVMCannotSetMenu = -13503;
const WTErr ePVMItemParentNotExists = -13504;
// Plugin View Manager - TextField Errors
const WTErr ePVMCannotCreateTextField = -13553;
const WTErr ePVMCannotEmbedTextField = -13554;
const WTErr ePVMNoTextToValidate = -13555;
const WTErr ePVMTextTooLong = -13556;
const WTErr ePVMIllegalCharacter = -13557;
// Meter Manager Errors
const WTErr eMM_MeterGetMeterValueForParameterNotConnected = -14000 ;
//Surface Driver Manager Errors
const WTErr eSDM_SurfaceDriverAPIFailed = -14101;
// IPC Errors
const WTErr eIPC_CreateNamedPipeFailed = -14200;
const WTErr eIPC_OpenPipeTimeout = -14201;
const WTErr eIPC_DeleteNamedPipeFailed = -14202;
const WTErr eIPC_SelectOnNamedPipeFailed = -14203;
const WTErr eIPC_ReadFromNamedPipeFailed = -14204;
const WTErr eIPC_ReadEndOfFileFromNamedPipe = -14205;
const WTErr eIPC_CloseNamedPipeFailed = -14206;
const WTErr eIPC_ParseArgsFailed = -14207;
const WTErr eIPC_OpenPipeFailed = -14208;
const WTErr eIPC_SendMsgFailed = -14209;
const WTErr eIPC_SendCommandInvalid = -14210;
const WTErr eIPC_QtTestMode = -14211;
const WTErr eIPC_ChangePermissionOnPipe = -14212;
const WTErr eIPC_ConnectionLost = -14213;
const WTErr eIPC_InvalidRole = -14213;
const WTErr eIPC_CreateNamedPipeM2SFailed = -14214;
const WTErr eIPC_CreateNamedPipeS2MFailed = -14215;
const WTErr eIPC_ChangePermissionOnPipeM2S = -14216;
const WTErr eIPC_ChangePermissionOnPipeS2M = -14217;
const WTErr eIPC_OpenReadPipeFailed = -14218;
const WTErr eIPC_OpenReadPipeDIsableSigPipe = -14219;
const WTErr eIPC_OpenWritePipeFailed = -14220;
const WTErr eIPC_WritePipeFailed = -14221;
const WTErr eIPC_WritePipeNotOpen = -14222;
const WTErr eIPC_WriteBufferResizeFailed = -14223;
const WTErr eIPC_NotConnectedSendMsgFailed = -14224;
const WTErr eIPC_OpenWritePipeWorkerStoping = -14225;
const WTErr eIPC_SoketSendFailed = -14226;
const WTErr eIPC_PtonFailed = -14227;
const WTErr eIPC_SocketFailed = -14228;
const WTErr eIPC_BindFailed = -14229;
const WTErr eIPC_ListenFailed = -14230;
const WTErr eIPC_ConnectFailed = -14231;
const WTErr eIPC_WsaStartupFailed = -14232;
const WTErr eIPC_UdpSocketCreateFailed = -14233;
const WTErr eIPC_UdpSocketConnectFailed = -14234;
const WTErr eIPC_UdpSocketBinFailed = -14235;
const WTErr eIPC_SetBufferPreambleFailed = -14226;
// Database errors
const WTErr eDB_BatchRollback = -15501;
// inventory related errors
const WTErr eUnknown_Device = -16001;
const WTErr eInvNoDevice = -16002;
// SG protocol service errors
const WTErr eSGProtocolService_Not_Running = -17001;
const WTErr eSGProtocolService_Version_MisMatch = -17002;
// Error code related to Param
const WTErr eInvalidParam = -18001;
#define WUIsError(theErrorCode) (eNoErr != (theErrorCode))
#define WUNoError(theErrorCode) (eNoErr == (theErrorCode))
#define WUThrowError(theErrorCode) {if(WUIsError(theErrorCode))throw (theErrorCode);}
#define WUThrowErrorIfNil(thePtr , theErrorCode) {if (0 == thePtr )throw (theErrorCode);}
#define WUThrowErrorIfFalse(theBool , theErrorCode) {if (!(theBool))throw (theErrorCode);}
#define WUThrowErrorCodeIfError(err,theErrorCode) {if(WUIsError(err))throw (theErrorCode);}
// Get the error string that match the error code.
DllExport const char* WTErrName(WTErr wtErr);
#endif //__WUErrors_h__:

View file

@ -0,0 +1,38 @@
/*
Copyright (C) 2014 John Emmas
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 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 General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __waves_pthread_utils__
#define __waves_pthread_utils__
/* Accommodate thread setting (and testing) for both
* 'libpthread' and 'libpthread_win32' (whose implementations
* of 'pthread_t' are subtlely different)
*/
#ifndef PTHREAD_MACROS_DEFINED
#define PTHREAD_MACROS_DEFINED
#ifdef PTW32_VERSION /* pthread_win32 */
#define mark_pthread_inactive(threadID) threadID.p=0
#define is_pthread_active(threadID) threadID.p!=0
#else /* normal pthread */
#define mark_pthread_inactive(threadID) threadID=0
#define is_pthread_active(threadID) threadID!=0
#endif /* PTW32_VERSION */
#endif /* PTHREAD_MACROS_DEFINED */
#endif /* __waves_pthread_utils__ */

View file

@ -0,0 +1,18 @@
#ifndef __safe_delete_h__
#define __safe_delete_h__
/* Copy to include:
#include "safe_delete.h"
*/
#define safe_delete(__pObject__) {if((__pObject__) != 0) {delete (__pObject__); (__pObject__) = 0;}}
#define safe_delete_array(__pArray__) {if((__pArray__) != 0) {delete [] (__pArray__); (__pArray__) = 0;}}
template <class T> void safe_delete_from_iterator(T* pToDelete)
{
safe_delete(pToDelete);
}
#endif // __safe_delete_h__