mirror of
https://github.com/Telecominfraproject/wlan-cloud-lib-poco.git
synced 2025-10-30 18:17:50 +00:00
changes for 1.2.5
This commit is contained in:
18
CHANGELOG
18
CHANGELOG
@@ -1,6 +1,6 @@
|
|||||||
This is the changelog file for POCO - the C++ Portable Components.
|
This is the changelog file for POCO - the C++ Portable Components.
|
||||||
|
|
||||||
Release 1.2.5 (2006-10-xx)
|
Release 1.2.5 (2006-10-23)
|
||||||
==========================
|
==========================
|
||||||
|
|
||||||
- Improved LoggingConfigurator: channel creation and configuration is now a two-step process.
|
- Improved LoggingConfigurator: channel creation and configuration is now a two-step process.
|
||||||
@@ -14,6 +14,20 @@ Release 1.2.5 (2006-10-xx)
|
|||||||
- improved ThreadPool performance
|
- improved ThreadPool performance
|
||||||
- XML now compiles with -DXML_UNICODE_WCHAR_T (SF# 1575174)
|
- XML now compiles with -DXML_UNICODE_WCHAR_T (SF# 1575174)
|
||||||
- fixed SF# 1572757: HTML forms can have more than one key/value pair with the same name
|
- fixed SF# 1572757: HTML forms can have more than one key/value pair with the same name
|
||||||
|
- got rid of the dynamic casts in Events, Events/Cache: simpler/faster Delegate < operator,
|
||||||
|
prevents some rare dynamic casts error from occuring when using StrategyCollection with Caches
|
||||||
|
- improvements to Logger and LoggingConfigurator:
|
||||||
|
* added Logger::unsafeGet()
|
||||||
|
* added Logger::setProperty(loggerName, propertyName, value)
|
||||||
|
* LoggingConfigurator now correctly (re)configures existing Loggers
|
||||||
|
(prior to this change, if a Logger named "a.b.c" existed before
|
||||||
|
the LoggingConfigurator started its work, and the LoggingConfigurator
|
||||||
|
configured a Logger named "a.b", then "a.b.c" would not inherit
|
||||||
|
the new configuration).
|
||||||
|
- improvements to SplitterChannel and EventLogChannel configuration
|
||||||
|
- improved LoggingRegistry exception messages
|
||||||
|
- MessageHeader::read() is more liberal with malformed message headers.
|
||||||
|
This fixes problems with certain network cameras sending malformed HTTP headers.
|
||||||
|
|
||||||
|
|
||||||
Release 1.2.4 (2006-10-02)
|
Release 1.2.4 (2006-10-02)
|
||||||
@@ -529,4 +543,4 @@ building the libraries.
|
|||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
$Id: //poco/1.2/dist/CHANGELOG#10 $
|
$Id: //poco/1.2/dist/CHANGELOG#13 $
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ Peter Schojer <peter.schojer@appinf.com>
|
|||||||
Claus Dabringer <claus.dabringer@appinf.com>
|
Claus Dabringer <claus.dabringer@appinf.com>
|
||||||
Andrew Marlow (public@marlowa.plus.com)
|
Andrew Marlow (public@marlowa.plus.com)
|
||||||
Caleb Epstein (caleb.epstein@gmail.com)
|
Caleb Epstein (caleb.epstein@gmail.com)
|
||||||
|
Andrew J. P. Maclean (a.maclean@optusnet.com.au)
|
||||||
|
|
||||||
--
|
--
|
||||||
$Id: //poco/1.2/dist/CONTRIBUTORS#1 $
|
$Id: //poco/1.2/dist/CONTRIBUTORS#2 $
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// AbstractCache.h
|
// AbstractCache.h
|
||||||
//
|
//
|
||||||
// $Id: //poco/1.2/Foundation/include/Poco/AbstractCache.h#3 $
|
// $Id: //poco/1.2/Foundation/include/Poco/AbstractCache.h#4 $
|
||||||
//
|
//
|
||||||
// Library: Foundation
|
// Library: Foundation
|
||||||
// Package: Cache
|
// Package: Cache
|
||||||
@@ -124,6 +124,25 @@ public:
|
|||||||
doClear();
|
doClear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::size_t size() const
|
||||||
|
/// Returns the number of cached elements
|
||||||
|
{
|
||||||
|
FastMutex::ScopedLock lock(_mutex);
|
||||||
|
return _data.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
void forceReplace()
|
||||||
|
/// Forces cache replacement. Note that Poco's cache strategy use for efficiency reason no background thread
|
||||||
|
/// which periodically triggers cache replacement. Cache Replacement is only started when the cache is modified
|
||||||
|
/// from outside, i.e. add is called, or when a user tries to access an cache element via get.
|
||||||
|
/// In some cases, i.e. expire based caching where for a long time no access to the cache happens,
|
||||||
|
/// it might be desirable to be able to trigger cache replacement manually.
|
||||||
|
{
|
||||||
|
FastMutex::ScopedLock lock(_mutex);
|
||||||
|
doReplace();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
mutable BasicEvent<ValidArgs<TKey> > IsValid;
|
mutable BasicEvent<ValidArgs<TKey> > IsValid;
|
||||||
mutable BasicEvent<KeySet> Replace;
|
mutable BasicEvent<KeySet> Replace;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// AbstractDelegate.h
|
// AbstractDelegate.h
|
||||||
//
|
//
|
||||||
// $Id: //poco/1.2/Foundation/include/Poco/AbstractDelegate.h#1 $
|
// $Id: //poco/1.2/Foundation/include/Poco/AbstractDelegate.h#2 $
|
||||||
//
|
//
|
||||||
// Library: Foundation
|
// Library: Foundation
|
||||||
// Package: Events
|
// Package: Events
|
||||||
@@ -54,8 +54,14 @@ class AbstractDelegate
|
|||||||
/// instead of run-time checks.
|
/// instead of run-time checks.
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AbstractDelegate()
|
AbstractDelegate(void* pTarget): _pTarget(pTarget)
|
||||||
{
|
{
|
||||||
|
poco_assert_dbg (_pTarget != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
AbstractDelegate(const AbstractDelegate& del):_pTarget(del._pTarget)
|
||||||
|
{
|
||||||
|
poco_assert_dbg (_pTarget != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~AbstractDelegate()
|
virtual ~AbstractDelegate()
|
||||||
@@ -68,8 +74,19 @@ public:
|
|||||||
virtual AbstractDelegate* clone() const = 0;
|
virtual AbstractDelegate* clone() const = 0;
|
||||||
/// Returns a deep-copy of the AbstractDelegate
|
/// Returns a deep-copy of the AbstractDelegate
|
||||||
|
|
||||||
virtual bool operator < (const AbstractDelegate<TArgs>& other) const = 0;
|
bool operator < (const AbstractDelegate<TArgs>& other) const
|
||||||
/// For comparing AbstractDelegates in a collection.
|
/// For comparing AbstractDelegates in a collection.
|
||||||
|
{
|
||||||
|
return _pTarget < other._pTarget;
|
||||||
|
}
|
||||||
|
|
||||||
|
void* target() const
|
||||||
|
{
|
||||||
|
return _pTarget;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void* _pTarget;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// AbstractEvent.h
|
// AbstractEvent.h
|
||||||
//
|
//
|
||||||
// $Id: //poco/1.2/Foundation/include/Poco/AbstractEvent.h#1 $
|
// $Id: //poco/1.2/Foundation/include/Poco/AbstractEvent.h#3 $
|
||||||
//
|
//
|
||||||
// Library: Foundation
|
// Library: Foundation
|
||||||
// Package: Events
|
// Package: Events
|
||||||
@@ -211,7 +211,7 @@ public:
|
|||||||
/// the next notify. If one of the delegates throws an exception, the execution
|
/// the next notify. If one of the delegates throws an exception, the execution
|
||||||
/// is aborted and the exception is reported to the caller.
|
/// is aborted and the exception is reported to the caller.
|
||||||
{
|
{
|
||||||
NotifyAsyncParams params;
|
NotifyAsyncParams params(pSender, args);
|
||||||
|
|
||||||
{
|
{
|
||||||
FastMutex::ScopedLock lock(_mutex);
|
FastMutex::ScopedLock lock(_mutex);
|
||||||
@@ -223,8 +223,6 @@ public:
|
|||||||
// between notifyAsync and the execution of the method no changes can occur
|
// between notifyAsync and the execution of the method no changes can occur
|
||||||
|
|
||||||
params.ptrStrat = SharedPtr<TStrategy>(new TStrategy(_strategy));
|
params.ptrStrat = SharedPtr<TStrategy>(new TStrategy(_strategy));
|
||||||
params.pSender = pSender;
|
|
||||||
params.args = args;
|
|
||||||
params.enabled = _enabled;
|
params.enabled = _enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,7 +265,13 @@ protected:
|
|||||||
const void* pSender;
|
const void* pSender;
|
||||||
TArgs args;
|
TArgs args;
|
||||||
bool enabled;
|
bool enabled;
|
||||||
|
|
||||||
|
NotifyAsyncParams(const void* pSend, const TArgs& a):ptrStrat(), pSender(pSend), args(a), enabled(true)
|
||||||
|
/// default constructor reduces the need for TArgs to have an empty constructor, only copy constructor is needed.
|
||||||
|
{
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ActiveMethod<TArgs, NotifyAsyncParams, AbstractEvent> _executeAsync;
|
ActiveMethod<TArgs, NotifyAsyncParams, AbstractEvent> _executeAsync;
|
||||||
|
|
||||||
TArgs executeAsyncImpl(const NotifyAsyncParams& par)
|
TArgs executeAsyncImpl(const NotifyAsyncParams& par)
|
||||||
@@ -278,7 +282,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
NotifyAsyncParams params = par;
|
NotifyAsyncParams params = par;
|
||||||
TArgs retArgs = params.args;
|
TArgs retArgs(params.args);
|
||||||
params.ptrStrat->notify(params.pSender, retArgs);
|
params.ptrStrat->notify(params.pSender, retArgs);
|
||||||
return retArgs;
|
return retArgs;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// AbstractPriorityDelegate.h
|
// AbstractPriorityDelegate.h
|
||||||
//
|
//
|
||||||
// $Id: //poco/1.2/Foundation/include/Poco/AbstractPriorityDelegate.h#1 $
|
// $Id: //poco/1.2/Foundation/include/Poco/AbstractPriorityDelegate.h#2 $
|
||||||
//
|
//
|
||||||
// Library: Foundation
|
// Library: Foundation
|
||||||
// Package: Events
|
// Package: Events
|
||||||
@@ -54,7 +54,15 @@ class AbstractPriorityDelegate
|
|||||||
/// instead of run-time checks.
|
/// instead of run-time checks.
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AbstractPriorityDelegate()
|
AbstractPriorityDelegate(void* pTarget, int prio):
|
||||||
|
_pTarget(pTarget),
|
||||||
|
_priority(prio)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
AbstractPriorityDelegate(const AbstractPriorityDelegate& del):
|
||||||
|
_pTarget(del._pTarget),
|
||||||
|
_priority(del._priority)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,8 +76,30 @@ public:
|
|||||||
virtual AbstractPriorityDelegate* clone() const = 0;
|
virtual AbstractPriorityDelegate* clone() const = 0;
|
||||||
// Returns a deep-copy of the object.
|
// Returns a deep-copy of the object.
|
||||||
|
|
||||||
virtual bool operator < (const AbstractPriorityDelegate<TArgs>& other) const = 0;
|
bool operator < (const AbstractPriorityDelegate<TArgs>& other) const
|
||||||
/// Operator used for comparing AbstractPriorityDelegates in a collection.
|
/// Operator used for comparing AbstractPriorityDelegates in a collection.
|
||||||
|
{
|
||||||
|
if (_priority == other._priority)
|
||||||
|
{
|
||||||
|
return _pTarget < other._pTarget;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (_priority < other._priority);
|
||||||
|
}
|
||||||
|
|
||||||
|
void* target() const
|
||||||
|
{
|
||||||
|
return _pTarget;
|
||||||
|
}
|
||||||
|
|
||||||
|
int priority() const
|
||||||
|
{
|
||||||
|
return _priority;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void* _pTarget;
|
||||||
|
int _priority;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Delegate.h
|
// Delegate.h
|
||||||
//
|
//
|
||||||
// $Id: //poco/1.2/Foundation/include/Poco/Delegate.h#1 $
|
// $Id: //poco/1.2/Foundation/include/Poco/Delegate.h#3 $
|
||||||
//
|
//
|
||||||
// Library: Foundation
|
// Library: Foundation
|
||||||
// Package: Events
|
// Package: Events
|
||||||
@@ -55,12 +55,14 @@ public:
|
|||||||
typedef void (TObj::*NotifyMethod)(const void*, TArgs&);
|
typedef void (TObj::*NotifyMethod)(const void*, TArgs&);
|
||||||
|
|
||||||
Delegate(TObj* obj, NotifyMethod method):
|
Delegate(TObj* obj, NotifyMethod method):
|
||||||
|
AbstractDelegate<TArgs>(obj),
|
||||||
_receiverObject(obj),
|
_receiverObject(obj),
|
||||||
_receiverMethod(method)
|
_receiverMethod(method)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Delegate(const Delegate& delegate):
|
Delegate(const Delegate& delegate):
|
||||||
|
AbstractDelegate<TArgs>(delegate),
|
||||||
_receiverObject(delegate._receiverObject),
|
_receiverObject(delegate._receiverObject),
|
||||||
_receiverMethod(delegate._receiverMethod)
|
_receiverMethod(delegate._receiverMethod)
|
||||||
{
|
{
|
||||||
@@ -74,8 +76,9 @@ public:
|
|||||||
{
|
{
|
||||||
if (&delegate != this)
|
if (&delegate != this)
|
||||||
{
|
{
|
||||||
_receiverObject = delegate._receiverObject;
|
this->_pTarget = delegate._pTarget;
|
||||||
_receiverMethod = delegate._receiverMethod;
|
this->_receiverObject = delegate._receiverObject;
|
||||||
|
this->_receiverMethod = delegate._receiverMethod;
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@@ -91,20 +94,6 @@ public:
|
|||||||
return new Delegate(*this);
|
return new Delegate(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator < (const AbstractDelegate<TArgs>& other) const
|
|
||||||
{
|
|
||||||
const Delegate<TObj, TArgs>* pOther = dynamic_cast<const Delegate<TObj, TArgs>*>(&other);
|
|
||||||
|
|
||||||
if (pOther == 0)
|
|
||||||
{
|
|
||||||
const Expire<TArgs>* pExpire = dynamic_cast<const Expire<TArgs>*>(&other);
|
|
||||||
poco_check_ptr(pExpire);
|
|
||||||
return this->operator < (pExpire->getDelegate());
|
|
||||||
}
|
|
||||||
|
|
||||||
return _receiverObject < pOther->_receiverObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
TObj* _receiverObject;
|
TObj* _receiverObject;
|
||||||
NotifyMethod _receiverMethod;
|
NotifyMethod _receiverMethod;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// EventLogChannel.h
|
// EventLogChannel.h
|
||||||
//
|
//
|
||||||
// $Id: //poco/1.2/Foundation/include/Poco/EventLogChannel.h#1 $
|
// $Id: //poco/1.2/Foundation/include/Poco/EventLogChannel.h#2 $
|
||||||
//
|
//
|
||||||
// Library: Foundation
|
// Library: Foundation
|
||||||
// Package: Logging
|
// Package: Logging
|
||||||
@@ -88,16 +88,18 @@ public:
|
|||||||
///
|
///
|
||||||
/// The following properties are supported:
|
/// The following properties are supported:
|
||||||
///
|
///
|
||||||
/// * name: The name of the event source.
|
/// * name: The name of the event source.
|
||||||
/// * host: The name of the host where the Event Log service is running.
|
/// * loghost: The name of the host where the Event Log service is running.
|
||||||
/// The default is "localhost".
|
/// The default is "localhost".
|
||||||
/// * logFile: The name of the log file. The default is "Application".
|
/// * host: same as host.
|
||||||
|
/// * logfile: The name of the log file. The default is "Application".
|
||||||
|
|
||||||
std::string getProperty(const std::string& name) const;
|
std::string getProperty(const std::string& name) const;
|
||||||
/// Returns the value of the given property.
|
/// Returns the value of the given property.
|
||||||
|
|
||||||
static const std::string PROP_NAME;
|
static const std::string PROP_NAME;
|
||||||
static const std::string PROP_HOST;
|
static const std::string PROP_HOST;
|
||||||
|
static const std::string PROP_LOGHOST;
|
||||||
static const std::string PROP_LOGFILE;
|
static const std::string PROP_LOGFILE;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Expire.h
|
// Expire.h
|
||||||
//
|
//
|
||||||
// $Id: //poco/1.2/Foundation/include/Poco/Expire.h#1 $
|
// $Id: //poco/1.2/Foundation/include/Poco/Expire.h#2 $
|
||||||
//
|
//
|
||||||
// Library: Foundation
|
// Library: Foundation
|
||||||
// Package: Events
|
// Package: Events
|
||||||
@@ -55,12 +55,14 @@ class Expire: public AbstractDelegate<TArgs>
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Expire(const AbstractDelegate<TArgs>& p, Timestamp::TimeDiff expireMillisecs):
|
Expire(const AbstractDelegate<TArgs>& p, Timestamp::TimeDiff expireMillisecs):
|
||||||
|
AbstractDelegate<TArgs>(p),
|
||||||
_pDelegate(p.clone()),
|
_pDelegate(p.clone()),
|
||||||
_expire(expireMillisecs*1000)
|
_expire(expireMillisecs*1000)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Expire(const Expire& expire):
|
Expire(const Expire& expire):
|
||||||
|
AbstractDelegate<TArgs>(expire),
|
||||||
_pDelegate(expire._pDelegate->clone()),
|
_pDelegate(expire._pDelegate->clone()),
|
||||||
_expire(expire._expire),
|
_expire(expire._expire),
|
||||||
_creationTime(expire._creationTime)
|
_creationTime(expire._creationTime)
|
||||||
@@ -76,10 +78,11 @@ public:
|
|||||||
{
|
{
|
||||||
if (&expire != this)
|
if (&expire != this)
|
||||||
{
|
{
|
||||||
delete _pDelegate;
|
delete this->_pDelegate;
|
||||||
_pDelegate = expire._pDelegate->clone();
|
this->_pDelegate = expire._pDelegate->clone();
|
||||||
_expire = expire._expire;
|
this->_expire = expire._expire;
|
||||||
_creationTime = expire._creationTime;
|
this->_creationTime = expire._creationTime;
|
||||||
|
this->_pTarget = expire._pTarget;
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@@ -87,7 +90,7 @@ public:
|
|||||||
bool notify(const void* sender, TArgs& arguments)
|
bool notify(const void* sender, TArgs& arguments)
|
||||||
{
|
{
|
||||||
if (!expired())
|
if (!expired())
|
||||||
return _pDelegate->notify(sender, arguments);
|
return this->_pDelegate->notify(sender, arguments);
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -97,34 +100,18 @@ public:
|
|||||||
return new Expire(*this);
|
return new Expire(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator < (const AbstractDelegate<TArgs>& other) const
|
|
||||||
{
|
|
||||||
const Expire* pOther = dynamic_cast<const Expire*>(&other);
|
|
||||||
|
|
||||||
if (pOther)
|
|
||||||
return _pDelegate->operator < (*pOther->_pDelegate);
|
|
||||||
else
|
|
||||||
return _pDelegate->operator < (other);
|
|
||||||
}
|
|
||||||
|
|
||||||
void destroy()
|
void destroy()
|
||||||
{
|
{
|
||||||
delete _pDelegate;
|
delete this->_pDelegate;
|
||||||
_pDelegate = 0;
|
this->_pDelegate = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const AbstractDelegate<TArgs>& getDelegate() const
|
const AbstractDelegate<TArgs>& getDelegate() const
|
||||||
{
|
{
|
||||||
return *_pDelegate;
|
return *this->_pDelegate;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Expire(AbstractDelegate<TArgs>* p, Timestamp::TimeDiff expireMillisecs):
|
|
||||||
_pDelegate(p),
|
|
||||||
_expire(expireMillisecs*1000)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool expired() const
|
bool expired() const
|
||||||
{
|
{
|
||||||
return _creationTime.isElapsed(_expire);
|
return _creationTime.isElapsed(_expire);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// ExpireLRUCache.h
|
// ExpireLRUCache.h
|
||||||
//
|
//
|
||||||
// $Id: //poco/1.2/Foundation/include/Poco/ExpireLRUCache.h#3 $
|
// $Id: //poco/1.2/Foundation/include/Poco/ExpireLRUCache.h#4 $
|
||||||
//
|
//
|
||||||
// Library: Foundation
|
// Library: Foundation
|
||||||
// Package: Cache
|
// Package: Cache
|
||||||
@@ -54,7 +54,7 @@ template <
|
|||||||
class TValue
|
class TValue
|
||||||
>
|
>
|
||||||
class ExpireLRUCache: public AbstractCache<TKey, TValue, StrategyCollection<TKey, TValue> >
|
class ExpireLRUCache: public AbstractCache<TKey, TValue, StrategyCollection<TKey, TValue> >
|
||||||
/// An ExpireLRUCache combines LUR caching and time based expire caching.
|
/// An ExpireLRUCache combines LRU caching and time based expire caching.
|
||||||
/// It cache entries for a fixed time period (per default 10 minutes)
|
/// It cache entries for a fixed time period (per default 10 minutes)
|
||||||
/// but also limits the size of the cache (per default: 1024).
|
/// but also limits the size of the cache (per default: 1024).
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// LRUCache.h
|
// LRUCache.h
|
||||||
//
|
//
|
||||||
// $Id: //poco/1.2/Foundation/include/Poco/LRUCache.h#3 $
|
// $Id: //poco/1.2/Foundation/include/Poco/LRUCache.h#4 $
|
||||||
//
|
//
|
||||||
// Library: Foundation
|
// Library: Foundation
|
||||||
// Package: Cache
|
// Package: Cache
|
||||||
@@ -49,7 +49,7 @@ namespace Poco {
|
|||||||
|
|
||||||
template <class TKey, class TValue>
|
template <class TKey, class TValue>
|
||||||
class LRUCache: public AbstractCache<TKey, TValue, LRUStrategy<TKey, TValue> >
|
class LRUCache: public AbstractCache<TKey, TValue, LRUStrategy<TKey, TValue> >
|
||||||
/// An LRUCache is the interface of all caches.
|
/// An LRUCache implements Least Recently Used caching. The default size for a cache is 1024 entries
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LRUCache(long size = 1024):
|
LRUCache(long size = 1024):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Logger.h
|
// Logger.h
|
||||||
//
|
//
|
||||||
// $Id: //poco/1.2/Foundation/include/Poco/Logger.h#1 $
|
// $Id: //poco/1.2/Foundation/include/Poco/Logger.h#2 $
|
||||||
//
|
//
|
||||||
// Library: Foundation
|
// Library: Foundation
|
||||||
// Package: Logging
|
// Package: Logging
|
||||||
@@ -241,10 +241,24 @@ public:
|
|||||||
/// Attaches the given Channel to all loggers that are
|
/// Attaches the given Channel to all loggers that are
|
||||||
/// descendants of the Logger with the given name.
|
/// descendants of the Logger with the given name.
|
||||||
|
|
||||||
|
static void setProperty(const std::string& loggerName, const std::string& propertyName, const std::string& value);
|
||||||
|
/// Sets or changes a configuration property for all loggers
|
||||||
|
/// that are descendants of the Logger with the given name.
|
||||||
|
|
||||||
static Logger& get(const std::string& name);
|
static Logger& get(const std::string& name);
|
||||||
/// Returns a reference to the Logger with the given name.
|
/// Returns a reference to the Logger with the given name.
|
||||||
/// If the Logger does not yet exist, it is created, based
|
/// If the Logger does not yet exist, it is created, based
|
||||||
/// on its parent logger.
|
/// on its parent logger.
|
||||||
|
|
||||||
|
static Logger& unsafeGet(const std::string& name);
|
||||||
|
/// Returns a reference to the Logger with the given name.
|
||||||
|
/// If the Logger does not yet exist, it is created, based
|
||||||
|
/// on its parent logger.
|
||||||
|
///
|
||||||
|
/// WARNING: This method is not thread safe. You should
|
||||||
|
/// probably use get() instead.
|
||||||
|
/// The only time this method should be used is during
|
||||||
|
/// program initialization, when only one thread is running.
|
||||||
|
|
||||||
static Logger& create(const std::string& name, Channel* pChannel, int level = Message::PRIO_INFORMATION);
|
static Logger& create(const std::string& name, Channel* pChannel, int level = Message::PRIO_INFORMATION);
|
||||||
/// Creates and returns a reference to a Logger with the
|
/// Creates and returns a reference to a Logger with the
|
||||||
@@ -274,6 +288,8 @@ public:
|
|||||||
/// Fills the given vector with the names
|
/// Fills the given vector with the names
|
||||||
/// of all currently defined loggers.
|
/// of all currently defined loggers.
|
||||||
|
|
||||||
|
static const std::string ROOT; /// The name of the root logger ("").
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef std::map<std::string, Logger*> LoggerMap;
|
typedef std::map<std::string, Logger*> LoggerMap;
|
||||||
|
|
||||||
@@ -286,6 +302,7 @@ protected:
|
|||||||
static void formatDump(std::string& message, const void* buffer, int length);
|
static void formatDump(std::string& message, const void* buffer, int length);
|
||||||
static Logger& parent(const std::string& name);
|
static Logger& parent(const std::string& name);
|
||||||
static void add(Logger* pLogger);
|
static void add(Logger* pLogger);
|
||||||
|
static Logger* find(const std::string& name);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Logger();
|
Logger();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// PriorityDelegate.h
|
// PriorityDelegate.h
|
||||||
//
|
//
|
||||||
// $Id: //poco/1.2/Foundation/include/Poco/PriorityDelegate.h#1 $
|
// $Id: //poco/1.2/Foundation/include/Poco/PriorityDelegate.h#3 $
|
||||||
//
|
//
|
||||||
// Library: Foundation
|
// Library: Foundation
|
||||||
// Package: Events
|
// Package: Events
|
||||||
@@ -54,17 +54,17 @@ class PriorityDelegate: public AbstractPriorityDelegate<TArgs>
|
|||||||
public:
|
public:
|
||||||
typedef void (TObj::*NotifyMethod)(const void*, TArgs&);
|
typedef void (TObj::*NotifyMethod)(const void*, TArgs&);
|
||||||
|
|
||||||
PriorityDelegate(TObj* obj, NotifyMethod method, int prio):
|
PriorityDelegate(TObj* obj, NotifyMethod method, int prio):
|
||||||
_receiverObject(obj),
|
AbstractPriorityDelegate<TArgs>(obj, prio),
|
||||||
_receiverMethod(method),
|
_receiverObject(obj),
|
||||||
_priority(prio)
|
_receiverMethod(method)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
PriorityDelegate(const PriorityDelegate& delegate):
|
PriorityDelegate(const PriorityDelegate& delegate):
|
||||||
|
AbstractPriorityDelegate<TArgs>(delegate._pTarget, delegate._priority),
|
||||||
_receiverObject(delegate._receiverObject),
|
_receiverObject(delegate._receiverObject),
|
||||||
_receiverMethod(delegate._receiverMethod),
|
_receiverMethod(delegate._receiverMethod)
|
||||||
_priority(delegate._priority)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,9 +72,10 @@ public:
|
|||||||
{
|
{
|
||||||
if (&delegate != this)
|
if (&delegate != this)
|
||||||
{
|
{
|
||||||
_receiverObject = delegate._receiverObject;
|
this->_pTarget = delegate._pTarget;
|
||||||
_receiverMethod = delegate._receiverMethod;
|
this->_receiverObject = delegate._receiverObject;
|
||||||
_priority = delegate._priority;
|
this->_receiverMethod = delegate._receiverMethod;
|
||||||
|
this->_priority = delegate._priority;
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@@ -94,35 +95,9 @@ public:
|
|||||||
return new PriorityDelegate(*this);
|
return new PriorityDelegate(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator < (const AbstractPriorityDelegate<TArgs>& other) const
|
|
||||||
{
|
|
||||||
const PriorityDelegate* pOther = dynamic_cast<const PriorityDelegate*>(&other);
|
|
||||||
|
|
||||||
if (pOther == 0)
|
|
||||||
{
|
|
||||||
const PriorityExpire<TArgs>* pExpire = dynamic_cast<const PriorityExpire<TArgs>*>(&other);
|
|
||||||
poco_check_ptr(pExpire);
|
|
||||||
|
|
||||||
return this->operator < (pExpire->getDelegate());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_priority < pOther->_priority)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_priority > pOther->_priority)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return _receiverObject < pOther->_receiverObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
TObj* _receiverObject;
|
TObj* _receiverObject;
|
||||||
NotifyMethod _receiverMethod;
|
NotifyMethod _receiverMethod;
|
||||||
int _priority;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PriorityDelegate();
|
PriorityDelegate();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// PriorityExpire.h
|
// PriorityExpire.h
|
||||||
//
|
//
|
||||||
// $Id: //poco/1.2/Foundation/include/Poco/PriorityExpire.h#1 $
|
// $Id: //poco/1.2/Foundation/include/Poco/PriorityExpire.h#2 $
|
||||||
//
|
//
|
||||||
// Library: Foundation
|
// Library: Foundation
|
||||||
// Package: Events
|
// Package: Events
|
||||||
@@ -54,13 +54,15 @@ class PriorityExpire: public AbstractPriorityDelegate<TArgs>
|
|||||||
/// expiring of registrations to AbstractPriorityDelegate.
|
/// expiring of registrations to AbstractPriorityDelegate.
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PriorityExpire(const AbstractPriorityDelegate<TArgs>& p, Timestamp::TimeDiff expireMilliSec):
|
PriorityExpire(const AbstractPriorityDelegate<TArgs>& p, Timestamp::TimeDiff expireMilliSec):
|
||||||
|
AbstractPriorityDelegate<TArgs>(p),
|
||||||
_pDelegate(p.clone()),
|
_pDelegate(p.clone()),
|
||||||
_expire(expireMilliSec*1000)
|
_expire(expireMilliSec*1000)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
PriorityExpire(const PriorityExpire& expire):
|
PriorityExpire(const PriorityExpire& expire):
|
||||||
|
AbstractPriorityDelegate<TArgs>(expire),
|
||||||
_pDelegate(expire._pDelegate->clone()),
|
_pDelegate(expire._pDelegate->clone()),
|
||||||
_expire(expire._expire),
|
_expire(expire._expire),
|
||||||
_creationTime(expire._creationTime)
|
_creationTime(expire._creationTime)
|
||||||
@@ -76,10 +78,11 @@ public:
|
|||||||
{
|
{
|
||||||
if (&expire != this)
|
if (&expire != this)
|
||||||
{
|
{
|
||||||
delete _pDelegate;
|
delete this->_pDelegate;
|
||||||
_pDelegate = expire._pDelegate->clone();
|
this->_pTarget = expire._pTarget;
|
||||||
_expire = expire._expire;
|
this->_pDelegate = expire._pDelegate->clone();
|
||||||
_creationTime = expire._creationTime;
|
this->_expire = expire._expire;
|
||||||
|
this->_creationTime = expire._creationTime;
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@@ -87,7 +90,7 @@ public:
|
|||||||
bool notify(const void* sender, TArgs& arguments)
|
bool notify(const void* sender, TArgs& arguments)
|
||||||
{
|
{
|
||||||
if (!expired())
|
if (!expired())
|
||||||
return _pDelegate->notify(sender, arguments);
|
return this->_pDelegate->notify(sender, arguments);
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -97,34 +100,18 @@ public:
|
|||||||
return new PriorityExpire(*this);
|
return new PriorityExpire(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator < (const AbstractPriorityDelegate<TArgs>& other) const
|
|
||||||
{
|
|
||||||
const PriorityExpire<TArgs>* pOther = dynamic_cast<const PriorityExpire<TArgs>*>(&other);
|
|
||||||
|
|
||||||
if (pOther)
|
|
||||||
return _pDelegate->operator < (*pOther->_pDelegate);
|
|
||||||
else
|
|
||||||
return _pDelegate->operator < (other);
|
|
||||||
}
|
|
||||||
|
|
||||||
void destroy()
|
void destroy()
|
||||||
{
|
{
|
||||||
delete _pDelegate;
|
delete this->_pDelegate;
|
||||||
_pDelegate = 0;
|
this->_pDelegate = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const AbstractPriorityDelegate<TArgs>& getDelegate() const
|
const AbstractPriorityDelegate<TArgs>& getDelegate() const
|
||||||
{
|
{
|
||||||
return *_pDelegate;
|
return *this->_pDelegate;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PriorityExpire(AbstractPriorityDelegate<TArgs>* p, Timestamp::TimeDiff expireMilliSec):
|
|
||||||
_pDelegate(p),
|
|
||||||
_expire(expireMilliSec*1000)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool expired() const
|
bool expired() const
|
||||||
{
|
{
|
||||||
return _creationTime.isElapsed(_expire);
|
return _creationTime.isElapsed(_expire);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// SplitterChannel.h
|
// SplitterChannel.h
|
||||||
//
|
//
|
||||||
// $Id: //poco/1.2/Foundation/include/Poco/SplitterChannel.h#1 $
|
// $Id: //poco/1.2/Foundation/include/Poco/SplitterChannel.h#2 $
|
||||||
//
|
//
|
||||||
// Library: Foundation
|
// Library: Foundation
|
||||||
// Package: Logging
|
// Package: Logging
|
||||||
@@ -71,7 +71,7 @@ public:
|
|||||||
/// Sets or changes a configuration property.
|
/// Sets or changes a configuration property.
|
||||||
///
|
///
|
||||||
/// Only the "channel" property is supported, which allows
|
/// Only the "channel" property is supported, which allows
|
||||||
/// adding a channel via the LoggingRegistry.
|
/// adding a comma-separated list of channels via the LoggingRegistry.
|
||||||
/// The "channel" property is set-only.
|
/// The "channel" property is set-only.
|
||||||
/// To simplify file-based configuration, all property
|
/// To simplify file-based configuration, all property
|
||||||
/// names starting with "channel" are treated as "channel".
|
/// names starting with "channel" are treated as "channel".
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// EventLogChannel.cpp
|
// EventLogChannel.cpp
|
||||||
//
|
//
|
||||||
// $Id: //poco/1.2/Foundation/src/EventLogChannel.cpp#1 $
|
// $Id: //poco/1.2/Foundation/src/EventLogChannel.cpp#2 $
|
||||||
//
|
//
|
||||||
// Library: Foundation
|
// Library: Foundation
|
||||||
// Package: Logging
|
// Package: Logging
|
||||||
@@ -36,6 +36,7 @@
|
|||||||
|
|
||||||
#include "Poco/EventLogChannel.h"
|
#include "Poco/EventLogChannel.h"
|
||||||
#include "Poco/Message.h"
|
#include "Poco/Message.h"
|
||||||
|
#include "Poco/String.h"
|
||||||
#include "pocomsg.h"
|
#include "pocomsg.h"
|
||||||
#if defined(POCO_WIN32_UTF8)
|
#if defined(POCO_WIN32_UTF8)
|
||||||
#include "Poco/UnicodeConverter.h"
|
#include "Poco/UnicodeConverter.h"
|
||||||
@@ -47,7 +48,8 @@ namespace Poco {
|
|||||||
|
|
||||||
const std::string EventLogChannel::PROP_NAME = "name";
|
const std::string EventLogChannel::PROP_NAME = "name";
|
||||||
const std::string EventLogChannel::PROP_HOST = "host";
|
const std::string EventLogChannel::PROP_HOST = "host";
|
||||||
const std::string EventLogChannel::PROP_LOGFILE = "logFile";
|
const std::string EventLogChannel::PROP_LOGHOST = "loghost";
|
||||||
|
const std::string EventLogChannel::PROP_LOGFILE = "logfile";
|
||||||
|
|
||||||
|
|
||||||
EventLogChannel::EventLogChannel():
|
EventLogChannel::EventLogChannel():
|
||||||
@@ -142,11 +144,13 @@ void EventLogChannel::log(const Message& msg)
|
|||||||
|
|
||||||
void EventLogChannel::setProperty(const std::string& name, const std::string& value)
|
void EventLogChannel::setProperty(const std::string& name, const std::string& value)
|
||||||
{
|
{
|
||||||
if (name == PROP_NAME)
|
if (icompare(name, PROP_NAME) == 0)
|
||||||
_name = value;
|
_name = value;
|
||||||
else if (name == PROP_HOST)
|
else if (icompare(name, PROP_HOST) == 0)
|
||||||
_host = value;
|
_host = value;
|
||||||
else if (name == PROP_LOGFILE)
|
else if (icompare(name, PROP_LOGHOST) == 0)
|
||||||
|
_host = value;
|
||||||
|
else if (icompare(name, PROP_LOGFILE) == 0)
|
||||||
_logFile = value;
|
_logFile = value;
|
||||||
else
|
else
|
||||||
Channel::setProperty(name, value);
|
Channel::setProperty(name, value);
|
||||||
@@ -155,11 +159,13 @@ void EventLogChannel::setProperty(const std::string& name, const std::string& va
|
|||||||
|
|
||||||
std::string EventLogChannel::getProperty(const std::string& name) const
|
std::string EventLogChannel::getProperty(const std::string& name) const
|
||||||
{
|
{
|
||||||
if (name == PROP_NAME)
|
if (icompare(name, PROP_NAME) == 0)
|
||||||
return _name;
|
return _name;
|
||||||
else if (name == PROP_HOST)
|
else if (icompare(name, PROP_HOST) == 0)
|
||||||
return _host;
|
return _host;
|
||||||
else if (name == PROP_LOGFILE)
|
else if (icompare(name, PROP_LOGHOST) == 0)
|
||||||
|
return _host;
|
||||||
|
else if (icompare(name, PROP_LOGFILE) == 0)
|
||||||
return _logFile;
|
return _logFile;
|
||||||
else
|
else
|
||||||
return Channel::getProperty(name);
|
return Channel::getProperty(name);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Logger.cpp
|
// Logger.cpp
|
||||||
//
|
//
|
||||||
// $Id: //poco/1.2/Foundation/src/Logger.cpp#1 $
|
// $Id: //poco/1.2/Foundation/src/Logger.cpp#2 $
|
||||||
//
|
//
|
||||||
// Library: Foundation
|
// Library: Foundation
|
||||||
// Package: Logging
|
// Package: Logging
|
||||||
@@ -46,6 +46,7 @@ namespace Poco {
|
|||||||
|
|
||||||
Logger::LoggerMap* Logger::_pLoggerMap = 0;
|
Logger::LoggerMap* Logger::_pLoggerMap = 0;
|
||||||
Mutex Logger::_mapMtx;
|
Mutex Logger::_mapMtx;
|
||||||
|
const std::string Logger::ROOT;
|
||||||
|
|
||||||
|
|
||||||
Logger::Logger(const std::string& name, Channel* pChannel, int level): _name(name), _pChannel(pChannel), _level(level)
|
Logger::Logger(const std::string& name, Channel* pChannel, int level): _name(name), _pChannel(pChannel), _level(level)
|
||||||
@@ -172,6 +173,22 @@ void Logger::setChannel(const std::string& name, Channel* pChannel)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Logger::setProperty(const std::string& loggerName, const std::string& propertyName, const std::string& value)
|
||||||
|
{
|
||||||
|
Mutex::ScopedLock lock(_mapMtx);
|
||||||
|
|
||||||
|
if (_pLoggerMap)
|
||||||
|
{
|
||||||
|
std::string::size_type len = loggerName.length();
|
||||||
|
for (LoggerMap::iterator it = _pLoggerMap->begin(); it != _pLoggerMap->end(); ++it)
|
||||||
|
{
|
||||||
|
if (len == 0 || it->first.compare(0, len, loggerName) == 0 && (it->first.length() == len || it->first[len] == '.'))
|
||||||
|
it->second->setProperty(propertyName, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string Logger::format(const std::string& fmt, const std::string& arg)
|
std::string Logger::format(const std::string& fmt, const std::string& arg)
|
||||||
{
|
{
|
||||||
std::string args[] =
|
std::string args[] =
|
||||||
@@ -289,11 +306,24 @@ Logger& Logger::get(const std::string& name)
|
|||||||
{
|
{
|
||||||
Mutex::ScopedLock lock(_mapMtx);
|
Mutex::ScopedLock lock(_mapMtx);
|
||||||
|
|
||||||
Logger* pLogger = has(name);
|
return unsafeGet(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Logger& Logger::unsafeGet(const std::string& name)
|
||||||
|
{
|
||||||
|
Logger* pLogger = find(name);
|
||||||
if (!pLogger)
|
if (!pLogger)
|
||||||
{
|
{
|
||||||
Logger& par = parent(name);
|
if (name == ROOT)
|
||||||
pLogger = new Logger(name, par.getChannel(), par.getLevel());
|
{
|
||||||
|
pLogger = new Logger(name, 0, Message::PRIO_INFORMATION);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Logger& par = parent(name);
|
||||||
|
pLogger = new Logger(name, par.getChannel(), par.getLevel());
|
||||||
|
}
|
||||||
add(pLogger);
|
add(pLogger);
|
||||||
}
|
}
|
||||||
return *pLogger;
|
return *pLogger;
|
||||||
@@ -304,7 +334,7 @@ Logger& Logger::create(const std::string& name, Channel* pChannel, int level)
|
|||||||
{
|
{
|
||||||
Mutex::ScopedLock lock(_mapMtx);
|
Mutex::ScopedLock lock(_mapMtx);
|
||||||
|
|
||||||
if (has(name)) throw ExistsException();
|
if (find(name)) throw ExistsException();
|
||||||
Logger* pLogger = new Logger(name, pChannel, level);
|
Logger* pLogger = new Logger(name, pChannel, level);
|
||||||
add(pLogger);
|
add(pLogger);
|
||||||
return *pLogger;
|
return *pLogger;
|
||||||
@@ -315,13 +345,7 @@ Logger& Logger::root()
|
|||||||
{
|
{
|
||||||
Mutex::ScopedLock lock(_mapMtx);
|
Mutex::ScopedLock lock(_mapMtx);
|
||||||
|
|
||||||
Logger* pRoot = has("");
|
return unsafeGet(ROOT);
|
||||||
if (!pRoot)
|
|
||||||
{
|
|
||||||
pRoot = new Logger("", 0, Message::PRIO_INFORMATION);
|
|
||||||
add(pRoot);
|
|
||||||
}
|
|
||||||
return *pRoot;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -329,13 +353,7 @@ Logger* Logger::has(const std::string& name)
|
|||||||
{
|
{
|
||||||
Mutex::ScopedLock lock(_mapMtx);
|
Mutex::ScopedLock lock(_mapMtx);
|
||||||
|
|
||||||
if (_pLoggerMap)
|
return find(name);
|
||||||
{
|
|
||||||
LoggerMap::iterator it = _pLoggerMap->find(name);
|
|
||||||
if (it != _pLoggerMap->end())
|
|
||||||
return it->second;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -355,6 +373,18 @@ void Logger::shutdown()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Logger* Logger::find(const std::string& name)
|
||||||
|
{
|
||||||
|
if (_pLoggerMap)
|
||||||
|
{
|
||||||
|
LoggerMap::iterator it = _pLoggerMap->find(name);
|
||||||
|
if (it != _pLoggerMap->end())
|
||||||
|
return it->second;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Logger::destroy(const std::string& name)
|
void Logger::destroy(const std::string& name)
|
||||||
{
|
{
|
||||||
Mutex::ScopedLock lock(_mapMtx);
|
Mutex::ScopedLock lock(_mapMtx);
|
||||||
@@ -392,16 +422,13 @@ Logger& Logger::parent(const std::string& name)
|
|||||||
if (pos != std::string::npos)
|
if (pos != std::string::npos)
|
||||||
{
|
{
|
||||||
std::string pname = name.substr(0, pos);
|
std::string pname = name.substr(0, pos);
|
||||||
Logger* pParent = has(pname);
|
Logger* pParent = find(pname);
|
||||||
if (pParent)
|
if (pParent)
|
||||||
return *pParent;
|
return *pParent;
|
||||||
else
|
else
|
||||||
return parent(pname);
|
return parent(pname);
|
||||||
}
|
}
|
||||||
else
|
else return unsafeGet(ROOT);
|
||||||
{
|
|
||||||
return root();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// LoggingRegistry.cpp
|
// LoggingRegistry.cpp
|
||||||
//
|
//
|
||||||
// $Id: //poco/1.2/Foundation/src/LoggingRegistry.cpp#1 $
|
// $Id: //poco/1.2/Foundation/src/LoggingRegistry.cpp#2 $
|
||||||
//
|
//
|
||||||
// Library: Foundation
|
// Library: Foundation
|
||||||
// Package: Logging
|
// Package: Logging
|
||||||
@@ -59,7 +59,7 @@ Channel* LoggingRegistry::channelForName(const std::string& name) const
|
|||||||
if (it != _channelMap.end())
|
if (it != _channelMap.end())
|
||||||
return const_cast<Channel*>(it->second.get());
|
return const_cast<Channel*>(it->second.get());
|
||||||
else
|
else
|
||||||
throw NotFoundException(name);
|
throw NotFoundException("logging channel", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ Formatter* LoggingRegistry::formatterForName(const std::string& name) const
|
|||||||
if (it != _formatterMap.end())
|
if (it != _formatterMap.end())
|
||||||
return const_cast<Formatter*>(it->second.get());
|
return const_cast<Formatter*>(it->second.get());
|
||||||
else
|
else
|
||||||
throw NotFoundException(name);
|
throw NotFoundException("logging formatter", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ void LoggingRegistry::unregisterChannel(const std::string& name)
|
|||||||
if (it != _channelMap.end())
|
if (it != _channelMap.end())
|
||||||
_channelMap.erase(it);
|
_channelMap.erase(it);
|
||||||
else
|
else
|
||||||
throw NotFoundException(name);
|
throw NotFoundException("logging channel", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ void LoggingRegistry::unregisterFormatter(const std::string& name)
|
|||||||
if (it != _formatterMap.end())
|
if (it != _formatterMap.end())
|
||||||
_formatterMap.erase(it);
|
_formatterMap.erase(it);
|
||||||
else
|
else
|
||||||
throw NotFoundException(name);
|
throw NotFoundException("logging formatter", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// SplitterChannel.cpp
|
// SplitterChannel.cpp
|
||||||
//
|
//
|
||||||
// $Id: //poco/1.2/Foundation/src/SplitterChannel.cpp#1 $
|
// $Id: //poco/1.2/Foundation/src/SplitterChannel.cpp#2 $
|
||||||
//
|
//
|
||||||
// Library: Foundation
|
// Library: Foundation
|
||||||
// Package: Logging
|
// Package: Logging
|
||||||
@@ -36,6 +36,7 @@
|
|||||||
|
|
||||||
#include "Poco/SplitterChannel.h"
|
#include "Poco/SplitterChannel.h"
|
||||||
#include "Poco/LoggingRegistry.h"
|
#include "Poco/LoggingRegistry.h"
|
||||||
|
#include "Poco/StringTokenizer.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
namespace Poco {
|
||||||
@@ -82,9 +83,14 @@ void SplitterChannel::removeChannel(Channel* pChannel)
|
|||||||
void SplitterChannel::setProperty(const std::string& name, const std::string& value)
|
void SplitterChannel::setProperty(const std::string& name, const std::string& value)
|
||||||
{
|
{
|
||||||
if (name.compare(0, 7, "channel") == 0)
|
if (name.compare(0, 7, "channel") == 0)
|
||||||
addChannel(LoggingRegistry::defaultRegistry().channelForName(value));
|
{
|
||||||
else
|
StringTokenizer tokenizer(value, ",;", StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM);
|
||||||
Channel::setProperty(name, value);
|
for (StringTokenizer::Iterator it = tokenizer.begin(); it != tokenizer.end(); ++it)
|
||||||
|
{
|
||||||
|
addChannel(LoggingRegistry::defaultRegistry().channelForName(*it));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else Channel::setProperty(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// LRUCacheTest.cpp
|
// LRUCacheTest.cpp
|
||||||
//
|
//
|
||||||
// $Id: //poco/1.2/Foundation/testsuite/src/LRUCacheTest.cpp#2 $
|
// $Id: //poco/1.2/Foundation/testsuite/src/LRUCacheTest.cpp#3 $
|
||||||
//
|
//
|
||||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||||
// and Contributors.
|
// and Contributors.
|
||||||
@@ -54,9 +54,11 @@ LRUCacheTest::~LRUCacheTest()
|
|||||||
void LRUCacheTest::testClear()
|
void LRUCacheTest::testClear()
|
||||||
{
|
{
|
||||||
LRUCache<int, int> aCache(3);
|
LRUCache<int, int> aCache(3);
|
||||||
|
assert (aCache.size() == 0);
|
||||||
aCache.add(1, 2);
|
aCache.add(1, 2);
|
||||||
aCache.add(3, 4);
|
aCache.add(3, 4);
|
||||||
aCache.add(5, 6);
|
aCache.add(5, 6);
|
||||||
|
assert (aCache.size() == 3);
|
||||||
assert (aCache.has(1));
|
assert (aCache.has(1));
|
||||||
assert (aCache.has(3));
|
assert (aCache.has(3));
|
||||||
assert (aCache.has(5));
|
assert (aCache.has(5));
|
||||||
|
|||||||
1
MANIFEST
1
MANIFEST
@@ -940,7 +940,6 @@ Foundation/testsuite/TestSuite_vs80.vcproj
|
|||||||
libversion
|
libversion
|
||||||
LICENSE
|
LICENSE
|
||||||
Makefile
|
Makefile
|
||||||
MANIFEST
|
|
||||||
Net
|
Net
|
||||||
Net/include
|
Net/include
|
||||||
Net/include/Poco
|
Net/include/Poco
|
||||||
|
|||||||
4
NEWS
4
NEWS
@@ -1,4 +1,4 @@
|
|||||||
Release 1.2.4 (2006-10-02)
|
Release 1.2.5 (2006-10-23)
|
||||||
==========================
|
==========================
|
||||||
|
|
||||||
This release contains bugfixes and minor enchancements.
|
This release contains bugfixes and minor enchancements.
|
||||||
@@ -124,4 +124,4 @@ Please refer to the README file for more information and instructions for
|
|||||||
building the libraries.
|
building the libraries.
|
||||||
|
|
||||||
--
|
--
|
||||||
$Id: //poco/1.2/dist/NEWS#5 $
|
$Id: //poco/1.2/dist/NEWS#6 $
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Makefile
|
# Makefile
|
||||||
#
|
#
|
||||||
# $Id: //poco/Main/Net/samples/Makefile#8 $
|
# $Id: //poco/1.2/Net/samples/Makefile#2 $
|
||||||
#
|
#
|
||||||
# Makefile for Poco Net Samples
|
# Makefile for Poco Net Samples
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// MessageHeader.cpp
|
// MessageHeader.cpp
|
||||||
//
|
//
|
||||||
// $Id: //poco/1.2/Net/src/MessageHeader.cpp#1 $
|
// $Id: //poco/1.2/Net/src/MessageHeader.cpp#2 $
|
||||||
//
|
//
|
||||||
// Library: Net
|
// Library: Net
|
||||||
// Package: Messages
|
// Package: Messages
|
||||||
@@ -86,7 +86,8 @@ void MessageHeader::read(std::istream& istr)
|
|||||||
{
|
{
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string value;
|
std::string value;
|
||||||
while (ch != eof && ch != ':' && name.length() < MAX_NAME_LENGTH) { name += ch; ch = istr.get(); }
|
while (ch != eof && ch != ':' && ch != '\n' && name.length() < MAX_NAME_LENGTH) { name += ch; ch = istr.get(); }
|
||||||
|
if (ch == '\n') { ch = istr.get(); continue; } // ignore invalid header lines
|
||||||
if (ch != ':') throw MessageException("Field name too long/no colon found");
|
if (ch != ':') throw MessageException("Field name too long/no colon found");
|
||||||
if (ch != eof) ch = istr.get(); // ':'
|
if (ch != eof) ch = istr.get(); // ':'
|
||||||
while (isspace(ch)) ch = istr.get();
|
while (isspace(ch)) ch = istr.get();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// LoggingConfigurator.cpp
|
// LoggingConfigurator.cpp
|
||||||
//
|
//
|
||||||
// $Id: //poco/1.2/Util/src/LoggingConfigurator.cpp#2 $
|
// $Id: //poco/1.2/Util/src/LoggingConfigurator.cpp#3 $
|
||||||
//
|
//
|
||||||
// Library: Util
|
// Library: Util
|
||||||
// Package: Configuration
|
// Package: Configuration
|
||||||
@@ -44,6 +44,7 @@
|
|||||||
#include "Poco/Logger.h"
|
#include "Poco/Logger.h"
|
||||||
#include "Poco/LoggingRegistry.h"
|
#include "Poco/LoggingRegistry.h"
|
||||||
#include "Poco/LoggingFactory.h"
|
#include "Poco/LoggingFactory.h"
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
|
||||||
using Poco::AutoPtr;
|
using Poco::AutoPtr;
|
||||||
@@ -119,12 +120,20 @@ void LoggingConfigurator::configureChannels(AbstractConfiguration* pConfig)
|
|||||||
|
|
||||||
void LoggingConfigurator::configureLoggers(AbstractConfiguration* pConfig)
|
void LoggingConfigurator::configureLoggers(AbstractConfiguration* pConfig)
|
||||||
{
|
{
|
||||||
|
typedef std::map<std::string, AutoPtr<AbstractConfiguration> > LoggerMap;
|
||||||
|
|
||||||
AbstractConfiguration::Keys loggers;
|
AbstractConfiguration::Keys loggers;
|
||||||
pConfig->keys(loggers);
|
pConfig->keys(loggers);
|
||||||
|
// use a map to sort loggers by their name, ensuring initialization in correct order (parents before children)
|
||||||
|
LoggerMap loggerMap;
|
||||||
for (AbstractConfiguration::Keys::const_iterator it = loggers.begin(); it != loggers.end(); ++it)
|
for (AbstractConfiguration::Keys::const_iterator it = loggers.begin(); it != loggers.end(); ++it)
|
||||||
{
|
{
|
||||||
AutoPtr<AbstractConfiguration> pLoggerConfig(pConfig->createView(*it));
|
AutoPtr<AbstractConfiguration> pLoggerConfig(pConfig->createView(*it));
|
||||||
configureLogger(pLoggerConfig);
|
loggerMap[pLoggerConfig->getString("name", "")] = pLoggerConfig;
|
||||||
|
}
|
||||||
|
for (LoggerMap::iterator it = loggerMap.begin(); it != loggerMap.end(); ++it)
|
||||||
|
{
|
||||||
|
configureLogger(it->second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,11 +212,11 @@ void LoggingConfigurator::configureLogger(AbstractConfiguration* pConfig)
|
|||||||
AutoPtr<AbstractConfiguration> pChannelConfig(pConfig->createView(*it));
|
AutoPtr<AbstractConfiguration> pChannelConfig(pConfig->createView(*it));
|
||||||
AutoPtr<Channel> pChannel(createChannel(pChannelConfig));
|
AutoPtr<Channel> pChannel(createChannel(pChannelConfig));
|
||||||
configureChannel(pChannel, pChannelConfig);
|
configureChannel(pChannel, pChannelConfig);
|
||||||
logger.setChannel(pChannel);
|
Logger::setChannel(logger.name(), pChannel);
|
||||||
}
|
}
|
||||||
else if (*it != "name")
|
else if (*it != "name")
|
||||||
{
|
{
|
||||||
logger.setProperty(*it, pConfig->getString(*it));
|
Logger::setProperty(logger.name(), *it, pConfig->getString(*it));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
0
build/script/makedepend.SunCC
Normal file → Executable file
0
build/script/makedepend.SunCC
Normal file → Executable file
0
build/script/makedepend.aCC
Normal file → Executable file
0
build/script/makedepend.aCC
Normal file → Executable file
0
build/script/makedepend.cxx
Normal file → Executable file
0
build/script/makedepend.cxx
Normal file → Executable file
0
build/script/makedepend.gcc
Normal file → Executable file
0
build/script/makedepend.gcc
Normal file → Executable file
0
build/script/makedepend.qcc
Normal file → Executable file
0
build/script/makedepend.qcc
Normal file → Executable file
0
build/script/makeldpath
Normal file → Executable file
0
build/script/makeldpath
Normal file → Executable file
0
build/script/projname
Normal file → Executable file
0
build/script/projname
Normal file → Executable file
0
build/script/shlibln
Normal file → Executable file
0
build/script/shlibln
Normal file → Executable file
Reference in New Issue
Block a user