aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/message_ptr_and_header.h
blob: 9b4e2fd2707a681c08a3b6c76e33065eddd6565e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#pragma once

#include "message.h"
#include "nondestroying_holder.h"

#include <util/generic/noncopyable.h>
#include <util/generic/utility.h>

namespace NBus {
    namespace NPrivate {
        struct TBusMessagePtrAndHeader : TNonCopyable {
            TNonDestroyingHolder<TBusMessage> MessagePtr;
            TBusHeader Header;
            ui32 LocalFlags;

            TBusMessagePtrAndHeader()
                : LocalFlags()
            {
            }

            explicit TBusMessagePtrAndHeader(TBusMessage* messagePtr)
                : MessagePtr(messagePtr)
                , Header(*MessagePtr->GetHeader())
                , LocalFlags(MessagePtr->LocalFlags)
            {
            }

            void Swap(TBusMessagePtrAndHeader& that) {
                DoSwap(MessagePtr, that.MessagePtr);
                DoSwap(Header, that.Header);
                DoSwap(LocalFlags, that.LocalFlags);
            }
        };

    }
}