#ifndef _Utils_H
#define _Utils_H
#include "platform/Mutex.h"
#include "platform/Log.h"
#include <string>
#include <locale>
#include <algorithm>
#include <sstream>
#include <vector>
namespace OpenZWave
{
string ToUpper( string const& _str );
string ToLower( string const& _str );
void split (std::vector<std::string>& lst, const std::string& input, const std::string& separators, bool remove_empty = true);
std::string &trim ( std::string &s );
void PrintHex(std::string prefix, uint8_t const *data, uint32 const length);
string PktToString(uint8 const *data, uint32 const length);
struct LockGuard
{
LockGuard(Mutex* mutex) : _ref(mutex)
{
_ref->Lock();
};
~LockGuard()
{
#if 0#endif
if (!_ref->IsSignalled())
_ref->Unlock();
}
void Unlock()
{
_ref->Unlock();
}
private:
LockGuard(const LockGuard&);
LockGuard& operator = ( LockGuard const& );
Mutex* _ref;
};
}
#endif