aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/poco/Foundation/include/Poco/PriorityExpire.h
diff options
context:
space:
mode:
authororivej <orivej@yandex-team.ru>2022-02-10 16:44:49 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:49 +0300
commit718c552901d703c502ccbefdfc3c9028d608b947 (patch)
tree46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/libs/poco/Foundation/include/Poco/PriorityExpire.h
parente9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff)
downloadydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/poco/Foundation/include/Poco/PriorityExpire.h')
-rw-r--r--contrib/libs/poco/Foundation/include/Poco/PriorityExpire.h386
1 files changed, 193 insertions, 193 deletions
diff --git a/contrib/libs/poco/Foundation/include/Poco/PriorityExpire.h b/contrib/libs/poco/Foundation/include/Poco/PriorityExpire.h
index 9491445f07..8c8a551b14 100644
--- a/contrib/libs/poco/Foundation/include/Poco/PriorityExpire.h
+++ b/contrib/libs/poco/Foundation/include/Poco/PriorityExpire.h
@@ -1,195 +1,195 @@
-//
-// PriorityExpire.h
-//
-// Library: Foundation
-// Package: Events
-// Module: PriorityExpire
-//
-// Implementation of the PriorityExpire template.
-//
-// Copyright (c) 2006-2011, Applied Informatics Software Engineering GmbH.
-// and Contributors.
-//
-// SPDX-License-Identifier: BSL-1.0
-//
-
-
-#ifndef Foundation_PriorityExpire_INCLUDED
-#define Foundation_PriorityExpire_INCLUDED
-
-
-#include "Poco/Foundation.h"
-#include "Poco/Timestamp.h"
-#include "Poco/AbstractPriorityDelegate.h"
-
-
-namespace Poco {
-
-
-template <class TArgs>
-class PriorityExpire: public AbstractPriorityDelegate<TArgs>
+//
+// PriorityExpire.h
+//
+// Library: Foundation
+// Package: Events
+// Module: PriorityExpire
+//
+// Implementation of the PriorityExpire template.
+//
+// Copyright (c) 2006-2011, Applied Informatics Software Engineering GmbH.
+// and Contributors.
+//
+// SPDX-License-Identifier: BSL-1.0
+//
+
+
+#ifndef Foundation_PriorityExpire_INCLUDED
+#define Foundation_PriorityExpire_INCLUDED
+
+
+#include "Poco/Foundation.h"
+#include "Poco/Timestamp.h"
+#include "Poco/AbstractPriorityDelegate.h"
+
+
+namespace Poco {
+
+
+template <class TArgs>
+class PriorityExpire: public AbstractPriorityDelegate<TArgs>
+ /// Decorator for AbstractPriorityDelegate adding automatic
+ /// expiring of registrations to AbstractPriorityDelegate.
+{
+public:
+ PriorityExpire(const AbstractPriorityDelegate<TArgs>& p, Timestamp::TimeDiff expireMilliSec):
+ AbstractPriorityDelegate<TArgs>(p),
+ _pDelegate(static_cast<AbstractPriorityDelegate<TArgs>*>(p.clone())),
+ _expire(expireMilliSec*1000)
+ {
+ }
+
+ PriorityExpire(const PriorityExpire& expire):
+ AbstractPriorityDelegate<TArgs>(expire),
+ _pDelegate(static_cast<AbstractPriorityDelegate<TArgs>*>(expire._pDelegate->clone())),
+ _expire(expire._expire),
+ _creationTime(expire._creationTime)
+ {
+ }
+
+ ~PriorityExpire()
+ {
+ delete _pDelegate;
+ }
+
+ PriorityExpire& operator = (const PriorityExpire& expire)
+ {
+ if (&expire != this)
+ {
+ delete this->_pDelegate;
+ this->_pTarget = expire._pTarget;
+ this->_pDelegate = expire._pDelegate->clone();
+ this->_expire = expire._expire;
+ this->_creationTime = expire._creationTime;
+ }
+ return *this;
+ }
+
+ bool notify(const void* sender, TArgs& arguments)
+ {
+ if (!expired())
+ return this->_pDelegate->notify(sender, arguments);
+ else
+ return false;
+ }
+
+ bool equals(const AbstractDelegate<TArgs>& other) const
+ {
+ return other.equals(*_pDelegate);
+ }
+
+ AbstractPriorityDelegate<TArgs>* clone() const
+ {
+ return new PriorityExpire(*this);
+ }
+
+ void disable()
+ {
+ _pDelegate->disable();
+ }
+
+ const AbstractPriorityDelegate<TArgs>* unwrap() const
+ {
+ return this->_pDelegate;
+ }
+
+protected:
+ bool expired() const
+ {
+ return _creationTime.isElapsed(_expire);
+ }
+
+ AbstractPriorityDelegate<TArgs>* _pDelegate;
+ Timestamp::TimeDiff _expire;
+ Timestamp _creationTime;
+
+private:
+ PriorityExpire();
+};
+
+
+template <>
+class PriorityExpire<void>: public AbstractPriorityDelegate<void>
/// Decorator for AbstractPriorityDelegate adding automatic
- /// expiring of registrations to AbstractPriorityDelegate.
-{
-public:
- PriorityExpire(const AbstractPriorityDelegate<TArgs>& p, Timestamp::TimeDiff expireMilliSec):
- AbstractPriorityDelegate<TArgs>(p),
- _pDelegate(static_cast<AbstractPriorityDelegate<TArgs>*>(p.clone())),
- _expire(expireMilliSec*1000)
- {
- }
-
- PriorityExpire(const PriorityExpire& expire):
- AbstractPriorityDelegate<TArgs>(expire),
- _pDelegate(static_cast<AbstractPriorityDelegate<TArgs>*>(expire._pDelegate->clone())),
- _expire(expire._expire),
- _creationTime(expire._creationTime)
- {
- }
-
- ~PriorityExpire()
- {
- delete _pDelegate;
- }
-
- PriorityExpire& operator = (const PriorityExpire& expire)
- {
- if (&expire != this)
- {
- delete this->_pDelegate;
- this->_pTarget = expire._pTarget;
- this->_pDelegate = expire._pDelegate->clone();
- this->_expire = expire._expire;
- this->_creationTime = expire._creationTime;
- }
+ /// expiring of registrations to AbstractPriorityDelegate.
+{
+public:
+ PriorityExpire(const AbstractPriorityDelegate<void>& p, Timestamp::TimeDiff expireMilliSec):
+ AbstractPriorityDelegate<void>(p),
+ _pDelegate(static_cast<AbstractPriorityDelegate<void>*>(p.clone())),
+ _expire(expireMilliSec*1000)
+ {
+ }
+
+ PriorityExpire(const PriorityExpire& expire):
+ AbstractPriorityDelegate<void>(expire),
+ _pDelegate(static_cast<AbstractPriorityDelegate<void>*>(expire._pDelegate->clone())),
+ _expire(expire._expire),
+ _creationTime(expire._creationTime)
+ {
+ }
+
+ ~PriorityExpire()
+ {
+ delete _pDelegate;
+ }
+
+ PriorityExpire& operator = (const PriorityExpire& expire)
+ {
+ if (&expire != this)
+ {
+ delete this->_pDelegate;
+ this->_pDelegate = static_cast<AbstractPriorityDelegate<void>*>(expire._pDelegate->clone());
+ this->_expire = expire._expire;
+ this->_creationTime = expire._creationTime;
+ }
return *this;
- }
-
- bool notify(const void* sender, TArgs& arguments)
- {
- if (!expired())
- return this->_pDelegate->notify(sender, arguments);
- else
- return false;
- }
-
- bool equals(const AbstractDelegate<TArgs>& other) const
- {
- return other.equals(*_pDelegate);
- }
-
- AbstractPriorityDelegate<TArgs>* clone() const
- {
- return new PriorityExpire(*this);
- }
-
- void disable()
- {
- _pDelegate->disable();
- }
-
- const AbstractPriorityDelegate<TArgs>* unwrap() const
- {
- return this->_pDelegate;
- }
-
-protected:
- bool expired() const
- {
- return _creationTime.isElapsed(_expire);
- }
-
- AbstractPriorityDelegate<TArgs>* _pDelegate;
- Timestamp::TimeDiff _expire;
- Timestamp _creationTime;
-
-private:
- PriorityExpire();
-};
-
-
-template <>
-class PriorityExpire<void>: public AbstractPriorityDelegate<void>
- /// Decorator for AbstractPriorityDelegate adding automatic
- /// expiring of registrations to AbstractPriorityDelegate.
-{
-public:
- PriorityExpire(const AbstractPriorityDelegate<void>& p, Timestamp::TimeDiff expireMilliSec):
- AbstractPriorityDelegate<void>(p),
- _pDelegate(static_cast<AbstractPriorityDelegate<void>*>(p.clone())),
- _expire(expireMilliSec*1000)
- {
- }
-
- PriorityExpire(const PriorityExpire& expire):
- AbstractPriorityDelegate<void>(expire),
- _pDelegate(static_cast<AbstractPriorityDelegate<void>*>(expire._pDelegate->clone())),
- _expire(expire._expire),
- _creationTime(expire._creationTime)
- {
- }
-
- ~PriorityExpire()
- {
- delete _pDelegate;
- }
-
- PriorityExpire& operator = (const PriorityExpire& expire)
- {
- if (&expire != this)
- {
- delete this->_pDelegate;
- this->_pDelegate = static_cast<AbstractPriorityDelegate<void>*>(expire._pDelegate->clone());
- this->_expire = expire._expire;
- this->_creationTime = expire._creationTime;
- }
- return *this;
- }
-
- bool notify(const void* sender)
- {
- if (!expired())
- return this->_pDelegate->notify(sender);
- else
- return false;
- }
-
- bool equals(const AbstractDelegate<void>& other) const
- {
- return other.equals(*_pDelegate);
- }
-
- AbstractPriorityDelegate<void>* clone() const
- {
- return new PriorityExpire(*this);
- }
-
- void disable()
- {
- _pDelegate->disable();
- }
-
- const AbstractPriorityDelegate<void>* unwrap() const
- {
- return this->_pDelegate;
- }
-
-protected:
- bool expired() const
- {
- return _creationTime.isElapsed(_expire);
- }
-
- AbstractPriorityDelegate<void>* _pDelegate;
- Timestamp::TimeDiff _expire;
- Timestamp _creationTime;
-
-private:
- PriorityExpire();
-};
-
-
-} // namespace Poco
-
-
-#endif // Foundation_PriorityExpire_INCLUDED
+ }
+
+ bool notify(const void* sender)
+ {
+ if (!expired())
+ return this->_pDelegate->notify(sender);
+ else
+ return false;
+ }
+
+ bool equals(const AbstractDelegate<void>& other) const
+ {
+ return other.equals(*_pDelegate);
+ }
+
+ AbstractPriorityDelegate<void>* clone() const
+ {
+ return new PriorityExpire(*this);
+ }
+
+ void disable()
+ {
+ _pDelegate->disable();
+ }
+
+ const AbstractPriorityDelegate<void>* unwrap() const
+ {
+ return this->_pDelegate;
+ }
+
+protected:
+ bool expired() const
+ {
+ return _creationTime.isElapsed(_expire);
+ }
+
+ AbstractPriorityDelegate<void>* _pDelegate;
+ Timestamp::TimeDiff _expire;
+ Timestamp _creationTime;
+
+private:
+ PriorityExpire();
+};
+
+
+} // namespace Poco
+
+
+#endif // Foundation_PriorityExpire_INCLUDED