xrootd
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 
24 namespace 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)
37  {
38  if( size )
39  Zero();
40  }
41 
42  //------------------------------------------------------------------------
44  //------------------------------------------------------------------------
45  virtual ~Message() {}
46 
47  //------------------------------------------------------------------------
49  //------------------------------------------------------------------------
50  bool IsMarshalled() const
51  {
52  return pIsMarshalled;
53  }
54 
55  //------------------------------------------------------------------------
57  //------------------------------------------------------------------------
58  void SetIsMarshalled( bool isMarshalled )
59  {
60  pIsMarshalled = isMarshalled;
61  }
62 
63  //------------------------------------------------------------------------
65  //------------------------------------------------------------------------
66  void SetDescription( const std::string &description )
67  {
68  pDescription = description;
69  }
70 
71  //------------------------------------------------------------------------
73  //------------------------------------------------------------------------
74  const std::string &GetDescription() const
75  {
76  return pDescription;
77  }
78 
79  //------------------------------------------------------------------------
81  //------------------------------------------------------------------------
82  void SetSessionId( uint64_t sessionId )
83  {
84  pSessionId = sessionId;
85  }
86 
87  //------------------------------------------------------------------------
89  //------------------------------------------------------------------------
90  uint64_t GetSessionId() const
91  {
92  return pSessionId;
93  }
94 
95  private:
97  uint64_t pSessionId;
98  std::string pDescription;
99  };
100 }
101 
102 #endif // __XRD_CL_MESSAGE_HH__
const std::string & GetDescription() const
Get the description of the message.
Definition: XrdClMessage.hh:74
void SetDescription(const std::string &description)
Set the description of the message.
Definition: XrdClMessage.hh:66
void SetIsMarshalled(bool isMarshalled)
Set the marshalling status.
Definition: XrdClMessage.hh:58
The message representation used throughout the system.
Definition: XrdClMessage.hh:29
uint64_t GetSessionId() const
Get the session ID the message is meant for.
Definition: XrdClMessage.hh:90
virtual ~Message()
Destructor.
Definition: XrdClMessage.hh:45
uint64_t pSessionId
Definition: XrdClMessage.hh:97
std::string pDescription
Definition: XrdClMessage.hh:98
bool IsMarshalled() const
Check if the message is marshalled.
Definition: XrdClMessage.hh:50
void SetSessionId(uint64_t sessionId)
Set the session ID which this message is meant for.
Definition: XrdClMessage.hh:82
void Zero()
Zero.
Definition: XrdClBuffer.hh:107
bool pIsMarshalled
Definition: XrdClMessage.hh:96
Binary blob representation.
Definition: XrdClBuffer.hh:33
Message(uint32_t size=0)
Constructor.
Definition: XrdClMessage.hh:35