You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@etch.apache.org by fi...@apache.org on 2012/06/01 13:16:14 UTC

svn commit: r1345056 - in /incubator/etch/trunk/binding-cpp/runtime: include/common/ include/serialization/ src/main/ src/main/serialization/ src/test/ src/test/serialization/

Author: fitzner
Date: Fri Jun  1 11:16:14 2012
New Revision: 1345056

URL: http://svn.apache.org/viewvc?rev=1345056&view=rev
Log:
ETCH-185 Implementation Validators

Short Validator has been implemented

Change-Id: Ic019f99ca254fafcf5cea2c81247fb556958fa7f

Added:
    incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorShort.h
    incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorShort.cpp
    incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorShortTest.cpp
Modified:
    incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObjectType.h
    incubator/etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt
    incubator/etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt

Modified: incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObjectType.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObjectType.h?rev=1345056&r1=1345055&r2=1345056&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObjectType.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObjectType.h Fri Jun  1 11:16:14 2012
@@ -42,6 +42,7 @@ enum EtchObjectTypeIds {
   EOTID_VALIDATOR_BOOLEAN,
   EOTID_VALIDATOR_BYTE,
   EOTID_VALIDATOR_INT,
+  EOTID_VALIDATOR_SHORT,
 
   EOTID_NATIVE_INT8,
   EOTID_NATIVE_INT16,

Added: incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorShort.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorShort.h?rev=1345056&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorShort.h (added)
+++ incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorShort.h Fri Jun  1 11:16:14 2012
@@ -0,0 +1,69 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __ETCHVALIDATORSHORT_H__
+#define __ETCHVALIDATORSHORT_H__
+
+#include "serialization/EtchTypeValidator.h"
+#include "common/EtchByte.h"
+#include "common/EtchShort.h"
+#include "common/EtchInt32.h"
+#include "common/EtchLong.h"
+#include "serialization/EtchTypeCodes.h"
+#include "common/EtchNativeArray.h"
+#include "capu/os/NumericLimits.h"
+
+class EtchValidatorShort : public EtchTypeValidator {
+public:
+
+  virtual ~EtchValidatorShort();
+
+  /**
+   * @see EtchValidator
+   */
+  virtual status_t getElementValidator(capu::SmartPointer<EtchValidator> &val);
+
+  /**
+   * @see EtchValidator
+   */
+  virtual capu::bool_t validate(EtchObject* value);
+
+  /**
+   * @see EtchValidator
+   */
+  virtual status_t validateValue(EtchObject* value, EtchObject*& result);
+
+  /**
+   * @see EtchValidator
+   */
+  static status_t Get(capu::uint32_t ndim, capu::SmartPointer<EtchValidator> &val);
+
+  static const EtchObjectType TYPE;
+
+protected:
+
+  EtchValidatorShort(capu::uint32_t ndim);
+
+private:
+
+  static capu::SmartPointer<EtchValidator> mValidator[MAX_CACHED];
+
+};
+
+#endif /* ETCHVALIDATORSHORT_H */
+

Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt?rev=1345056&r1=1345055&r2=1345056&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt Fri Jun  1 11:16:14 2012
@@ -67,6 +67,7 @@ SET(MAIN_INCLUDES
     ${PROJECT_SOURCE_DIR}/include/serialization/EtchValidatorBoolean.h
     ${PROJECT_SOURCE_DIR}/include/serialization/EtchValidatorByte.h
     ${PROJECT_SOURCE_DIR}/include/serialization/EtchValidatorInt.h
+    ${PROJECT_SOURCE_DIR}/include/serialization/EtchValidatorShort.h
     ${PROJECT_SOURCE_DIR}/include/util/EtchUtil.h
     )
 
@@ -96,6 +97,7 @@ SET(MAIN_SOURCES
     serialization/EtchValidatorBoolean.cpp
     serialization/EtchValidatorByte.cpp
     serialization/EtchValidatorInt.cpp
+    serialization/EtchValidatorShort.cpp
     util/EtchUtil.cpp
     )
 

Added: incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorShort.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorShort.cpp?rev=1345056&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorShort.cpp (added)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorShort.cpp Fri Jun  1 11:16:14 2012
@@ -0,0 +1,123 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "serialization/EtchValidatorShort.h"
+
+capu::SmartPointer<EtchValidator> EtchValidatorShort::mValidator[MAX_CACHED];
+const EtchObjectType EtchValidatorShort::TYPE(EOTID_VALIDATOR_SHORT, NULL);
+
+EtchValidatorShort::EtchValidatorShort(capu::uint32_t ndim)
+: EtchTypeValidator(&EtchValidatorShort::TYPE, &EtchShort::TYPE, &EtchShort::TYPE, ndim) {
+
+}
+
+EtchValidatorShort::~EtchValidatorShort() {
+
+}
+
+capu::bool_t EtchValidatorShort::validate(EtchObject* value) {
+  if (value == NULL)
+    return false;
+
+  if (mExpectedType == NULL)
+    return false;
+
+  if (value->getObjectType()->equals(mExpectedType))
+    return true;
+
+  if ((value->getObjectType()->equals(&EtchShort::TYPE)) ||
+          (value->getObjectType()->equals(&EtchByte::TYPE)))
+    return true;
+
+  if (value->getObjectType()->equals(&EtchInt32::TYPE)) {
+    EtchInt32 *v = (EtchInt32 *) value;
+    return ((v->get() >= capu::NumericLimitMin<capu::int16_t > ()) && (v->get() <= capu::NumericLimitMax<capu::int16_t > ()));
+  }
+
+  if (value->getObjectType()->equals(&EtchLong::TYPE)) {
+    EtchLong *v = (EtchLong *) value;
+    return ((v->get() >= capu::NumericLimitMin<capu::int16_t > ()) && (v->get() <= capu::NumericLimitMax<capu::int16_t > ()));
+  }
+
+  if ((value->getObjectType()->isArray()) && (mExpectedType->isArray())) {
+
+    EtchNativeArray<EtchObject*> *array = (EtchNativeArray<EtchObject*> *) value;
+    const EtchObjectType* type = array->getContentType();
+    const EtchObjectType* type2 = mExpectedType->getObjectComponentType();
+    while ((type->getObjectComponentType() != NULL) && (mExpectedType->getObjectComponentType() != NULL)) {
+      type = type->getObjectComponentType();
+      type2 = type2->getObjectComponentType();
+    }
+
+    //both of them should be pointing null
+    if (type->getObjectComponentType() != type2->getObjectComponentType()) {
+      return false;
+    }
+    return type->equals(type2);
+  }
+  return false;
+}
+
+status_t EtchValidatorShort::validateValue(EtchObject* value, EtchObject*& result) {
+  if (validate(value)) {
+    if ((value->getObjectType()->equals(&EtchShort::TYPE)) || (mNDims > 0)) {
+      result = value;
+      return ETCH_OK;
+    } else {
+      if (value->getObjectType()->equals(&EtchInt32::TYPE)) {
+        EtchInt32 *v = (EtchInt32 *) value;
+        result = (EtchObject*) (new EtchShort((capu::int16_t)v->get()));
+        return ETCH_OK;
+      }
+
+      if (value->getObjectType()->equals(&EtchByte::TYPE)) {
+        EtchByte *v = (EtchByte *) value;
+        result = (EtchObject*) (new EtchShort((capu::int16_t)v->get()));
+        return ETCH_OK;
+      }
+
+      if (value->getObjectType()->equals(&EtchLong::TYPE)) {
+        EtchLong *v = (EtchLong *) value;
+        result = (EtchObject*) (new EtchShort((capu::int16_t)v->get()));
+        return ETCH_OK;
+      }
+      return ETCH_ERROR;
+    }
+  } else {
+    return ETCH_ERROR;
+  }
+}
+
+status_t EtchValidatorShort::Get(capu::uint32_t ndim, capu::SmartPointer<EtchValidator> &val) {
+  if (ndim > MAX_NDIMS) {
+    return ETCH_EINVAL;
+  }
+  if (ndim >= MAX_CACHED) {
+    val = new EtchValidatorShort(ndim);
+    return ETCH_OK;
+  }
+  if (mValidator[ndim].get() == NULL) {
+    mValidator[ndim] = new EtchValidatorShort(ndim);
+  }
+  val = mValidator[ndim];
+  return ETCH_OK;
+}
+
+status_t EtchValidatorShort::getElementValidator(capu::SmartPointer<EtchValidator> &val) {
+  return EtchValidatorShort::Get(mNDims - 1, val);
+}
\ No newline at end of file

Modified: incubator/etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt?rev=1345056&r1=1345055&r2=1345056&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt Fri Jun  1 11:16:14 2012
@@ -51,6 +51,7 @@ add_executable (etch-cpp-test
     serialization/EtchValidatorBooleanTest.cpp
     serialization/EtchValidatorByteTest.cpp
     serialization/EtchValidatorIntTest.cpp
+    serialization/EtchValidatorShortTest.cpp
     util/EtchUtilTest.cpp
     ${GTEST}/src/gtest-all.cc
     ${GMOCK}/src/gmock-all.cc

Added: incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorShortTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorShortTest.cpp?rev=1345056&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorShortTest.cpp (added)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorShortTest.cpp Fri Jun  1 11:16:14 2012
@@ -0,0 +1,224 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <gtest/gtest.h>
+#include "serialization/EtchValidatorShort.h"
+#include "capu/util/SmartPointer.h"
+#include "common/EtchString.h"
+
+TEST(EtchValidatorShortTest, createTest) {
+  capu::SmartPointer<EtchValidatorShort> ptr = NULL;
+  capu::SmartPointer<EtchValidator> val;
+  EXPECT_TRUE(EtchValidatorShort::Get(0, val) == ETCH_OK);
+  ptr = capu::smartpointer_cast<EtchValidatorShort>(val);
+  EXPECT_TRUE(ptr->getExpectedType()->equals(&EtchShort::TYPE));
+  EXPECT_TRUE(ptr->getNDims() == 0);
+
+  EtchObjectType type1(EOTID_SHORT, NULL);
+  EtchObjectType type2(EOTID_NATIVE_ARRAY, &type1);
+  EtchObjectType type3(EOTID_NATIVE_ARRAY, &type2);
+  EXPECT_TRUE(EtchValidatorShort::Get(2, val) == ETCH_OK);
+  ptr = capu::smartpointer_cast<EtchValidatorShort>(val);
+  EXPECT_TRUE(ptr->getExpectedType()->equals(&type3));
+  EXPECT_TRUE(ptr->getNDims() == 2);
+}
+
+TEST(EtchValidatorShortTest, validateTest) {
+  EtchObject* byte = NULL;
+
+  EtchObject* integer = new EtchInt32(capu::NumericLimitMin<capu::int16_t>());
+  EtchObject* integer2 = new EtchInt32(0);
+  EtchObject* integer3 = new EtchInt32(capu::NumericLimitMax<capu::int16_t>());
+  EtchObject* integer4 = new EtchInt32(897);
+
+  //exceed limits of integer
+  EtchObject* integer5 = new EtchInt32(capu::NumericLimitMax<capu::int16_t>() + 2);
+
+  EtchObject* longInteger = new EtchLong(capu::NumericLimitMin<capu::int16_t>());
+  EtchObject* longInteger2 = new EtchLong(0);
+  EtchObject* longInteger3 = new EtchLong(capu::NumericLimitMax<capu::int16_t>());
+  EtchObject* longInteger4 = new EtchLong(897);
+  //exceed limits of integer
+  EtchObject* longInteger5 = new EtchLong((capu::int64_t)capu::NumericLimitMax<capu::int16_t>() + (capu::int64_t)2);
+
+  EtchObject* shortInteger = new EtchShort(capu::NumericLimitMin<capu::int16_t>());
+  EtchObject* shortInteger2 = new EtchShort(0);
+  EtchObject* shortInteger3 = new EtchShort(capu::NumericLimitMax<capu::int16_t>());
+  EtchObject* shortInteger4 = new EtchShort();
+
+  //incompatible type
+  EtchObject* str = new EtchString();
+
+  EtchObject* byte1 = new EtchByte(capu::NumericLimitMax<capu::int8_t>());
+  EtchObject* byte2 = new EtchByte(0);
+  EtchObject* byte3 = new EtchByte(capu::NumericLimitMin<capu::int8_t>());
+  EtchObject* byte4 = new EtchByte(32);
+  capu::SmartPointer<EtchValidator> ptr = NULL;
+  EXPECT_TRUE(EtchValidatorShort::Get(0, ptr) == ETCH_OK);
+  EXPECT_TRUE((capu::smartpointer_cast<EtchTypeValidator>(ptr))->getNDims() == 0);
+  EXPECT_FALSE(ptr->validate(byte));
+  EXPECT_FALSE(ptr->validate(str));
+  EXPECT_FALSE(ptr->validate(longInteger5));
+  EXPECT_FALSE(ptr->validate(integer5));
+  EXPECT_TRUE(ptr->validate(integer));
+  EXPECT_TRUE(ptr->validate(integer2));
+  EXPECT_TRUE(ptr->validate(integer3));
+  EXPECT_TRUE(ptr->validate(longInteger));
+  EXPECT_TRUE(ptr->validate(longInteger2));
+  EXPECT_TRUE(ptr->validate(longInteger3));
+  EXPECT_TRUE(ptr->validate(shortInteger));
+  EXPECT_TRUE(ptr->validate(shortInteger2));
+  EXPECT_TRUE(ptr->validate(shortInteger3));
+  EXPECT_TRUE(ptr->validate(byte1));
+  EXPECT_TRUE(ptr->validate(byte2));
+  EXPECT_TRUE(ptr->validate(byte3));
+  EXPECT_TRUE(ptr->validate(byte4));
+  EXPECT_TRUE(ptr->validate(integer4));
+  EXPECT_TRUE(ptr->validate(longInteger4));
+  EXPECT_TRUE(ptr->validate(shortInteger4));
+
+  delete integer;
+  delete integer2;
+  delete integer3;
+  delete integer4;
+  delete integer5;
+
+  delete longInteger;
+  delete longInteger2;
+  delete longInteger3;
+  delete longInteger4;
+  delete longInteger5;
+
+  delete shortInteger;
+  delete shortInteger2;
+  delete shortInteger3;
+  delete shortInteger4;
+
+  delete byte1;
+  delete byte2;
+  delete byte3;
+  delete byte4;
+
+  delete str;
+}
+
+TEST(EtchValidatorShortTest, validateValueTest) {
+  EtchObject* byte = NULL;
+  EtchObject* result;
+  EtchObject* integer = new EtchInt32(-128);
+  EtchObject* integer2 = new EtchInt32(5);
+  EtchObject* integer3 = new EtchInt32(127);
+  EtchObject* byte2 = new EtchByte(3);
+  capu::SmartPointer<EtchValidator> ptr = NULL;
+  EXPECT_TRUE(EtchValidatorShort::Get(0, ptr) == ETCH_OK);
+  EXPECT_TRUE(ptr->validateValue(byte, result) == ETCH_ERROR);
+  EXPECT_TRUE(ptr->validateValue(integer, result) == ETCH_OK);
+  EXPECT_TRUE(((EtchShort*) result)->get() == ((EtchInt32*) integer)->get());
+  delete result;
+  EXPECT_TRUE(ptr->validateValue(integer2, result) == ETCH_OK);
+  EXPECT_TRUE(((EtchShort*) result)->get() == ((EtchInt32*) integer2)->get());
+  delete result;
+  EXPECT_TRUE(ptr->validateValue(integer3, result) == ETCH_OK);
+  EXPECT_TRUE(((EtchShort*) result)->get() == ((EtchInt32*) integer3)->get());
+  delete result;
+  EXPECT_TRUE(ptr->validateValue(byte2, result) == ETCH_OK);
+  EXPECT_TRUE(((EtchShort*) result)->get() == ((EtchByte*) byte2)->get());
+  delete result;
+  delete integer;
+  delete integer2;
+  delete integer3;
+  delete byte2;
+}
+
+TEST(EtchValidatorShortTest, elementValidatorTest) {
+  capu::SmartPointer<EtchValidator> ptr = NULL;
+  EXPECT_TRUE(EtchValidatorShort::Get(1, ptr) == ETCH_OK);
+  capu::SmartPointer<EtchValidator> elementValidator;
+  ptr->getElementValidator(elementValidator);
+
+  EtchObject* integer = new EtchInt32(capu::NumericLimitMin<capu::int16_t>());
+  EtchObject* integer2 = new EtchInt32(0);
+  EtchObject* integer3 = new EtchInt32(capu::NumericLimitMax<capu::int16_t>());
+  EtchObject* integer4 = new EtchInt32(897);
+
+  //exceed limits of integer
+  EtchObject* integer5 = new EtchInt32(capu::NumericLimitMax<capu::int16_t>() + 2);
+
+  EtchObject* longInteger = new EtchLong(capu::NumericLimitMin<capu::int16_t>());
+  EtchObject* longInteger2 = new EtchLong(0);
+  EtchObject* longInteger3 = new EtchLong(capu::NumericLimitMax<capu::int16_t>());
+  EtchObject* longInteger4 = new EtchLong(897);
+  //exceed limits of integer
+  EtchObject* longInteger5 = new EtchLong((capu::int64_t)capu::NumericLimitMax<capu::int16_t>() + (capu::int64_t)2);
+
+  EtchObject* shortInteger = new EtchShort(capu::NumericLimitMin<capu::int16_t>());
+  EtchObject* shortInteger2 = new EtchShort(0);
+  EtchObject* shortInteger3 = new EtchShort(capu::NumericLimitMax<capu::int16_t>());
+  EtchObject* shortInteger4 = new EtchShort();
+
+  //incompatible type
+  EtchObject* str = new EtchString();
+
+  EtchObject* byte1 = new EtchByte(capu::NumericLimitMax<capu::int8_t>());
+  EtchObject* byte2 = new EtchByte(0);
+  EtchObject* byte3 = new EtchByte(capu::NumericLimitMin<capu::int8_t>());
+  EtchObject* byte4 = new EtchByte(32);
+
+  EXPECT_FALSE(elementValidator->validate(str));
+  EXPECT_FALSE(elementValidator->validate(longInteger5));
+  EXPECT_FALSE(elementValidator->validate(integer5));
+  EXPECT_TRUE(elementValidator->validate(integer));
+  EXPECT_TRUE(elementValidator->validate(integer2));
+  EXPECT_TRUE(elementValidator->validate(integer3));
+  EXPECT_TRUE(elementValidator->validate(longInteger));
+  EXPECT_TRUE(elementValidator->validate(longInteger2));
+  EXPECT_TRUE(elementValidator->validate(longInteger3));
+  EXPECT_TRUE(elementValidator->validate(shortInteger));
+  EXPECT_TRUE(elementValidator->validate(shortInteger2));
+  EXPECT_TRUE(elementValidator->validate(shortInteger3));
+  EXPECT_TRUE(elementValidator->validate(byte1));
+  EXPECT_TRUE(elementValidator->validate(byte2));
+  EXPECT_TRUE(elementValidator->validate(byte3));
+  EXPECT_TRUE(elementValidator->validate(byte4));
+  EXPECT_TRUE(elementValidator->validate(integer4));
+  EXPECT_TRUE(elementValidator->validate(longInteger4));
+  EXPECT_TRUE(elementValidator->validate(shortInteger4));
+  delete integer;
+  delete integer2;
+  delete integer3;
+  delete integer4;
+  delete integer5;
+
+  delete longInteger;
+  delete longInteger2;
+  delete longInteger3;
+  delete longInteger4;
+  delete longInteger5;
+
+  delete shortInteger;
+  delete shortInteger2;
+  delete shortInteger3;
+  delete shortInteger4;
+
+  delete byte1;
+  delete byte2;
+  delete byte3;
+  delete byte4;
+
+  delete str;
+}