xrootd
Loading...
Searching...
No Matches
XrdClMessage.hh
Go to the documentation of this file.
1//------------------------------------------------------------------------------
2// Copyright (c) 2011-2012 by European Organization for Nuclear Research (CERN)
3// Author: Lukasz Janyst <ljanyst@cern.ch>
4//------------------------------------------------------------------------------
5// XRootD is free software: you can redistribute it and/or modify
6// it under the terms of the GNU Lesser General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// XRootD is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with XRootD. If not, see <http://www.gnu.org/licenses/>.
17//------------------------------------------------------------------------------
18
19#ifndef __XRD_CL_MESSAGE_HH__
20#define __XRD_CL_MESSAGE_HH__
21
22#include "XrdCl/XrdClBuffer.hh"
23
24namespace XrdCl
25{
26 //----------------------------------------------------------------------------
28 //----------------------------------------------------------------------------
29 class Message: public Buffer
30 {
31 public:
32 //------------------------------------------------------------------------
34 //------------------------------------------------------------------------
35 Message( uint32_t size = 0 ):
36 Buffer( size ), pIsMarshalled( false ), pSessionId(0), pVirtReqID( 0 )
37 {
38 if( size )
39 Zero();
40 }
41
42 //------------------------------------------------------------------------
44 //------------------------------------------------------------------------
45 Message( Message && msg ):
46 Buffer( std::move( msg ) ), pIsMarshalled( msg.pIsMarshalled ),
47 pSessionId( std::move( msg.pSessionId ) ), pVirtReqID( msg.pVirtReqID )
48 {
49 }
50
51 //------------------------------------------------------------------------
53 //------------------------------------------------------------------------
55 {
56 Steal( std::move( msg ) );
57 pIsMarshalled = msg.pIsMarshalled;
58 pSessionId = std::move( msg.pSessionId );
59 pVirtReqID = msg.pVirtReqID;
60 return *this;
61 }
62
63 //------------------------------------------------------------------------
65 //------------------------------------------------------------------------
66 virtual ~Message() {}
67
68 //------------------------------------------------------------------------
70 //------------------------------------------------------------------------
71 bool IsMarshalled() const
72 {
73 return pIsMarshalled;
74 }
75
76 //------------------------------------------------------------------------
78 //------------------------------------------------------------------------
79 void SetIsMarshalled( bool isMarshalled )
80 {
81 pIsMarshalled = isMarshalled;
82 }
83
84 //------------------------------------------------------------------------
86 //------------------------------------------------------------------------
87 void SetDescription( const std::string &description )
88 {
89 pDescription = description;
90 }
91
92 //------------------------------------------------------------------------
94 //------------------------------------------------------------------------
95 const std::string &GetDescription() const
96 {
97 return pDescription;
98 }
99
100 //------------------------------------------------------------------------
102 //------------------------------------------------------------------------
103 void SetSessionId( uint64_t sessionId )
104 {
105 pSessionId = sessionId;
106 }
107
108 //------------------------------------------------------------------------
110 //------------------------------------------------------------------------
111 uint64_t GetSessionId() const
112 {
113 return pSessionId;
114 }
115
116 //------------------------------------------------------------------------
118 //------------------------------------------------------------------------
119 void SetVirtReqID( uint16_t virtReqID )
120 {
121 pVirtReqID = virtReqID;
122 }
123
124 //------------------------------------------------------------------------
126 //------------------------------------------------------------------------
127 uint16_t GetVirtReqID() const
128 {
129 return pVirtReqID;
130 }
131
132 private:
134 uint64_t pSessionId;
135 std::string pDescription;
136 uint16_t pVirtReqID;
137 };
138}
139
140#endif // __XRD_CL_MESSAGE_HH__
Binary blob representation.
Definition XrdClBuffer.hh:34
void Steal(Buffer &&buffer)
Definition XrdClBuffer.hh:249
void Zero()
Zero.
Definition XrdClBuffer.hh:124
The message representation used throughout the system.
Definition XrdClMessage.hh:30
std::string pDescription
Definition XrdClMessage.hh:135
virtual ~Message()
Destructor.
Definition XrdClMessage.hh:66
uint64_t pSessionId
Definition XrdClMessage.hh:134
void SetDescription(const std::string &description)
Set the description of the message.
Definition XrdClMessage.hh:87
void SetSessionId(uint64_t sessionId)
Set the session ID which this message is meant for.
Definition XrdClMessage.hh:103
void SetVirtReqID(uint16_t virtReqID)
Set virtual request ID for the message.
Definition XrdClMessage.hh:119
bool pIsMarshalled
Definition XrdClMessage.hh:133
void SetIsMarshalled(bool isMarshalled)
Set the marshalling status.
Definition XrdClMessage.hh:79
bool IsMarshalled() const
Check if the message is marshalled.
Definition XrdClMessage.hh:71
const std::string & GetDescription() const
Get the description of the message.
Definition XrdClMessage.hh:95
uint16_t GetVirtReqID() const
Get virtual request ID for the message.
Definition XrdClMessage.hh:127
Message(Message &&msg)
Move Constructor.
Definition XrdClMessage.hh:45
Message & operator=(Message &&msg)
Move assignment operator.
Definition XrdClMessage.hh:54
uint16_t pVirtReqID
Definition XrdClMessage.hh:136
Message(uint32_t size=0)
Constructor.
Definition XrdClMessage.hh:35
uint64_t GetSessionId() const
Get the session ID the message is meant for.
Definition XrdClMessage.hh:111
Definition XrdClAction.hh:34
Definition XrdOucJson.hh:4517