1 // ANNA - Anna is Not Nothingness Anymore //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
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 //
9 #include <anna/comm/Message.hpp>
11 #include <anna/xml/Compiler.hpp>
15 comm::Message::Message() :
18 a_statusCodeBuffer(StatusCodeBuffer::None),
23 comm::Message::Message(const comm::Message::StatusCodeBuffer::_v statusCodeBuffer) :
26 a_statusCodeBuffer(statusCodeBuffer) {
27 if(statusCodeBuffer == StatusCodeBuffer::Reserve)
28 a_codeBuffer = new DataBlock(true);
34 comm::Message::Message(DataBlock& codeBuffer) :
37 a_statusCodeBuffer(StatusCodeBuffer::Copy) {
38 a_codeBuffer = &codeBuffer;
42 comm::Message::~Message() {
43 if(a_statusCodeBuffer == StatusCodeBuffer::Reserve)
50 * (1) Si NO tiene activado el indicador de copia profunda => tenemos que ubicar la memoria; que tiene que estar disponible
51 * hasta el momento en que se invoca al método de Message::code.
54 comm::Message * comm::Message::setBody(const xml::Node* node)
55 throw(RuntimeException) {
56 if(a_xmlCompiler == NULL)
57 a_xmlCompiler = new xml::Compiler;
59 const char* xmldoc = a_xmlCompiler->apply(node, xml::Compiler::Mode::Compact);
60 setBody(xmldoc, anna_strlen(xmldoc));