Coverage Report

Created: 2026-01-09 06:49

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.49k
{
40
5.49k
    auto next_index = map.get_selected_range().start;
41
42
5.49k
    for (const auto& elem : map)
43
28.6k
    {
44
28.6k
        if (elem.second.variation != variation)
45
554
        {
46
            // the variation has changed
47
554
            return true;
48
554
        }
49
50
28.1k
        if (elem.first != next_index)
51
966
        {
52
            // we've loaded all we can with a contiguous range
53
966
            return true;
54
966
        }
55
56
27.1k
        if (!writer.Write(elem.second.value))
57
0
        {
58
0
            return false;
59
0
        }
60
61
27.1k
        ++next_index;
62
27.1k
    }
63
64
3.97k
    return true;
65
5.49k
}
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
600
{
40
600
    auto next_index = map.get_selected_range().start;
41
42
600
    for (const auto& elem : map)
43
3.36k
    {
44
3.36k
        if (elem.second.variation != variation)
45
0
        {
46
            // the variation has changed
47
0
            return true;
48
0
        }
49
50
3.36k
        if (elem.first != next_index)
51
123
        {
52
            // we've loaded all we can with a contiguous range
53
123
            return true;
54
123
        }
55
56
3.23k
        if (!writer.Write(elem.second.value))
57
0
        {
58
0
            return false;
59
0
        }
60
61
3.23k
        ++next_index;
62
3.23k
    }
63
64
477
    return true;
65
600
}
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
503
{
40
503
    auto next_index = map.get_selected_range().start;
41
42
503
    for (const auto& elem : map)
43
2.61k
    {
44
2.61k
        if (elem.second.variation != variation)
45
0
        {
46
            // the variation has changed
47
0
            return true;
48
0
        }
49
50
2.61k
        if (elem.first != next_index)
51
119
        {
52
            // we've loaded all we can with a contiguous range
53
119
            return true;
54
119
        }
55
56
2.49k
        if (!writer.Write(elem.second.value))
57
0
        {
58
0
            return false;
59
0
        }
60
61
2.49k
        ++next_index;
62
2.49k
    }
63
64
384
    return true;
65
503
}
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.04k
{
40
1.04k
    auto next_index = map.get_selected_range().start;
41
42
1.04k
    for (const auto& elem : map)
43
5.13k
    {
44
5.13k
        if (elem.second.variation != variation)
45
196
        {
46
            // the variation has changed
47
196
            return true;
48
196
        }
49
50
4.93k
        if (elem.first != next_index)
51
158
        {
52
            // we've loaded all we can with a contiguous range
53
158
            return true;
54
158
        }
55
56
4.78k
        if (!writer.Write(elem.second.value))
57
0
        {
58
0
            return false;
59
0
        }
60
61
4.78k
        ++next_index;
62
4.78k
    }
63
64
693
    return true;
65
1.04k
}
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
718
{
40
718
    auto next_index = map.get_selected_range().start;
41
42
718
    for (const auto& elem : map)
43
3.65k
    {
44
3.65k
        if (elem.second.variation != variation)
45
87
        {
46
            // the variation has changed
47
87
            return true;
48
87
        }
49
50
3.57k
        if (elem.first != next_index)
51
127
        {
52
            // we've loaded all we can with a contiguous range
53
127
            return true;
54
127
        }
55
56
3.44k
        if (!writer.Write(elem.second.value))
57
0
        {
58
0
            return false;
59
0
        }
60
61
3.44k
        ++next_index;
62
3.44k
    }
63
64
504
    return true;
65
718
}
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
1.04k
{
40
1.04k
    auto next_index = map.get_selected_range().start;
41
42
1.04k
    for (const auto& elem : map)
43
5.21k
    {
44
5.21k
        if (elem.second.variation != variation)
45
182
        {
46
            // the variation has changed
47
182
            return true;
48
182
        }
49
50
5.03k
        if (elem.first != next_index)
51
147
        {
52
            // we've loaded all we can with a contiguous range
53
147
            return true;
54
147
        }
55
56
4.88k
        if (!writer.Write(elem.second.value))
57
0
        {
58
0
            return false;
59
0
        }
60
61
4.88k
        ++next_index;
62
4.88k
    }
63
64
712
    return true;
65
1.04k
}
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
502
{
40
502
    auto next_index = map.get_selected_range().start;
41
42
502
    for (const auto& elem : map)
43
2.69k
    {
44
2.69k
        if (elem.second.variation != variation)
45
0
        {
46
            // the variation has changed
47
0
            return true;
48
0
        }
49
50
2.69k
        if (elem.first != next_index)
51
110
        {
52
            // we've loaded all we can with a contiguous range
53
110
            return true;
54
110
        }
55
56
2.58k
        if (!writer.Write(elem.second.value))
57
0
        {
58
0
            return false;
59
0
        }
60
61
2.58k
        ++next_index;
62
2.58k
    }
63
64
392
    return true;
65
502
}
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
763
{
40
763
    auto next_index = map.get_selected_range().start;
41
42
763
    for (const auto& elem : map)
43
4.06k
    {
44
4.06k
        if (elem.second.variation != variation)
45
89
        {
46
            // the variation has changed
47
89
            return true;
48
89
        }
49
50
3.97k
        if (elem.first != next_index)
51
115
        {
52
            // we've loaded all we can with a contiguous range
53
115
            return true;
54
115
        }
55
56
3.86k
        if (!writer.Write(elem.second.value))
57
0
        {
58
0
            return false;
59
0
        }
60
61
3.86k
        ++next_index;
62
3.86k
    }
63
64
559
    return true;
65
763
}
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
323
{
40
323
    auto next_index = map.get_selected_range().start;
41
42
323
    for (const auto& elem : map)
43
1.93k
    {
44
1.93k
        if (elem.second.variation != variation)
45
0
        {
46
            // the variation has changed
47
0
            return true;
48
0
        }
49
50
1.93k
        if (elem.first != next_index)
51
67
        {
52
            // we've loaded all we can with a contiguous range
53
67
            return true;
54
67
        }
55
56
1.86k
        if (!writer.Write(elem.second.value))
57
0
        {
58
0
            return false;
59
0
        }
60
61
1.86k
        ++next_index;
62
1.86k
    }
63
64
256
    return true;
65
323
}
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.49k
{
117
5.49k
    const auto range = map.get_selected_range();
118
119
5.49k
    if (range.IsOneByte())
120
5.49k
    {
121
5.49k
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
5.49k
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
5.49k
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
5.49k
    }
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.49k
}
bool opendnp3::WriteWithSerializer<opendnp3::BinarySpec, opendnp3::Group1Var2>(opendnp3::StaticDataMap<opendnp3::BinarySpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
600
{
117
600
    const auto range = map.get_selected_range();
118
119
600
    if (range.IsOneByte())
120
600
    {
121
600
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
600
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
600
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
600
    }
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
600
}
bool opendnp3::WriteWithSerializer<opendnp3::DoubleBitBinarySpec, opendnp3::Group3Var2>(opendnp3::StaticDataMap<opendnp3::DoubleBitBinarySpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
503
{
117
503
    const auto range = map.get_selected_range();
118
119
503
    if (range.IsOneByte())
120
503
    {
121
503
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
503
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
503
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
503
    }
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
503
}
bool opendnp3::WriteWithSerializer<opendnp3::AnalogSpec, opendnp3::Group30Var1>(opendnp3::StaticDataMap<opendnp3::AnalogSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
425
{
117
425
    const auto range = map.get_selected_range();
118
119
425
    if (range.IsOneByte())
120
425
    {
121
425
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
425
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
425
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
425
    }
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
425
}
bool opendnp3::WriteWithSerializer<opendnp3::AnalogSpec, opendnp3::Group30Var2>(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::Group30Var3>(opendnp3::StaticDataMap<opendnp3::AnalogSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
107
{
117
107
    const auto range = map.get_selected_range();
118
119
107
    if (range.IsOneByte())
120
107
    {
121
107
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
107
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
107
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
107
    }
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
107
}
bool opendnp3::WriteWithSerializer<opendnp3::AnalogSpec, opendnp3::Group30Var4>(opendnp3::StaticDataMap<opendnp3::AnalogSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
115
{
117
115
    const auto range = map.get_selected_range();
118
119
115
    if (range.IsOneByte())
120
115
    {
121
115
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
115
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
115
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
115
    }
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
115
}
bool opendnp3::WriteWithSerializer<opendnp3::AnalogSpec, opendnp3::Group30Var5>(opendnp3::StaticDataMap<opendnp3::AnalogSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
113
{
117
113
    const auto range = map.get_selected_range();
118
119
113
    if (range.IsOneByte())
120
113
    {
121
113
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
113
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
113
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
113
    }
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
113
}
bool opendnp3::WriteWithSerializer<opendnp3::AnalogSpec, opendnp3::Group30Var6>(opendnp3::StaticDataMap<opendnp3::AnalogSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
168
{
117
168
    const auto range = map.get_selected_range();
118
119
168
    if (range.IsOneByte())
120
168
    {
121
168
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
168
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
168
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
168
    }
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
168
}
bool opendnp3::WriteWithSerializer<opendnp3::CounterSpec, opendnp3::Group20Var1>(opendnp3::StaticDataMap<opendnp3::CounterSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
344
{
117
344
    const auto range = map.get_selected_range();
118
119
344
    if (range.IsOneByte())
120
344
    {
121
344
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
344
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
344
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
344
    }
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
344
}
bool opendnp3::WriteWithSerializer<opendnp3::CounterSpec, opendnp3::Group20Var2>(opendnp3::StaticDataMap<opendnp3::CounterSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
139
{
117
139
    const auto range = map.get_selected_range();
118
119
139
    if (range.IsOneByte())
120
139
    {
121
139
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
139
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
139
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
139
    }
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
139
}
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
401
{
117
401
    const auto range = map.get_selected_range();
118
119
401
    if (range.IsOneByte())
120
401
    {
121
401
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
401
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
401
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
401
    }
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
401
}
bool opendnp3::WriteWithSerializer<opendnp3::FrozenCounterSpec, opendnp3::Group21Var2>(opendnp3::StaticDataMap<opendnp3::FrozenCounterSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
130
{
117
130
    const auto range = map.get_selected_range();
118
119
130
    if (range.IsOneByte())
120
130
    {
121
130
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
130
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
130
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
130
    }
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
130
}
bool opendnp3::WriteWithSerializer<opendnp3::FrozenCounterSpec, opendnp3::Group21Var5>(opendnp3::StaticDataMap<opendnp3::FrozenCounterSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
160
{
117
160
    const auto range = map.get_selected_range();
118
119
160
    if (range.IsOneByte())
120
160
    {
121
160
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
160
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
160
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
160
    }
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
160
}
bool opendnp3::WriteWithSerializer<opendnp3::FrozenCounterSpec, opendnp3::Group21Var6>(opendnp3::StaticDataMap<opendnp3::FrozenCounterSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
138
{
117
138
    const auto range = map.get_selected_range();
118
119
138
    if (range.IsOneByte())
120
138
    {
121
138
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
138
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
138
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
138
    }
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
138
}
bool opendnp3::WriteWithSerializer<opendnp3::FrozenCounterSpec, opendnp3::Group21Var9>(opendnp3::StaticDataMap<opendnp3::FrozenCounterSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
97
{
117
97
    const auto range = map.get_selected_range();
118
119
97
    if (range.IsOneByte())
120
97
    {
121
97
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
97
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
97
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
97
    }
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
97
}
bool opendnp3::WriteWithSerializer<opendnp3::FrozenCounterSpec, opendnp3::Group21Var10>(opendnp3::StaticDataMap<opendnp3::FrozenCounterSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
115
{
117
115
    const auto range = map.get_selected_range();
118
119
115
    if (range.IsOneByte())
120
115
    {
121
115
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
115
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
115
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
115
    }
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
115
}
bool opendnp3::WriteWithSerializer<opendnp3::BinaryOutputStatusSpec, opendnp3::Group10Var2>(opendnp3::StaticDataMap<opendnp3::BinaryOutputStatusSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
502
{
117
502
    const auto range = map.get_selected_range();
118
119
502
    if (range.IsOneByte())
120
502
    {
121
502
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
502
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
502
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
502
    }
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
502
}
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
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::AnalogOutputStatusSpec, opendnp3::Group40Var3>(opendnp3::StaticDataMap<opendnp3::AnalogOutputStatusSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
114
{
117
114
    const auto range = map.get_selected_range();
118
119
114
    if (range.IsOneByte())
120
114
    {
121
114
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
114
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
114
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
114
    }
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
114
}
bool opendnp3::WriteWithSerializer<opendnp3::AnalogOutputStatusSpec, opendnp3::Group40Var4>(opendnp3::StaticDataMap<opendnp3::AnalogOutputStatusSpec>&, 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::TimeAndIntervalSpec, opendnp3::Group50Var4>(opendnp3::StaticDataMap<opendnp3::TimeAndIntervalSpec>&, opendnp3::HeaderWriter&)
Line
Count
Source
116
323
{
117
323
    const auto range = map.get_selected_range();
118
119
323
    if (range.IsOneByte())
120
323
    {
121
323
        auto iter = writer.IterateOverRange<ser4cpp::UInt8, typename Serializer::Target>(
122
323
            QualifierCode::UINT8_START_STOP, Serializer::Inst(), static_cast<uint8_t>(range.start));
123
323
        return LoadWithRangeIterator<Spec, ser4cpp::UInt8>(map, iter, Serializer::svariation);
124
323
    }
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
323
}
130
131
static_write_func_t<BinarySpec> StaticWriters::get(StaticBinaryVariation variation)
132
600
{
133
600
    switch (variation)
134
600
    {
135
0
    case (StaticBinaryVariation::Group1Var1):
136
0
        return &WriteSingleBitfield<BinarySpec, Group1Var1>;
137
600
    default:
138
600
        return &WriteWithSerializer<BinarySpec, Group1Var2>;
139
600
    }
140
600
}
141
142
static_write_func_t<DoubleBitBinarySpec> StaticWriters::get(StaticDoubleBinaryVariation variation)
143
503
{
144
503
    switch (variation)
145
503
    {
146
503
    case (StaticDoubleBinaryVariation::Group3Var2):
147
503
        return &WriteWithSerializer<DoubleBitBinarySpec, Group3Var2>;
148
0
    default:
149
0
        return &WriteWithSerializer<DoubleBitBinarySpec, Group3Var2>;
150
503
    }
151
503
}
152
153
static_write_func_t<AnalogSpec> StaticWriters::get(StaticAnalogVariation variation)
154
1.04k
{
155
1.04k
    switch (variation)
156
1.04k
    {
157
425
    case (StaticAnalogVariation::Group30Var1):
158
425
        return &WriteWithSerializer<AnalogSpec, Group30Var1>;
159
119
    case (StaticAnalogVariation::Group30Var2):
160
119
        return &WriteWithSerializer<AnalogSpec, Group30Var2>;
161
107
    case (StaticAnalogVariation::Group30Var3):
162
107
        return &WriteWithSerializer<AnalogSpec, Group30Var3>;
163
115
    case (StaticAnalogVariation::Group30Var4):
164
115
        return &WriteWithSerializer<AnalogSpec, Group30Var4>;
165
113
    case (StaticAnalogVariation::Group30Var5):
166
113
        return &WriteWithSerializer<AnalogSpec, Group30Var5>;
167
168
    case (StaticAnalogVariation::Group30Var6):
168
168
        return &WriteWithSerializer<AnalogSpec, Group30Var6>;
169
0
    default:
170
0
        return &WriteWithSerializer<AnalogSpec, Group30Var1>;
171
1.04k
    }
172
1.04k
}
173
174
static_write_func_t<CounterSpec> StaticWriters::get(StaticCounterVariation variation)
175
718
{
176
718
    switch (variation)
177
718
    {
178
344
    case (StaticCounterVariation::Group20Var1):
179
344
        return &WriteWithSerializer<CounterSpec, Group20Var1>;
180
139
    case (StaticCounterVariation::Group20Var2):
181
139
        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
718
    }
189
718
}
190
191
static_write_func_t<FrozenCounterSpec> StaticWriters::get(StaticFrozenCounterVariation variation)
192
1.04k
{
193
1.04k
    switch (variation)
194
1.04k
    {
195
401
    case (StaticFrozenCounterVariation::Group21Var1):
196
401
        return &WriteWithSerializer<FrozenCounterSpec, Group21Var1>;
197
130
    case (StaticFrozenCounterVariation::Group21Var2):
198
130
        return &WriteWithSerializer<FrozenCounterSpec, Group21Var2>;
199
160
    case (StaticFrozenCounterVariation::Group21Var5):
200
160
        return &WriteWithSerializer<FrozenCounterSpec, Group21Var5>;
201
138
    case (StaticFrozenCounterVariation::Group21Var6):
202
138
        return &WriteWithSerializer<FrozenCounterSpec, Group21Var6>;
203
97
    case (StaticFrozenCounterVariation::Group21Var9):
204
97
        return &WriteWithSerializer<FrozenCounterSpec, Group21Var9>;
205
115
    case (StaticFrozenCounterVariation::Group21Var10):
206
115
        return &WriteWithSerializer<FrozenCounterSpec, Group21Var10>;
207
0
    default:
208
0
        return &WriteWithSerializer<FrozenCounterSpec, Group21Var1>;
209
1.04k
    }
210
1.04k
}
211
212
static_write_func_t<BinaryOutputStatusSpec> StaticWriters::get(StaticBinaryOutputStatusVariation variation)
213
502
{
214
502
    switch (variation)
215
502
    {
216
502
    case (StaticBinaryOutputStatusVariation::Group10Var2):
217
502
        return &WriteWithSerializer<BinaryOutputStatusSpec, Group10Var2>;
218
0
    default:
219
0
        return &WriteWithSerializer<BinaryOutputStatusSpec, Group10Var2>;
220
502
    }
221
502
}
222
223
static_write_func_t<AnalogOutputStatusSpec> StaticWriters::get(StaticAnalogOutputStatusVariation variation)
224
763
{
225
763
    switch (variation)
226
763
    {
227
411
    case (StaticAnalogOutputStatusVariation::Group40Var1):
228
411
        return &WriteWithSerializer<AnalogOutputStatusSpec, Group40Var1>;
229
119
    case (StaticAnalogOutputStatusVariation::Group40Var2):
230
119
        return &WriteWithSerializer<AnalogOutputStatusSpec, Group40Var2>;
231
114
    case (StaticAnalogOutputStatusVariation::Group40Var3):
232
114
        return &WriteWithSerializer<AnalogOutputStatusSpec, Group40Var3>;
233
119
    case (StaticAnalogOutputStatusVariation::Group40Var4):
234
119
        return &WriteWithSerializer<AnalogOutputStatusSpec, Group40Var4>;
235
0
    default:
236
0
        return &WriteWithSerializer<AnalogOutputStatusSpec, Group40Var1>;
237
763
    }
238
763
}
239
240
bool write_octet_strings(StaticDataMap<OctetStringSpec>& map, HeaderWriter& writer);
241
242
static_write_func_t<OctetStringSpec> StaticWriters::get(StaticOctetStringVariation /*variation*/)
243
330
{
244
330
    return write_octet_strings;
245
330
}
246
247
static_write_func_t<TimeAndIntervalSpec> StaticWriters::get(StaticTimeAndIntervalVariation /*variation*/)
248
323
{
249
323
    return &WriteWithSerializer<TimeAndIntervalSpec, Group50Var4>;
250
323
}
251
252
template<class Writer> bool write_some_octet_strings(StaticDataMap<OctetStringSpec>& map, Writer& writer)
253
330
{
254
330
    bool first = true;
255
330
    uint8_t last_length = 0;
256
330
    uint16_t next_index = 0;
257
258
330
    for (const auto& elem : map)
259
2.04k
    {
260
261
2.04k
        if(!first) {
262
263
1.71k
            if(next_index != elem.first) {
264
                // discontiguous indices
265
63
                return true;
266
63
            }
267
268
1.65k
            if(last_length != elem.second.value.Size()) {
269
                // different lengths
270
0
                return true;
271
0
            }
272
1.65k
        }
273
274
1.98k
        first = false;
275
1.98k
        next_index = elem.first + 1;
276
1.98k
        last_length = elem.second.value.Size();
277
278
1.98k
        if (!writer.Write(elem.second.value))
279
0
        {
280
0
            return false;
281
0
        }
282
1.98k
    }
283
284
267
    return true;
285
330
}
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
330
{
254
330
    bool first = true;
255
330
    uint8_t last_length = 0;
256
330
    uint16_t next_index = 0;
257
258
330
    for (const auto& elem : map)
259
2.04k
    {
260
261
2.04k
        if(!first) {
262
263
1.71k
            if(next_index != elem.first) {
264
                // discontiguous indices
265
63
                return true;
266
63
            }
267
268
1.65k
            if(last_length != elem.second.value.Size()) {
269
                // different lengths
270
0
                return true;
271
0
            }
272
1.65k
        }
273
274
1.98k
        first = false;
275
1.98k
        next_index = elem.first + 1;
276
1.98k
        last_length = elem.second.value.Size();
277
278
1.98k
        if (!writer.Write(elem.second.value))
279
0
        {
280
0
            return false;
281
0
        }
282
1.98k
    }
283
284
267
    return true;
285
330
}
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
330
{
289
330
    const auto range = map.get_selected_range();
290
291
330
    const uint8_t starting_size = (*map.begin()).second.value.Size();
292
330
    const OctetStringSerializer serializer(false, starting_size);
293
294
330
    if (range.IsOneByte())
295
330
    {
296
330
        auto iter = writer.IterateOverRange<ser4cpp::UInt8>(QualifierCode::UINT8_START_STOP, serializer,
297
330
                                                            static_cast<uint8_t>(range.start));
298
330
        return write_some_octet_strings(map, iter);
299
330
    }
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
330
}
304
305
} // namespace opendnp3