/src/opendnp3/cpp/lib/include/opendnp3/app/Indexed.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright 2013-2022 Step Function I/O, LLC |
3 | | * |
4 | | * Licensed to Green Energy Corp (www.greenenergycorp.com) and Step Function I/O |
5 | | * LLC (https://stepfunc.io) under one or more contributor license agreements. |
6 | | * See the NOTICE file distributed with this work for additional information |
7 | | * regarding copyright ownership. Green Energy Corp and Step Function I/O LLC license |
8 | | * this file to you under the Apache License, Version 2.0 (the "License"); you |
9 | | * may not use this file except in compliance with the License. You may obtain |
10 | | * a copy of the License at: |
11 | | * |
12 | | * http://www.apache.org/licenses/LICENSE-2.0 |
13 | | * |
14 | | * Unless required by applicable law or agreed to in writing, software |
15 | | * distributed under the License is distributed on an "AS IS" BASIS, |
16 | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
17 | | * See the License for the specific language governing permissions and |
18 | | * limitations under the License. |
19 | | */ |
20 | | #ifndef OPENDNP3_INDEXED_H |
21 | | #define OPENDNP3_INDEXED_H |
22 | | |
23 | | #include <cstdint> |
24 | | |
25 | | namespace opendnp3 |
26 | | { |
27 | | |
28 | | /** |
29 | | * A simple tuple for pairing Values with an index |
30 | | */ |
31 | | template<class T> class Indexed |
32 | | { |
33 | | public: |
34 | 369k | Indexed(const T& value_, uint16_t index_) : value(value_), index(index_) {}opendnp3::Indexed<opendnp3::ControlRelayOutputBlock>::Indexed(opendnp3::ControlRelayOutputBlock const&, unsigned short) Line | Count | Source | 34 | 1.35k | Indexed(const T& value_, uint16_t index_) : value(value_), index(index_) {} |
opendnp3::Indexed<opendnp3::AnalogOutputInt16>::Indexed(opendnp3::AnalogOutputInt16 const&, unsigned short) Line | Count | Source | 34 | 14.3k | Indexed(const T& value_, uint16_t index_) : value(value_), index(index_) {} |
opendnp3::Indexed<opendnp3::AnalogOutputInt32>::Indexed(opendnp3::AnalogOutputInt32 const&, unsigned short) Line | Count | Source | 34 | 2.27k | Indexed(const T& value_, uint16_t index_) : value(value_), index(index_) {} |
opendnp3::Indexed<opendnp3::AnalogOutputFloat32>::Indexed(opendnp3::AnalogOutputFloat32 const&, unsigned short) Line | Count | Source | 34 | 3.59k | Indexed(const T& value_, uint16_t index_) : value(value_), index(index_) {} |
opendnp3::Indexed<opendnp3::AnalogOutputDouble64>::Indexed(opendnp3::AnalogOutputDouble64 const&, unsigned short) Line | Count | Source | 34 | 3.77k | Indexed(const T& value_, uint16_t index_) : value(value_), index(index_) {} |
opendnp3::Indexed<opendnp3::OctetString>::Indexed(opendnp3::OctetString const&, unsigned short) Line | Count | Source | 34 | 6.33k | Indexed(const T& value_, uint16_t index_) : value(value_), index(index_) {} |
opendnp3::Indexed<opendnp3::Binary>::Indexed(opendnp3::Binary const&, unsigned short) Line | Count | Source | 34 | 135k | Indexed(const T& value_, uint16_t index_) : value(value_), index(index_) {} |
opendnp3::Indexed<opendnp3::DoubleBitBinary>::Indexed(opendnp3::DoubleBitBinary const&, unsigned short) Line | Count | Source | 34 | 48.7k | Indexed(const T& value_, uint16_t index_) : value(value_), index(index_) {} |
opendnp3::Indexed<opendnp3::BinaryOutputStatus>::Indexed(opendnp3::BinaryOutputStatus const&, unsigned short) Line | Count | Source | 34 | 53.3k | Indexed(const T& value_, uint16_t index_) : value(value_), index(index_) {} |
opendnp3::Indexed<opendnp3::Counter>::Indexed(opendnp3::Counter const&, unsigned short) Line | Count | Source | 34 | 10.6k | Indexed(const T& value_, uint16_t index_) : value(value_), index(index_) {} |
opendnp3::Indexed<opendnp3::FrozenCounter>::Indexed(opendnp3::FrozenCounter const&, unsigned short) Line | Count | Source | 34 | 17.0k | Indexed(const T& value_, uint16_t index_) : value(value_), index(index_) {} |
opendnp3::Indexed<opendnp3::Analog>::Indexed(opendnp3::Analog const&, unsigned short) Line | Count | Source | 34 | 18.2k | Indexed(const T& value_, uint16_t index_) : value(value_), index(index_) {} |
opendnp3::Indexed<opendnp3::AnalogOutputStatus>::Indexed(opendnp3::AnalogOutputStatus const&, unsigned short) Line | Count | Source | 34 | 15.0k | Indexed(const T& value_, uint16_t index_) : value(value_), index(index_) {} |
opendnp3::Indexed<opendnp3::TimeAndInterval>::Indexed(opendnp3::TimeAndInterval const&, unsigned short) Line | Count | Source | 34 | 3.60k | Indexed(const T& value_, uint16_t index_) : value(value_), index(index_) {} |
opendnp3::Indexed<opendnp3::IINValue>::Indexed(opendnp3::IINValue const&, unsigned short) Line | Count | Source | 34 | 34.8k | Indexed(const T& value_, uint16_t index_) : value(value_), index(index_) {} |
|
35 | | |
36 | 169k | Indexed() : value(), index(0) {}opendnp3::Indexed<opendnp3::IINValue>::Indexed() Line | Count | Source | 36 | 950 | Indexed() : value(), index(0) {} |
opendnp3::Indexed<opendnp3::Binary>::Indexed() Line | Count | Source | 36 | 10.3k | Indexed() : value(), index(0) {} |
opendnp3::Indexed<opendnp3::DoubleBitBinary>::Indexed() Line | Count | Source | 36 | 8.23k | Indexed() : value(), index(0) {} |
opendnp3::Indexed<opendnp3::BinaryOutputStatus>::Indexed() Line | Count | Source | 36 | 6.86k | Indexed() : value(), index(0) {} |
opendnp3::Indexed<opendnp3::ControlRelayOutputBlock>::Indexed() Line | Count | Source | 36 | 6.42k | Indexed() : value(), index(0) {} |
opendnp3::Indexed<opendnp3::BinaryCommandEvent>::Indexed() Line | Count | Source | 36 | 19.7k | Indexed() : value(), index(0) {} |
opendnp3::Indexed<opendnp3::Counter>::Indexed() Line | Count | Source | 36 | 8.04k | Indexed() : value(), index(0) {} |
opendnp3::Indexed<opendnp3::FrozenCounter>::Indexed() Line | Count | Source | 36 | 8.11k | Indexed() : value(), index(0) {} |
opendnp3::Indexed<opendnp3::Analog>::Indexed() Line | Count | Source | 36 | 15.4k | Indexed() : value(), index(0) {} |
opendnp3::Indexed<opendnp3::AnalogOutputInt32>::Indexed() Line | Count | Source | 36 | 6.37k | Indexed() : value(), index(0) {} |
opendnp3::Indexed<opendnp3::AnalogOutputInt16>::Indexed() Line | Count | Source | 36 | 25.4k | Indexed() : value(), index(0) {} |
opendnp3::Indexed<opendnp3::AnalogOutputFloat32>::Indexed() Line | Count | Source | 36 | 8.10k | Indexed() : value(), index(0) {} |
opendnp3::Indexed<opendnp3::AnalogOutputDouble64>::Indexed() Line | Count | Source | 36 | 10.0k | Indexed() : value(), index(0) {} |
opendnp3::Indexed<opendnp3::AnalogOutputStatus>::Indexed() Line | Count | Source | 36 | 16.0k | Indexed() : value(), index(0) {} |
opendnp3::Indexed<opendnp3::AnalogCommandEvent>::Indexed() Line | Count | Source | 36 | 19.0k | Indexed() : value(), index(0) {} |
opendnp3::Indexed<opendnp3::TimeAndInterval>::Indexed() Line | Count | Source | 36 | 695 | Indexed() : value(), index(0) {} |
|
37 | | |
38 | | T value; |
39 | | uint16_t index; |
40 | | }; |
41 | | |
42 | | template<class T> Indexed<T> WithIndex(const T& value, uint16_t index) |
43 | 343k | { |
44 | 343k | return Indexed<T>(value, index); |
45 | 343k | } opendnp3::Indexed<opendnp3::OctetString> opendnp3::WithIndex<opendnp3::OctetString>(opendnp3::OctetString const&, unsigned short) Line | Count | Source | 43 | 6.33k | { | 44 | 6.33k | return Indexed<T>(value, index); | 45 | 6.33k | } |
opendnp3::Indexed<opendnp3::Binary> opendnp3::WithIndex<opendnp3::Binary>(opendnp3::Binary const&, unsigned short) Line | Count | Source | 43 | 135k | { | 44 | 135k | return Indexed<T>(value, index); | 45 | 135k | } |
opendnp3::Indexed<opendnp3::DoubleBitBinary> opendnp3::WithIndex<opendnp3::DoubleBitBinary>(opendnp3::DoubleBitBinary const&, unsigned short) Line | Count | Source | 43 | 48.7k | { | 44 | 48.7k | return Indexed<T>(value, index); | 45 | 48.7k | } |
opendnp3::Indexed<opendnp3::BinaryOutputStatus> opendnp3::WithIndex<opendnp3::BinaryOutputStatus>(opendnp3::BinaryOutputStatus const&, unsigned short) Line | Count | Source | 43 | 53.3k | { | 44 | 53.3k | return Indexed<T>(value, index); | 45 | 53.3k | } |
opendnp3::Indexed<opendnp3::Counter> opendnp3::WithIndex<opendnp3::Counter>(opendnp3::Counter const&, unsigned short) Line | Count | Source | 43 | 10.6k | { | 44 | 10.6k | return Indexed<T>(value, index); | 45 | 10.6k | } |
opendnp3::Indexed<opendnp3::FrozenCounter> opendnp3::WithIndex<opendnp3::FrozenCounter>(opendnp3::FrozenCounter const&, unsigned short) Line | Count | Source | 43 | 17.0k | { | 44 | 17.0k | return Indexed<T>(value, index); | 45 | 17.0k | } |
opendnp3::Indexed<opendnp3::Analog> opendnp3::WithIndex<opendnp3::Analog>(opendnp3::Analog const&, unsigned short) Line | Count | Source | 43 | 18.2k | { | 44 | 18.2k | return Indexed<T>(value, index); | 45 | 18.2k | } |
opendnp3::Indexed<opendnp3::AnalogOutputStatus> opendnp3::WithIndex<opendnp3::AnalogOutputStatus>(opendnp3::AnalogOutputStatus const&, unsigned short) Line | Count | Source | 43 | 15.0k | { | 44 | 15.0k | return Indexed<T>(value, index); | 45 | 15.0k | } |
opendnp3::Indexed<opendnp3::TimeAndInterval> opendnp3::WithIndex<opendnp3::TimeAndInterval>(opendnp3::TimeAndInterval const&, unsigned short) Line | Count | Source | 43 | 3.60k | { | 44 | 3.60k | return Indexed<T>(value, index); | 45 | 3.60k | } |
opendnp3::Indexed<opendnp3::IINValue> opendnp3::WithIndex<opendnp3::IINValue>(opendnp3::IINValue const&, unsigned short) Line | Count | Source | 43 | 34.8k | { | 44 | 34.8k | return Indexed<T>(value, index); | 45 | 34.8k | } |
Unexecuted instantiation: opendnp3::Indexed<opendnp3::ControlRelayOutputBlock> opendnp3::WithIndex<opendnp3::ControlRelayOutputBlock>(opendnp3::ControlRelayOutputBlock const&, unsigned short) Unexecuted instantiation: opendnp3::Indexed<opendnp3::AnalogOutputInt32> opendnp3::WithIndex<opendnp3::AnalogOutputInt32>(opendnp3::AnalogOutputInt32 const&, unsigned short) Unexecuted instantiation: opendnp3::Indexed<opendnp3::AnalogOutputInt16> opendnp3::WithIndex<opendnp3::AnalogOutputInt16>(opendnp3::AnalogOutputInt16 const&, unsigned short) Unexecuted instantiation: opendnp3::Indexed<opendnp3::AnalogOutputFloat32> opendnp3::WithIndex<opendnp3::AnalogOutputFloat32>(opendnp3::AnalogOutputFloat32 const&, unsigned short) Unexecuted instantiation: opendnp3::Indexed<opendnp3::AnalogOutputDouble64> opendnp3::WithIndex<opendnp3::AnalogOutputDouble64>(opendnp3::AnalogOutputDouble64 const&, unsigned short) |
46 | | |
47 | | } // namespace opendnp3 |
48 | | |
49 | | #endif |