diff --git a/include/Attribute.h b/include/Attribute.h index 47438322d0..7884b86420 100644 --- a/include/Attribute.h +++ b/include/Attribute.h @@ -70,11 +70,10 @@ public: }; /** - * Marshall the attribute in a single string. The string MUST be freed - * by the calling function. - * @return a string (allocated in the heap) holding the attribute value. + * Marshall the attribute in a single string. + * @return a string holding the attribute value. */ - virtual std::string * marshall(const char * _sep = 0) const = 0; + virtual std::string marshall(const char * _sep = 0) const = 0; /** * Write the attribute using a simple XML format. The string MUST be freed @@ -153,17 +152,12 @@ public: }; /** - * Marshall the attribute in a single string. The string MUST be freed - * by the calling function. - * @return a string (allocated in the heap) holding the attribute value. + * Marshall the attribute in a single string. + * @return a string holding the attribute value. */ - std::string * marshall(const char * _sep = 0) const override + std::string marshall(const char * _sep = 0) const override { - auto rs = new std::string; - - *rs = attribute_value; - - return rs; + return attribute_value; }; /** @@ -391,7 +385,7 @@ public: * "VAL_NAME_1=VAL_VALUE_1,...,VAL_NAME_N=VAL_VALUE_N". * @return a string (allocated in the heap) holding the attribute value. */ - std::string * marshall(const char * _sep = 0) const override; + std::string marshall(const char * _sep = 0) const override; /** * Write the attribute using a simple XML format: diff --git a/include/Cluster.h b/include/Cluster.h index 128884ab27..4abbeca745 100644 --- a/include/Cluster.h +++ b/include/Cluster.h @@ -138,7 +138,8 @@ private: // ************************************************************************* // Constructor // ************************************************************************* - Cluster(int id, const std::string& name, ClusterTemplate* cl_template, + Cluster(int id, const std::string& name, + std::unique_ptr cl_template, const VectorAttribute& vnc_conf); // ************************************************************************* @@ -256,9 +257,9 @@ private: /** * Factory method for cluster templates */ - Template * get_new_template() const override + std::unique_ptr