From 0657bfa159a5e64c40768d60237849aee8b18cec Mon Sep 17 00:00:00 2001
From: ziemke <ziemke@astron.nl>
Date: Thu, 28 Mar 2019 15:09:14 +0000
Subject: [PATCH] Task #2926: Removed print statements. Code cleanup.

---
 LCS/WinCCWrapper/src/WinCCManager.cc | 43 +++++-----------------------
 1 file changed, 7 insertions(+), 36 deletions(-)

diff --git a/LCS/WinCCWrapper/src/WinCCManager.cc b/LCS/WinCCWrapper/src/WinCCManager.cc
index d806858c4e2..1ac9724a125 100644
--- a/LCS/WinCCWrapper/src/WinCCManager.cc
+++ b/LCS/WinCCWrapper/src/WinCCManager.cc
@@ -611,24 +611,19 @@ bool WinCCManager::set_datapoint_validity(const std::string &name, bool validity
         }
 
         // get VariableType from DpIdentifier
+
+        //   assign values
+        VariableType dpId_VariableType;
         DpElementType dpId_ElementType;
+
         DpIdentification temp_dpId;  // make a temp dpId to use the 'getElementType' method
         DpIdentificationResult dir = temp_dpId.getElementType(dpId, dpId_ElementType);
 
-        VariableType dpId_VariableType;
-        std::cout << "Garbage dpIdVarType is " << dpId_VariableType << '\n';
-        VariableType value_VariableType;
-        std::cout << "Garbage valueVarType is " << value_VariableType << '\n';
-
+        //   check that the dpIdResult is OK
         if(DpIdentificationResult::DpIdentOK == dir) {
-            std::cout << "IdResult is OK\n";
             dpId_VariableType = DpElement::getVariableType(dpId_ElementType);
-            std::cout << "(unassigned) DpVariableType is " << DpElement::getVariableType(dpId_ElementType)<< '\n';
-            value_VariableType = value->isA();
         }
-
         else {
-            std::cout << "DpIdentification.getElementType() failed\n";
             return false;
         }
 
@@ -636,41 +631,18 @@ bool WinCCManager::set_datapoint_validity(const std::string &name, bool validity
         // if not, convert value to the appropriate datapoint type
         if (value->isA() != dpId_VariableType){
 
-            std::cout << "Given value VariableType does not match dpId VariableType. Converting...\n";
-            std::cout << "value VariableType is " << value_VariableType << '\n';
-            std::cout << "dpId VariableType is " << dpId_VariableType << '\n';
-
-            // TODO: Fix this...
             VariablePtr converted_var = NULL;
-            //Variable::ConvertResult cr = convert(value, value->getValue(), converted_var);
-            std::cout << "value isA before: " << value->isA() << '\n';
             Variable::ConvertResult cr = value->convert(dpId_VariableType, converted_var);
-            std::cout << "value isA after: " << value->isA() << '\n';
 
             // if conversion succeeds, send the converted var
             if(Variable::ConvertResult::OK == cr) {
-                std::cout << "Given value has been successfully converted\n";
                 DrvManager *drvman = DrvManager::getSelfPtr();
                 drvman ->sendVCMsg(dpId, converted_var!=NULL ? *converted_var : *last_known_value, now, infoBits);
                 delete converted_var;  //delete it, since it was a newly created variable in var->convert
             }
-            // 'Out of range' error in converting
-            else if(Variable::ConvertResult::OUT_OF_RANGE == cr) {
-                std::cout << "Given value was not successfully converted (OOR)\n";
-                delete converted_var;  //delete it, since it was a newly created variable in var->convert
-                return false;
-            }
-            // 'Conversion not defined' error in converting
-            else if(Variable::ConvertResult::CONV_NOT_DEFINED == cr) {
-                // NOTE: This is what is failing in all cases.
-                std::cout << "Given value was not successfully converted\n";
-                std::cout << "Conv not def for val-type " << value->isA() << " and dp-type " << dpId_VariableType << "\n";
-                delete converted_var;  //delete it, since it was a newly created variable in var->convert
-                return false;
-            }
-            // Unknown error in converting (should never occur).
+
+            // Either 'out_of_bounds' error or 'conv_not_defined' error in converting
             else {
-                std::cout << "Given value was not successfully converted (UNKNOWN)\n";
                 delete converted_var;  //delete it, since it was a newly created variable in var->convert
                 return false;
             }
@@ -678,7 +650,6 @@ bool WinCCManager::set_datapoint_validity(const std::string &name, bool validity
 
         // no need for conversion
         else {
-            std::cout << "Given value VariableType matches dpId VariableType\n";
             DrvManager *drvman = DrvManager::getSelfPtr();
             drvman ->sendVCMsg(dpId, value!=NULL ? *value : *last_known_value, now, infoBits);
         }
-- 
GitLab