Coverage Report

Created: 2025-12-31 06:09

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/opendnp3/cpp/lib/src/outstation/StaticWriters.cpp
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
#include "StaticWriters.h"
21
22
#include "gen/objects/Group1.h"
23
#include "gen/objects/Group10.h"
24
#include "gen/objects/Group20.h"
25
#include "gen/objects/Group21.h"
26
#include "gen/objects/Group3.h"
27
#include "gen/objects/Group30.h"
28
#include "gen/objects/Group40.h"
29
#include "gen/objects/Group50.h"
30
#include "outstation/OctetStringSerializer.h"
31
32
namespace opendnp3
33
{
34
35
template<class Spec, class IndexType>
36
bool LoadWithRangeIterator(StaticDataMap<Spec>& map,
37
                           RangeWriteIterator<IndexType, typename Spec::meas_t>& writer,
38
                           typename Spec::static_variation_t variation)
39
5.53k
{
40
5.53k
    auto next_index = map.get_selected_range().start;
41
42
5.53k
    for (const auto& elem : map)
43
28.7k
    {
44
28.7k
        if (elem.second.variation != variation)
45
501
        {
46
            // the variation has changed
47
501
            return true;
48
501
        }
49
50
28.2k
        if (elem.first != next_index)
51
1.01k
        {
52
            // we've loaded all we can with a contiguous range
53
1.01k
            return true;
54
1.01k
        }
55
56
27.2k
        if (!writer.Write(elem.second.value))
57
0
        {
58
0
            return false;
59
0
        }
60
61
27.2k
        ++next_index;
62
27.2k
    }
63
64
4.01k
    return true;
65
5.53k
}
bool opendnp3::LoadWithRangeIterator<opendnp3::BinarySpec, ser4cpp::UInt8>(opendnp3::StaticDataMap<opendnp3::BinarySpec>&, opendnp3::RangeWriteIterator<ser4cpp::UInt8, opendnp3::BinarySpec::meas_t>&, opendnp3::BinarySpec::static_variation_t)
Line
Count
Source
39
614
{
40
614
    auto next_index = map.get_selected_range().start;
41
42
614
    for (const auto& elem : map)
43
3.38k
    {
44
3.38k
        if (elem.second.variation != variation)
45
0
        {
46
            // the variation has changed
47
0
            return true;
48
0
        }
49
50
3.38k
        if (elem.first != next_index)
51
134
        {
52
            // we've loaded all we can with a contiguous range
53
134
            return true;
54
134
        }
55
56
3.25k
        if (!writer.Write(elem.second.value))
57
0
        {
58
0
            return false;
59
0
        }
60
61
3.25k
        ++next_index;
62
3.25k
    }
63
64
480
    return true;
65
614
}
Unexecuted instantiation: bool opendnp3::LoadWithRangeIterator<opendnp3::BinarySpec, ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1> >(opendnp3::StaticDataMap<opendnp3::BinarySpec>&, opendnp3::RangeWriteIterator<ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1>, opendnp3::BinarySpec::meas_t>&, opendnp3::BinarySpec::static_variation_t)
bool opendnp3::LoadWithRangeIterator<opendnp3::DoubleBitBinarySpec, ser4cpp::UInt8>(opendnp3::StaticDataMap<opendnp3::DoubleBitBinarySpec>&, opendnp3::RangeWriteIterator<ser4cpp::UInt8, opendnp3::DoubleBitBinarySpec::meas_t>&, opendnp3::DoubleBitBinarySpec::static_variation_t)
Line
Count
Source
39
516
{
40
516
    auto next_index = map.get_selected_range().start;
41
42
516
    for (const auto& elem : map)
43
2.65k
    {
44
2.65k
        if (elem.second.variation != variation)
45
0
        {
46
            // the variation has changed
47
0
            return true;
48
0
        }
49
50
2.65k
        if (elem.first != next_index)
51
121
        {
52
            // we've loaded all we can with a contiguous range
53
121
            return true;
54
121
        }
55
56
2.53k
        if (!writer.Write(elem.second.value))
57
0
        {
58
0
            return false;
59
0
        }
60
61
2.53k
        ++next_index;
62
2.53k
    }
63
64
395
    return true;
65
516
}
Unexecuted instantiation: bool opendnp3::LoadWithRangeIterator<opendnp3::DoubleBitBinarySpec, ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1> >(opendnp3::StaticDataMap<opendnp3::DoubleBitBinarySpec>&, opendnp3::RangeWriteIterator<ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1>, opendnp3::DoubleBitBinarySpec::meas_t>&, opendnp3::DoubleBitBinarySpec::static_variation_t)
bool opendnp3::LoadWithRangeIterator<opendnp3::AnalogSpec, ser4cpp::UInt8>(opendnp3::StaticDataMap<opendnp3::AnalogSpec>&, opendnp3::RangeWriteIterator<ser4cpp::UInt8, opendnp3::AnalogSpec::meas_t>&, opendnp3::AnalogSpec::static_variation_t)
Line
Count
Source
39
1.11k
{
40
1.11k
    auto next_index = map.get_selected_range().start;
41
42
1.11k
    for (const auto& elem : map)
43
5.44k
    {
44
5.44k
        if (elem.second.variation != variation)
45
184
        {
46
            // the variation has changed
47
184
            return true;
48
184
        }
49
50
5.25k
        if (elem.first != next_index)
51
198
        {
52
            // we've loaded all we can with a contiguous range
53
198
            return true;
54
198
        }
55
56
5.06k
        if (!writer.Write(elem.second.value))
57
0
        {
58
0
            return false;
59
0
        }
60
61
5.06k
        ++next_index;
62
5.06k
    }
63
64
734
    return true;
65
1.11k
}
Unexecuted instantiation: bool opendnp3::LoadWithRangeIterator<opendnp3::AnalogSpec, ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1> >(opendnp3::StaticDataMap<opendnp3::AnalogSpec>&, opendnp3::RangeWriteIterator<ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1>, opendnp3::AnalogSpec::meas_t>&, opendnp3::AnalogSpec::static_variation_t)
bool opendnp3::LoadWithRangeIterator<opendnp3::CounterSpec, ser4cpp::UInt8>(opendnp3::StaticDataMap<opendnp3::CounterSpec>&, opendnp3::RangeWriteIterator<ser4cpp::UInt8, opendnp3::CounterSpec::meas_t>&, opendnp3::CounterSpec::static_variation_t)
Line
Count
Source
39
725
{
40
725
    auto next_index = map.get_selected_range().start;
41
42
725
    for (const auto& elem : map)
43
3.74k
    {
44
3.74k
        if (elem.second.variation != variation)
45
77
        {
46
            // the variation has changed
47
77
            return true;
48
77
        }
49
50
3.66k
        if (elem.first != next_index)
51
132
        {
52
            // we've loaded all we can with a contiguous range
53
132
            return true;
54
132
        }
55
56
3.53k
        if (!writer.Write(elem.second.value))
57
0
        {
58
0
            return false;
59
0
        }
60
61
3.53k
        ++next_index;
62
3.53k
    }
63
64
516
    return true;
65
725
}
Unexecuted instantiation: bool opendnp3::LoadWithRangeIterator<opendnp3::CounterSpec, ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1> >(opendnp3::StaticDataMap<opendnp3::CounterSpec>&, opendnp3::RangeWriteIterator<ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1>, opendnp3::CounterSpec::meas_t>&, opendnp3::CounterSpec::static_variation_t)
bool opendnp3::LoadWithRangeIterator<opendnp3::FrozenCounterSpec, ser4cpp::UInt8>(opendnp3::StaticDataMap<opendnp3::FrozenCounterSpec>&, opendnp3::RangeWriteIterator<ser4cpp::UInt8, opendnp3::FrozenCounterSpec::meas_t>&, opendnp3::FrozenCounterSpec::static_variation_t)
Line
Count
Source
39
988
{
40
988
    auto next_index = map.get_selected_range().start;
41
42
988
    for (const auto& elem : map)
43
4.91k
    {
44
4.91k
        if (elem.second.variation != variation)
45
162
        {
46
            // the variation has changed
47
162
            return true;
48
162
        }
49
50
4.75k
        if (elem.first != next_index)
51
142
        {
52
            // we've loaded all we can with a contiguous range
53
142
            return true;
54
142
        }
55
56
4.61k
        if (!writer.Write(elem.second.value))
57
0
        {
58
0
            return false;
59
0
        }
60
61
4.61k
        ++next_index;
62
4.61k
    }
63
64
684
    return true;
65
988
}
Unexecuted instantiation: bool opendnp3::LoadWithRangeIterator<opendnp3::FrozenCounterSpec, ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1> >(opendnp3::StaticDataMap<opendnp3::FrozenCounterSpec>&, opendnp3::RangeWriteIterator<ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1>, opendnp3::FrozenCounterSpec::meas_t>&, opendnp3::FrozenCounterSpec::static_variation_t)
bool opendnp3::LoadWithRangeIterator<opendnp3::BinaryOutputStatusSpec, ser4cpp::UInt8>(opendnp3::StaticDataMap<opendnp3::BinaryOutputStatusSpec>&, opendnp3::RangeWriteIterator<ser4cpp::UInt8, opendnp3::BinaryOutputStatusSpec::meas_t>&, opendnp3::BinaryOutputStatusSpec::static_variation_t)
Line
Count
Source
39
475
{
40
475
    auto next_index = map.get_selected_range().start;
41
42
475
    for (const auto& elem : map)
43
2.55k
    {
44
2.55k
        if (elem.second.variation != variation)
45
0
        {
46
            // the variation has changed
47
0
            return true;
48
0
        }
49
50
2.55k
        if (elem.first != next_index)
51
93
        {
52
            // we've loaded all we can with a contiguous range
53
93
            return true;
54
93
        }
55
56
2.46k
        if (!writer.Write(elem.second.value))
57
0
        {
58
0
            return false;
59
0
        }
60
61
2.46k
        ++next_index;
62
2.46k
    }
63
64
382
    return true;
65
475
}
Unexecuted instantiation: bool opendnp3::LoadWithRangeIterator<opendnp3::BinaryOutputStatusSpec, ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1> >(opendnp3::StaticDataMap<opendnp3::BinaryOutputStatusSpec>&, opendnp3::RangeWriteIterator<ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1>, opendnp3::BinaryOutputStatusSpec::meas_t>&, opendnp3::BinaryOutputStatusSpec::static_variation_t)
bool opendnp3::LoadWithRangeIterator<opendnp3::AnalogOutputStatusSpec, ser4cpp::UInt8>(opendnp3::StaticDataMap<opendnp3::AnalogOutputStatusSpec>&, opendnp3::RangeWriteIterator<ser4cpp::UInt8, opendnp3::AnalogOutputStatusSpec::meas_t>&, opendnp3::AnalogOutputStatusSpec::static_variation_t)
Line
Count
Source
39
770
{
40
770
    auto next_index = map.get_selected_range().start;
41
42
770
    for (const auto& elem : map)
43
4.11k
    {
44
4.11k
        if (elem.second.variation != variation)
45
78
        {
46
            // the variation has changed
47
78
            return true;
48
78
        }
49
50
4.03k
        if (elem.first != next_index)
51
131
        {
52
            // we've loaded all we can with a contiguous range
53
131
            return true;
54
131
        }
55
56
3.90k
        if (!writer.Write(elem.second.value))
57
0
        {
58
0
            return false;
59
0
        }
60
61
3.90k
        ++next_index;
62
3.90k
    }
63
64
561
    return true;
65
770
}
Unexecuted instantiation: bool opendnp3::LoadWithRangeIterator<opendnp3::AnalogOutputStatusSpec, ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1> >(opendnp3::StaticDataMap<opendnp3::AnalogOutputStatusSpec>&, opendnp3::RangeWriteIterator<ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1>, opendnp3::AnalogOutputStatusSpec::meas_t>&, opendnp3::AnalogOutputStatusSpec::static_variation_t)
bool opendnp3::LoadWithRangeIterator<opendnp3::TimeAndIntervalSpec, ser4cpp::UInt8>(opendnp3::StaticDataMap<opendnp3::TimeAndIntervalSpec>&, opendnp3::RangeWriteIterator<ser4cpp::UInt8, opendnp3::TimeAndIntervalSpec::meas_t>&, opendnp3::TimeAndIntervalSpec::static_variation_t)
Line
Count
Source
39
329
{
40
329
    auto next_index = map.get_selected_range().start;
41
42
329
    for (const auto& elem : map)
43
1.92k
    {
44
1.92k
        if (elem.second.variation != variation)
45
0
        {
46
            // the variation has changed
47
0
            return true;
48
0
        }
49
50
1.92k
        if (elem.first != next_index)
51
68
        {
52
            // we've loaded all we can with a contiguous range
53
68
            return true;
54
68
        }
55
56
1.85k
        if (!writer.Write(elem.second.value))
57
0
        {
58
0
            return false;
59
0
        }
60
61
1.85k
        ++next_index;
62
1.85k
    }
63
64
261
    return true;
65
329
}
Unexecuted instantiation: bool opendnp3::LoadWithRangeIterator<opendnp3::TimeAndIntervalSpec, ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1> >(opendnp3::StaticDataMap<opendnp3::TimeAndIntervalSpec>&, opendnp3::RangeWriteIterator<ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1>, opendnp3::TimeAndIntervalSpec::meas_t>&, opendnp3::TimeAndIntervalSpec::static_variation_t)
66
67
template<class Spec, class IndexType>
68
bool LoadWithBitfieldIterator(StaticDataMap<Spec>& map,
69
                              BitfieldRangeWriteIterator<IndexType>& iter,
70
                              typename Spec::static_variation_t variation)
71
0
{
72
0
    auto next_index = map.get_selected_range().start;
73
74
0
    for (const auto& elem : map)
75
0
    {
76
0
        if (elem.second.variation != variation)
77
0
        {
78
            // the variation has changed
79
0
            return true;
80
0
        }
81
82
0
        if (elem.first != next_index)
83
0
        {
84
            // we've loaded all we can with a contiguous range
85
0
            return true;
86
0
        }
87
88
0
        if (!iter.Write(elem.second.value.value))
89
0
        {
90
0
            return false;
91
0
        }
92
93
0
        ++next_index;
94
0
    }
95
96
0
    return true;
97
0
}
Unexecuted instantiation: bool opendnp3::LoadWithBitfieldIterator<opendnp3::BinarySpec, ser4cpp::UInt8>(opendnp3::StaticDataMap<opendnp3::BinarySpec>&, opendnp3::BitfieldRangeWriteIterator<ser4cpp::UInt8>&, opendnp3::BinarySpec::static_variation_t)
Unexecuted instantiation: bool opendnp3::LoadWithBitfieldIterator<opendnp3::BinarySpec, ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1> >(opendnp3::StaticDataMap<opendnp3::BinarySpec>&, opendnp3::BitfieldRangeWriteIterator<ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1> >&, opendnp3::BinarySpec::static_variation_t)
98
99
template<class Spec, class GV> bool WriteSingleBitfield(StaticDataMap<Spec>& map, HeaderWriter& writer)
100
0
{
101
0
    const auto range = map.get_selected_range();
102
103
0
    if (range.IsOneByte())
104
0
    {
105
0
        auto write_iter = writer.IterateOverSingleBitfield<ser4cpp::UInt8>(GV::ID(), QualifierCode::UINT8_START_STOP,
106
0
                                                                           static_cast<uint8_t>(range.start));
107
0
        return LoadWithBitfieldIterator<Spec, ser4cpp::UInt8>(map, write_iter, GV::svariation);
108
0
    }
109
110
0
    auto write_iter
111
0
        = writer.IterateOverSingleBitfield<ser4cpp::UInt16>(GV::ID(), QualifierCode::UINT16_START_STOP, range.start);
112
0
    return LoadWithBitfieldIterator<Spec, ser4cpp::UInt16>(map, write_iter, GV::svariation);
113
0
}
114
115
template<class Spec, class Serializer> bool WriteWithSerializer(StaticDataMap<Spec>& map, HeaderWriter& writer)
116
5.53k
{
117
5.53k
    const auto range = map.get_selected_range();
118
119
5.53k
    if (range.IsOneByte())
120
5.53k
    {
121
5.53k
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
5.53k
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
5.53k
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
5.53k
    }
125
126
0
    auto iter = writer.IterateOverRange<ser4cpp::UInt16, typename Serializer::Target>(QualifierCode::UINT16_START_STOP,
127
0
                                                                                      Serializer::Inst(), range.start);
128
0
    return LoadWithRangeIterator<Spec, ser4cpp::UInt16>(map, iter, Serializer::svariation);
129
5.53k
}
bool opendnp3::WriteWithSerializer<opendnp3::BinarySpec, opendnp3::Group1Var2>(opendnp3::StaticDataMap<opendnp3::BinarySpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
614
{
117
614
    const auto range = map.get_selected_range();
118
119
614
    if (range.IsOneByte())
120
614
    {
121
614
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
614
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
614
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
614
    }
125
126
0
    auto iter = writer.IterateOverRange<ser4cpp::UInt16, typename Serializer::Target>(QualifierCode::UINT16_START_STOP,
127
0
                                                                                      Serializer::Inst(), range.start);
128
0
    return LoadWithRangeIterator<Spec, ser4cpp::UInt16>(map, iter, Serializer::svariation);
129
614
}
bool opendnp3::WriteWithSerializer<opendnp3::DoubleBitBinarySpec, opendnp3::Group3Var2>(opendnp3::StaticDataMap<opendnp3::DoubleBitBinarySpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
516
{
117
516
    const auto range = map.get_selected_range();
118
119
516
    if (range.IsOneByte())
120
516
    {
121
516
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
516
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
516
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
516
    }
125
126
0
    auto iter = writer.IterateOverRange<ser4cpp::UInt16, typename Serializer::Target>(QualifierCode::UINT16_START_STOP,
127
0
                                                                                      Serializer::Inst(), range.start);
128
0
    return LoadWithRangeIterator<Spec, ser4cpp::UInt16>(map, iter, Serializer::svariation);
129
516
}
bool opendnp3::WriteWithSerializer<opendnp3::AnalogSpec, opendnp3::Group30Var1>(opendnp3::StaticDataMap<opendnp3::AnalogSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
448
{
117
448
    const auto range = map.get_selected_range();
118
119
448
    if (range.IsOneByte())
120
448
    {
121
448
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
448
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
448
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
448
    }
125
126
0
    auto iter = writer.IterateOverRange<ser4cpp::UInt16, typename Serializer::Target>(QualifierCode::UINT16_START_STOP,
127
0
                                                                                      Serializer::Inst(), range.start);
128
0
    return LoadWithRangeIterator<Spec, ser4cpp::UInt16>(map, iter, Serializer::svariation);
129
448
}
bool opendnp3::WriteWithSerializer<opendnp3::AnalogSpec, opendnp3::Group30Var2>(opendnp3::StaticDataMap<opendnp3::AnalogSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
117
{
117
117
    const auto range = map.get_selected_range();
118
119
117
    if (range.IsOneByte())
120
117
    {
121
117
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
117
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
117
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
117
    }
125
126
0
    auto iter = writer.IterateOverRange<ser4cpp::UInt16, typename Serializer::Target>(QualifierCode::UINT16_START_STOP,
127
0
                                                                                      Serializer::Inst(), range.start);
128
0
    return LoadWithRangeIterator<Spec, ser4cpp::UInt16>(map, iter, Serializer::svariation);
129
117
}
bool opendnp3::WriteWithSerializer<opendnp3::AnalogSpec, opendnp3::Group30Var3>(opendnp3::StaticDataMap<opendnp3::AnalogSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
119
{
117
119
    const auto range = map.get_selected_range();
118
119
119
    if (range.IsOneByte())
120
119
    {
121
119
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
119
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
119
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
119
    }
125
126
0
    auto iter = writer.IterateOverRange<ser4cpp::UInt16, typename Serializer::Target>(QualifierCode::UINT16_START_STOP,
127
0
                                                                                      Serializer::Inst(), range.start);
128
0
    return LoadWithRangeIterator<Spec, ser4cpp::UInt16>(map, iter, Serializer::svariation);
129
119
}
bool opendnp3::WriteWithSerializer<opendnp3::AnalogSpec, opendnp3::Group30Var4>(opendnp3::StaticDataMap<opendnp3::AnalogSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
129
{
117
129
    const auto range = map.get_selected_range();
118
119
129
    if (range.IsOneByte())
120
129
    {
121
129
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
129
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
129
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
129
    }
125
126
0
    auto iter = writer.IterateOverRange<ser4cpp::UInt16, typename Serializer::Target>(QualifierCode::UINT16_START_STOP,
127
0
                                                                                      Serializer::Inst(), range.start);
128
0
    return LoadWithRangeIterator<Spec, ser4cpp::UInt16>(map, iter, Serializer::svariation);
129
129
}
bool opendnp3::WriteWithSerializer<opendnp3::AnalogSpec, opendnp3::Group30Var5>(opendnp3::StaticDataMap<opendnp3::AnalogSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
120
{
117
120
    const auto range = map.get_selected_range();
118
119
120
    if (range.IsOneByte())
120
120
    {
121
120
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
120
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
120
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
120
    }
125
126
0
    auto iter = writer.IterateOverRange<ser4cpp::UInt16, typename Serializer::Target>(QualifierCode::UINT16_START_STOP,
127
0
                                                                                      Serializer::Inst(), range.start);
128
0
    return LoadWithRangeIterator<Spec, ser4cpp::UInt16>(map, iter, Serializer::svariation);
129
120
}
bool opendnp3::WriteWithSerializer<opendnp3::AnalogSpec, opendnp3::Group30Var6>(opendnp3::StaticDataMap<opendnp3::AnalogSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
183
{
117
183
    const auto range = map.get_selected_range();
118
119
183
    if (range.IsOneByte())
120
183
    {
121
183
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
183
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
183
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
183
    }
125
126
0
    auto iter = writer.IterateOverRange<ser4cpp::UInt16, typename Serializer::Target>(QualifierCode::UINT16_START_STOP,
127
0
                                                                                      Serializer::Inst(), range.start);
128
0
    return LoadWithRangeIterator<Spec, ser4cpp::UInt16>(map, iter, Serializer::svariation);
129
183
}
bool opendnp3::WriteWithSerializer<opendnp3::CounterSpec, opendnp3::Group20Var1>(opendnp3::StaticDataMap<opendnp3::CounterSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
350
{
117
350
    const auto range = map.get_selected_range();
118
119
350
    if (range.IsOneByte())
120
350
    {
121
350
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
350
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
350
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
350
    }
125
126
0
    auto iter = writer.IterateOverRange<ser4cpp::UInt16, typename Serializer::Target>(QualifierCode::UINT16_START_STOP,
127
0
                                                                                      Serializer::Inst(), range.start);
128
0
    return LoadWithRangeIterator<Spec, ser4cpp::UInt16>(map, iter, Serializer::svariation);
129
350
}
bool opendnp3::WriteWithSerializer<opendnp3::CounterSpec, opendnp3::Group20Var2>(opendnp3::StaticDataMap<opendnp3::CounterSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
140
{
117
140
    const auto range = map.get_selected_range();
118
119
140
    if (range.IsOneByte())
120
140
    {
121
140
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
140
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
140
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
140
    }
125
126
0
    auto iter = writer.IterateOverRange<ser4cpp::UInt16, typename Serializer::Target>(QualifierCode::UINT16_START_STOP,
127
0
                                                                                      Serializer::Inst(), range.start);
128
0
    return LoadWithRangeIterator<Spec, ser4cpp::UInt16>(map, iter, Serializer::svariation);
129
140
}
bool opendnp3::WriteWithSerializer<opendnp3::CounterSpec, opendnp3::Group20Var5>(opendnp3::StaticDataMap<opendnp3::CounterSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
111
{
117
111
    const auto range = map.get_selected_range();
118
119
111
    if (range.IsOneByte())
120
111
    {
121
111
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
111
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
111
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
111
    }
125
126
0
    auto iter = writer.IterateOverRange<ser4cpp::UInt16, typename Serializer::Target>(QualifierCode::UINT16_START_STOP,
127
0
                                                                                      Serializer::Inst(), range.start);
128
0
    return LoadWithRangeIterator<Spec, ser4cpp::UInt16>(map, iter, Serializer::svariation);
129
111
}
bool opendnp3::WriteWithSerializer<opendnp3::CounterSpec, opendnp3::Group20Var6>(opendnp3::StaticDataMap<opendnp3::CounterSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
124
{
117
124
    const auto range = map.get_selected_range();
118
119
124
    if (range.IsOneByte())
120
124
    {
121
124
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
124
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
124
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
124
    }
125
126
0
    auto iter = writer.IterateOverRange<ser4cpp::UInt16, typename Serializer::Target>(QualifierCode::UINT16_START_STOP,
127
0
                                                                                      Serializer::Inst(), range.start);
128
0
    return LoadWithRangeIterator<Spec, ser4cpp::UInt16>(map, iter, Serializer::svariation);
129
124
}
bool opendnp3::WriteWithSerializer<opendnp3::FrozenCounterSpec, opendnp3::Group21Var1>(opendnp3::StaticDataMap<opendnp3::FrozenCounterSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
377
{
117
377
    const auto range = map.get_selected_range();
118
119
377
    if (range.IsOneByte())
120
377
    {
121
377
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
377
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
377
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
377
    }
125
126
0
    auto iter = writer.IterateOverRange<ser4cpp::UInt16, typename Serializer::Target>(QualifierCode::UINT16_START_STOP,
127
0
                                                                                      Serializer::Inst(), range.start);
128
0
    return LoadWithRangeIterator<Spec, ser4cpp::UInt16>(map, iter, Serializer::svariation);
129
377
}
bool opendnp3::WriteWithSerializer<opendnp3::FrozenCounterSpec, opendnp3::Group21Var2>(opendnp3::StaticDataMap<opendnp3::FrozenCounterSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
119
{
117
119
    const auto range = map.get_selected_range();
118
119
119
    if (range.IsOneByte())
120
119
    {
121
119
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
119
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
119
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
119
    }
125
126
0
    auto iter = writer.IterateOverRange<ser4cpp::UInt16, typename Serializer::Target>(QualifierCode::UINT16_START_STOP,
127
0
                                                                                      Serializer::Inst(), range.start);
128
0
    return LoadWithRangeIterator<Spec, ser4cpp::UInt16>(map, iter, Serializer::svariation);
129
119
}
bool opendnp3::WriteWithSerializer<opendnp3::FrozenCounterSpec, opendnp3::Group21Var5>(opendnp3::StaticDataMap<opendnp3::FrozenCounterSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
149
{
117
149
    const auto range = map.get_selected_range();
118
119
149
    if (range.IsOneByte())
120
149
    {
121
149
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
149
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
149
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
149
    }
125
126
0
    auto iter = writer.IterateOverRange<ser4cpp::UInt16, typename Serializer::Target>(QualifierCode::UINT16_START_STOP,
127
0
                                                                                      Serializer::Inst(), range.start);
128
0
    return LoadWithRangeIterator<Spec, ser4cpp::UInt16>(map, iter, Serializer::svariation);
129
149
}
bool opendnp3::WriteWithSerializer<opendnp3::FrozenCounterSpec, opendnp3::Group21Var6>(opendnp3::StaticDataMap<opendnp3::FrozenCounterSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
147
{
117
147
    const auto range = map.get_selected_range();
118
119
147
    if (range.IsOneByte())
120
147
    {
121
147
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
147
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
147
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
147
    }
125
126
0
    auto iter = writer.IterateOverRange<ser4cpp::UInt16, typename Serializer::Target>(QualifierCode::UINT16_START_STOP,
127
0
                                                                                      Serializer::Inst(), range.start);
128
0
    return LoadWithRangeIterator<Spec, ser4cpp::UInt16>(map, iter, Serializer::svariation);
129
147
}
bool opendnp3::WriteWithSerializer<opendnp3::FrozenCounterSpec, opendnp3::Group21Var9>(opendnp3::StaticDataMap<opendnp3::FrozenCounterSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
96
{
117
96
    const auto range = map.get_selected_range();
118
119
96
    if (range.IsOneByte())
120
96
    {
121
96
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
96
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
96
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
96
    }
125
126
0
    auto iter = writer.IterateOverRange<ser4cpp::UInt16, typename Serializer::Target>(QualifierCode::UINT16_START_STOP,
127
0
                                                                                      Serializer::Inst(), range.start);
128
0
    return LoadWithRangeIterator<Spec, ser4cpp::UInt16>(map, iter, Serializer::svariation);
129
96
}
bool opendnp3::WriteWithSerializer<opendnp3::FrozenCounterSpec, opendnp3::Group21Var10>(opendnp3::StaticDataMap<opendnp3::FrozenCounterSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
100
{
117
100
    const auto range = map.get_selected_range();
118
119
100
    if (range.IsOneByte())
120
100
    {
121
100
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
100
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
100
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
100
    }
125
126
0
    auto iter = writer.IterateOverRange<ser4cpp::UInt16, typename Serializer::Target>(QualifierCode::UINT16_START_STOP,
127
0
                                                                                      Serializer::Inst(), range.start);
128
0
    return LoadWithRangeIterator<Spec, ser4cpp::UInt16>(map, iter, Serializer::svariation);
129
100
}
bool opendnp3::WriteWithSerializer<opendnp3::BinaryOutputStatusSpec, opendnp3::Group10Var2>(opendnp3::StaticDataMap<opendnp3::BinaryOutputStatusSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
475
{
117
475
    const auto range = map.get_selected_range();
118
119
475
    if (range.IsOneByte())
120
475
    {
121
475
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
475
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
475
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
475
    }
125
126
0
    auto iter = writer.IterateOverRange<ser4cpp::UInt16, typename Serializer::Target>(QualifierCode::UINT16_START_STOP,
127
0
                                                                                      Serializer::Inst(), range.start);
128
0
    return LoadWithRangeIterator<Spec, ser4cpp::UInt16>(map, iter, Serializer::svariation);
129
475
}
bool opendnp3::WriteWithSerializer<opendnp3::AnalogOutputStatusSpec, opendnp3::Group40Var1>(opendnp3::StaticDataMap<opendnp3::AnalogOutputStatusSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
411
{
117
411
    const auto range = map.get_selected_range();
118
119
411
    if (range.IsOneByte())
120
411
    {
121
411
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
411
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
411
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
411
    }
125
126
0
    auto iter = writer.IterateOverRange<ser4cpp::UInt16, typename Serializer::Target>(QualifierCode::UINT16_START_STOP,
127
0
                                                                                      Serializer::Inst(), range.start);
128
0
    return LoadWithRangeIterator<Spec, ser4cpp::UInt16>(map, iter, Serializer::svariation);
129
411
}
bool opendnp3::WriteWithSerializer<opendnp3::AnalogOutputStatusSpec, opendnp3::Group40Var2>(opendnp3::StaticDataMap<opendnp3::AnalogOutputStatusSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
128
{
117
128
    const auto range = map.get_selected_range();
118
119
128
    if (range.IsOneByte())
120
128
    {
121
128
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
128
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
128
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
128
    }
125
126
0
    auto iter = writer.IterateOverRange<ser4cpp::UInt16, typename Serializer::Target>(QualifierCode::UINT16_START_STOP,
127
0
                                                                                      Serializer::Inst(), range.start);
128
0
    return LoadWithRangeIterator<Spec, ser4cpp::UInt16>(map, iter, Serializer::svariation);
129
128
}
bool opendnp3::WriteWithSerializer<opendnp3::AnalogOutputStatusSpec, opendnp3::Group40Var3>(opendnp3::StaticDataMap<opendnp3::AnalogOutputStatusSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
98
{
117
98
    const auto range = map.get_selected_range();
118
119
98
    if (range.IsOneByte())
120
98
    {
121
98
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
98
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
98
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
98
    }
125
126
0
    auto iter = writer.IterateOverRange<ser4cpp::UInt16, typename Serializer::Target>(QualifierCode::UINT16_START_STOP,
127
0
                                                                                      Serializer::Inst(), range.start);
128
0
    return LoadWithRangeIterator<Spec, ser4cpp::UInt16>(map, iter, Serializer::svariation);
129
98
}
bool opendnp3::WriteWithSerializer<opendnp3::AnalogOutputStatusSpec, opendnp3::Group40Var4>(opendnp3::StaticDataMap<opendnp3::AnalogOutputStatusSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
133
{
117
133
    const auto range = map.get_selected_range();
118
119
133
    if (range.IsOneByte())
120
133
    {
121
133
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
133
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
133
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
133
    }
125
126
0
    auto iter = writer.IterateOverRange<ser4cpp::UInt16, typename Serializer::Target>(QualifierCode::UINT16_START_STOP,
127
0
                                                                                      Serializer::Inst(), range.start);
128
0
    return LoadWithRangeIterator<Spec, ser4cpp::UInt16>(map, iter, Serializer::svariation);
129
133
}
bool opendnp3::WriteWithSerializer<opendnp3::TimeAndIntervalSpec, opendnp3::Group50Var4>(opendnp3::StaticDataMap<opendnp3::TimeAndIntervalSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
329
{
117
329
    const auto range = map.get_selected_range();
118
119
329
    if (range.IsOneByte())
120
329
    {
121
329
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
329
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
329
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
329
    }
125
126
0
    auto iter = writer.IterateOverRange<ser4cpp::UInt16, typename Serializer::Target>(QualifierCode::UINT16_START_STOP,
127
0
                                                                                      Serializer::Inst(), range.start);
128
0
    return LoadWithRangeIterator<Spec, ser4cpp::UInt16>(map, iter, Serializer::svariation);
129
329
}
130
131
static_write_func_t<BinarySpec> StaticWriters::get(StaticBinaryVariation variation)
132
614
{
133
614
    switch (variation)
134
614
    {
135
0
    case (StaticBinaryVariation::Group1Var1):
136
0
        return &WriteSingleBitfield<BinarySpec, Group1Var1>;
137
614
    default:
138
614
        return &WriteWithSerializer<BinarySpec, Group1Var2>;
139
614
    }
140
614
}
141
142
static_write_func_t<DoubleBitBinarySpec> StaticWriters::get(StaticDoubleBinaryVariation variation)
143
516
{
144
516
    switch (variation)
145
516
    {
146
516
    case (StaticDoubleBinaryVariation::Group3Var2):
147
516
        return &WriteWithSerializer<DoubleBitBinarySpec, Group3Var2>;
148
0
    default:
149
0
        return &WriteWithSerializer<DoubleBitBinarySpec, Group3Var2>;
150
516
    }
151
516
}
152
153
static_write_func_t<AnalogSpec> StaticWriters::get(StaticAnalogVariation variation)
154
1.11k
{
155
1.11k
    switch (variation)
156
1.11k
    {
157
448
    case (StaticAnalogVariation::Group30Var1):
158
448
        return &WriteWithSerializer<AnalogSpec, Group30Var1>;
159
117
    case (StaticAnalogVariation::Group30Var2):
160
117
        return &WriteWithSerializer<AnalogSpec, Group30Var2>;
161
119
    case (StaticAnalogVariation::Group30Var3):
162
119
        return &WriteWithSerializer<AnalogSpec, Group30Var3>;
163
129
    case (StaticAnalogVariation::Group30Var4):
164
129
        return &WriteWithSerializer<AnalogSpec, Group30Var4>;
165
120
    case (StaticAnalogVariation::Group30Var5):
166
120
        return &WriteWithSerializer<AnalogSpec, Group30Var5>;
167
183
    case (StaticAnalogVariation::Group30Var6):
168
183
        return &WriteWithSerializer<AnalogSpec, Group30Var6>;
169
0
    default:
170
0
        return &WriteWithSerializer<AnalogSpec, Group30Var1>;
171
1.11k
    }
172
1.11k
}
173
174
static_write_func_t<CounterSpec> StaticWriters::get(StaticCounterVariation variation)
175
725
{
176
725
    switch (variation)
177
725
    {
178
350
    case (StaticCounterVariation::Group20Var1):
179
350
        return &WriteWithSerializer<CounterSpec, Group20Var1>;
180
140
    case (StaticCounterVariation::Group20Var2):
181
140
        return &WriteWithSerializer<CounterSpec, Group20Var2>;
182
111
    case (StaticCounterVariation::Group20Var5):
183
111
        return &WriteWithSerializer<CounterSpec, Group20Var5>;
184
124
    case (StaticCounterVariation::Group20Var6):
185
124
        return &WriteWithSerializer<CounterSpec, Group20Var6>;
186
0
    default:
187
0
        return &WriteWithSerializer<CounterSpec, Group20Var1>;
188
725
    }
189
725
}
190
191
static_write_func_t<FrozenCounterSpec> StaticWriters::get(StaticFrozenCounterVariation variation)
192
988
{
193
988
    switch (variation)
194
988
    {
195
377
    case (StaticFrozenCounterVariation::Group21Var1):
196
377
        return &WriteWithSerializer<FrozenCounterSpec, Group21Var1>;
197
119
    case (StaticFrozenCounterVariation::Group21Var2):
198
119
        return &WriteWithSerializer<FrozenCounterSpec, Group21Var2>;
199
149
    case (StaticFrozenCounterVariation::Group21Var5):
200
149
        return &WriteWithSerializer<FrozenCounterSpec, Group21Var5>;
201
147
    case (StaticFrozenCounterVariation::Group21Var6):
202
147
        return &WriteWithSerializer<FrozenCounterSpec, Group21Var6>;
203
96
    case (StaticFrozenCounterVariation::Group21Var9):
204
96
        return &WriteWithSerializer<FrozenCounterSpec, Group21Var9>;
205
100
    case (StaticFrozenCounterVariation::Group21Var10):
206
100
        return &WriteWithSerializer<FrozenCounterSpec, Group21Var10>;
207
0
    default:
208
0
        return &WriteWithSerializer<FrozenCounterSpec, Group21Var1>;
209
988
    }
210
988
}
211
212
static_write_func_t<BinaryOutputStatusSpec> StaticWriters::get(StaticBinaryOutputStatusVariation variation)
213
475
{
214
475
    switch (variation)
215
475
    {
216
475
    case (StaticBinaryOutputStatusVariation::Group10Var2):
217
475
        return &WriteWithSerializer<BinaryOutputStatusSpec, Group10Var2>;
218
0
    default:
219
0
        return &WriteWithSerializer<BinaryOutputStatusSpec, Group10Var2>;
220
475
    }
221
475
}
222
223
static_write_func_t<AnalogOutputStatusSpec> StaticWriters::get(StaticAnalogOutputStatusVariation variation)
224
770
{
225
770
    switch (variation)
226
770
    {
227
411
    case (StaticAnalogOutputStatusVariation::Group40Var1):
228
411
        return &WriteWithSerializer<AnalogOutputStatusSpec, Group40Var1>;
229
128
    case (StaticAnalogOutputStatusVariation::Group40Var2):
230
128
        return &WriteWithSerializer<AnalogOutputStatusSpec, Group40Var2>;
231
98
    case (StaticAnalogOutputStatusVariation::Group40Var3):
232
98
        return &WriteWithSerializer<AnalogOutputStatusSpec, Group40Var3>;
233
133
    case (StaticAnalogOutputStatusVariation::Group40Var4):
234
133
        return &WriteWithSerializer<AnalogOutputStatusSpec, Group40Var4>;
235
0
    default:
236
0
        return &WriteWithSerializer<AnalogOutputStatusSpec, Group40Var1>;
237
770
    }
238
770
}
239
240
bool write_octet_strings(StaticDataMap<OctetStringSpec>& map, HeaderWriter& writer);
241
242
static_write_func_t<OctetStringSpec> StaticWriters::get(StaticOctetStringVariation /*variation*/)
243
318
{
244
318
    return write_octet_strings;
245
318
}
246
247
static_write_func_t<TimeAndIntervalSpec> StaticWriters::get(StaticTimeAndIntervalVariation /*variation*/)
248
329
{
249
329
    return &WriteWithSerializer<TimeAndIntervalSpec, Group50Var4>;
250
329
}
251
252
template<class Writer> bool write_some_octet_strings(StaticDataMap<OctetStringSpec>& map, Writer& writer)
253
318
{
254
318
    bool first = true;
255
318
    uint8_t last_length = 0;
256
318
    uint16_t next_index = 0;
257
258
318
    for (const auto& elem : map)
259
1.93k
    {
260
261
1.93k
        if(!first) {
262
263
1.62k
            if(next_index != elem.first) {
264
                // discontiguous indices
265
59
                return true;
266
59
            }
267
268
1.56k
            if(last_length != elem.second.value.Size()) {
269
                // different lengths
270
0
                return true;
271
0
            }
272
1.56k
        }
273
274
1.87k
        first = false;
275
1.87k
        next_index = elem.first + 1;
276
1.87k
        last_length = elem.second.value.Size();
277
278
1.87k
        if (!writer.Write(elem.second.value))
279
0
        {
280
0
            return false;
281
0
        }
282
1.87k
    }
283
284
259
    return true;
285
318
}
bool opendnp3::write_some_octet_strings<opendnp3::RangeWriteIterator<ser4cpp::UInt8, opendnp3::OctetString> >(opendnp3::StaticDataMap<opendnp3::OctetStringSpec>&, opendnp3::RangeWriteIterator<ser4cpp::UInt8, opendnp3::OctetString>&)
Line
Count
Source
253
318
{
254
318
    bool first = true;
255
318
    uint8_t last_length = 0;
256
318
    uint16_t next_index = 0;
257
258
318
    for (const auto& elem : map)
259
1.93k
    {
260
261
1.93k
        if(!first) {
262
263
1.62k
            if(next_index != elem.first) {
264
                // discontiguous indices
265
59
                return true;
266
59
            }
267
268
1.56k
            if(last_length != elem.second.value.Size()) {
269
                // different lengths
270
0
                return true;
271
0
            }
272
1.56k
        }
273
274
1.87k
        first = false;
275
1.87k
        next_index = elem.first + 1;
276
1.87k
        last_length = elem.second.value.Size();
277
278
1.87k
        if (!writer.Write(elem.second.value))
279
0
        {
280
0
            return false;
281
0
        }
282
1.87k
    }
283
284
259
    return true;
285
318
}
Unexecuted instantiation: bool opendnp3::write_some_octet_strings<opendnp3::RangeWriteIterator<ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1>, opendnp3::OctetString> >(opendnp3::StaticDataMap<opendnp3::OctetStringSpec>&, opendnp3::RangeWriteIterator<ser4cpp::Bit16<unsigned short, (unsigned char)0, (unsigned char)1>, opendnp3::OctetString>&)
286
287
bool write_octet_strings(StaticDataMap<OctetStringSpec>& map, HeaderWriter& writer)
288
318
{
289
318
    const auto range = map.get_selected_range();
290
291
318
    const uint8_t starting_size = (*map.begin()).second.value.Size();
292
318
    const OctetStringSerializer serializer(false, starting_size);
293
294
318
    if (range.IsOneByte())
295
318
    {
296
318
        auto iter = writer.IterateOverRange<ser4cpp::UInt8>(QualifierCode::UINT8_START_STOP, serializer,
297
318
                                                            static_cast<uint8_t>(range.start));
298
318
        return write_some_octet_strings(map, iter);
299
318
    }
300
301
0
    auto iter = writer.IterateOverRange<ser4cpp::UInt16>(QualifierCode::UINT16_START_STOP, serializer, range.start);
302
0
    return write_some_octet_strings(map, iter);
303
318
}
304
305
} // namespace opendnp3