mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-26 18:42:41 +01:00
Merge branch 'develop' into issue_532-3
This commit is contained in:
@@ -65,6 +65,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <>
|
||||
class AbstractDelegate<void>
|
||||
/// Base class for Delegate and Expire.
|
||||
@@ -104,6 +105,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
} // namespace Poco
|
||||
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ class AbstractEvent
|
||||
/// only.
|
||||
///
|
||||
/// BasicEvent works with a standard delegate. They allow one object to register
|
||||
/// onr or more delegates with an event. In contrast, a PriorityDelegate comes with an attached priority value
|
||||
/// one or more delegates with an event. In contrast, a PriorityDelegate comes with an attached priority value
|
||||
/// and allows one object to register for one priority value one or more delegates. Note that PriorityDelegates
|
||||
/// only work with PriorityEvents:
|
||||
///
|
||||
@@ -151,6 +151,7 @@ class AbstractEvent
|
||||
/// to create the PriorityDelegate.
|
||||
{
|
||||
public:
|
||||
typedef TDelegate* DelegateHandle;
|
||||
typedef TArgs Args;
|
||||
|
||||
AbstractEvent():
|
||||
@@ -188,6 +189,28 @@ public:
|
||||
_strategy.remove(aDelegate);
|
||||
}
|
||||
|
||||
DelegateHandle add(const TDelegate& aDelegate)
|
||||
/// Adds a delegate to the event.
|
||||
///
|
||||
/// Exact behavior is determined by the TStrategy.
|
||||
///
|
||||
/// Returns a DelegateHandle which can be used in call to
|
||||
/// remove() to remove the delegate.
|
||||
{
|
||||
typename TMutex::ScopedLock lock(_mutex);
|
||||
return _strategy.add(aDelegate);
|
||||
}
|
||||
|
||||
void remove(DelegateHandle delegateHandle)
|
||||
/// Removes a delegate from the event using a DelegateHandle
|
||||
/// returned by add().
|
||||
///
|
||||
/// If the delegate is not found, this function does nothing.
|
||||
{
|
||||
typename TMutex::ScopedLock lock(_mutex);
|
||||
_strategy.remove(delegateHandle);
|
||||
}
|
||||
|
||||
void operator () (const void* pSender, TArgs& args)
|
||||
/// Shortcut for notify(pSender, args);
|
||||
{
|
||||
@@ -330,126 +353,13 @@ private:
|
||||
AbstractEvent& operator = (const AbstractEvent& other);
|
||||
};
|
||||
|
||||
|
||||
template <class TStrategy, class TDelegate, class TMutex>
|
||||
class AbstractEvent<void,TStrategy,TDelegate,TMutex>
|
||||
/// An AbstractEvent is the base class of all events.
|
||||
/// It works similar to the way C# handles notifications (aka events in C#).
|
||||
///
|
||||
/// Events can be used to send information to a set of delegates
|
||||
/// which are registered with the event. The type of the data is specified with
|
||||
/// the template parameter TArgs. The TStrategy parameter must be a subclass
|
||||
/// of NotificationStrategy. The parameter TDelegate can either be a subclass of AbstractDelegate
|
||||
/// or of AbstractPriorityDelegate.
|
||||
///
|
||||
/// Note that AbstractEvent should never be used directly. One ought to use
|
||||
/// one of its subclasses which set the TStrategy and TDelegate template parameters
|
||||
/// to fixed values. For most use-cases the BasicEvent template will be sufficient:
|
||||
///
|
||||
/// #include "Poco/BasicEvent.h"
|
||||
/// #include "Poco/Delegate.h"
|
||||
///
|
||||
/// Note that as of release 1.4.2, the behavior of BasicEvent equals that of FIFOEvent,
|
||||
/// so the FIFOEvent class is no longer necessary and provided for backwards compatibility
|
||||
/// only.
|
||||
///
|
||||
/// BasicEvent works with a standard delegate. They allow one object to register
|
||||
/// onr or more delegates with an event. In contrast, a PriorityDelegate comes with an attached priority value
|
||||
/// and allows one object to register for one priority value one or more delegates. Note that PriorityDelegates
|
||||
/// only work with PriorityEvents:
|
||||
///
|
||||
/// #include "Poco/PriorityEvent.h"
|
||||
/// #include "Poco/PriorityDelegate.h"
|
||||
///
|
||||
/// Use events by adding them as public members to the object which is throwing notifications:
|
||||
///
|
||||
/// class MyData
|
||||
/// {
|
||||
/// public:
|
||||
/// Poco::BasicEvent<int> dataChanged;
|
||||
///
|
||||
/// MyData();
|
||||
/// ...
|
||||
/// void setData(int i);
|
||||
/// ...
|
||||
/// private:
|
||||
/// int _data;
|
||||
/// };
|
||||
///
|
||||
/// Firing the event is done either by calling the event's notify() or notifyAsync() method:
|
||||
///
|
||||
/// void MyData::setData(int i)
|
||||
/// {
|
||||
/// this->_data = i;
|
||||
/// dataChanged.notify(this, this->_data);
|
||||
/// }
|
||||
///
|
||||
/// Alternatively, instead of notify(), operator () can be used.
|
||||
///
|
||||
/// void MyData::setData(int i)
|
||||
/// {
|
||||
/// this->_data = i;
|
||||
/// dataChanged(this, this->_data);
|
||||
/// }
|
||||
///
|
||||
/// Note that operator (), notify() and notifyAsync() do not catch exceptions, i.e. in case a
|
||||
/// delegate throws an exception, notifying is immediately aborted and the exception is propagated
|
||||
/// back to the caller.
|
||||
///
|
||||
/// Delegates can register methods at the event. In the case of a BasicEvent
|
||||
/// the Delegate template is used, in case of an PriorityEvent a PriorityDelegate is used.
|
||||
/// Mixing of delegates, e.g. using a PriorityDelegate with a BasicEvent is not allowed and
|
||||
/// can lead to compile-time and/or run-time errors. The standalone delegate() functions
|
||||
/// can be used to construct Delegate objects.
|
||||
///
|
||||
/// Events require the observers to have one of the following method signatures:
|
||||
///
|
||||
/// void onEvent(const void* pSender, TArgs& args);
|
||||
/// void onEvent(TArgs& args);
|
||||
/// static void onEvent(const void* pSender, TArgs& args);
|
||||
/// static void onEvent(void* pSender, TArgs& args);
|
||||
/// static void onEvent(TArgs& args);
|
||||
///
|
||||
/// For performance reasons arguments are always sent by reference. This also allows observers
|
||||
/// to modify the event argument. To prevent that, use <[const TArg]> as template
|
||||
/// parameter. A non-conformant method signature leads to compile errors.
|
||||
///
|
||||
/// Assuming that the observer meets the method signature requirement, it can register
|
||||
/// this method with the += operator:
|
||||
///
|
||||
/// class MyController
|
||||
/// {
|
||||
/// protected:
|
||||
/// MyData _data;
|
||||
///
|
||||
/// void onDataChanged(void* pSender, int& data);
|
||||
/// ...
|
||||
/// };
|
||||
///
|
||||
/// MyController::MyController()
|
||||
/// {
|
||||
/// _data.dataChanged += delegate(this, &MyController::onDataChanged);
|
||||
/// }
|
||||
///
|
||||
/// In some cases it might be desirable to work with automatically expiring registrations. Simply add
|
||||
/// to delegate as 3rd parameter a expireValue (in milliseconds):
|
||||
///
|
||||
/// _data.dataChanged += delegate(this, &MyController::onDataChanged, 1000);
|
||||
///
|
||||
/// This will add a delegate to the event which will automatically be removed in 1000 millisecs.
|
||||
///
|
||||
/// Unregistering happens via the -= operator. Forgetting to unregister a method will lead to
|
||||
/// segmentation faults later, when one tries to send a notify to a no longer existing object.
|
||||
///
|
||||
/// MyController::~MyController()
|
||||
/// {
|
||||
/// _data.dataChanged -= delegate(this, &MyController::onDataChanged);
|
||||
/// }
|
||||
///
|
||||
/// Working with PriorityDelegate's as similar to working with BasicEvent.
|
||||
/// Instead of delegate(), the priorityDelegate() function must be used
|
||||
/// to create the PriorityDelegate.
|
||||
class AbstractEvent<void, TStrategy, TDelegate, TMutex>
|
||||
{
|
||||
public:
|
||||
typedef TDelegate* DelegateHandle;
|
||||
|
||||
AbstractEvent():
|
||||
_executeAsync(this, &AbstractEvent::executeAsyncImpl),
|
||||
_enabled(true)
|
||||
@@ -484,6 +394,28 @@ public:
|
||||
typename TMutex::ScopedLock lock(_mutex);
|
||||
_strategy.remove(aDelegate);
|
||||
}
|
||||
|
||||
DelegateHandle add(const TDelegate& aDelegate)
|
||||
/// Adds a delegate to the event.
|
||||
///
|
||||
/// Exact behavior is determined by the TStrategy.
|
||||
///
|
||||
/// Returns a DelegateHandle which can be used in call to
|
||||
/// remove() to remove the delegate.
|
||||
{
|
||||
typename TMutex::ScopedLock lock(_mutex);
|
||||
return _strategy.add(aDelegate);
|
||||
}
|
||||
|
||||
void remove(DelegateHandle delegateHandle)
|
||||
/// Removes a delegate from the event using a DelegateHandle
|
||||
/// returned by add().
|
||||
///
|
||||
/// If the delegate is not found, this function does nothing.
|
||||
{
|
||||
typename TMutex::ScopedLock lock(_mutex);
|
||||
_strategy.remove(delegateHandle);
|
||||
}
|
||||
|
||||
void operator () (const void* pSender)
|
||||
/// Shortcut for notify(pSender, args);
|
||||
@@ -621,6 +553,7 @@ private:
|
||||
AbstractEvent& operator = (const AbstractEvent& other);
|
||||
};
|
||||
|
||||
|
||||
} // namespace Poco
|
||||
|
||||
|
||||
|
||||
@@ -40,10 +40,10 @@ class Foundation_API Bugcheck
|
||||
/// automatically provide useful context information.
|
||||
{
|
||||
public:
|
||||
static void assertion(const char* cond, const char* file, int line);
|
||||
static void assertion(const char* cond, const char* file, int line, const char* text = 0);
|
||||
/// An assertion failed. Break into the debugger, if
|
||||
/// possible, then throw an AssertionViolationException.
|
||||
|
||||
|
||||
static void nullPointer(const char* ptr, const char* file, int line);
|
||||
/// An null pointer was encountered. Break into the debugger, if
|
||||
/// possible, then throw an NullPointerException.
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
/// possible.
|
||||
|
||||
protected:
|
||||
static std::string what(const char* msg, const char* file, int line);
|
||||
static std::string what(const char* msg, const char* file, int line, const char* text = 0);
|
||||
};
|
||||
|
||||
|
||||
@@ -84,7 +84,11 @@ protected:
|
||||
#if defined(_DEBUG)
|
||||
#define poco_assert_dbg(cond) \
|
||||
if (!(cond)) Poco::Bugcheck::assertion(#cond, __FILE__, __LINE__); else (void) 0
|
||||
|
||||
#define poco_assert_msg_dbg(cond, text) \
|
||||
if (!(cond)) Poco::Bugcheck::assertion(#cond, __FILE__, __LINE__, text); else (void) 0
|
||||
#else
|
||||
#define poco_assert_msg_dbg(cond, text)
|
||||
#define poco_assert_dbg(cond)
|
||||
#endif
|
||||
|
||||
@@ -93,6 +97,10 @@ protected:
|
||||
if (!(cond)) Poco::Bugcheck::assertion(#cond, __FILE__, __LINE__); else (void) 0
|
||||
|
||||
|
||||
#define poco_assert_msg(cond, text) \
|
||||
if (!(cond)) Poco::Bugcheck::assertion(#cond, __FILE__, __LINE__, text); else (void) 0
|
||||
|
||||
|
||||
#define poco_check_ptr(ptr) \
|
||||
if (!(ptr)) Poco::Bugcheck::nullPointer(#ptr, __FILE__, __LINE__); else (void) 0
|
||||
|
||||
@@ -103,8 +111,8 @@ protected:
|
||||
|
||||
#define poco_bugcheck_msg(msg) \
|
||||
Poco::Bugcheck::bugcheck(msg, __FILE__, __LINE__)
|
||||
|
||||
|
||||
|
||||
|
||||
#define poco_unexpected() \
|
||||
Poco::Bugcheck::unexpected(__FILE__, __LINE__);
|
||||
|
||||
@@ -135,22 +143,27 @@ protected:
|
||||
|
||||
//
|
||||
// poco_static_assert
|
||||
//
|
||||
//
|
||||
// The following was ported from <boost/static_assert.hpp>
|
||||
//
|
||||
|
||||
|
||||
#if defined(POCO_COMPILER_GCC) && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 406)
|
||||
GCC_DIAG_OFF(unused-local-typedefs) // supress numerous gcc warnings
|
||||
#endif // POCO_COMPILER_GCC && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 406)
|
||||
|
||||
|
||||
template <bool x>
|
||||
struct POCO_STATIC_ASSERTION_FAILURE;
|
||||
|
||||
|
||||
template <>
|
||||
struct POCO_STATIC_ASSERTION_FAILURE<true>
|
||||
template <>
|
||||
struct POCO_STATIC_ASSERTION_FAILURE<true>
|
||||
{
|
||||
enum
|
||||
{
|
||||
value = 1
|
||||
};
|
||||
enum
|
||||
{
|
||||
value = 1
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -45,8 +45,14 @@ class Foundation_API Clock
|
||||
/// to the time of day.
|
||||
{
|
||||
public:
|
||||
typedef Int64 ClockVal; /// monotonic clock value in microsecond resolution
|
||||
typedef Int64 ClockDiff; /// difference between two clock values in microseconds
|
||||
typedef Int64 ClockVal;
|
||||
/// Monotonic clock value in microsecond resolution.
|
||||
|
||||
typedef Int64 ClockDiff;
|
||||
/// Difference between two ClockVal values in microseconds.
|
||||
|
||||
static const ClockVal CLOCKVAL_MIN; /// Minimum clock value.
|
||||
static const ClockVal CLOCKVAL_MAX; /// Maximum clock value.
|
||||
|
||||
Clock();
|
||||
/// Creates a Clock with the current system clock value.
|
||||
@@ -78,7 +84,7 @@ public:
|
||||
|
||||
Clock operator + (ClockDiff d) const;
|
||||
Clock operator - (ClockDiff d) const;
|
||||
ClockDiff operator - (const Clock& ts) const;
|
||||
ClockDiff operator - (const Clock& ts) const;
|
||||
Clock& operator += (ClockDiff d);
|
||||
Clock& operator -= (ClockDiff d);
|
||||
|
||||
@@ -102,12 +108,12 @@ public:
|
||||
/// Returns true iff the given interval has passed
|
||||
/// since the time denoted by the Clock instance.
|
||||
|
||||
static ClockVal resolution();
|
||||
static ClockDiff resolution();
|
||||
/// Returns the resolution in units per second.
|
||||
/// Since the Clock clas has microsecond resolution,
|
||||
/// the returned value is always 1000000.
|
||||
|
||||
static ClockVal accuracy();
|
||||
static ClockDiff accuracy();
|
||||
/// Returns the system's clock accuracy in microseconds.
|
||||
|
||||
static bool monotonic();
|
||||
@@ -210,7 +216,7 @@ inline bool Clock::isElapsed(Clock::ClockDiff interval) const
|
||||
}
|
||||
|
||||
|
||||
inline Clock::ClockVal Clock::resolution()
|
||||
inline Clock::ClockDiff Clock::resolution()
|
||||
{
|
||||
return 1000000;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
|
||||
// Define to enable Windows Unicode (UTF-8) support
|
||||
// NOTE: As of POCO C++ Libraries release 1.6.0, compiling POCO
|
||||
// without POCO_WIN32_UTF8 defined on Windows is deprecated.
|
||||
#define POCO_WIN32_UTF8
|
||||
|
||||
|
||||
|
||||
@@ -47,6 +47,14 @@ class Foundation_API DateTimeParser
|
||||
/// additional specifier is supported: %r will parse a year given by either
|
||||
/// two or four digits. Years 69-00 are interpreted in the 20th century
|
||||
/// (1969-2000), years 01-68 in the 21th century (2001-2068).
|
||||
///
|
||||
/// Note that in the current implementation all characters other than format specifiers in
|
||||
/// the format string are ignored/not matched against the date/time string. This may
|
||||
/// lead to non-error results even with nonsense input strings.
|
||||
/// This may change in a future version to a more strict behavior.
|
||||
/// If more strict format validation of date/time strings is required, a regular
|
||||
/// expression could be used for initial validation, before passing the string
|
||||
/// to DateTimeParser.
|
||||
{
|
||||
public:
|
||||
static void parse(const std::string& fmt, const std::string& str, DateTime& dateTime, int& timeZoneDifferential);
|
||||
|
||||
@@ -37,6 +37,7 @@ class DefaultStrategy: public NotificationStrategy<TArgs, TDelegate>
|
||||
/// order in which they have been registered.
|
||||
{
|
||||
public:
|
||||
typedef TDelegate* DelegateHandle;
|
||||
typedef SharedPtr<TDelegate> DelegatePtr;
|
||||
typedef std::vector<DelegatePtr> Delegates;
|
||||
typedef typename Delegates::iterator Iterator;
|
||||
@@ -63,9 +64,11 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void add(const TDelegate& delegate)
|
||||
DelegateHandle add(const TDelegate& delegate)
|
||||
{
|
||||
_delegates.push_back(DelegatePtr(static_cast<TDelegate*>(delegate.clone())));
|
||||
DelegatePtr pDelegate(static_cast<TDelegate*>(delegate.clone()));
|
||||
_delegates.push_back(pDelegate);
|
||||
return pDelegate.get();
|
||||
}
|
||||
|
||||
void remove(const TDelegate& delegate)
|
||||
@@ -80,6 +83,19 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void remove(DelegateHandle delegateHandle)
|
||||
{
|
||||
for (Iterator it = _delegates.begin(); it != _delegates.end(); ++it)
|
||||
{
|
||||
if (*it == delegateHandle)
|
||||
{
|
||||
(*it)->disable();
|
||||
_delegates.erase(it);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DefaultStrategy& operator = (const DefaultStrategy& s)
|
||||
{
|
||||
@@ -108,6 +124,7 @@ protected:
|
||||
Delegates _delegates;
|
||||
};
|
||||
|
||||
|
||||
template <class TDelegate>
|
||||
class DefaultStrategy<void,TDelegate>: public NotificationStrategy<void, TDelegate>
|
||||
/// Default notification strategy.
|
||||
@@ -117,6 +134,7 @@ class DefaultStrategy<void,TDelegate>: public NotificationStrategy<void, TDelega
|
||||
/// order in which they have been registered.
|
||||
{
|
||||
public:
|
||||
typedef TDelegate* DelegateHandle;
|
||||
typedef SharedPtr<TDelegate> DelegatePtr;
|
||||
typedef std::vector<DelegatePtr> Delegates;
|
||||
typedef typename Delegates::iterator Iterator;
|
||||
@@ -143,9 +161,11 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void add(const TDelegate& delegate)
|
||||
DelegateHandle add(const TDelegate& delegate)
|
||||
{
|
||||
_delegates.push_back(DelegatePtr(static_cast<TDelegate*>(delegate.clone())));
|
||||
DelegatePtr pDelegate(static_cast<TDelegate*>(delegate.clone()));
|
||||
_delegates.push_back(pDelegate);
|
||||
return pDelegate.get();
|
||||
}
|
||||
|
||||
void remove(const TDelegate& delegate)
|
||||
@@ -161,6 +181,19 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void remove(DelegateHandle delegateHandle)
|
||||
{
|
||||
for (Iterator it = _delegates.begin(); it != _delegates.end(); ++it)
|
||||
{
|
||||
if (*it == delegateHandle)
|
||||
{
|
||||
(*it)->disable();
|
||||
_delegates.erase(it);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DefaultStrategy& operator = (const DefaultStrategy& s)
|
||||
{
|
||||
if (this != &s)
|
||||
@@ -188,6 +221,7 @@ protected:
|
||||
Delegates _delegates;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Poco
|
||||
|
||||
|
||||
|
||||
@@ -174,78 +174,75 @@ private:
|
||||
|
||||
|
||||
template <class TObj, class TArgs>
|
||||
static Delegate<TObj, TArgs, true> delegate(TObj* pObj, void (TObj::*NotifyMethod)(const void*, TArgs&))
|
||||
inline Delegate<TObj, TArgs, true> delegate(TObj* pObj, void (TObj::*NotifyMethod)(const void*, TArgs&))
|
||||
{
|
||||
return Delegate<TObj, TArgs, true>(pObj, NotifyMethod);
|
||||
}
|
||||
|
||||
|
||||
template <class TObj, class TArgs>
|
||||
static Delegate<TObj, TArgs, false> delegate(TObj* pObj, void (TObj::*NotifyMethod)(TArgs&))
|
||||
inline Delegate<TObj, TArgs, false> delegate(TObj* pObj, void (TObj::*NotifyMethod)(TArgs&))
|
||||
{
|
||||
return Delegate<TObj, TArgs, false>(pObj, NotifyMethod);
|
||||
}
|
||||
|
||||
|
||||
template <class TObj, class TArgs>
|
||||
static Expire<TArgs> delegate(TObj* pObj, void (TObj::*NotifyMethod)(const void*, TArgs&), Timestamp::TimeDiff expireMillisecs)
|
||||
inline Expire<TArgs> delegate(TObj* pObj, void (TObj::*NotifyMethod)(const void*, TArgs&), Timestamp::TimeDiff expireMillisecs)
|
||||
{
|
||||
return Expire<TArgs>(Delegate<TObj, TArgs, true>(pObj, NotifyMethod), expireMillisecs);
|
||||
}
|
||||
|
||||
|
||||
template <class TObj, class TArgs>
|
||||
static Expire<TArgs> delegate(TObj* pObj, void (TObj::*NotifyMethod)(TArgs&), Timestamp::TimeDiff expireMillisecs)
|
||||
inline Expire<TArgs> delegate(TObj* pObj, void (TObj::*NotifyMethod)(TArgs&), Timestamp::TimeDiff expireMillisecs)
|
||||
{
|
||||
return Expire<TArgs>(Delegate<TObj, TArgs, false>(pObj, NotifyMethod), expireMillisecs);
|
||||
}
|
||||
|
||||
|
||||
template <class TArgs>
|
||||
static Expire<TArgs> delegate(void (*NotifyMethod)(const void*, TArgs&), Timestamp::TimeDiff expireMillisecs)
|
||||
inline Expire<TArgs> delegate(void (*NotifyMethod)(const void*, TArgs&), Timestamp::TimeDiff expireMillisecs)
|
||||
{
|
||||
return Expire<TArgs>(FunctionDelegate<TArgs, true, true>(NotifyMethod), expireMillisecs);
|
||||
}
|
||||
|
||||
|
||||
template <class TArgs>
|
||||
static Expire<TArgs> delegate(void (*NotifyMethod)(void*, TArgs&), Timestamp::TimeDiff expireMillisecs)
|
||||
inline Expire<TArgs> delegate(void (*NotifyMethod)(void*, TArgs&), Timestamp::TimeDiff expireMillisecs)
|
||||
{
|
||||
return Expire<TArgs>(FunctionDelegate<TArgs, true, false>(NotifyMethod), expireMillisecs);
|
||||
}
|
||||
|
||||
|
||||
template <class TArgs>
|
||||
static Expire<TArgs> delegate(void (*NotifyMethod)(TArgs&), Timestamp::TimeDiff expireMillisecs)
|
||||
inline Expire<TArgs> delegate(void (*NotifyMethod)(TArgs&), Timestamp::TimeDiff expireMillisecs)
|
||||
{
|
||||
return Expire<TArgs>(FunctionDelegate<TArgs, false>(NotifyMethod), expireMillisecs);
|
||||
}
|
||||
|
||||
|
||||
template <class TArgs>
|
||||
static FunctionDelegate<TArgs, true, true> delegate(void (*NotifyMethod)(const void*, TArgs&))
|
||||
inline FunctionDelegate<TArgs, true, true> delegate(void (*NotifyMethod)(const void*, TArgs&))
|
||||
{
|
||||
return FunctionDelegate<TArgs, true, true>(NotifyMethod);
|
||||
}
|
||||
|
||||
|
||||
template <class TArgs>
|
||||
static FunctionDelegate<TArgs, true, false> delegate(void (*NotifyMethod)(void*, TArgs&))
|
||||
inline FunctionDelegate<TArgs, true, false> delegate(void (*NotifyMethod)(void*, TArgs&))
|
||||
{
|
||||
return FunctionDelegate<TArgs, true, false>(NotifyMethod);
|
||||
}
|
||||
|
||||
|
||||
template <class TArgs>
|
||||
static FunctionDelegate<TArgs, false> delegate(void (*NotifyMethod)(TArgs&))
|
||||
inline FunctionDelegate<TArgs, false> delegate(void (*NotifyMethod)(TArgs&))
|
||||
{
|
||||
return FunctionDelegate<TArgs, false>(NotifyMethod);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <class TObj>
|
||||
class Delegate<TObj,void,true>: public AbstractDelegate<void>
|
||||
{
|
||||
@@ -390,28 +387,28 @@ private:
|
||||
|
||||
|
||||
template <class TObj>
|
||||
static Delegate<TObj, void, true> delegate(TObj* pObj, void (TObj::*NotifyMethod)(const void*))
|
||||
inline Delegate<TObj, void, true> delegate(TObj* pObj, void (TObj::*NotifyMethod)(const void*))
|
||||
{
|
||||
return Delegate<TObj, void, true>(pObj, NotifyMethod);
|
||||
}
|
||||
|
||||
|
||||
template <class TObj>
|
||||
static Delegate<TObj, void, false> delegate(TObj* pObj, void (TObj::*NotifyMethod)())
|
||||
inline Delegate<TObj, void, false> delegate(TObj* pObj, void (TObj::*NotifyMethod)())
|
||||
{
|
||||
return Delegate<TObj, void, false>(pObj, NotifyMethod);
|
||||
}
|
||||
|
||||
|
||||
template <class TObj>
|
||||
static Expire<void> delegate(TObj* pObj, void (TObj::*NotifyMethod)(const void*), Timestamp::TimeDiff expireMillisecs)
|
||||
inline Expire<void> delegate(TObj* pObj, void (TObj::*NotifyMethod)(const void*), Timestamp::TimeDiff expireMillisecs)
|
||||
{
|
||||
return Expire<void>(Delegate<TObj, void, true>(pObj, NotifyMethod), expireMillisecs);
|
||||
}
|
||||
|
||||
|
||||
template <class TObj>
|
||||
static Expire<void> delegate(TObj* pObj, void (TObj::*NotifyMethod)(), Timestamp::TimeDiff expireMillisecs)
|
||||
inline Expire<void> delegate(TObj* pObj, void (TObj::*NotifyMethod)(), Timestamp::TimeDiff expireMillisecs)
|
||||
{
|
||||
return Expire<void>(Delegate<TObj, void, false>(pObj, NotifyMethod), expireMillisecs);
|
||||
}
|
||||
@@ -452,6 +449,7 @@ inline FunctionDelegate<void, false> delegate(void (*NotifyMethod)())
|
||||
return FunctionDelegate<void, false>(NotifyMethod);
|
||||
}
|
||||
|
||||
|
||||
} // namespace Poco
|
||||
|
||||
|
||||
|
||||
@@ -542,6 +542,7 @@ private:
|
||||
static Var parseObject(const std::string& val, std::string::size_type& pos);
|
||||
static Var parseArray(const std::string& val, std::string::size_type& pos);
|
||||
static std::string parseString(const std::string& val, std::string::size_type& pos);
|
||||
static std::string parseJSONString(const std::string& val, std::string::size_type& pos);
|
||||
static void skipWhiteSpace(const std::string& val, std::string::size_type& pos);
|
||||
|
||||
template <typename T>
|
||||
|
||||
@@ -33,9 +33,15 @@ class Foundation_API Error
|
||||
public:
|
||||
|
||||
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||
static DWORD last();
|
||||
/// Utility function returning the last error.
|
||||
|
||||
static std::string getMessage(DWORD errorCode);
|
||||
/// Utility function translating numeric error code to string.
|
||||
#else
|
||||
static int last();
|
||||
/// Utility function returning the last error.
|
||||
|
||||
static std::string getMessage(int errorCode);
|
||||
/// Utility function translating numeric error code to string.
|
||||
#endif
|
||||
|
||||
@@ -108,6 +108,7 @@ private:
|
||||
Expire();
|
||||
};
|
||||
|
||||
|
||||
template <>
|
||||
class Expire<void>: public AbstractDelegate<void>
|
||||
/// Decorator for AbstractDelegate adding automatic
|
||||
@@ -189,7 +190,6 @@ private:
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // namespace Poco
|
||||
|
||||
|
||||
|
||||
@@ -24,6 +24,25 @@
|
||||
#include <float.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifndef _SW_INEXACT
|
||||
# define _SW_INEXACT 0x00000001 // inexact (precision)
|
||||
#endif
|
||||
#ifndef _SW_UNDERFLOW
|
||||
# define _SW_UNDERFLOW 0x00000002 // underflow
|
||||
#endif
|
||||
#ifndef _SW_OVERFLOW
|
||||
# define _SW_OVERFLOW 0x00000004 // overflow
|
||||
#endif
|
||||
#ifndef _SW_ZERODIVIDE
|
||||
# define _SW_ZERODIVIDE 0x00000008 // zero divide
|
||||
#endif
|
||||
#ifndef _SW_INVALID
|
||||
# define _SW_INVALID 0x00000010 // invalid
|
||||
#endif
|
||||
#ifndef _SW_DENORMAL
|
||||
# define _SW_DENORMAL 0x00080000 // denormal status bit
|
||||
#endif
|
||||
|
||||
|
||||
namespace Poco {
|
||||
|
||||
@@ -33,24 +52,24 @@ class Foundation_API FPEnvironmentImpl
|
||||
protected:
|
||||
enum RoundingModeImpl
|
||||
{
|
||||
FP_ROUND_DOWNWARD_IMPL = RC_DOWN,
|
||||
FP_ROUND_UPWARD_IMPL = RC_UP,
|
||||
FP_ROUND_TONEAREST_IMPL = RC_NEAR,
|
||||
FP_ROUND_TOWARDZERO_IMPL = RC_CHOP
|
||||
FP_ROUND_DOWNWARD_IMPL = _RC_DOWN,
|
||||
FP_ROUND_UPWARD_IMPL = _RC_UP,
|
||||
FP_ROUND_TONEAREST_IMPL = _RC_NEAR,
|
||||
FP_ROUND_TOWARDZERO_IMPL = _RC_CHOP
|
||||
};
|
||||
enum FlagImpl
|
||||
{
|
||||
FP_DIVIDE_BY_ZERO_IMPL = SW_ZERODIVIDE,
|
||||
FP_INEXACT_IMPL = SW_INEXACT,
|
||||
FP_OVERFLOW_IMPL = SW_OVERFLOW,
|
||||
FP_UNDERFLOW_IMPL = SW_UNDERFLOW,
|
||||
FP_INVALID_IMPL = SW_INVALID
|
||||
FP_DIVIDE_BY_ZERO_IMPL = _SW_ZERODIVIDE,
|
||||
FP_INEXACT_IMPL = _SW_INEXACT,
|
||||
FP_OVERFLOW_IMPL = _SW_OVERFLOW,
|
||||
FP_UNDERFLOW_IMPL = _SW_UNDERFLOW,
|
||||
FP_INVALID_IMPL = _SW_INVALID
|
||||
};
|
||||
FPEnvironmentImpl();
|
||||
FPEnvironmentImpl(const FPEnvironmentImpl& env);
|
||||
~FPEnvironmentImpl();
|
||||
FPEnvironmentImpl& operator = (const FPEnvironmentImpl& env);
|
||||
void keepCurrentImpl();
|
||||
void keepCurrentImpl();
|
||||
static void clearFlagsImpl();
|
||||
static bool isFlagImpl(FlagImpl flag);
|
||||
static void setRoundingModeImpl(RoundingModeImpl mode);
|
||||
|
||||
@@ -109,6 +109,10 @@ std::string Foundation_API format(const std::string& fmt, const Any& value1, con
|
||||
std::string Foundation_API format(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4);
|
||||
std::string Foundation_API format(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5);
|
||||
std::string Foundation_API format(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6);
|
||||
std::string Foundation_API format(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7);
|
||||
std::string Foundation_API format(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8);
|
||||
std::string Foundation_API format(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9);
|
||||
std::string Foundation_API format(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9, const Any& value10);
|
||||
|
||||
|
||||
void Foundation_API format(std::string& result, const std::string& fmt, const Any& value);
|
||||
@@ -119,6 +123,10 @@ void Foundation_API format(std::string& result, const std::string& fmt, const An
|
||||
void Foundation_API format(std::string& result, const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4);
|
||||
void Foundation_API format(std::string& result, const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5);
|
||||
void Foundation_API format(std::string& result, const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6);
|
||||
void Foundation_API format(std::string& result, const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7);
|
||||
void Foundation_API format(std::string& result, const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8);
|
||||
void Foundation_API format(std::string& result, const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9);
|
||||
void Foundation_API format(std::string& result, const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9, const Any& value10);
|
||||
|
||||
|
||||
void Foundation_API format(std::string& result, const std::string& fmt, const std::vector<Any>& values);
|
||||
|
||||
@@ -34,16 +34,16 @@ class FunctionDelegate: public AbstractDelegate<TArgs>
|
||||
/// for use as a Delegate.
|
||||
{
|
||||
public:
|
||||
typedef void (*NotifyMethod)(const void*, TArgs&);
|
||||
typedef void (*NotifyFunction)(const void*, TArgs&);
|
||||
|
||||
FunctionDelegate(NotifyMethod method):
|
||||
_receiverMethod(method)
|
||||
FunctionDelegate(NotifyFunction function):
|
||||
_function(function)
|
||||
{
|
||||
}
|
||||
|
||||
FunctionDelegate(const FunctionDelegate& delegate):
|
||||
AbstractDelegate<TArgs>(delegate),
|
||||
_receiverMethod(delegate._receiverMethod)
|
||||
_function(delegate._function)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -55,8 +55,7 @@ public:
|
||||
{
|
||||
if (&delegate != this)
|
||||
{
|
||||
this->_pTarget = delegate._pTarget;
|
||||
this->_receiverMethod = delegate._receiverMethod;
|
||||
this->_function = delegate._function;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -64,9 +63,9 @@ public:
|
||||
bool notify(const void* sender, TArgs& arguments)
|
||||
{
|
||||
Mutex::ScopedLock lock(_mutex);
|
||||
if (_receiverMethod)
|
||||
if (_function)
|
||||
{
|
||||
(*_receiverMethod)(sender, arguments);
|
||||
(*_function)(sender, arguments);
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
@@ -75,7 +74,7 @@ public:
|
||||
bool equals(const AbstractDelegate<TArgs>& other) const
|
||||
{
|
||||
const FunctionDelegate* pOtherDelegate = dynamic_cast<const FunctionDelegate*>(other.unwrap());
|
||||
return pOtherDelegate && _receiverMethod == pOtherDelegate->_receiverMethod;
|
||||
return pOtherDelegate && _function == pOtherDelegate->_function;
|
||||
}
|
||||
|
||||
AbstractDelegate<TArgs>* clone() const
|
||||
@@ -86,11 +85,11 @@ public:
|
||||
void disable()
|
||||
{
|
||||
Mutex::ScopedLock lock(_mutex);
|
||||
_receiverMethod = 0;
|
||||
_function = 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
NotifyMethod _receiverMethod;
|
||||
NotifyFunction _function;
|
||||
Mutex _mutex;
|
||||
|
||||
private:
|
||||
@@ -102,16 +101,16 @@ template <class TArgs>
|
||||
class FunctionDelegate<TArgs, true, false>: public AbstractDelegate<TArgs>
|
||||
{
|
||||
public:
|
||||
typedef void (*NotifyMethod)(void*, TArgs&);
|
||||
typedef void (*NotifyFunction)(void*, TArgs&);
|
||||
|
||||
FunctionDelegate(NotifyMethod method):
|
||||
_receiverMethod(method)
|
||||
FunctionDelegate(NotifyFunction function):
|
||||
_function(function)
|
||||
{
|
||||
}
|
||||
|
||||
FunctionDelegate(const FunctionDelegate& delegate):
|
||||
AbstractDelegate<TArgs>(delegate),
|
||||
_receiverMethod(delegate._receiverMethod)
|
||||
_function(delegate._function)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -123,8 +122,7 @@ public:
|
||||
{
|
||||
if (&delegate != this)
|
||||
{
|
||||
this->_pTarget = delegate._pTarget;
|
||||
this->_receiverMethod = delegate._receiverMethod;
|
||||
this->_function = delegate._function;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -132,9 +130,9 @@ public:
|
||||
bool notify(const void* sender, TArgs& arguments)
|
||||
{
|
||||
Mutex::ScopedLock lock(_mutex);
|
||||
if (_receiverMethod)
|
||||
if (_function)
|
||||
{
|
||||
(*_receiverMethod)(const_cast<void*>(sender), arguments);
|
||||
(*_function)(const_cast<void*>(sender), arguments);
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
@@ -143,7 +141,7 @@ public:
|
||||
bool equals(const AbstractDelegate<TArgs>& other) const
|
||||
{
|
||||
const FunctionDelegate* pOtherDelegate = dynamic_cast<const FunctionDelegate*>(other.unwrap());
|
||||
return pOtherDelegate && _receiverMethod == pOtherDelegate->_receiverMethod;
|
||||
return pOtherDelegate && _function == pOtherDelegate->_function;
|
||||
}
|
||||
|
||||
AbstractDelegate<TArgs>* clone() const
|
||||
@@ -154,11 +152,11 @@ public:
|
||||
void disable()
|
||||
{
|
||||
Mutex::ScopedLock lock(_mutex);
|
||||
_receiverMethod = 0;
|
||||
_function = 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
NotifyMethod _receiverMethod;
|
||||
NotifyFunction _function;
|
||||
Mutex _mutex;
|
||||
|
||||
private:
|
||||
@@ -170,16 +168,16 @@ template <class TArgs, bool senderIsConst>
|
||||
class FunctionDelegate<TArgs, false, senderIsConst>: public AbstractDelegate<TArgs>
|
||||
{
|
||||
public:
|
||||
typedef void (*NotifyMethod)(TArgs&);
|
||||
typedef void (*NotifyFunction)(TArgs&);
|
||||
|
||||
FunctionDelegate(NotifyMethod method):
|
||||
_receiverMethod(method)
|
||||
FunctionDelegate(NotifyFunction function):
|
||||
_function(function)
|
||||
{
|
||||
}
|
||||
|
||||
FunctionDelegate(const FunctionDelegate& delegate):
|
||||
AbstractDelegate<TArgs>(delegate),
|
||||
_receiverMethod(delegate._receiverMethod)
|
||||
_function(delegate._function)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -191,8 +189,7 @@ public:
|
||||
{
|
||||
if (&delegate != this)
|
||||
{
|
||||
this->_pTarget = delegate._pTarget;
|
||||
this->_receiverMethod = delegate._receiverMethod;
|
||||
this->_function = delegate._function;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -200,9 +197,9 @@ public:
|
||||
bool notify(const void* /*sender*/, TArgs& arguments)
|
||||
{
|
||||
Mutex::ScopedLock lock(_mutex);
|
||||
if (_receiverMethod)
|
||||
if (_function)
|
||||
{
|
||||
(*_receiverMethod)(arguments);
|
||||
(*_function)(arguments);
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
@@ -211,7 +208,7 @@ public:
|
||||
bool equals(const AbstractDelegate<TArgs>& other) const
|
||||
{
|
||||
const FunctionDelegate* pOtherDelegate = dynamic_cast<const FunctionDelegate*>(other.unwrap());
|
||||
return pOtherDelegate && _receiverMethod == pOtherDelegate->_receiverMethod;
|
||||
return pOtherDelegate && _function == pOtherDelegate->_function;
|
||||
}
|
||||
|
||||
AbstractDelegate<TArgs>* clone() const
|
||||
@@ -222,11 +219,11 @@ public:
|
||||
void disable()
|
||||
{
|
||||
Mutex::ScopedLock lock(_mutex);
|
||||
_receiverMethod = 0;
|
||||
_function = 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
NotifyMethod _receiverMethod;
|
||||
NotifyFunction _function;
|
||||
Mutex _mutex;
|
||||
|
||||
private:
|
||||
@@ -234,26 +231,22 @@ private:
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <>
|
||||
class FunctionDelegate<void,true,true>: public AbstractDelegate<void>
|
||||
class FunctionDelegate<void, true, true>: public AbstractDelegate<void>
|
||||
/// Wraps a freestanding function or static member function
|
||||
/// for use as a Delegate.
|
||||
{
|
||||
public:
|
||||
typedef void (*NotifyMethod)(const void*);
|
||||
typedef void (*NotifyFunction)(const void*);
|
||||
|
||||
FunctionDelegate(NotifyMethod method):
|
||||
_receiverMethod(method)
|
||||
FunctionDelegate(NotifyFunction function):
|
||||
_function(function)
|
||||
{
|
||||
}
|
||||
|
||||
FunctionDelegate(const FunctionDelegate& delegate):
|
||||
AbstractDelegate<void>(delegate),
|
||||
_receiverMethod(delegate._receiverMethod)
|
||||
_function(delegate._function)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -265,8 +258,7 @@ public:
|
||||
{
|
||||
if (&delegate != this)
|
||||
{
|
||||
//this->_pTarget = delegate._pTarget;
|
||||
this->_receiverMethod = delegate._receiverMethod;
|
||||
this->_function = delegate._function;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -274,9 +266,9 @@ public:
|
||||
bool notify(const void* sender)
|
||||
{
|
||||
Mutex::ScopedLock lock(_mutex);
|
||||
if (_receiverMethod)
|
||||
if (_function)
|
||||
{
|
||||
(*_receiverMethod)(sender);
|
||||
(*_function)(sender);
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
@@ -285,7 +277,7 @@ public:
|
||||
bool equals(const AbstractDelegate<void>& other) const
|
||||
{
|
||||
const FunctionDelegate* pOtherDelegate = dynamic_cast<const FunctionDelegate*>(other.unwrap());
|
||||
return pOtherDelegate && _receiverMethod == pOtherDelegate->_receiverMethod;
|
||||
return pOtherDelegate && _function == pOtherDelegate->_function;
|
||||
}
|
||||
|
||||
AbstractDelegate<void>* clone() const
|
||||
@@ -296,11 +288,11 @@ public:
|
||||
void disable()
|
||||
{
|
||||
Mutex::ScopedLock lock(_mutex);
|
||||
_receiverMethod = 0;
|
||||
_function = 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
NotifyMethod _receiverMethod;
|
||||
NotifyFunction _function;
|
||||
Mutex _mutex;
|
||||
|
||||
private:
|
||||
@@ -312,16 +304,16 @@ template <>
|
||||
class FunctionDelegate<void, true, false>: public AbstractDelegate<void>
|
||||
{
|
||||
public:
|
||||
typedef void (*NotifyMethod)(void*);
|
||||
typedef void (*NotifyFunction)(void*);
|
||||
|
||||
FunctionDelegate(NotifyMethod method):
|
||||
_receiverMethod(method)
|
||||
FunctionDelegate(NotifyFunction function):
|
||||
_function(function)
|
||||
{
|
||||
}
|
||||
|
||||
FunctionDelegate(const FunctionDelegate& delegate):
|
||||
AbstractDelegate<void>(delegate),
|
||||
_receiverMethod(delegate._receiverMethod)
|
||||
_function(delegate._function)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -333,8 +325,7 @@ public:
|
||||
{
|
||||
if (&delegate != this)
|
||||
{
|
||||
//this->_pTarget = delegate._pTarget;
|
||||
this->_receiverMethod = delegate._receiverMethod;
|
||||
this->_function = delegate._function;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -342,9 +333,9 @@ public:
|
||||
bool notify(const void* sender)
|
||||
{
|
||||
Mutex::ScopedLock lock(_mutex);
|
||||
if (_receiverMethod)
|
||||
if (_function)
|
||||
{
|
||||
(*_receiverMethod)(const_cast<void*>(sender));
|
||||
(*_function)(const_cast<void*>(sender));
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
@@ -353,7 +344,7 @@ public:
|
||||
bool equals(const AbstractDelegate<void>& other) const
|
||||
{
|
||||
const FunctionDelegate* pOtherDelegate = dynamic_cast<const FunctionDelegate*>(other.unwrap());
|
||||
return pOtherDelegate && _receiverMethod == pOtherDelegate->_receiverMethod;
|
||||
return pOtherDelegate && _function == pOtherDelegate->_function;
|
||||
}
|
||||
|
||||
AbstractDelegate<void>* clone() const
|
||||
@@ -364,11 +355,11 @@ public:
|
||||
void disable()
|
||||
{
|
||||
Mutex::ScopedLock lock(_mutex);
|
||||
_receiverMethod = 0;
|
||||
_function = 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
NotifyMethod _receiverMethod;
|
||||
NotifyFunction _function;
|
||||
Mutex _mutex;
|
||||
|
||||
private:
|
||||
@@ -380,16 +371,16 @@ template <bool senderIsConst>
|
||||
class FunctionDelegate<void, false, senderIsConst>: public AbstractDelegate<void>
|
||||
{
|
||||
public:
|
||||
typedef void (*NotifyMethod)();
|
||||
typedef void (*NotifyFunction)();
|
||||
|
||||
FunctionDelegate(NotifyMethod method):
|
||||
_receiverMethod(method)
|
||||
FunctionDelegate(NotifyFunction function):
|
||||
_function(function)
|
||||
{
|
||||
}
|
||||
|
||||
FunctionDelegate(const FunctionDelegate& delegate):
|
||||
AbstractDelegate<void>(delegate),
|
||||
_receiverMethod(delegate._receiverMethod)
|
||||
_function(delegate._function)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -401,8 +392,7 @@ public:
|
||||
{
|
||||
if (&delegate != this)
|
||||
{
|
||||
//this->_pTarget = delegate._pTarget;
|
||||
this->_receiverMethod = delegate._receiverMethod;
|
||||
this->_function = delegate._function;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -410,9 +400,9 @@ public:
|
||||
bool notify(const void* /*sender*/)
|
||||
{
|
||||
Mutex::ScopedLock lock(_mutex);
|
||||
if (_receiverMethod)
|
||||
if (_function)
|
||||
{
|
||||
(*_receiverMethod)();
|
||||
(*_function)();
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
@@ -421,7 +411,7 @@ public:
|
||||
bool equals(const AbstractDelegate<void>& other) const
|
||||
{
|
||||
const FunctionDelegate* pOtherDelegate = dynamic_cast<const FunctionDelegate*>(other.unwrap());
|
||||
return pOtherDelegate && _receiverMethod == pOtherDelegate->_receiverMethod;
|
||||
return pOtherDelegate && _function == pOtherDelegate->_function;
|
||||
}
|
||||
|
||||
AbstractDelegate<void>* clone() const
|
||||
@@ -432,11 +422,11 @@ public:
|
||||
void disable()
|
||||
{
|
||||
Mutex::ScopedLock lock(_mutex);
|
||||
_receiverMethod = 0;
|
||||
_function = 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
NotifyMethod _receiverMethod;
|
||||
NotifyFunction _function;
|
||||
Mutex _mutex;
|
||||
|
||||
private:
|
||||
|
||||
@@ -34,17 +34,17 @@ class FunctionPriorityDelegate: public AbstractPriorityDelegate<TArgs>
|
||||
/// for use as a PriorityDelegate.
|
||||
{
|
||||
public:
|
||||
typedef void (*NotifyMethod)(const void*, TArgs&);
|
||||
typedef void (*NotifyFunction)(const void*, TArgs&);
|
||||
|
||||
FunctionPriorityDelegate(NotifyMethod method, int prio):
|
||||
FunctionPriorityDelegate(NotifyFunction function, int prio):
|
||||
AbstractPriorityDelegate<TArgs>(prio),
|
||||
_receiverMethod(method)
|
||||
_function(function)
|
||||
{
|
||||
}
|
||||
|
||||
FunctionPriorityDelegate(const FunctionPriorityDelegate& delegate):
|
||||
AbstractPriorityDelegate<TArgs>(delegate),
|
||||
_receiverMethod(delegate._receiverMethod)
|
||||
_function(delegate._function)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -52,9 +52,8 @@ public:
|
||||
{
|
||||
if (&delegate != this)
|
||||
{
|
||||
this->_pTarget = delegate._pTarget;
|
||||
this->_receiverMethod = delegate._receiverMethod;
|
||||
this->_priority = delegate._priority;
|
||||
this->_function = delegate._function;
|
||||
this->_priority = delegate._priority;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -66,9 +65,9 @@ public:
|
||||
bool notify(const void* sender, TArgs& arguments)
|
||||
{
|
||||
Mutex::ScopedLock lock(_mutex);
|
||||
if (_receiverMethod)
|
||||
if (_function)
|
||||
{
|
||||
(*_receiverMethod)(sender, arguments);
|
||||
(*_function)(sender, arguments);
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
@@ -77,7 +76,7 @@ public:
|
||||
bool equals(const AbstractDelegate<TArgs>& other) const
|
||||
{
|
||||
const FunctionPriorityDelegate* pOtherDelegate = dynamic_cast<const FunctionPriorityDelegate*>(other.unwrap());
|
||||
return pOtherDelegate && this->priority() == pOtherDelegate->priority() && _receiverMethod == pOtherDelegate->_receiverMethod;
|
||||
return pOtherDelegate && this->priority() == pOtherDelegate->priority() && _function == pOtherDelegate->_function;
|
||||
}
|
||||
|
||||
AbstractDelegate<TArgs>* clone() const
|
||||
@@ -88,11 +87,11 @@ public:
|
||||
void disable()
|
||||
{
|
||||
Mutex::ScopedLock lock(_mutex);
|
||||
_receiverMethod = 0;
|
||||
_function = 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
NotifyMethod _receiverMethod;
|
||||
NotifyFunction _function;
|
||||
Mutex _mutex;
|
||||
|
||||
private:
|
||||
@@ -104,17 +103,17 @@ template <class TArgs>
|
||||
class FunctionPriorityDelegate<TArgs, true, false>: public AbstractPriorityDelegate<TArgs>
|
||||
{
|
||||
public:
|
||||
typedef void (*NotifyMethod)(void*, TArgs&);
|
||||
typedef void (*NotifyFunction)(void*, TArgs&);
|
||||
|
||||
FunctionPriorityDelegate(NotifyMethod method, int prio):
|
||||
FunctionPriorityDelegate(NotifyFunction function, int prio):
|
||||
AbstractPriorityDelegate<TArgs>(prio),
|
||||
_receiverMethod(method)
|
||||
_function(function)
|
||||
{
|
||||
}
|
||||
|
||||
FunctionPriorityDelegate(const FunctionPriorityDelegate& delegate):
|
||||
AbstractPriorityDelegate<TArgs>(delegate),
|
||||
_receiverMethod(delegate._receiverMethod)
|
||||
_function(delegate._function)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -122,9 +121,8 @@ public:
|
||||
{
|
||||
if (&delegate != this)
|
||||
{
|
||||
this->_pTarget = delegate._pTarget;
|
||||
this->_receiverMethod = delegate._receiverMethod;
|
||||
this->_priority = delegate._priority;
|
||||
this->_function = delegate._function;
|
||||
this->_priority = delegate._priority;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -136,9 +134,9 @@ public:
|
||||
bool notify(const void* sender, TArgs& arguments)
|
||||
{
|
||||
Mutex::ScopedLock lock(_mutex);
|
||||
if (_receiverMethod)
|
||||
if (_function)
|
||||
{
|
||||
(*_receiverMethod)(const_cast<void*>(sender), arguments);
|
||||
(*_function)(const_cast<void*>(sender), arguments);
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
@@ -147,7 +145,7 @@ public:
|
||||
bool equals(const AbstractDelegate<TArgs>& other) const
|
||||
{
|
||||
const FunctionPriorityDelegate* pOtherDelegate = dynamic_cast<const FunctionPriorityDelegate*>(other.unwrap());
|
||||
return pOtherDelegate && this->priority() == pOtherDelegate->priority() && _receiverMethod == pOtherDelegate->_receiverMethod;
|
||||
return pOtherDelegate && this->priority() == pOtherDelegate->priority() && _function == pOtherDelegate->_function;
|
||||
}
|
||||
|
||||
AbstractDelegate<TArgs>* clone() const
|
||||
@@ -158,11 +156,11 @@ public:
|
||||
void disable()
|
||||
{
|
||||
Mutex::ScopedLock lock(_mutex);
|
||||
_receiverMethod = 0;
|
||||
_function = 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
NotifyMethod _receiverMethod;
|
||||
NotifyFunction _function;
|
||||
Mutex _mutex;
|
||||
|
||||
private:
|
||||
@@ -174,17 +172,17 @@ template <class TArgs>
|
||||
class FunctionPriorityDelegate<TArgs, false>: public AbstractPriorityDelegate<TArgs>
|
||||
{
|
||||
public:
|
||||
typedef void (*NotifyMethod)(TArgs&);
|
||||
typedef void (*NotifyFunction)(TArgs&);
|
||||
|
||||
FunctionPriorityDelegate(NotifyMethod method, int prio):
|
||||
FunctionPriorityDelegate(NotifyFunction function, int prio):
|
||||
AbstractPriorityDelegate<TArgs>(prio),
|
||||
_receiverMethod(method)
|
||||
_function(function)
|
||||
{
|
||||
}
|
||||
|
||||
FunctionPriorityDelegate(const FunctionPriorityDelegate& delegate):
|
||||
AbstractPriorityDelegate<TArgs>(delegate),
|
||||
_receiverMethod(delegate._receiverMethod)
|
||||
_function(delegate._function)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -192,9 +190,8 @@ public:
|
||||
{
|
||||
if (&delegate != this)
|
||||
{
|
||||
this->_pTarget = delegate._pTarget;
|
||||
this->_receiverMethod = delegate._receiverMethod;
|
||||
this->_priority = delegate._priority;
|
||||
this->_function = delegate._function;
|
||||
this->_priority = delegate._priority;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -206,9 +203,9 @@ public:
|
||||
bool notify(const void* sender, TArgs& arguments)
|
||||
{
|
||||
Mutex::ScopedLock lock(_mutex);
|
||||
if (_receiverMethod)
|
||||
if (_function)
|
||||
{
|
||||
(*_receiverMethod)(arguments);
|
||||
(*_function)(arguments);
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
@@ -217,7 +214,7 @@ public:
|
||||
bool equals(const AbstractDelegate<TArgs>& other) const
|
||||
{
|
||||
const FunctionPriorityDelegate* pOtherDelegate = dynamic_cast<const FunctionPriorityDelegate*>(other.unwrap());
|
||||
return pOtherDelegate && this->priority() == pOtherDelegate->priority() && _receiverMethod == pOtherDelegate->_receiverMethod;
|
||||
return pOtherDelegate && this->priority() == pOtherDelegate->priority() && _function == pOtherDelegate->_function;
|
||||
}
|
||||
|
||||
AbstractDelegate<TArgs>* clone() const
|
||||
@@ -228,11 +225,11 @@ public:
|
||||
void disable()
|
||||
{
|
||||
Mutex::ScopedLock lock(_mutex);
|
||||
_receiverMethod = 0;
|
||||
_function = 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
NotifyMethod _receiverMethod;
|
||||
NotifyFunction _function;
|
||||
Mutex _mutex;
|
||||
|
||||
private:
|
||||
@@ -241,22 +238,22 @@ private:
|
||||
|
||||
|
||||
template <>
|
||||
class FunctionPriorityDelegate<void,true,true>: public AbstractPriorityDelegate<void>
|
||||
class FunctionPriorityDelegate<void, true, true>: public AbstractPriorityDelegate<void>
|
||||
/// Wraps a freestanding function or static member function
|
||||
/// for use as a PriorityDelegate.
|
||||
{
|
||||
public:
|
||||
typedef void (*NotifyMethod)(const void*);
|
||||
typedef void (*NotifyFunction)(const void*);
|
||||
|
||||
FunctionPriorityDelegate(NotifyMethod method, int prio):
|
||||
FunctionPriorityDelegate(NotifyFunction function, int prio):
|
||||
AbstractPriorityDelegate<void>(prio),
|
||||
_receiverMethod(method)
|
||||
_function(function)
|
||||
{
|
||||
}
|
||||
|
||||
FunctionPriorityDelegate(const FunctionPriorityDelegate& delegate):
|
||||
AbstractPriorityDelegate<void>(delegate),
|
||||
_receiverMethod(delegate._receiverMethod)
|
||||
_function(delegate._function)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -264,8 +261,8 @@ public:
|
||||
{
|
||||
if (&delegate != this)
|
||||
{
|
||||
this->_receiverMethod = delegate._receiverMethod;
|
||||
this->_priority = delegate._priority;
|
||||
this->_function = delegate._function;
|
||||
this->_priority = delegate._priority;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -277,9 +274,9 @@ public:
|
||||
bool notify(const void* sender)
|
||||
{
|
||||
Mutex::ScopedLock lock(_mutex);
|
||||
if (_receiverMethod)
|
||||
if (_function)
|
||||
{
|
||||
(*_receiverMethod)(sender);
|
||||
(*_function)(sender);
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
@@ -288,7 +285,7 @@ public:
|
||||
bool equals(const AbstractDelegate<void>& other) const
|
||||
{
|
||||
const FunctionPriorityDelegate* pOtherDelegate = dynamic_cast<const FunctionPriorityDelegate*>(other.unwrap());
|
||||
return pOtherDelegate && this->priority() == pOtherDelegate->priority() && _receiverMethod == pOtherDelegate->_receiverMethod;
|
||||
return pOtherDelegate && this->priority() == pOtherDelegate->priority() && _function == pOtherDelegate->_function;
|
||||
}
|
||||
|
||||
AbstractDelegate<void>* clone() const
|
||||
@@ -299,11 +296,11 @@ public:
|
||||
void disable()
|
||||
{
|
||||
Mutex::ScopedLock lock(_mutex);
|
||||
_receiverMethod = 0;
|
||||
_function = 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
NotifyMethod _receiverMethod;
|
||||
NotifyFunction _function;
|
||||
Mutex _mutex;
|
||||
|
||||
private:
|
||||
@@ -315,17 +312,17 @@ template <>
|
||||
class FunctionPriorityDelegate<void, true, false>: public AbstractPriorityDelegate<void>
|
||||
{
|
||||
public:
|
||||
typedef void (*NotifyMethod)(void*);
|
||||
typedef void (*NotifyFunction)(void*);
|
||||
|
||||
FunctionPriorityDelegate(NotifyMethod method, int prio):
|
||||
FunctionPriorityDelegate(NotifyFunction function, int prio):
|
||||
AbstractPriorityDelegate<void>(prio),
|
||||
_receiverMethod(method)
|
||||
_function(function)
|
||||
{
|
||||
}
|
||||
|
||||
FunctionPriorityDelegate(const FunctionPriorityDelegate& delegate):
|
||||
AbstractPriorityDelegate<void>(delegate),
|
||||
_receiverMethod(delegate._receiverMethod)
|
||||
_function(delegate._function)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -333,8 +330,8 @@ public:
|
||||
{
|
||||
if (&delegate != this)
|
||||
{
|
||||
this->_receiverMethod = delegate._receiverMethod;
|
||||
this->_priority = delegate._priority;
|
||||
this->_function = delegate._function;
|
||||
this->_priority = delegate._priority;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -346,9 +343,9 @@ public:
|
||||
bool notify(const void* sender)
|
||||
{
|
||||
Mutex::ScopedLock lock(_mutex);
|
||||
if (_receiverMethod)
|
||||
if (_function)
|
||||
{
|
||||
(*_receiverMethod)(const_cast<void*>(sender));
|
||||
(*_function)(const_cast<void*>(sender));
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
@@ -357,7 +354,7 @@ public:
|
||||
bool equals(const AbstractDelegate<void>& other) const
|
||||
{
|
||||
const FunctionPriorityDelegate* pOtherDelegate = dynamic_cast<const FunctionPriorityDelegate*>(other.unwrap());
|
||||
return pOtherDelegate && this->priority() == pOtherDelegate->priority() && _receiverMethod == pOtherDelegate->_receiverMethod;
|
||||
return pOtherDelegate && this->priority() == pOtherDelegate->priority() && _function == pOtherDelegate->_function;
|
||||
}
|
||||
|
||||
AbstractDelegate<void>* clone() const
|
||||
@@ -368,11 +365,11 @@ public:
|
||||
void disable()
|
||||
{
|
||||
Mutex::ScopedLock lock(_mutex);
|
||||
_receiverMethod = 0;
|
||||
_function = 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
NotifyMethod _receiverMethod;
|
||||
NotifyFunction _function;
|
||||
Mutex _mutex;
|
||||
|
||||
private:
|
||||
@@ -384,17 +381,17 @@ template <>
|
||||
class FunctionPriorityDelegate<void, false>: public AbstractPriorityDelegate<void>
|
||||
{
|
||||
public:
|
||||
typedef void (*NotifyMethod)();
|
||||
typedef void (*NotifyFunction)();
|
||||
|
||||
FunctionPriorityDelegate(NotifyMethod method, int prio):
|
||||
FunctionPriorityDelegate(NotifyFunction function, int prio):
|
||||
AbstractPriorityDelegate<void>(prio),
|
||||
_receiverMethod(method)
|
||||
_function(function)
|
||||
{
|
||||
}
|
||||
|
||||
FunctionPriorityDelegate(const FunctionPriorityDelegate& delegate):
|
||||
AbstractPriorityDelegate<void>(delegate),
|
||||
_receiverMethod(delegate._receiverMethod)
|
||||
_function(delegate._function)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -402,8 +399,8 @@ public:
|
||||
{
|
||||
if (&delegate != this)
|
||||
{
|
||||
this->_receiverMethod = delegate._receiverMethod;
|
||||
this->_priority = delegate._priority;
|
||||
this->_function = delegate._function;
|
||||
this->_priority = delegate._priority;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -415,9 +412,9 @@ public:
|
||||
bool notify(const void* sender)
|
||||
{
|
||||
Mutex::ScopedLock lock(_mutex);
|
||||
if (_receiverMethod)
|
||||
if (_function)
|
||||
{
|
||||
(*_receiverMethod)();
|
||||
(*_function)();
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
@@ -426,7 +423,7 @@ public:
|
||||
bool equals(const AbstractDelegate<void>& other) const
|
||||
{
|
||||
const FunctionPriorityDelegate* pOtherDelegate = dynamic_cast<const FunctionPriorityDelegate*>(other.unwrap());
|
||||
return pOtherDelegate && this->priority() == pOtherDelegate->priority() && _receiverMethod == pOtherDelegate->_receiverMethod;
|
||||
return pOtherDelegate && this->priority() == pOtherDelegate->priority() && _function == pOtherDelegate->_function;
|
||||
}
|
||||
|
||||
AbstractDelegate<void>* clone() const
|
||||
@@ -437,17 +434,18 @@ public:
|
||||
void disable()
|
||||
{
|
||||
Mutex::ScopedLock lock(_mutex);
|
||||
_receiverMethod = 0;
|
||||
_function = 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
NotifyMethod _receiverMethod;
|
||||
NotifyFunction _function;
|
||||
Mutex _mutex;
|
||||
|
||||
private:
|
||||
FunctionPriorityDelegate();
|
||||
};
|
||||
|
||||
|
||||
} // namespace Poco
|
||||
|
||||
|
||||
|
||||
@@ -85,6 +85,7 @@ public:
|
||||
protected:
|
||||
int readFromDevice(char* buffer, std::streamsize length);
|
||||
int writeToDevice(const char* buffer, std::streamsize length);
|
||||
int sync();
|
||||
|
||||
private:
|
||||
enum
|
||||
|
||||
@@ -158,6 +158,10 @@ public:
|
||||
void fatal(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4);
|
||||
void fatal(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5);
|
||||
void fatal(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6);
|
||||
void fatal(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7);
|
||||
void fatal(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8);
|
||||
void fatal(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9);
|
||||
void fatal(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9, const Any& value10);
|
||||
|
||||
void critical(const std::string& msg);
|
||||
/// If the Logger's log level is at least PRIO_CRITICAL,
|
||||
@@ -181,6 +185,10 @@ public:
|
||||
void critical(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4);
|
||||
void critical(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5);
|
||||
void critical(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6);
|
||||
void critical(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7);
|
||||
void critical(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8);
|
||||
void critical(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9);
|
||||
void critical(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9, const Any& value10);
|
||||
|
||||
void error(const std::string& msg);
|
||||
/// If the Logger's log level is at least PRIO_ERROR,
|
||||
@@ -204,6 +212,10 @@ public:
|
||||
void error(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4);
|
||||
void error(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5);
|
||||
void error(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6);
|
||||
void error(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7);
|
||||
void error(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8);
|
||||
void error(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9);
|
||||
void error(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9, const Any& value10);
|
||||
|
||||
void warning(const std::string& msg);
|
||||
/// If the Logger's log level is at least PRIO_WARNING,
|
||||
@@ -227,6 +239,10 @@ public:
|
||||
void warning(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4);
|
||||
void warning(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5);
|
||||
void warning(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6);
|
||||
void warning(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7);
|
||||
void warning(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8);
|
||||
void warning(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9);
|
||||
void warning(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9, const Any& value10);
|
||||
|
||||
void notice(const std::string& msg);
|
||||
/// If the Logger's log level is at least PRIO_NOTICE,
|
||||
@@ -250,6 +266,10 @@ public:
|
||||
void notice(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4);
|
||||
void notice(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5);
|
||||
void notice(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6);
|
||||
void notice(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7);
|
||||
void notice(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8);
|
||||
void notice(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9);
|
||||
void notice(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9, const Any& value10);
|
||||
|
||||
void information(const std::string& msg);
|
||||
/// If the Logger's log level is at least PRIO_INFORMATION,
|
||||
@@ -273,6 +293,10 @@ public:
|
||||
void information(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4);
|
||||
void information(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5);
|
||||
void information(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6);
|
||||
void information(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7);
|
||||
void information(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8);
|
||||
void information(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9);
|
||||
void information(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9, const Any& value10);
|
||||
|
||||
void debug(const std::string& msg);
|
||||
/// If the Logger's log level is at least PRIO_DEBUG,
|
||||
@@ -296,6 +320,10 @@ public:
|
||||
void debug(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4);
|
||||
void debug(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5);
|
||||
void debug(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6);
|
||||
void debug(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7);
|
||||
void debug(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8);
|
||||
void debug(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9);
|
||||
void debug(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9, const Any& value10);
|
||||
|
||||
void trace(const std::string& msg);
|
||||
/// If the Logger's log level is at least PRIO_TRACE,
|
||||
@@ -319,6 +347,10 @@ public:
|
||||
void trace(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4);
|
||||
void trace(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5);
|
||||
void trace(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6);
|
||||
void trace(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7);
|
||||
void trace(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8);
|
||||
void trace(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9);
|
||||
void trace(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9, const Any& value10);
|
||||
|
||||
void dump(const std::string& msg, const void* buffer, std::size_t length, Message::Priority prio = Message::PRIO_DEBUG);
|
||||
/// Logs the given message, followed by the data in buffer.
|
||||
@@ -700,6 +732,30 @@ inline void Logger::fatal(const std::string& fmt, const Any& value1, const Any&
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::fatal(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7)
|
||||
{
|
||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6, value7), Message::PRIO_FATAL);
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::fatal(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8)
|
||||
{
|
||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6, value7, value8), Message::PRIO_FATAL);
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::fatal(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9)
|
||||
{
|
||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6, value7, value8, value9), Message::PRIO_FATAL);
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::fatal(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9, const Any& value10)
|
||||
{
|
||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6, value7, value8, value9, value10), Message::PRIO_FATAL);
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::critical(const std::string& msg)
|
||||
{
|
||||
log(msg, Message::PRIO_CRITICAL);
|
||||
@@ -748,6 +804,30 @@ inline void Logger::critical(const std::string& fmt, const Any& value1, const An
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::critical(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7)
|
||||
{
|
||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6, value7), Message::PRIO_CRITICAL);
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::critical(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8)
|
||||
{
|
||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6, value7, value8), Message::PRIO_CRITICAL);
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::critical(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9)
|
||||
{
|
||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6, value7, value8, value9), Message::PRIO_CRITICAL);
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::critical(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9, const Any& value10)
|
||||
{
|
||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6, value7, value8, value9, value10), Message::PRIO_CRITICAL);
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::error(const std::string& msg)
|
||||
{
|
||||
log(msg, Message::PRIO_ERROR);
|
||||
@@ -796,6 +876,30 @@ inline void Logger::error(const std::string& fmt, const Any& value1, const Any&
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::error(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7)
|
||||
{
|
||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6, value7), Message::PRIO_ERROR);
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::error(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8)
|
||||
{
|
||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6, value7, value8), Message::PRIO_ERROR);
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::error(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9)
|
||||
{
|
||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6, value7, value8, value9), Message::PRIO_ERROR);
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::error(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9, const Any& value10)
|
||||
{
|
||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6, value7, value8, value9, value10), Message::PRIO_ERROR);
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::warning(const std::string& msg)
|
||||
{
|
||||
log(msg, Message::PRIO_WARNING);
|
||||
@@ -844,6 +948,30 @@ inline void Logger::warning(const std::string& fmt, const Any& value1, const Any
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::warning(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7)
|
||||
{
|
||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6, value7), Message::PRIO_WARNING);
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::warning(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8)
|
||||
{
|
||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6, value7, value8), Message::PRIO_WARNING);
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::warning(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9)
|
||||
{
|
||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6, value7, value8, value9), Message::PRIO_WARNING);
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::warning(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9, const Any& value10)
|
||||
{
|
||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6, value7, value8, value9, value10), Message::PRIO_WARNING);
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::notice(const std::string& msg)
|
||||
{
|
||||
log(msg, Message::PRIO_NOTICE);
|
||||
@@ -892,6 +1020,30 @@ inline void Logger::notice(const std::string& fmt, const Any& value1, const Any&
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::notice(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7)
|
||||
{
|
||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6, value7), Message::PRIO_NOTICE);
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::notice(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8)
|
||||
{
|
||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6, value7, value8), Message::PRIO_NOTICE);
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::notice(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9)
|
||||
{
|
||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6, value7, value8, value9), Message::PRIO_NOTICE);
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::notice(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9, const Any& value10)
|
||||
{
|
||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6, value7, value8, value9, value10), Message::PRIO_NOTICE);
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::information(const std::string& msg)
|
||||
{
|
||||
log(msg, Message::PRIO_INFORMATION);
|
||||
@@ -940,6 +1092,30 @@ inline void Logger::information(const std::string& fmt, const Any& value1, const
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::information(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7)
|
||||
{
|
||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6, value7), Message::PRIO_INFORMATION);
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::information(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8)
|
||||
{
|
||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6, value7, value8), Message::PRIO_INFORMATION);
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::information(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9)
|
||||
{
|
||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6, value7, value8, value9), Message::PRIO_INFORMATION);
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::information(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9, const Any& value10)
|
||||
{
|
||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6, value7, value8, value9, value10), Message::PRIO_INFORMATION);
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::debug(const std::string& msg)
|
||||
{
|
||||
log(msg, Message::PRIO_DEBUG);
|
||||
@@ -988,6 +1164,30 @@ inline void Logger::debug(const std::string& fmt, const Any& value1, const Any&
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::debug(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7)
|
||||
{
|
||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6, value7), Message::PRIO_DEBUG);
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::debug(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8)
|
||||
{
|
||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6, value7, value8), Message::PRIO_DEBUG);
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::debug(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9)
|
||||
{
|
||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6, value7, value8, value9), Message::PRIO_DEBUG);
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::debug(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9, const Any& value10)
|
||||
{
|
||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6, value7, value8, value9, value10), Message::PRIO_DEBUG);
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::trace(const std::string& msg)
|
||||
{
|
||||
log(msg, Message::PRIO_TRACE);
|
||||
@@ -1036,6 +1236,30 @@ inline void Logger::trace(const std::string& fmt, const Any& value1, const Any&
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::trace(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7)
|
||||
{
|
||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6, value7), Message::PRIO_TRACE);
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::trace(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8)
|
||||
{
|
||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6, value7, value8), Message::PRIO_TRACE);
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::trace(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9)
|
||||
{
|
||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6, value7, value8, value9), Message::PRIO_TRACE);
|
||||
}
|
||||
|
||||
|
||||
inline void Logger::trace(const std::string& fmt, const Any& value1, const Any& value2, const Any& value3, const Any& value4, const Any& value5, const Any& value6, const Any& value7, const Any& value8, const Any& value9, const Any& value10)
|
||||
{
|
||||
log(Poco::format(fmt, value1, value2, value3, value4, value5, value6, value7, value8, value9, value10), Message::PRIO_TRACE);
|
||||
}
|
||||
|
||||
|
||||
inline bool Logger::is(int level) const
|
||||
{
|
||||
return _level >= level;
|
||||
|
||||
@@ -35,6 +35,8 @@ class NotificationStrategy
|
||||
/// but does not need to inherit from NotificationStrategy.
|
||||
{
|
||||
public:
|
||||
typedef TDelegate* DelegateHandle;
|
||||
|
||||
NotificationStrategy()
|
||||
{
|
||||
}
|
||||
@@ -46,13 +48,17 @@ public:
|
||||
virtual void notify(const void* sender, TArgs& arguments) = 0;
|
||||
/// Sends a notification to all registered delegates.
|
||||
|
||||
virtual void add(const TDelegate& delegate) = 0;
|
||||
virtual DelegateHandle add(const TDelegate& delegate) = 0;
|
||||
/// Adds a delegate to the strategy.
|
||||
|
||||
virtual void remove(const TDelegate& delegate) = 0;
|
||||
/// Removes a delegate from the strategy, if found.
|
||||
/// Does nothing if the delegate has not been added.
|
||||
|
||||
virtual void remove(DelegateHandle delegateHandle) = 0;
|
||||
/// Removes a delegate from the strategy, if found.
|
||||
/// Does nothing if the delegate has not been added.
|
||||
|
||||
virtual void clear() = 0;
|
||||
/// Removes all delegates from the strategy.
|
||||
|
||||
@@ -60,8 +66,9 @@ public:
|
||||
/// Returns false if the strategy contains at least one delegate.
|
||||
};
|
||||
|
||||
|
||||
template <class TDelegate>
|
||||
class NotificationStrategy<void,TDelegate>
|
||||
class NotificationStrategy<void, TDelegate>
|
||||
/// The interface that all notification strategies must implement.
|
||||
///
|
||||
/// Note: Event is based on policy-driven design, so every strategy implementation
|
||||
@@ -69,6 +76,8 @@ class NotificationStrategy<void,TDelegate>
|
||||
/// but does not need to inherit from NotificationStrategy.
|
||||
{
|
||||
public:
|
||||
typedef TDelegate* DelegateHandle;
|
||||
|
||||
NotificationStrategy()
|
||||
{
|
||||
}
|
||||
@@ -80,13 +89,17 @@ public:
|
||||
virtual void notify(const void* sender) = 0;
|
||||
/// Sends a notification to all registered delegates.
|
||||
|
||||
virtual void add(const TDelegate& delegate) = 0;
|
||||
virtual DelegateHandle add(const TDelegate& delegate) = 0;
|
||||
/// Adds a delegate to the strategy.
|
||||
|
||||
virtual void remove(const TDelegate& delegate) = 0;
|
||||
/// Removes a delegate from the strategy, if found.
|
||||
/// Does nothing if the delegate has not been added.
|
||||
|
||||
virtual void remove(DelegateHandle delegateHandle) = 0;
|
||||
/// Removes a delegate from the strategy, if found.
|
||||
/// Does nothing if the delegate has not been added.
|
||||
|
||||
virtual void clear() = 0;
|
||||
/// Removes all delegates from the strategy.
|
||||
|
||||
|
||||
@@ -121,10 +121,11 @@ protected:
|
||||
/// Returns a string for the given priority value.
|
||||
|
||||
private:
|
||||
|
||||
struct PatternAction
|
||||
{
|
||||
PatternAction(): key(0), length(0) {}
|
||||
PatternAction(): key(0), length(0)
|
||||
{
|
||||
}
|
||||
|
||||
char key;
|
||||
int length;
|
||||
@@ -132,16 +133,14 @@ private:
|
||||
std::string prepend;
|
||||
};
|
||||
|
||||
std::vector<PatternAction> _patternActions;
|
||||
bool _localTime;
|
||||
Timestamp::TimeDiff _localTimeOffset;
|
||||
std::string _pattern;
|
||||
|
||||
|
||||
void ParsePattern();
|
||||
void parsePattern();
|
||||
/// Will parse the _pattern string into the vector of PatternActions,
|
||||
/// which contains the message key, any text that needs to be written first
|
||||
/// a proprety in case of %[] and required length.
|
||||
|
||||
std::vector<PatternAction> _patternActions;
|
||||
bool _localTime;
|
||||
std::string _pattern;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
#if (_MSC_VER >= 1300) && (_MSC_VER < 1400) // Visual Studio 2003, MSVC++ 7.1
|
||||
#if (_MSC_VER >= 1300) && (_MSC_VER < 1400) // Visual Studio 2003, MSVC++ 7.1
|
||||
#define POCO_MSVS_VERSION 2003
|
||||
#define POCO_MSVC_VERSION 71
|
||||
#elif (_MSC_VER >= 1400) && (_MSC_VER < 1500) // Visual Studio 2005, MSVC++ 8.0
|
||||
@@ -163,6 +163,9 @@
|
||||
#elif (_MSC_VER >= 1700) && (_MSC_VER < 1800) // Visual Studio 2012, MSVC++ 11.0
|
||||
#define POCO_MSVS_VERSION 2012
|
||||
#define POCO_MSVC_VERSION 110
|
||||
#elif (_MSC_VER >= 1800) && (_MSC_VER < 1900) // Visual Studio 2013, MSVC++ 12.0
|
||||
#define POCO_MSVS_VERSION 2013
|
||||
#define POCO_MSVC_VERSION 120
|
||||
#endif
|
||||
|
||||
|
||||
@@ -172,6 +175,11 @@
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(POCO_WIN32_UTF8)
|
||||
#pragma message("Compiling POCO on Windows without #define POCO_WIN32_UTF8 is deprecated.")
|
||||
#endif
|
||||
|
||||
|
||||
// Turn off some annoying warnings
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(disable:4018) // signed/unsigned comparison
|
||||
|
||||
@@ -251,6 +251,7 @@ private:
|
||||
PriorityDelegate();
|
||||
};
|
||||
|
||||
|
||||
template <class TObj>
|
||||
class PriorityDelegate<TObj, void, false>: public AbstractPriorityDelegate<void>
|
||||
{
|
||||
@@ -324,6 +325,7 @@ private:
|
||||
PriorityDelegate();
|
||||
};
|
||||
|
||||
|
||||
template <class TObj, class TArgs>
|
||||
static PriorityDelegate<TObj, TArgs, true> priorityDelegate(TObj* pObj, void (TObj::*NotifyMethod)(const void*, TArgs&), int prio)
|
||||
{
|
||||
@@ -394,9 +396,6 @@ static FunctionPriorityDelegate<TArgs, false> priorityDelegate(void (*NotifyMeth
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <class TObj>
|
||||
static PriorityDelegate<TObj, void, true> priorityDelegate(TObj* pObj, void (TObj::*NotifyMethod)(const void*), int prio)
|
||||
{
|
||||
@@ -463,4 +462,5 @@ inline FunctionPriorityDelegate<void, false> priorityDelegate(void (*NotifyMetho
|
||||
|
||||
} // namespace Poco
|
||||
|
||||
|
||||
#endif // Foundation_PriorityDelegate_INCLUDED
|
||||
|
||||
@@ -109,6 +109,7 @@ private:
|
||||
PriorityExpire();
|
||||
};
|
||||
|
||||
|
||||
template <>
|
||||
class PriorityExpire<void>: public AbstractPriorityDelegate<void>
|
||||
/// Decorator for AbstractPriorityDelegate adding automatic
|
||||
@@ -188,6 +189,8 @@ protected:
|
||||
private:
|
||||
PriorityExpire();
|
||||
};
|
||||
|
||||
|
||||
} // namespace Poco
|
||||
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ class PriorityStrategy: public NotificationStrategy<TArgs, TDelegate>
|
||||
/// by their priority.
|
||||
{
|
||||
public:
|
||||
typedef TDelegate* DelegateHandle;
|
||||
typedef SharedPtr<TDelegate> DelegatePtr;
|
||||
typedef std::vector<DelegatePtr> Delegates;
|
||||
typedef typename Delegates::iterator Iterator;
|
||||
@@ -62,17 +63,20 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void add(const TDelegate& delegate)
|
||||
DelegateHandle add(const TDelegate& delegate)
|
||||
{
|
||||
for (Iterator it = _delegates.begin(); it != _delegates.end(); ++it)
|
||||
{
|
||||
if ((*it)->priority() > delegate.priority())
|
||||
{
|
||||
_delegates.insert(it, DelegatePtr(static_cast<TDelegate*>(delegate.clone())));
|
||||
return;
|
||||
DelegatePtr pDelegate(static_cast<TDelegate*>(delegate.clone()));
|
||||
_delegates.insert(it, pDelegate);
|
||||
return pDelegate.get();
|
||||
}
|
||||
}
|
||||
_delegates.push_back(DelegatePtr(static_cast<TDelegate*>(delegate.clone())));
|
||||
DelegatePtr pDelegate(static_cast<TDelegate*>(delegate.clone()));
|
||||
_delegates.push_back(pDelegate);
|
||||
return pDelegate.get();
|
||||
}
|
||||
|
||||
void remove(const TDelegate& delegate)
|
||||
@@ -88,6 +92,19 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void remove(DelegateHandle delegateHandle)
|
||||
{
|
||||
for (Iterator it = _delegates.begin(); it != _delegates.end(); ++it)
|
||||
{
|
||||
if (*it == delegateHandle)
|
||||
{
|
||||
(*it)->disable();
|
||||
_delegates.erase(it);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PriorityStrategy& operator = (const PriorityStrategy& s)
|
||||
{
|
||||
if (this != &s)
|
||||
@@ -115,6 +132,7 @@ protected:
|
||||
Delegates _delegates;
|
||||
};
|
||||
|
||||
|
||||
template <class TDelegate>
|
||||
class PriorityStrategy<void, TDelegate>
|
||||
/// NotificationStrategy for PriorityEvent.
|
||||
@@ -123,6 +141,7 @@ class PriorityStrategy<void, TDelegate>
|
||||
/// by their priority.
|
||||
{
|
||||
public:
|
||||
typedef TDelegate* DelegateHandle;
|
||||
typedef SharedPtr<TDelegate> DelegatePtr;
|
||||
typedef std::vector<DelegatePtr> Delegates;
|
||||
typedef typename Delegates::iterator Iterator;
|
||||
@@ -137,17 +156,20 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void add(const TDelegate& delegate)
|
||||
DelegateHandle add(const TDelegate& delegate)
|
||||
{
|
||||
for (Iterator it = _delegates.begin(); it != _delegates.end(); ++it)
|
||||
{
|
||||
if ((*it)->priority() > delegate.priority())
|
||||
{
|
||||
_delegates.insert(it, DelegatePtr(static_cast<TDelegate*>(delegate.clone())));
|
||||
return;
|
||||
DelegatePtr pDelegate(static_cast<TDelegate*>(delegate.clone()));
|
||||
_delegates.insert(it, pDelegate);
|
||||
return pDelegate.get();
|
||||
}
|
||||
}
|
||||
_delegates.push_back(DelegatePtr(static_cast<TDelegate*>(delegate.clone())));
|
||||
DelegatePtr pDelegate(static_cast<TDelegate*>(delegate.clone()));
|
||||
_delegates.push_back(pDelegate);
|
||||
return pDelegate.get();
|
||||
}
|
||||
|
||||
void remove(const TDelegate& delegate)
|
||||
@@ -163,6 +185,19 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void remove(DelegateHandle delegateHandle)
|
||||
{
|
||||
for (Iterator it = _delegates.begin(); it != _delegates.end(); ++it)
|
||||
{
|
||||
if (*it == delegateHandle)
|
||||
{
|
||||
(*it)->disable();
|
||||
_delegates.erase(it);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PriorityStrategy& operator = (const PriorityStrategy& s)
|
||||
{
|
||||
if (this != &s)
|
||||
@@ -189,6 +224,8 @@ public:
|
||||
protected:
|
||||
Delegates _delegates;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Poco
|
||||
|
||||
|
||||
|
||||
@@ -66,9 +66,8 @@ public:
|
||||
|
||||
enum
|
||||
{
|
||||
D_INFINITE = 0
|
||||
D_INFINITE = 0 /// Constant for infinite traverse depth.
|
||||
};
|
||||
/// Constant for infinite traverse depth.
|
||||
|
||||
RecursiveDirectoryIterator()
|
||||
/// Creates the end iterator.
|
||||
@@ -76,31 +75,34 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
RecursiveDirectoryIterator(const std::string& path, UInt16 maxDepth = D_INFINITE);
|
||||
RecursiveDirectoryIterator(const std::string& path, UInt16 maxDepth = D_INFINITE)
|
||||
/// Creates a recursive directory iterator for the given path.
|
||||
|
||||
RecursiveDirectoryIterator(const MyType& iterator)
|
||||
/// Creates a copy of another recursive directory iterator.
|
||||
: _pImpl(iterator._pImpl), _path(iterator._path), _file(iterator._file)
|
||||
: _pImpl(new ImplType(path, maxDepth)), _path(Path(_pImpl->get())), _file(_path)
|
||||
{
|
||||
}
|
||||
|
||||
RecursiveDirectoryIterator(const DirectoryIterator& iterator, UInt16 maxDepth = D_INFINITE)
|
||||
RecursiveDirectoryIterator(const MyType& iterator):
|
||||
/// Creates a copy of another recursive directory iterator.
|
||||
_pImpl(iterator._pImpl), _path(iterator._path), _file(iterator._file)
|
||||
{
|
||||
}
|
||||
|
||||
RecursiveDirectoryIterator(const DirectoryIterator& iterator, UInt16 maxDepth = D_INFINITE):
|
||||
/// Creates a recursive directory iterator for the path of
|
||||
/// non-recursive directory iterator.
|
||||
: _pImpl(new ImplType(iterator->path(), maxDepth)), _path(Path(_pImpl->get())), _file(_path)
|
||||
_pImpl(new ImplType(iterator->path(), maxDepth)), _path(Path(_pImpl->get())), _file(_path)
|
||||
{
|
||||
}
|
||||
|
||||
RecursiveDirectoryIterator(const File& file, UInt16 maxDepth = D_INFINITE)
|
||||
RecursiveDirectoryIterator(const File& file, UInt16 maxDepth = D_INFINITE):
|
||||
/// Creates a recursive directory iterator for the given path.
|
||||
: _pImpl(new ImplType(file.path(), maxDepth)), _path(Path(_pImpl->get())), _file(_path)
|
||||
_pImpl(new ImplType(file.path(), maxDepth)), _path(Path(_pImpl->get())), _file(_path)
|
||||
{
|
||||
}
|
||||
|
||||
RecursiveDirectoryIterator(const Path& path, UInt16 maxDepth = D_INFINITE)
|
||||
RecursiveDirectoryIterator(const Path& path, UInt16 maxDepth = D_INFINITE):
|
||||
/// Creates a recursive directory iterator for the given path.
|
||||
: _pImpl(new ImplType(path.toString(), maxDepth)), _path(Path(_pImpl->get())), _file(_path)
|
||||
_pImpl(new ImplType(path.toString(), maxDepth)), _path(Path(_pImpl->get())), _file(_path)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ S toUpper(const S& str)
|
||||
|
||||
S result;
|
||||
result.reserve(str.size());
|
||||
while (it != end) result += Ascii::toUpper(*it++);
|
||||
while (it != end) result += static_cast<typename S::value_type>(Ascii::toUpper(*it++));
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ S& toUpperInPlace(S& str)
|
||||
typename S::iterator it = str.begin();
|
||||
typename S::iterator end = str.end();
|
||||
|
||||
while (it != end) { *it = Ascii::toUpper(*it); ++it; }
|
||||
while (it != end) { *it = static_cast<typename S::value_type>(Ascii::toUpper(*it)); ++it; }
|
||||
return str;
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ S toLower(const S& str)
|
||||
|
||||
S result;
|
||||
result.reserve(str.size());
|
||||
while (it != end) result += Ascii::toLower(*it++);
|
||||
while (it != end) result += static_cast<typename S::value_type>(Ascii::toLower(*it++));
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ S& toLowerInPlace(S& str)
|
||||
typename S::iterator it = str.begin();
|
||||
typename S::iterator end = str.end();
|
||||
|
||||
while (it != end) { *it = Ascii::toLower(*it); ++it; }
|
||||
while (it != end) { *it = static_cast<typename S::value_type>(Ascii::toLower(*it)); ++it; }
|
||||
return str;
|
||||
}
|
||||
|
||||
@@ -183,8 +183,8 @@ int icompare(
|
||||
It end1 = str.begin() + pos + n;
|
||||
while (it1 != end1 && it2 != end2)
|
||||
{
|
||||
typename S::value_type c1(Ascii::toLower(*it1));
|
||||
typename S::value_type c2(Ascii::toLower(*it2));
|
||||
typename S::value_type c1(static_cast<typename S::value_type>(Ascii::toLower(*it1)));
|
||||
typename S::value_type c2(static_cast<typename S::value_type>(Ascii::toLower(*it2)));
|
||||
if (c1 < c2)
|
||||
return -1;
|
||||
else if (c1 > c2)
|
||||
@@ -209,8 +209,8 @@ int icompare(const S& str1, const S& str2)
|
||||
typename S::const_iterator end2(str2.end());
|
||||
while (it1 != end1 && it2 != end2)
|
||||
{
|
||||
typename S::value_type c1(Ascii::toLower(*it1));
|
||||
typename S::value_type c2(Ascii::toLower(*it2));
|
||||
typename S::value_type c1(static_cast<typename S::value_type>(Ascii::toLower(*it1)));
|
||||
typename S::value_type c2(static_cast<typename S::value_type>(Ascii::toLower(*it2)));
|
||||
if (c1 < c2)
|
||||
return -1;
|
||||
else if (c1 > c2)
|
||||
@@ -294,8 +294,8 @@ int icompare(
|
||||
typename S::const_iterator end = str.begin() + pos + n;
|
||||
while (it != end && *ptr)
|
||||
{
|
||||
typename S::value_type c1(Ascii::toLower(*it));
|
||||
typename S::value_type c2(Ascii::toLower(*ptr));
|
||||
typename S::value_type c1(static_cast<typename S::value_type>(Ascii::toLower(*it)));
|
||||
typename S::value_type c2(static_cast<typename S::value_type>(Ascii::toLower(*ptr)));
|
||||
if (c1 < c2)
|
||||
return -1;
|
||||
else if (c1 > c2)
|
||||
|
||||
@@ -122,7 +122,7 @@ public:
|
||||
/// May return 0 if the priority has not been explicitly set.
|
||||
|
||||
static int getMinOSPriority(int policy = POLICY_DEFAULT);
|
||||
/// Returns the mininum operating system-specific priority value,
|
||||
/// Returns the minimum operating system-specific priority value,
|
||||
/// which can be passed to setOSPriority() for the given policy.
|
||||
|
||||
static int getMaxOSPriority(int policy = POLICY_DEFAULT);
|
||||
@@ -149,6 +149,13 @@ public:
|
||||
void start(Callable target, void* pData = 0);
|
||||
/// Starts the thread with the given target and parameter.
|
||||
|
||||
template <class Functor>
|
||||
void startFunc(Functor fn)
|
||||
/// Starts the thread with the given functor object or lambda.
|
||||
{
|
||||
startImpl(new FunctorRunnable<Functor>(fn));
|
||||
}
|
||||
|
||||
void join();
|
||||
/// Waits until the thread completes execution.
|
||||
/// If multiple threads try to join the same
|
||||
@@ -184,8 +191,8 @@ public:
|
||||
/// The trySleep() and wakeUp() calls should be used with
|
||||
/// understanding that the suspended state is not a true sleep,
|
||||
/// but rather a state of waiting for an event, with timeout
|
||||
/// expiration. This makes order of calls significantant; calling
|
||||
/// wakeUp() before calling trySleep() will prevent the next
|
||||
/// expiration. This makes order of calls significant; calling
|
||||
/// wakeUp() before calling trySleep() will prevent the next
|
||||
/// trySleep() call to actually suspend the thread (which, in
|
||||
/// some scenarios, may be desirable behavior).
|
||||
|
||||
@@ -221,7 +228,29 @@ protected:
|
||||
|
||||
static int uniqueId();
|
||||
/// Creates and returns a unique id for a thread.
|
||||
|
||||
|
||||
template <class Functor>
|
||||
class FunctorRunnable: public Runnable
|
||||
{
|
||||
public:
|
||||
FunctorRunnable(const Functor& functor):
|
||||
_functor(functor)
|
||||
{
|
||||
}
|
||||
|
||||
~FunctorRunnable()
|
||||
{
|
||||
}
|
||||
|
||||
void run()
|
||||
{
|
||||
_functor();
|
||||
}
|
||||
|
||||
private:
|
||||
Functor _functor;
|
||||
};
|
||||
|
||||
private:
|
||||
Thread(const Thread&);
|
||||
Thread& operator = (const Thread&);
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "Poco/Event.h"
|
||||
#include "Poco/RefCountedObject.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
#include <pthread.h>
|
||||
// must be limits.h (not <climits>) for PTHREAD_STACK_MIN on Solaris
|
||||
#include <limits.h>
|
||||
@@ -61,16 +62,6 @@ public:
|
||||
POLICY_DEFAULT_IMPL = SCHED_OTHER
|
||||
};
|
||||
|
||||
struct CallbackData: public RefCountedObject
|
||||
{
|
||||
CallbackData(): callback(0), pData(0)
|
||||
{
|
||||
}
|
||||
|
||||
Callable callback;
|
||||
void* pData;
|
||||
};
|
||||
|
||||
ThreadImpl();
|
||||
~ThreadImpl();
|
||||
|
||||
@@ -83,9 +74,7 @@ public:
|
||||
static int getMaxOSPriorityImpl(int policy);
|
||||
void setStackSizeImpl(int size);
|
||||
int getStackSizeImpl() const;
|
||||
void startImpl(Runnable& target);
|
||||
void startImpl(Callable target, void* pData = 0);
|
||||
|
||||
void startImpl(SharedPtr<Runnable> pTarget);
|
||||
void joinImpl();
|
||||
bool joinImpl(long milliseconds);
|
||||
bool isRunningImpl() const;
|
||||
@@ -96,7 +85,6 @@ public:
|
||||
|
||||
protected:
|
||||
static void* runnableEntry(void* pThread);
|
||||
static void* callableEntry(void* pThread);
|
||||
static int mapPrio(int prio, int policy = SCHED_OTHER);
|
||||
static int reverseMapPrio(int osPrio, int policy = SCHED_OTHER);
|
||||
|
||||
@@ -129,8 +117,6 @@ private:
|
||||
struct ThreadData: public RefCountedObject
|
||||
{
|
||||
ThreadData():
|
||||
pRunnableTarget(0),
|
||||
pCallbackTarget(0),
|
||||
thread(0),
|
||||
prio(PRIO_NORMAL_IMPL),
|
||||
policy(SCHED_OTHER),
|
||||
@@ -146,8 +132,7 @@ private:
|
||||
#endif
|
||||
}
|
||||
|
||||
Runnable* pRunnableTarget;
|
||||
AutoPtr<CallbackData> pCallbackTarget;
|
||||
SharedPtr<Runnable> pRunnableTarget;
|
||||
pthread_t thread;
|
||||
int prio;
|
||||
int osPrio;
|
||||
@@ -186,8 +171,7 @@ inline int ThreadImpl::getOSPriorityImpl() const
|
||||
|
||||
inline bool ThreadImpl::isRunningImpl() const
|
||||
{
|
||||
return _pData->pRunnableTarget != 0 ||
|
||||
(_pData->pCallbackTarget.get() != 0 && _pData->pCallbackTarget->callback != 0);
|
||||
return !_pData->pRunnableTarget.isNull();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "Poco/Foundation.h"
|
||||
#include "Poco/Runnable.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
#include "Poco/UnWindows.h"
|
||||
|
||||
|
||||
@@ -40,16 +41,6 @@ public:
|
||||
typedef unsigned (__stdcall *Entry)(void*);
|
||||
#endif
|
||||
|
||||
struct CallbackData
|
||||
{
|
||||
CallbackData(): callback(0), pData(0)
|
||||
{
|
||||
}
|
||||
|
||||
Callable callback;
|
||||
void* pData;
|
||||
};
|
||||
|
||||
enum Priority
|
||||
{
|
||||
PRIO_LOWEST_IMPL = THREAD_PRIORITY_LOWEST,
|
||||
@@ -76,9 +67,7 @@ public:
|
||||
static int getMaxOSPriorityImpl(int policy);
|
||||
void setStackSizeImpl(int size);
|
||||
int getStackSizeImpl() const;
|
||||
void startImpl(Runnable& target);
|
||||
void startImpl(Callable target, void* pData = 0);
|
||||
|
||||
void startImpl(SharedPtr<Runnable> pTarget);
|
||||
void joinImpl();
|
||||
bool joinImpl(long milliseconds);
|
||||
bool isRunningImpl() const;
|
||||
@@ -94,12 +83,6 @@ protected:
|
||||
static unsigned __stdcall runnableEntry(void* pThread);
|
||||
#endif
|
||||
|
||||
#if defined(_DLL)
|
||||
static DWORD WINAPI callableEntry(LPVOID pThread);
|
||||
#else
|
||||
static unsigned __stdcall callableEntry(void* pThread);
|
||||
#endif
|
||||
|
||||
void createImpl(Entry ent, void* pData);
|
||||
void threadCleanup();
|
||||
|
||||
@@ -129,12 +112,11 @@ private:
|
||||
DWORD _slot;
|
||||
};
|
||||
|
||||
Runnable* _pRunnableTarget;
|
||||
CallbackData _callbackTarget;
|
||||
HANDLE _thread;
|
||||
DWORD _threadId;
|
||||
int _prio;
|
||||
int _stackSize;
|
||||
SharedPtr<Runnable> _pRunnableTarget;
|
||||
HANDLE _thread;
|
||||
DWORD _threadId;
|
||||
int _prio;
|
||||
int _stackSize;
|
||||
|
||||
static CurrentThreadHolder _currentThreadHolder;
|
||||
};
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "Poco/Foundation.h"
|
||||
#include "Poco/Runnable.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
#include "Poco/UnWindows.h"
|
||||
|
||||
|
||||
@@ -40,16 +41,6 @@ public:
|
||||
typedef void (*Callable)(void*);
|
||||
typedef DWORD (WINAPI *Entry)(LPVOID);
|
||||
|
||||
struct CallbackData
|
||||
{
|
||||
CallbackData(): callback(0), pData(0)
|
||||
{
|
||||
}
|
||||
|
||||
Callable callback;
|
||||
void* pData;
|
||||
};
|
||||
|
||||
enum Priority
|
||||
{
|
||||
PRIO_LOWEST_IMPL = THREAD_PRIORITY_LOWEST,
|
||||
@@ -76,9 +67,7 @@ public:
|
||||
static int getMaxOSPriorityImpl(int policy);
|
||||
void setStackSizeImpl(int size);
|
||||
int getStackSizeImpl() const;
|
||||
void startImpl(Runnable& target);
|
||||
void startImpl(Callable target, void* pData = 0);
|
||||
|
||||
void startImpl(SharedPtr<Runnable> pTarget);
|
||||
void joinImpl();
|
||||
bool joinImpl(long milliseconds);
|
||||
bool isRunningImpl() const;
|
||||
@@ -89,7 +78,6 @@ public:
|
||||
|
||||
protected:
|
||||
static DWORD WINAPI runnableEntry(LPVOID pThread);
|
||||
static DWORD WINAPI callableEntry(LPVOID pThread);
|
||||
|
||||
void createImpl(Entry ent, void* pData);
|
||||
void threadCleanup();
|
||||
@@ -120,8 +108,7 @@ private:
|
||||
DWORD _slot;
|
||||
};
|
||||
|
||||
Runnable* _pRunnableTarget;
|
||||
CallbackData _callbackTarget;
|
||||
SharedPtr<Runnable> _pRunnableTarget;
|
||||
HANDLE _thread;
|
||||
DWORD _threadId;
|
||||
int _prio;
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace Poco {
|
||||
|
||||
class Timespan;
|
||||
|
||||
|
||||
class Foundation_API Timestamp
|
||||
/// A Timestamp stores a monotonic* time value
|
||||
/// with (theoretical) microseconds resolution.
|
||||
@@ -36,22 +37,37 @@ class Foundation_API Timestamp
|
||||
///
|
||||
/// [*] Note that Timestamp values are only monotonic as
|
||||
/// long as the systems's clock is monotonic as well
|
||||
/// (and not, e.g. set back).
|
||||
/// (and not, e.g. set back due to time synchronization
|
||||
/// or other reasons).
|
||||
///
|
||||
/// Timestamps are UTC (Coordinated Universal Time)
|
||||
/// based and thus independent of the timezone
|
||||
/// in effect on the system.
|
||||
///
|
||||
/// The internal reference time is the Unix epoch,
|
||||
/// midnight, January 1, 1970.
|
||||
{
|
||||
public:
|
||||
typedef Int64 TimeVal; /// monotonic UTC time value in microsecond resolution
|
||||
typedef Int64 UtcTimeVal; /// monotonic UTC time value in 100 nanosecond resolution
|
||||
typedef Int64 TimeDiff; /// difference between two timestamps in microseconds
|
||||
typedef Int64 TimeVal;
|
||||
/// Monotonic UTC time value in microsecond resolution,
|
||||
/// with base time midnight, January 1, 1970.
|
||||
|
||||
typedef Int64 UtcTimeVal;
|
||||
/// Monotonic UTC time value in 100 nanosecond resolution,
|
||||
/// with base time midnight, October 15, 1582.
|
||||
|
||||
typedef Int64 TimeDiff;
|
||||
/// Difference between two TimeVal values in microseconds.
|
||||
|
||||
static const TimeVal TIMEVAL_MIN; /// Minimum timestamp value.
|
||||
static const TimeVal TIMEVAL_MAX; /// Maximum timestamp value.
|
||||
|
||||
Timestamp();
|
||||
/// Creates a timestamp with the current time.
|
||||
|
||||
Timestamp(TimeVal tv);
|
||||
/// Creates a timestamp from the given time value.
|
||||
/// Creates a timestamp from the given time value
|
||||
/// (microseconds since midnight, January 1, 1970).
|
||||
|
||||
Timestamp(const Timestamp& other);
|
||||
/// Copy constructor.
|
||||
@@ -116,9 +132,11 @@ public:
|
||||
/// Creates a timestamp from a std::time_t.
|
||||
|
||||
static Timestamp fromUtcTime(UtcTimeVal val);
|
||||
/// Creates a timestamp from a UTC time value.
|
||||
/// Creates a timestamp from a UTC time value
|
||||
/// (100 nanosecond intervals since midnight,
|
||||
/// October 15, 1582).
|
||||
|
||||
static TimeVal resolution();
|
||||
static TimeDiff resolution();
|
||||
/// Returns the resolution in units per second.
|
||||
/// Since the timestamp has microsecond resolution,
|
||||
/// the returned value is always 1000000.
|
||||
@@ -237,7 +255,7 @@ inline bool Timestamp::isElapsed(Timestamp::TimeDiff interval) const
|
||||
}
|
||||
|
||||
|
||||
inline Timestamp::TimeVal Timestamp::resolution()
|
||||
inline Timestamp::TimeDiff Timestamp::resolution()
|
||||
{
|
||||
return 1000000;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "Poco/Foundation.h"
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
@@ -40,11 +41,13 @@ class Foundation_API URI
|
||||
///
|
||||
/// The class automatically performs a few normalizations on
|
||||
/// all URIs and URI parts passed to it:
|
||||
/// * scheme identifiers are converted to lower case.
|
||||
/// * scheme identifiers are converted to lower case
|
||||
/// * percent-encoded characters are decoded
|
||||
/// * optionally, dot segments are removed from paths (see normalize())
|
||||
{
|
||||
public:
|
||||
typedef std::vector<std::pair<std::string, std::string> > QueryParameters;
|
||||
|
||||
URI();
|
||||
/// Creates an empty URI.
|
||||
|
||||
@@ -159,10 +162,30 @@ public:
|
||||
/// Sets the path part of the URI.
|
||||
|
||||
std::string getQuery() const;
|
||||
/// Returns the query part of the URI.
|
||||
/// Returns the decoded query part of the URI.
|
||||
///
|
||||
/// Note that encoded ampersand characters ('&', "%26")
|
||||
/// will be decoded, which could cause ambiguities if the query
|
||||
/// string contains multiple parameters and a parameter name
|
||||
/// or value contains an ampersand as well.
|
||||
/// In such a case it's better to use getRawQuery() or
|
||||
/// getQueryParameters().
|
||||
|
||||
void setQuery(const std::string& query);
|
||||
/// Sets the query part of the URI.
|
||||
///
|
||||
/// The query string will be percent-encoded. If the query
|
||||
/// already contains percent-encoded characters, these
|
||||
/// will be double-encoded, which is probably not what's
|
||||
/// intended by the caller. Furthermore, ampersand ('&')
|
||||
/// characters in the query will not be encoded. This could
|
||||
/// lead to ambiguity issues if the query string contains multiple
|
||||
/// name-value parameters separated by ampersand, and if any
|
||||
/// name or value also contains an ampersand. In such a
|
||||
/// case, it's better to use setRawQuery() with a properly
|
||||
/// percent-encoded query string, or use addQueryParameter()
|
||||
/// or setQueryParameters(), which take care of appropriate
|
||||
/// percent encoding of parameter names and values.
|
||||
|
||||
void addQueryParameter(const std::string& param, const std::string& val = "");
|
||||
/// Adds "param=val" to the query; "param" may not be empty.
|
||||
@@ -172,11 +195,24 @@ public:
|
||||
/// if found in param or val.
|
||||
|
||||
const std::string& getRawQuery() const;
|
||||
/// Returns the unencoded query part of the URI.
|
||||
/// Returns the query string in raw form, which usually
|
||||
/// means percent encoded.
|
||||
|
||||
void setRawQuery(const std::string& query);
|
||||
/// Sets the query part of the URI.
|
||||
///
|
||||
/// The given query string must be properly percent-encoded.
|
||||
|
||||
QueryParameters getQueryParameters() const;
|
||||
/// Returns the decoded query string parameters as a vector
|
||||
/// of name-value pairs.
|
||||
|
||||
void setQueryParameters(const QueryParameters& params);
|
||||
/// Sets the query part of the URI from a vector
|
||||
/// of query parameters.
|
||||
///
|
||||
/// Calls addQueryParameter() for each parameter name and value.
|
||||
|
||||
const std::string& getFragment() const;
|
||||
/// Returns the fragment part of the URI.
|
||||
|
||||
@@ -246,6 +282,7 @@ public:
|
||||
/// URI-decodes the given string by replacing percent-encoded
|
||||
/// characters with the actual character. The decoded string
|
||||
/// is appended to decodedStr.
|
||||
///
|
||||
/// When plusAsSpace is true, non-encoded plus signs in the query are decoded as spaces.
|
||||
/// (http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1)
|
||||
|
||||
|
||||
@@ -35,6 +35,9 @@ struct Foundation_API UTF8
|
||||
///
|
||||
/// toUpper(), toUpperInPlace(), toLower() and toLowerInPlace() provide
|
||||
/// Unicode-based character case transformation for UTF-8 encoded strings.
|
||||
///
|
||||
/// removeBOM() removes the UTF-8 Byte Order Mark sequence (0xEF, 0xBB, 0xBF)
|
||||
/// from the beginning of the given string, if it's there.
|
||||
{
|
||||
static int icompare(const std::string& str, std::string::size_type pos, std::string::size_type n, std::string::const_iterator it2, std::string::const_iterator end2);
|
||||
static int icompare(const std::string& str1, const std::string& str2);
|
||||
@@ -51,6 +54,10 @@ struct Foundation_API UTF8
|
||||
static std::string& toUpperInPlace(std::string& str);
|
||||
static std::string toLower(const std::string& str);
|
||||
static std::string& toLowerInPlace(std::string& str);
|
||||
|
||||
static void removeBOM(std::string& str);
|
||||
/// Remove the UTF-8 Byte Order Mark sequence (0xEF, 0xBB, 0xBF)
|
||||
/// from the beginning of the string, if it's there.
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -23,18 +23,21 @@
|
||||
//
|
||||
// Version Information
|
||||
//
|
||||
// Since 1.6.0, we're using Semantic Versioning 2.0
|
||||
// (http://semver.org/spec/v2.0.0.html)
|
||||
//
|
||||
// Version format is 0xAABBCCDD, where
|
||||
// - AA is the major version number,
|
||||
// - BB is the minor version number,
|
||||
// - CC is the revision number, and
|
||||
// - DD is the patch level number.
|
||||
// Note that some patch level numbers have
|
||||
// a special meaning:
|
||||
// Dx are development releases
|
||||
// Ax are alpha releases
|
||||
// Bx are beta releases
|
||||
// - CC is the patch version number, and
|
||||
// - DD is the pre-release designation/number.
|
||||
// The pre-release designation hex digits have a special meaning:
|
||||
// 00: final/stable releases
|
||||
// Dx: development releases
|
||||
// Ax: alpha releases
|
||||
// Bx: beta releases
|
||||
//
|
||||
#define POCO_VERSION 0x01050400
|
||||
#define POCO_VERSION 0x01060000
|
||||
|
||||
|
||||
#endif // Foundation_Version_INCLUDED
|
||||
|
||||
Reference in New Issue
Block a user