1//
2// KeyValueArgs.h
3//
4// Library: Foundation
5// Package: Cache
6// Module: KeyValueArgs
7//
8// Definition of the KeyValueArgs class.
9//
10// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
11// and Contributors.
12//
13// SPDX-License-Identifier: BSL-1.0
14//
15
16
17#ifndef Foundation_KeyValueArgs_INCLUDED
18#define Foundation_KeyValueArgs_INCLUDED
19
20
21#include "Poco/Foundation.h"
22
23
24namespace Poco {
25
26
27template <class TKey, class TValue>
28class KeyValueArgs
29 /// Simply event arguments class to transfer a key and a value via an event call.
30 /// Note that key and value are *NOT* copied, only references to them are stored.
31{
32public:
33 KeyValueArgs(const TKey& aKey, const TValue& aVal):
34 _key(aKey),
35 _value(aVal)
36 {
37 }
38
39 KeyValueArgs(const KeyValueArgs& args):
40 _key(args._key),
41 _value(args._value)
42 {
43 }
44
45 ~KeyValueArgs()
46 {
47 }
48
49 const TKey& key() const
50 /// Returns a reference to the key,
51 {
52 return _key;
53 }
54
55 const TValue& value() const
56 /// Returns a Reference to the value.
57 {
58 return _value;
59 }
60
61protected:
62 const TKey& _key;
63 const TValue& _value;
64
65private:
66 KeyValueArgs& operator = (const KeyValueArgs& args);
67};
68
69
70} // namespace Poco
71
72
73#endif // Foundation_KeyValueArgs_INCLUDED
74