aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/message_ptr_and_header.h
blob: a28ec7b08bbd3f2efbe17cf5cd40d69f468db5bc (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);
            }
        };
 
    }
}