WsmanEPR: add assignment operator
Implement assignment operator explicitly because
deep copy of epr data is required.
The default implementation of the assignment operator
provides only a shallow copy of the object.
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
diff --git a/src/cpp/WsmanEPR.cpp b/src/cpp/WsmanEPR.cpp
index 352e414..7579794 100644
--- a/src/cpp/WsmanEPR.cpp
+++ b/src/cpp/WsmanEPR.cpp
@@ -29,6 +29,12 @@
{
}
+WsmanEPR& WsmanEPR::operator=(const WsmanEPR &other)
+{
+ epr = epr_copy(other.getepr());
+ return *this;
+}
+
WsmanEPR::~WsmanEPR()
{
if (epr) {
diff --git a/src/cpp/WsmanEPR.h b/src/cpp/WsmanEPR.h
index e97f5b8..9e33040 100644
--- a/src/cpp/WsmanEPR.h
+++ b/src/cpp/WsmanEPR.h
@@ -16,6 +16,7 @@
WsmanEPR(const string &eprstring);
WsmanEPR(const string &uri, const string &address);
WsmanEPR(WsmanEPR &epr);
+ WsmanEPR& operator=(const WsmanEPR &other);
~WsmanEPR();
int addTextSelector(const string &name, const string &value);