Coverage Report

Created: 2025-08-29 06:15

/src/opendnp3/cpp/lib/src/app/DNP3Serializer.h
Line
Count
Source
1
/*
2
 * Copyright 2013-2022 Step Function I/O, LLC
3
 *
4
 * Licensed to Green Energy Corp (www.greenenergycorp.com) and Step Function I/O
5
 * LLC (https://stepfunc.io) under one or more contributor license agreements.
6
 * See the NOTICE file distributed with this work for additional information
7
 * regarding copyright ownership. Green Energy Corp and Step Function I/O LLC license
8
 * this file to you under the Apache License, Version 2.0 (the "License"); you
9
 * may not use this file except in compliance with the License. You may obtain
10
 * a copy of the License at:
11
 *
12
 * http://www.apache.org/licenses/LICENSE-2.0
13
 *
14
 * Unless required by applicable law or agreed to in writing, software
15
 * distributed under the License is distributed on an "AS IS" BASIS,
16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
 * See the License for the specific language governing permissions and
18
 * limitations under the License.
19
 */
20
#ifndef OPENDNP3_DNP3SERIALIZER_H
21
#define OPENDNP3_DNP3SERIALIZER_H
22
23
#include "Serializer.h"
24
25
#include "opendnp3/app/GroupVariationID.h"
26
27
namespace opendnp3
28
{
29
30
template<class T> class DNP3Serializer : public Serializer<T>
31
{
32
public:
33
    DNP3Serializer(GroupVariationID id,
34
                   size_t size,
35
                   typename Serializer<T>::read_func_t read_func,
36
                   typename Serializer<T>::write_func_t write_func)
37
13.2k
        : Serializer<T>(size, read_func, write_func), id(id)
38
13.2k
    {
39
13.2k
    }
opendnp3::DNP3Serializer<opendnp3::ControlRelayOutputBlock>::DNP3Serializer(opendnp3::GroupVariationID, unsigned long, bool (*)(ser4cpp::RSeq<unsigned long>&, opendnp3::ControlRelayOutputBlock&), bool (*)(opendnp3::ControlRelayOutputBlock const&, ser4cpp::WSeq<unsigned long>&))
Line
Count
Source
37
1.26k
        : Serializer<T>(size, read_func, write_func), id(id)
38
1.26k
    {
39
1.26k
    }
opendnp3::DNP3Serializer<opendnp3::AnalogOutputInt16>::DNP3Serializer(opendnp3::GroupVariationID, unsigned long, bool (*)(ser4cpp::RSeq<unsigned long>&, opendnp3::AnalogOutputInt16&), bool (*)(opendnp3::AnalogOutputInt16 const&, ser4cpp::WSeq<unsigned long>&))
Line
Count
Source
37
1.66k
        : Serializer<T>(size, read_func, write_func), id(id)
38
1.66k
    {
39
1.66k
    }
opendnp3::DNP3Serializer<opendnp3::AnalogOutputInt32>::DNP3Serializer(opendnp3::GroupVariationID, unsigned long, bool (*)(ser4cpp::RSeq<unsigned long>&, opendnp3::AnalogOutputInt32&), bool (*)(opendnp3::AnalogOutputInt32 const&, ser4cpp::WSeq<unsigned long>&))
Line
Count
Source
37
1.48k
        : Serializer<T>(size, read_func, write_func), id(id)
38
1.48k
    {
39
1.48k
    }
opendnp3::DNP3Serializer<opendnp3::AnalogOutputFloat32>::DNP3Serializer(opendnp3::GroupVariationID, unsigned long, bool (*)(ser4cpp::RSeq<unsigned long>&, opendnp3::AnalogOutputFloat32&), bool (*)(opendnp3::AnalogOutputFloat32 const&, ser4cpp::WSeq<unsigned long>&))
Line
Count
Source
37
1.67k
        : Serializer<T>(size, read_func, write_func), id(id)
38
1.67k
    {
39
1.67k
    }
opendnp3::DNP3Serializer<opendnp3::AnalogOutputDouble64>::DNP3Serializer(opendnp3::GroupVariationID, unsigned long, bool (*)(ser4cpp::RSeq<unsigned long>&, opendnp3::AnalogOutputDouble64&), bool (*)(opendnp3::AnalogOutputDouble64 const&, ser4cpp::WSeq<unsigned long>&))
Line
Count
Source
37
1.84k
        : Serializer<T>(size, read_func, write_func), id(id)
38
1.84k
    {
39
1.84k
    }
opendnp3::DNP3Serializer<opendnp3::Binary>::DNP3Serializer(opendnp3::GroupVariationID, unsigned long, bool (*)(ser4cpp::RSeq<unsigned long>&, opendnp3::Binary&), bool (*)(opendnp3::Binary const&, ser4cpp::WSeq<unsigned long>&))
Line
Count
Source
37
540
        : Serializer<T>(size, read_func, write_func), id(id)
38
540
    {
39
540
    }
opendnp3::DNP3Serializer<opendnp3::DoubleBitBinary>::DNP3Serializer(opendnp3::GroupVariationID, unsigned long, bool (*)(ser4cpp::RSeq<unsigned long>&, opendnp3::DoubleBitBinary&), bool (*)(opendnp3::DoubleBitBinary const&, ser4cpp::WSeq<unsigned long>&))
Line
Count
Source
37
444
        : Serializer<T>(size, read_func, write_func), id(id)
38
444
    {
39
444
    }
opendnp3::DNP3Serializer<opendnp3::Analog>::DNP3Serializer(opendnp3::GroupVariationID, unsigned long, bool (*)(ser4cpp::RSeq<unsigned long>&, opendnp3::Analog&), bool (*)(opendnp3::Analog const&, ser4cpp::WSeq<unsigned long>&))
Line
Count
Source
37
952
        : Serializer<T>(size, read_func, write_func), id(id)
38
952
    {
39
952
    }
opendnp3::DNP3Serializer<opendnp3::Counter>::DNP3Serializer(opendnp3::GroupVariationID, unsigned long, bool (*)(ser4cpp::RSeq<unsigned long>&, opendnp3::Counter&), bool (*)(opendnp3::Counter const&, ser4cpp::WSeq<unsigned long>&))
Line
Count
Source
37
659
        : Serializer<T>(size, read_func, write_func), id(id)
38
659
    {
39
659
    }
opendnp3::DNP3Serializer<opendnp3::FrozenCounter>::DNP3Serializer(opendnp3::GroupVariationID, unsigned long, bool (*)(ser4cpp::RSeq<unsigned long>&, opendnp3::FrozenCounter&), bool (*)(opendnp3::FrozenCounter const&, ser4cpp::WSeq<unsigned long>&))
Line
Count
Source
37
931
        : Serializer<T>(size, read_func, write_func), id(id)
38
931
    {
39
931
    }
opendnp3::DNP3Serializer<opendnp3::BinaryOutputStatus>::DNP3Serializer(opendnp3::GroupVariationID, unsigned long, bool (*)(ser4cpp::RSeq<unsigned long>&, opendnp3::BinaryOutputStatus&), bool (*)(opendnp3::BinaryOutputStatus const&, ser4cpp::WSeq<unsigned long>&))
Line
Count
Source
37
445
        : Serializer<T>(size, read_func, write_func), id(id)
38
445
    {
39
445
    }
opendnp3::DNP3Serializer<opendnp3::AnalogOutputStatus>::DNP3Serializer(opendnp3::GroupVariationID, unsigned long, bool (*)(ser4cpp::RSeq<unsigned long>&, opendnp3::AnalogOutputStatus&), bool (*)(opendnp3::AnalogOutputStatus const&, ser4cpp::WSeq<unsigned long>&))
Line
Count
Source
37
732
        : Serializer<T>(size, read_func, write_func), id(id)
38
732
    {
39
732
    }
opendnp3::DNP3Serializer<opendnp3::TimeAndInterval>::DNP3Serializer(opendnp3::GroupVariationID, unsigned long, bool (*)(ser4cpp::RSeq<unsigned long>&, opendnp3::TimeAndInterval&), bool (*)(opendnp3::TimeAndInterval const&, ser4cpp::WSeq<unsigned long>&))
Line
Count
Source
37
292
        : Serializer<T>(size, read_func, write_func), id(id)
38
292
    {
39
292
    }
opendnp3::DNP3Serializer<opendnp3::OctetString>::DNP3Serializer(opendnp3::GroupVariationID, unsigned long, bool (*)(ser4cpp::RSeq<unsigned long>&, opendnp3::OctetString&), bool (*)(opendnp3::OctetString const&, ser4cpp::WSeq<unsigned long>&))
Line
Count
Source
37
305
        : Serializer<T>(size, read_func, write_func), id(id)
38
305
    {
39
305
    }
40
41
    GroupVariationID ID() const
42
10.4k
    {
43
10.4k
        return id;
44
10.4k
    }
opendnp3::DNP3Serializer<opendnp3::ControlRelayOutputBlock>::ID() const
Line
Count
Source
42
758
    {
43
758
        return id;
44
758
    }
opendnp3::DNP3Serializer<opendnp3::AnalogOutputInt16>::ID() const
Line
Count
Source
42
1.05k
    {
43
1.05k
        return id;
44
1.05k
    }
opendnp3::DNP3Serializer<opendnp3::AnalogOutputInt32>::ID() const
Line
Count
Source
42
1.02k
    {
43
1.02k
        return id;
44
1.02k
    }
opendnp3::DNP3Serializer<opendnp3::AnalogOutputFloat32>::ID() const
Line
Count
Source
42
1.11k
    {
43
1.11k
        return id;
44
1.11k
    }
opendnp3::DNP3Serializer<opendnp3::AnalogOutputDouble64>::ID() const
Line
Count
Source
42
1.20k
    {
43
1.20k
        return id;
44
1.20k
    }
opendnp3::DNP3Serializer<opendnp3::Binary>::ID() const
Line
Count
Source
42
540
    {
43
540
        return id;
44
540
    }
opendnp3::DNP3Serializer<opendnp3::DoubleBitBinary>::ID() const
Line
Count
Source
42
444
    {
43
444
        return id;
44
444
    }
opendnp3::DNP3Serializer<opendnp3::Analog>::ID() const
Line
Count
Source
42
952
    {
43
952
        return id;
44
952
    }
opendnp3::DNP3Serializer<opendnp3::Counter>::ID() const
Line
Count
Source
42
659
    {
43
659
        return id;
44
659
    }
opendnp3::DNP3Serializer<opendnp3::FrozenCounter>::ID() const
Line
Count
Source
42
931
    {
43
931
        return id;
44
931
    }
opendnp3::DNP3Serializer<opendnp3::BinaryOutputStatus>::ID() const
Line
Count
Source
42
445
    {
43
445
        return id;
44
445
    }
opendnp3::DNP3Serializer<opendnp3::AnalogOutputStatus>::ID() const
Line
Count
Source
42
732
    {
43
732
        return id;
44
732
    }
opendnp3::DNP3Serializer<opendnp3::TimeAndInterval>::ID() const
Line
Count
Source
42
292
    {
43
292
        return id;
44
292
    }
opendnp3::DNP3Serializer<opendnp3::OctetString>::ID() const
Line
Count
Source
42
305
    {
43
305
        return id;
44
305
    }
45
46
private:
47
    GroupVariationID id;
48
};
49
50
} // namespace opendnp3
51
52
#endif