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

    } 
}