| 1 | // |
| 2 | // PriorityEvent.h |
| 3 | // |
| 4 | // Library: Foundation |
| 5 | // Package: Events |
| 6 | // Module: PriorityEvent |
| 7 | // |
| 8 | // Implementation of the PriorityEvent template. |
| 9 | // |
| 10 | // Copyright (c) 2006-2011, Applied Informatics Software Engineering GmbH. |
| 11 | // and Contributors. |
| 12 | // |
| 13 | // SPDX-License-Identifier: BSL-1.0 |
| 14 | // |
| 15 | |
| 16 | |
| 17 | #ifndef Foundation_PriorityEvent_INCLUDED |
| 18 | #define Foundation_PriorityEvent_INCLUDED |
| 19 | |
| 20 | |
| 21 | #include "Poco/AbstractEvent.h" |
| 22 | #include "Poco/PriorityStrategy.h" |
| 23 | #include "Poco/AbstractPriorityDelegate.h" |
| 24 | |
| 25 | |
| 26 | namespace Poco { |
| 27 | |
| 28 | |
| 29 | template <class TArgs, class TMutex = FastMutex> |
| 30 | class PriorityEvent: public AbstractEvent < |
| 31 | TArgs, |
| 32 | PriorityStrategy<TArgs, AbstractPriorityDelegate<TArgs> >, |
| 33 | AbstractPriorityDelegate<TArgs>, |
| 34 | TMutex |
| 35 | > |
| 36 | /// A PriorityEvent uses internally a PriorityStrategy which |
| 37 | /// invokes delegates in order of priority (lower priorities first). |
| 38 | /// PriorityEvent's can only be used together with PriorityDelegate's. |
| 39 | /// PriorityDelegate's are sorted according to the priority value, when |
| 40 | /// two delegates have the same priority, they are invoked in |
| 41 | /// an arbitrary manner. |
| 42 | { |
| 43 | public: |
| 44 | PriorityEvent() |
| 45 | { |
| 46 | } |
| 47 | |
| 48 | ~PriorityEvent() |
| 49 | { |
| 50 | } |
| 51 | |
| 52 | private: |
| 53 | PriorityEvent(const PriorityEvent&); |
| 54 | PriorityEvent& operator = (const PriorityEvent&); |
| 55 | }; |
| 56 | |
| 57 | |
| 58 | } // namespace Poco |
| 59 | |
| 60 | |
| 61 | #endif // Foundation_PriorityEvent_INCLUDED |
| 62 | |