ANNA Suite  2020b
Multipurpose development suite for Telco applications
Message.hpp
Go to the documentation of this file.
1 // ANNA - Anna is Not Nothingness Anymore //
2 // //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
4 // //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
7 
8 
9 #ifndef anna_comm_Message_hpp
10 #define anna_comm_Message_hpp
11 
12 #include <anna/core/DataBlock.hpp>
13 
14 namespace anna {
15 
16 namespace xml {
17 class Compiler;
18 class Node;
19 }
20 
21 namespace comm {
22 
26 class Message : public DataBlock {
27 public:
31  Message();
32 
36  virtual ~Message();
37 
42  const DataBlock& getBody() const { return *this; }
43 
51  Message * setBody(const DataBlock& body) noexcept(false) { assign(body); return this; }
52 
61  Message * setBody(const char* buffer, const int size) noexcept(false) {
62  DataBlock aux(buffer, size, false);
63  assign(aux);
64  return this;
65  }
66 
72  virtual Message * setBody(const xml::Node* node) noexcept(false);
73 
77  void clearBody() { clear(); }
78 
84  virtual const DataBlock& code() noexcept(false) { return *this; }
85 
86 protected:
87  struct StatusCodeBuffer { enum _v { None, Reserve, Copy }; };
88 
90 
96  explicit Message(const StatusCodeBuffer::_v statusCodeBuffer);
97 
103  explicit Message(DataBlock& codeBuffer);
104 
105 private:
106  const StatusCodeBuffer::_v a_statusCodeBuffer;
107  xml::Compiler* a_xmlCompiler;
108 
109  Message(const Message&);
110  Message& operator = (const Message&);
111 };
112 
113 }
114 }
115 
116 #endif
117 
118 
Definition: Compiler.hpp:28
DataBlock * a_codeBuffer
Definition: Message.hpp:89
const DataBlock & getBody() const
Definition: Message.hpp:42
_v
Definition: Message.hpp:87
void clearBody()
Definition: Message.hpp:77
Definition: Node.hpp:56
Definition: Message.hpp:26
virtual const DataBlock & code() noexcept(false)
Definition: Message.hpp:84
xml::Node Node
Definition: Node.hpp:21
Message * setBody(const DataBlock &body) noexcept(false)
Definition: Message.hpp:51
Message * setBody(const char *buffer, const int size) noexcept(false)
Definition: Message.hpp:61
Definition: app.hpp:12
xml::Compiler Compiler
Definition: Compiler.hpp:21
Definition: Message.hpp:87
Definition: DataBlock.hpp:24