Coverage Report

Created: 2025-06-13 06:46

/src/Fast-CDR/include/fastcdr/xcdr/MemberId.hpp
Line
Count
Source (jump to first uncovered line)
1
// Copyright 2023 Proyectos y Sistemas de Mantenimiento SL (eProsima).
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//     http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
//
15
#ifndef _FASTCDR_XCDR_MEMBERID_HPP_
16
#define _FASTCDR_XCDR_MEMBERID_HPP_
17
18
#include <cstdint>
19
20
#include "../fastcdr_dll.h"
21
22
namespace eprosima {
23
namespace fastcdr {
24
25
class Cdr;
26
27
class Cdr_DllAPI MemberId
28
{
29
public:
30
31
0
    MemberId() = default;
32
33
    MemberId(
34
            uint32_t id_value)
35
0
        : id(id_value)
36
0
    {
37
0
    }
38
39
    bool operator ==(
40
            uint32_t id_value) const
41
0
    {
42
0
        return id == id_value;
43
0
    }
44
45
    bool operator ==(
46
            const MemberId member_id) const
47
0
    {
48
0
        return id == member_id.id;
49
0
    }
50
51
    bool operator !=(
52
            const MemberId member_id) const
53
0
    {
54
0
        return !(member_id == *this);
55
0
    }
56
57
    uint32_t id { member_id_invalid_value_ };
58
59
    bool must_understand { false };
60
61
private:
62
63
    static constexpr uint32_t member_id_invalid_value_ = 0xFFFFFFFF;
64
65
};
66
67
static const MemberId MEMBER_ID_INVALID {};
68
69
} // namespace fastcdr
70
} // namespace eprosima
71
72
#endif //_FASTCDR_XCDR_MEMBERID_HPP_