You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by gw...@apache.org on 2007/02/02 14:12:46 UTC

svn commit: r502599 [3/4] - in /incubator/tuscany/cpp/sdo: VSExpress/tuscany_sdo/sdo_runtime/ runtime/core/src/commonj/sdo/ runtime/core/test/

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectImpl.h?view=diff&rev=502599&r1=502598&r2=502599
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectImpl.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectImpl.h Fri Feb  2 05:12:45 2007
@@ -42,6 +42,7 @@
 #include "commonj/sdo/RefCountingPointer.h"
 #include "commonj/sdo/ChangeSummaryImpl.h"
 #include "commonj/sdo/SDODate.h"
+#include "commonj/sdo/SDOValue.h"
 
 namespace commonj{
 namespace sdo{
@@ -121,9 +122,6 @@
     //    Introspection
     /////////////////////////////////////////////////////////////////////////
 
-
-    void handlePropertyNotSet(const char* name);
-
     /**  getPropertyIndex gets the unique index of a property
      *
      * A property of a data object has a unique index associated with it. 
@@ -277,7 +275,7 @@
     virtual unsigned int getString(const char* path, wchar_t* buf, unsigned int max) ;
     virtual unsigned int getString(unsigned int propindex,wchar_t* buf, unsigned int max) ;
     virtual unsigned int getString(const Property& p,wchar_t* buf, unsigned int max) ;
-    
+
     virtual void setString(const SDOString& path, const wchar_t* c,unsigned int len);
     virtual void setString(const char* path, const wchar_t* c,unsigned int len) ;
     virtual void setString(unsigned int propindex, const wchar_t* c,unsigned int len) ;
@@ -509,6 +507,7 @@
     virtual const char*  getCString();
     virtual void setCString(const char* s);
     virtual void setCString(const SDOString& s);
+    virtual void setSDOValue(const SDOValue& s);
     virtual DataObjectImpl* getDataObject();
     virtual void setDataObject(DataObject* d);
 
@@ -572,7 +571,9 @@
     virtual const PropertyImpl* defineProperty(const SDOString& propname, 
                  const Type& t);
 
-     virtual const PropertyImpl* defineBoolean(const SDOString& propname);
+    virtual const PropertyImpl* defineSDOValue(const SDOString& propname,
+                                               const SDOValue& sval);
+    virtual const PropertyImpl* defineBoolean(const SDOString& propname);
     virtual const PropertyImpl* defineByte(const SDOString& propname);
     virtual const PropertyImpl* defineCharacter(const SDOString& propname);
     virtual const PropertyImpl* defineString(const SDOString& propname);
@@ -633,10 +634,18 @@
 
     // Does not keep a reference counted pointer to the container.
     DataObjectImpl* container;
- 
-    // remove the value from the data object.
-    void deleteValue();
 
+    virtual void setSDOValue(const SDOString& path, const SDOValue& sval, const SDOString& dataType);
+    virtual void setSDOValue(unsigned int propindex, const SDOValue& sval, const SDOString& dataType);
+    virtual void setSDOValue(const Property& p, const SDOValue& sval, const SDOString& dataType);
+
+    virtual const SDOValue& getSDOValue(PropertyImpl** propertyForDefault);
+    virtual const SDOValue& getSDOValue(const unsigned int propertyIndex,
+                                        PropertyImpl** propertyForDefault);
+    virtual const SDOValue& getSDOValue(const Property& property,
+                                        PropertyImpl** propertyForDefault);
+    virtual const SDOValue& getSDOValue(const SDOString& path,
+                                        PropertyImpl** propertyForDefault);
 
     PropertyValueMap PropertyValues;
     
@@ -644,14 +653,11 @@
 
     DataObjectListImpl* listValue;
     
-    // Holds the value , reallocated as necessary for strings
-    void* value;  
+    // Holds the value as an SDOValue object, if the value is a primitive data type.
+    SDOValue sdoValue;
 
-    // In the case of a bytes/string - this holds the length;
-    unsigned int valuelength;
-                         
-    // holds the value as a string - if requested.
-    char* asStringBuffer; 
+    // If the value is a data object, it is recorded here.
+    DataObjectImpl* doValue;
 
     // holds the Xpath to this object if requested.
     std::string asXPathBuffer;
@@ -664,7 +670,6 @@
     unsigned int openBase;
     std::list<PropertyImpl> openProperties;
 
-    static const char* emptyString;
     static const char* templateString;
 
     // Data may be set to null in any data object

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectList.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectList.h?view=diff&rev=502599&r1=502598&r2=502599
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectList.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectList.h Fri Feb  2 05:12:45 2007
@@ -27,6 +27,7 @@
 #include "commonj/sdo/RefCountingPointer.h"
 #include "commonj/sdo/DataObject.h"
 #include "commonj/sdo/SDODate.h"
+#include "commonj/sdo/SDOValue.h"
 #include <wchar.h>
 
 
@@ -143,6 +144,8 @@
     virtual SDO_API void insert (unsigned int index, const SDOString& d) = 0;
     virtual SDO_API void append (const char* d) = 0;
     virtual SDO_API void append (const SDOString& d) = 0;
+
+    virtual SDO_API void append (const SDOValue& sval) = 0;
 
     virtual SDO_API void insert (unsigned int index, short d) = 0;
     virtual SDO_API void append (short d) = 0;

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.cpp?view=diff&rev=502599&r1=502598&r2=502599
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.cpp Fri Feb  2 05:12:45 2007
@@ -636,6 +636,18 @@
     append( dol);
 }
 
+void DataObjectListImpl::append (const SDOValue& sval)
+{
+    if (theFactory == 0) return;
+
+    if (typeUnset)setType(Type::SDOTypeNamespaceURI, StringLiteral);
+
+    RefCountingPointer<DataObject> dol = theFactory->create(typeURI, typeName);
+    DataObject* dob = dol;
+    ((DataObjectImpl*)dob)->setSDOValue(sval);
+    append(dol);
+}
+
 void DataObjectListImpl::insert (unsigned int index, short d)
 {
     if (theFactory == 0) return;

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.h?view=diff&rev=502599&r1=502598&r2=502599
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.h Fri Feb  2 05:12:45 2007
@@ -24,6 +24,7 @@
 
 #include "commonj/sdo/DataObjectList.h"
 #include "commonj/sdo/SDODate.h"
+#include "commonj/sdo/SDOValue.h"
 
 #include "commonj/sdo/disable_warn.h"
 
@@ -123,6 +124,8 @@
     virtual  void insert (unsigned int index, const SDOString& d) ;
     virtual  void append (const char* d) ;
     virtual  void append (const SDOString& d) ;
+
+    virtual  void append (const SDOValue& sval);
 
     virtual  void insert (unsigned int index, short d) ;
     virtual  void append (short d) ;

Added: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataTypeInfo.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataTypeInfo.cpp?view=auto&rev=502599
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataTypeInfo.cpp (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataTypeInfo.cpp Fri Feb  2 05:12:45 2007
@@ -0,0 +1,54 @@
+/*
+*
+*  Copyright 2007 The Apache Software Foundation or its licensors, as applicable.
+*
+*  Licensed 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.
+*/
+
+/* $Rev$ $Date$ */
+
+#include "commonj/sdo/SDOString.h"
+#include "commonj/sdo/DataTypeInfo.h"
+
+namespace commonj
+{
+  namespace sdo
+  {
+
+     const SDOString& DataTypeInfo::convertTypeEnumToString(TrueDataType dataType)
+     {
+        if ((dataType < 0) || (dataType > TDTWideString))
+        {
+           return rawTypeNames[TDTWideString + 1];
+        }
+        else
+        {
+           return rawTypeNames[dataType];
+        }
+     }
+
+     const SDOString DataTypeInfo::rawTypeNames[] = {"Boolean", // 0
+                                                     "Byte",
+                                                     "Character",
+                                                     "Short",
+                                                     "Integer",
+                                                     "Long", // 5
+                                                     "Float",
+                                                     "Double",
+                                                     "Date",
+                                                     "String",
+                                                     "Bytes", // 10
+                                                     "String",
+                                                     "No Such Type"};
+  }
+}

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataTypeInfo.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataTypeInfo.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataTypeInfo.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataTypeInfo.h?view=auto&rev=502599
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataTypeInfo.h (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataTypeInfo.h Fri Feb  2 05:12:45 2007
@@ -0,0 +1,144 @@
+/*
+*
+*  Copyright 2007 The Apache Software Foundation or its licensors, as applicable.
+*
+*  Licensed 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.
+*/
+
+/* $Rev$ $Date$ */
+
+#ifndef _DATATYPEINFO_H_
+#define _DATATYPEINFO_H_
+
+#include "commonj/sdo/SDODate.h"
+#include "commonj/sdo/SDOString.h"
+
+namespace commonj
+{
+   namespace sdo
+   {
+
+      // The DataTypeInfo class provides types that encapsulate the various
+      // primitive data types that SDO uses to represent the user level data
+      // types defined in the specification. The central artifact is a union
+      // of all the C++ data types that are used to represent SDO data
+      // types. This is augmented by enumerations that provide a convenient
+      // way to label a particular type, plus a method to retrieve a text
+      // representation of each enumeration value.
+
+      // There are three different array-like primitive data types.
+      // 1. CString: An array of char, terminated by a 0 ie a C style string.
+      // 2. ByteArray: An array of bytes. Similar to 1. but without the null
+      // terminator.
+      // 3. String: An array of wchar_t, terminated by a 0.  In the SDOValue
+      // class, the first two are stored in an SDOString (ie std::string),
+      // while the third is stored explicitly as a pointer to a buffer.
+
+      class DataTypeInfo
+      {
+         public:
+            // The values of TrueDataType are used as subscripts for an array
+            // so they must a) start at zero and b) be contiguous. Elsewhere,
+            // TDTWideString is used as the definition of the largest
+            // TrueDatatype value, so if any constants are added beyond it the
+            // code that depends on it will have to be changed.
+            enum TrueDataType
+            {
+               TDTbool = 0,
+               TDTchar = 1,
+               TDTwchar_t = 2,
+               TDTshort = 3,
+               TDTlong = 4,
+               TDTint64_t = 5,
+               TDTfloat = 6,
+               TDTdouble = 7,
+               TDTSDODate = 8,
+               TDTCString = 9,
+               TDTByteArray = 10,
+               TDTWideString = 11
+            };
+
+            enum PseudoDataType
+            {
+               PDTunset = -2,
+               PDTnull = -1
+            };
+
+            // This enum identifies what C++ datatype is present in the union.
+            // It does not necessarily say what the SDO type is. Since it is
+            // possible for a value to be either unset or null there are
+            // enumerations for those cases too. This enum is effectively a
+            // union of the two previous enums where TrueDataType includes
+            // just those data types that can actually have values, while
+            // PseudoDataType includes just null and unset. This allows for
+            // methods that have to be told which type to create and for which
+            // unset and null are inappropriate.
+            enum RawDataType
+            {
+               SDOunset = PDTunset,
+               SDOnull = PDTnull,
+               SDObool = TDTbool,
+               SDOchar = TDTchar,
+               SDOwchar_t = TDTwchar_t,
+               SDOshort = TDTshort,
+               SDOlong = TDTlong,
+               SDOint64_t = TDTint64_t,
+               SDOfloat = TDTfloat,
+               SDOdouble = TDTdouble,
+               SDOSDODate = TDTSDODate,
+               SDOCString = TDTCString,
+               SDOByteArray = TDTByteArray,
+               SDOWideString = TDTWideString,
+            };
+
+            // Entities with copy constructors/destructors are not allowed in a union,
+            // since in general, the compiler doesn't know what type is
+            // actually in there so it can't know which constructor/destructor
+            // to call, hence the use of pointers for dates and strings
+            union SDODataTypeUnion
+            {
+                  bool Boolean;
+                  char Character;
+                  wchar_t WideChar;
+                  short Short;
+                  long Integer;
+                  int64_t Int64;
+                  float Float;
+                  long double Double;
+                  SDODate* Date;
+                  SDOString* TextString;
+                  struct
+                  {
+                        wchar_t* data;
+                        unsigned int length;
+                  } WideString;
+            };
+
+            static const SDOString& convertTypeEnumToString(TrueDataType dataType);
+
+            // We sometimes need to convert primitive data types into an
+            // equivalent string representation and for that we need a
+            // temporary buffer. Rather than fret too much about how big each
+            // one can be we choose a size that should be adequate for any of them
+
+            static const int MAX_TRANSIENT_SIZE = 48;
+
+         private:
+            // Array of text strings that correspond to TrueDataType enumeration values
+            static SDO_API const SDOString rawTypeNames[];
+
+      };
+   } // End - namespace sdo
+} // End - namespace commonj
+
+#endif // _DATATYPEINFO_H_

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataTypeInfo.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataTypeInfo.h
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/Makefile.am?view=diff&rev=502599&r1=502598&r2=502599
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/Makefile.am (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/Makefile.am Fri Feb  2 05:12:45 2007
@@ -37,6 +37,7 @@
 	DataObjectInstance.cpp \
 	DataObjectList.cpp \
 	DataObjectListImpl.cpp \
+	DataTypeInfo.cpp \
 	DefaultLogWriter.cpp \
 	EqualityHelper.cpp \
 	GroupDefinition.cpp \
@@ -59,12 +60,14 @@
 	SAX2Parser.cpp \
 	SchemaInfo.cpp \
 	SdoCheck.cpp \
+	SDODataConverter.cpp \
 	SDODate.cpp \
 	SdoRuntime.cpp \
 	SDORuntimeException.cpp \
 	SDOSAX2Parser.cpp \
 	SDOSchemaSAX2Parser.cpp \
 	SDOUtils.cpp \
+	SDOValue.cpp \
 	SDOXMLBufferWriter.cpp \
 	SDOXMLFileWriter.cpp \
 	SDOXMLStreamWriter.cpp \

Added: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDODataConverter.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDODataConverter.cpp?view=auto&rev=502599
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDODataConverter.cpp (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDODataConverter.cpp Fri Feb  2 05:12:45 2007
@@ -0,0 +1,1128 @@
+/*
+ *
+ *  Copyright 2007 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed 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.
+ */
+
+/* $Rev$ $Date$ */
+
+#include <string.h>
+#include "commonj/sdo/SDODataConverter.h"
+#include "commonj/sdo/SDORuntimeException.h"
+
+
+// Data type conversion code is currently spread across this class and
+// TypeImpl. This is necessary while the widespread use of C macros is
+// eradicated, however, the long term aim should be to have all the conversion
+// code here and anything else that needs to perform conversions (eg TypeImpl)
+// should invoke these methods.
+
+
+namespace commonj
+{
+   namespace sdo
+   {
+
+      const bool SDODataConverter::convertToBoolean(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+                                                    const DataTypeInfo::TrueDataType& dataType)
+      {
+         switch (dataType)
+         {
+            case DataTypeInfo::TDTbool:
+               return sourceValue.Boolean;
+
+            case DataTypeInfo::TDTchar:
+               return (sourceValue.Character != 0) ? true : false;
+
+            case DataTypeInfo::TDTwchar_t:
+               return (sourceValue.WideChar != 0) ? true : false;
+
+            case DataTypeInfo::TDTshort:
+               return (sourceValue.Short != 0) ? true : false;
+
+            case DataTypeInfo::TDTlong:
+               return (sourceValue.Integer != 0) ? true : false;
+
+            case DataTypeInfo::TDTint64_t:
+               return (sourceValue.Int64 != 0) ? true : false;
+
+            case DataTypeInfo::TDTfloat:
+               return (sourceValue.Float != 0) ? true : false;
+
+            case DataTypeInfo::TDTdouble:
+               return (sourceValue.Double != 0) ? true : false;
+
+            case DataTypeInfo::TDTSDODate:
+               return ((sourceValue.Date)->getTime() != 0) ? true : false;
+
+            case DataTypeInfo::TDTCString:
+            case DataTypeInfo::TDTByteArray:
+               return (*(sourceValue.TextString) == "true") ? true : false;
+
+            case DataTypeInfo::TDTWideString:
+               if (sourceValue.WideString.length < 4) 
+               {
+                  return false;
+               }
+               
+               if ((sourceValue.WideString.data[0] == (wchar_t) 't') &&
+                   (sourceValue.WideString.data[1] == (wchar_t) 'r') &&
+                   (sourceValue.WideString.data[2] == (wchar_t) 'u') &&
+                   (sourceValue.WideString.data[3] == (wchar_t) 'e'))
+               {
+                  return true;
+               }
+
+               return false;
+
+            default:
+            {
+               std::string msg("Invalid conversion to boolean from SDOValue of type: ");
+               msg += DataTypeInfo::convertTypeEnumToString(dataType);
+               SDO_THROW_EXCEPTION("SDODataConverter::convertToBoolean",
+                                   SDOInvalidConversionException,
+                                   msg.c_str());
+               break;
+            }
+         }
+      }
+
+
+      const char SDODataConverter::convertToByte(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+                                                 const DataTypeInfo::TrueDataType& dataType)
+      {
+         switch (dataType)
+         {
+            case DataTypeInfo::TDTbool:
+               return (sourceValue.Boolean) ? 1 : 0;
+
+            case DataTypeInfo::TDTchar:
+               return sourceValue.Character;
+
+            case DataTypeInfo::TDTwchar_t:
+               return (char) sourceValue.WideChar;
+
+            case DataTypeInfo::TDTshort:
+               return (char) sourceValue.Short;
+
+            case DataTypeInfo::TDTlong:
+               return (char) sourceValue.Integer;
+
+            case DataTypeInfo::TDTint64_t:
+               return (char) sourceValue.Int64;
+
+            case DataTypeInfo::TDTfloat:
+               return (char) sourceValue.Float;
+
+            case DataTypeInfo::TDTdouble:
+               return (char) sourceValue.Double;
+
+            case DataTypeInfo::TDTSDODate:
+               return (char) (sourceValue.Date)->getTime();
+
+            case DataTypeInfo::TDTCString:
+            case DataTypeInfo::TDTByteArray:
+               return (char) atoi((sourceValue.TextString)->c_str());
+
+            case DataTypeInfo::TDTWideString:
+            {
+               // char tmpstr[DataTypeInfo::MAX_TRANSIENT_SIZE];
+               char* tmpstr = new char[sourceValue.WideString.length + 1];
+               for (unsigned int j = 0; j < sourceValue.WideString.length; j++)
+               {
+                  tmpstr[j] = (char) sourceValue.WideString.data[j];
+               }
+               tmpstr[sourceValue.WideString.length] = 0;
+               char result = (char) atoi(tmpstr);
+               delete tmpstr;
+               return result;
+            }
+            default:
+            {
+               std::string msg("Invalid conversion to byte from SDOValue of type: ");
+               msg += DataTypeInfo::convertTypeEnumToString(dataType);
+               SDO_THROW_EXCEPTION("SDODataConverter::convertToByte",
+                                   SDOInvalidConversionException,
+                                   msg.c_str());
+               break;
+            }
+         }
+         return 0;
+      }
+
+      const wchar_t SDODataConverter::convertToCharacter(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+                                                         const DataTypeInfo::TrueDataType& dataType)
+      {
+         switch (dataType)
+         {
+            case DataTypeInfo::TDTbool:
+               return (sourceValue.Boolean == false) ? (wchar_t) 0 : (wchar_t) 1;
+
+            case DataTypeInfo::TDTchar:
+               return (wchar_t) sourceValue.Character;
+
+            case DataTypeInfo::TDTwchar_t:
+               return sourceValue.WideChar;
+
+            case DataTypeInfo::TDTshort:
+               return (wchar_t) sourceValue.Short;
+
+            case DataTypeInfo::TDTlong:
+               return (wchar_t) sourceValue.Integer;
+
+            case DataTypeInfo::TDTint64_t:
+               return (wchar_t) sourceValue.Int64;
+
+            case DataTypeInfo::TDTfloat:
+               return (wchar_t) sourceValue.Float;
+
+            case DataTypeInfo::TDTdouble:
+               return (wchar_t) sourceValue.Double;
+
+            case DataTypeInfo::TDTSDODate:
+               return (wchar_t) (sourceValue.Date)->getTime();
+
+            case DataTypeInfo::TDTCString:
+            case DataTypeInfo::TDTByteArray:
+               if ((sourceValue.TextString)->length() == 0)
+               {
+                  return (wchar_t) 0;
+               }
+               return (wchar_t) (*sourceValue.TextString)[0];
+
+            case DataTypeInfo::TDTWideString:
+               if (sourceValue.WideString.length == 0)
+               {
+                  return (wchar_t) 0;
+               }
+               return sourceValue.WideString.data[0];
+
+            default:
+            {
+               std::string msg("Invalid conversion to character from SDOValue of type: ");
+               msg += DataTypeInfo::convertTypeEnumToString(dataType);
+               SDO_THROW_EXCEPTION("SDODataConverter::convertToCharacter",
+                                   SDOInvalidConversionException,
+                                   msg.c_str());
+               break;
+            }
+         }
+         return 0;
+      }
+
+      const short SDODataConverter::convertToShort(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+                                                   const DataTypeInfo::TrueDataType& dataType)
+      {
+         switch (dataType)
+         {
+            case DataTypeInfo::TDTbool:
+               return (sourceValue.Boolean == false) ? 0 : 1;
+
+            case DataTypeInfo::TDTchar:
+               return (short) sourceValue.Character;
+
+            case DataTypeInfo::TDTwchar_t:
+               return (short) sourceValue.WideChar;
+
+            case DataTypeInfo::TDTshort:
+               return sourceValue.Short;
+
+            case DataTypeInfo::TDTlong:
+               return (short) sourceValue.Integer;
+
+            case DataTypeInfo::TDTint64_t:
+               return (short) sourceValue.Int64;
+
+            case DataTypeInfo::TDTfloat:
+               return (short) sourceValue.Float;
+
+            case DataTypeInfo::TDTdouble:
+               return (short) sourceValue.Double;
+
+            case DataTypeInfo::TDTSDODate:
+               return (short) (sourceValue.Date)->getTime();
+
+            case DataTypeInfo::TDTCString:
+            case DataTypeInfo::TDTByteArray:
+               return (short) atoi((sourceValue.TextString)->c_str());
+
+            case DataTypeInfo::TDTWideString:
+            {
+               char* tmpstr = new char[sourceValue.WideString.length + 1];
+               for (unsigned int j = 0; j < sourceValue.WideString.length; j++)
+               {
+                  tmpstr[j] = (char) sourceValue.WideString.data[j];
+               }
+               tmpstr[sourceValue.WideString.length] = 0;
+               short result = (short) atoi(tmpstr);
+               delete tmpstr;
+               return result;
+            }
+            
+            default:
+            {
+               std::string msg("Invalid conversion to short from SDOValue of type: ");
+               msg += DataTypeInfo::convertTypeEnumToString(dataType);
+               SDO_THROW_EXCEPTION("SDODataConverter::convertToShort",
+                                   SDOInvalidConversionException,
+                                   msg.c_str());
+               break;
+            }
+         }
+         return 0;
+      }
+
+      const long SDODataConverter::convertToInteger(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+                                                    const DataTypeInfo::TrueDataType& dataType)
+      {
+         switch (dataType)
+         {
+            case DataTypeInfo::TDTbool:
+               return (sourceValue.Boolean == false) ? 0 : 1;
+
+            case DataTypeInfo::TDTchar:
+               return (long) sourceValue.Character;
+
+            case DataTypeInfo::TDTwchar_t:
+               return (long) sourceValue.WideChar;
+
+            case DataTypeInfo::TDTshort:
+               return (long) sourceValue.Short;
+
+            case DataTypeInfo::TDTlong:
+               return sourceValue.Integer;
+
+            case DataTypeInfo::TDTint64_t:
+               return (long) sourceValue.Int64;
+
+            case DataTypeInfo::TDTfloat:
+               return (long) sourceValue.Float;
+
+            case DataTypeInfo::TDTdouble:
+               return (long) sourceValue.Double;
+
+            case DataTypeInfo::TDTSDODate:
+               return (long) (sourceValue.Date)->getTime();
+
+            case DataTypeInfo::TDTCString:
+            case DataTypeInfo::TDTByteArray:
+               return (long) atoi((sourceValue.TextString)->c_str());
+
+            case DataTypeInfo::TDTWideString:
+            {
+               char* tmpstr = new char[sourceValue.WideString.length + 1];
+               for (unsigned int j = 0; j < sourceValue.WideString.length; j++)
+               {
+                  tmpstr[j] = (char) sourceValue.WideString.data[j];
+               }
+               tmpstr[sourceValue.WideString.length] = 0;
+               long result = (long) atoi(tmpstr);
+               delete tmpstr;
+               return result;
+            }
+            
+            default:
+            {
+               std::string msg("Invalid conversion to long from SDOValue of type: ");
+               msg += DataTypeInfo::convertTypeEnumToString(dataType);
+               SDO_THROW_EXCEPTION("SDODataConverter::convertToInteger",
+                                   SDOInvalidConversionException,
+                                   msg.c_str());
+               break;
+            }
+         }
+         return 0;
+      }
+
+
+      const int64_t SDODataConverter::convertToLong(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+                                                    const DataTypeInfo::TrueDataType& dataType)
+      {
+         switch (dataType)
+         {
+            case DataTypeInfo::TDTbool:
+               return (sourceValue.Boolean == false) ? 0 : 1;
+
+            case DataTypeInfo::TDTchar:
+               return (int64_t) sourceValue.Character;
+
+            case DataTypeInfo::TDTwchar_t:
+               return (int64_t) sourceValue.WideChar;
+
+            case DataTypeInfo::TDTshort:
+               return (int64_t) sourceValue.Short;
+
+            case DataTypeInfo::TDTlong:
+               return (int64_t) sourceValue.Integer;
+
+            case DataTypeInfo::TDTint64_t:
+               return sourceValue.Int64;
+
+            case DataTypeInfo::TDTfloat:
+               return (int64_t) sourceValue.Float;
+
+            case DataTypeInfo::TDTdouble:
+               return (int64_t) sourceValue.Double;
+
+            case DataTypeInfo::TDTSDODate:
+               return (int64_t) (sourceValue.Date)->getTime();
+
+            case DataTypeInfo::TDTCString:
+            case DataTypeInfo::TDTByteArray:
+#if defined(WIN32)  || defined (_WINDOWS)
+               return _atoi64((sourceValue.TextString)->c_str());
+#else
+               return  strtoll((sourceValue.TextString)->c_str(), NULL, 0);
+#endif
+
+            case DataTypeInfo::TDTWideString:
+            {
+               char* tmpstr = new char[sourceValue.WideString.length + 1];
+               for (unsigned int j = 0; j < sourceValue.WideString.length; j++)
+               {
+                  tmpstr[j] = (char) sourceValue.WideString.data[j];
+               }
+               tmpstr[sourceValue.WideString.length] = 0;
+#if defined(WIN32)  || defined (_WINDOWS)
+               int64_t result = _atoi64(tmpstr);
+#else
+               int64_t result = strtoll(tmpstr, NULL, 0);
+#endif
+               delete tmpstr;
+               return result;
+            }
+            
+            default:
+            {
+               std::string msg("Invalid conversion to int64_t from SDOValue of type: ");
+               msg += DataTypeInfo::convertTypeEnumToString(dataType);
+               SDO_THROW_EXCEPTION("SDODataConverter::convertToLong",
+                                   SDOInvalidConversionException,
+                                   msg.c_str());
+               break;
+            }
+         }
+         return 0;
+      }
+
+
+      const float SDODataConverter::convertToFloat(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+                                                   const DataTypeInfo::TrueDataType& dataType)
+      {
+         switch (dataType)
+         {
+            case DataTypeInfo::TDTbool:
+               return (sourceValue.Boolean == false) ? (float) 0 : (float) 1;
+
+            case DataTypeInfo::TDTchar:
+               return (float) sourceValue.Character;
+
+            case DataTypeInfo::TDTwchar_t:
+               return (float) sourceValue.WideChar;
+
+            case DataTypeInfo::TDTshort:
+               return (float) sourceValue.Short;
+
+            case DataTypeInfo::TDTlong:
+               return (float) sourceValue.Integer;
+
+            case DataTypeInfo::TDTint64_t:
+               return (float) sourceValue.Int64;
+
+            case DataTypeInfo::TDTfloat:
+               return sourceValue.Float;
+
+            case DataTypeInfo::TDTdouble:
+               return (float) sourceValue.Double;
+
+            case DataTypeInfo::TDTSDODate:
+               return (float) (sourceValue.Date)->getTime();
+
+            case DataTypeInfo::TDTCString:
+            case DataTypeInfo::TDTByteArray:
+               return (float) atof(sourceValue.TextString->c_str());
+
+            case DataTypeInfo::TDTWideString:
+            {
+               char* tmpstr = new char[sourceValue.WideString.length + 1];
+               for (unsigned int j = 0; j < sourceValue.WideString.length; j++)
+               {
+                  tmpstr[j] = (char) sourceValue.WideString.data[j];
+               }
+               tmpstr[sourceValue.WideString.length] = 0;
+               float result = (float) atof(tmpstr);
+               delete tmpstr;
+               return result;
+            }
+            
+            default:
+            {
+               std::string msg("Invalid conversion to float from SDOValue of type: ");
+               msg += DataTypeInfo::convertTypeEnumToString(dataType);
+               SDO_THROW_EXCEPTION("SDODataConverter::convertToFloat",
+                                   SDOInvalidConversionException,
+                                   msg.c_str());
+               break;
+            }
+         }
+         return 0;
+      }
+
+
+      const double SDODataConverter::convertToDouble(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+                                                     const DataTypeInfo::TrueDataType& dataType)
+      {
+         switch (dataType)
+         {
+            case DataTypeInfo::TDTbool:
+               return (sourceValue.Boolean == false) ? (double) 0 : (double) 1;
+
+            case DataTypeInfo::TDTchar:
+               return (double) sourceValue.Character;
+
+            case DataTypeInfo::TDTwchar_t:
+               return (double) sourceValue.WideChar;
+
+            case DataTypeInfo::TDTshort:
+               return (double) sourceValue.Short;
+
+            case DataTypeInfo::TDTlong:
+               return (double) sourceValue.Integer;
+
+            case DataTypeInfo::TDTint64_t:
+               return (double) sourceValue.Int64;
+
+            case DataTypeInfo::TDTfloat:
+               return (double) sourceValue.Float;
+
+            case DataTypeInfo::TDTdouble:
+               return sourceValue.Double;
+
+            case DataTypeInfo::TDTSDODate:
+               return (double) (sourceValue.Date)->getTime();
+
+            case DataTypeInfo::TDTCString:
+            case DataTypeInfo::TDTByteArray:
+               return atof(sourceValue.TextString->c_str());
+
+            case DataTypeInfo::TDTWideString:
+            {
+               char* tmpstr = new char[sourceValue.WideString.length + 1];
+               for (unsigned int j = 0; j < sourceValue.WideString.length; j++)
+               {
+                  tmpstr[j] = (char) sourceValue.WideString.data[j];
+               }
+               tmpstr[sourceValue.WideString.length] = 0;
+               double result = atof(tmpstr);
+               delete tmpstr;
+               return result;
+            }
+            
+            default:
+            {
+               std::string msg("Invalid conversion to double from SDOValue of type: ");
+               msg += DataTypeInfo::convertTypeEnumToString(dataType);
+               SDO_THROW_EXCEPTION("SDODataConverter::convertToDouble",
+                                   SDOInvalidConversionException,
+                                   msg.c_str());
+               break;
+            }
+         }
+         return 0;
+      }
+
+
+      const SDODate SDODataConverter::convertToDate(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+                                                    const DataTypeInfo::TrueDataType& dataType)
+      {
+         switch (dataType)
+         {
+            case DataTypeInfo::TDTbool:
+            case DataTypeInfo::TDTCString:
+            case DataTypeInfo::TDTByteArray:
+            case DataTypeInfo::TDTWideString:
+            {
+               std::string msg("Cannot get Date from object of type:");
+               msg += DataTypeInfo::convertTypeEnumToString(dataType);
+               SDO_THROW_EXCEPTION("SDODataConverter::convertToDate" ,
+                                   SDOInvalidConversionException,
+                                   msg.c_str());
+               break;
+            }
+            case DataTypeInfo::TDTchar:
+               return SDODate((time_t) sourceValue.Character);
+
+            case DataTypeInfo::TDTwchar_t:
+               return SDODate((time_t) sourceValue.WideChar);
+
+            case DataTypeInfo::TDTshort:
+               return SDODate((time_t) sourceValue.Short);
+
+            case DataTypeInfo::TDTlong:
+               return SDODate((time_t) sourceValue.Integer);
+
+            case DataTypeInfo::TDTint64_t:
+               return SDODate((time_t) sourceValue.Int64);
+
+            case DataTypeInfo::TDTfloat:
+               return SDODate((time_t) sourceValue.Float);
+
+            case DataTypeInfo::TDTdouble:
+               return SDODate((time_t) sourceValue.Double);
+
+            case DataTypeInfo::TDTSDODate:
+               return *(sourceValue.Date);
+
+            default:
+            {
+               std::string msg("Invalid conversion to SDODate from SDOValue of type: ");
+               msg += DataTypeInfo::convertTypeEnumToString(dataType);
+               SDO_THROW_EXCEPTION("SDODataConverter::convertToDate",
+                                   SDOInvalidConversionException,
+                                   msg.c_str());
+               break;
+            }
+         }
+         return 0;
+      }
+
+
+      SDOString* SDODataConverter::convertToSDOString(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+                                                      const DataTypeInfo::TrueDataType& dataType)
+      {
+         char buffer[DataTypeInfo::MAX_TRANSIENT_SIZE];
+         buffer[0] = 0;
+
+         switch (dataType)
+         {
+            case DataTypeInfo::TDTbool:
+               if (sourceValue.Boolean == false)
+               {
+                  return new SDOString("false");
+               }
+               return new SDOString("true");
+            case DataTypeInfo::TDTchar:
+            {
+               sprintf(buffer , "%ld", (long) sourceValue.Character);
+               break;
+            }
+            case DataTypeInfo::TDTwchar_t:
+            {
+               sprintf(buffer , "%ld", (long) sourceValue.WideChar);
+               break;
+            }
+            case DataTypeInfo::TDTshort:
+            {
+               sprintf(buffer , "%ld", (long) sourceValue.Short);
+               break;
+            }
+            case DataTypeInfo::TDTlong:
+            {
+               sprintf(buffer , "%ld", sourceValue.Integer);
+               break;
+            }
+            case DataTypeInfo::TDTint64_t:
+               sprintf(buffer , "%lld", sourceValue.Int64);
+               break;
+
+            case DataTypeInfo::TDTfloat:
+            {
+               sprintf(buffer , "%ld", sourceValue.Float);
+               break;
+            }
+            case DataTypeInfo::TDTdouble:
+            {
+               sprintf(buffer , "%ld", sourceValue.Double);
+               break;
+            }
+            case DataTypeInfo::TDTSDODate:
+            {
+               sprintf(buffer , "%ld", (sourceValue.Date)->getTime());
+               break;
+            }
+            case DataTypeInfo::TDTByteArray:
+            case DataTypeInfo::TDTCString:
+               return new SDOString(*sourceValue.TextString);
+            case DataTypeInfo::TDTWideString:
+            {
+               char* tmpbuf = new char[sourceValue.WideString.length + 1];
+               for (unsigned int i = 0; i < sourceValue.WideString.length; i++)
+               {
+                  tmpbuf[i] = (char) (sourceValue.WideString.data)[i];
+               }
+
+               tmpbuf[sourceValue.WideString.length] = 0;
+               SDOString* result = new SDOString(tmpbuf);
+               delete tmpbuf;
+               return result;
+            }
+               
+            default:
+            {
+               std::string msg("Invalid conversion to String from SDOValue of type: ");
+               msg += DataTypeInfo::convertTypeEnumToString(dataType);
+               SDO_THROW_EXCEPTION("SDODataConverter::convertToSDOString",
+                                   SDOInvalidConversionException,
+                                   msg.c_str());
+               break;
+            }
+         }
+         return new SDOString(buffer);
+      }
+
+
+      unsigned int SDODataConverter::convertToBytes(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+                                                    const DataTypeInfo::TrueDataType& dataType,
+                                                    char* outptr,
+                                                    unsigned int max_length)
+      {
+         // max_length and outptr are allowed to be zero for some data types,
+         // to request that the length required to hold this value be returned
+         // rather than the actual data. This is a now obselete alternative to
+         // the getLength method. It creates a confusing situation because
+         // some datatypes respond to this and some return 0.
+         // if ((outptr == 0) || (max_length == 0))
+
+         switch (dataType)
+         {
+            case DataTypeInfo::TDTbool:
+               if (outptr == 0)
+               {
+                  return 0;
+               }
+
+               if (sourceValue.Boolean)
+               {
+                  if (max_length < 4)
+                  {
+                     return 0;
+                  }
+                  else
+                  {
+                    outptr[0] = 't';
+                    outptr[1] = 'r';
+                    outptr[2] = 'u';
+                    outptr[3] = 'e';
+                    return 4;
+                  }
+               }
+               else
+               {
+                  if (max_length < 5)
+                  {
+                     return 0;
+                  }
+                  else
+                  {
+                    outptr[0] = 'f';
+                    outptr[1] = 'a';
+                    outptr[2] = 'l';
+                    outptr[3] = 's';
+                    outptr[4] = 'e';
+                    return 5;
+                  }
+               }
+
+            case DataTypeInfo::TDTchar:
+               if (outptr == 0)
+               {
+                  return 0;
+               }
+               outptr[0] = sourceValue.Character;
+               return 1;
+
+            case DataTypeInfo::TDTwchar_t:
+               if (outptr == 0)
+               {
+                  return 0;
+               }
+               outptr[0] = (char) sourceValue.WideChar;
+               return 1;
+
+            case DataTypeInfo::TDTshort:
+            {
+               char tmpstr[DataTypeInfo::MAX_TRANSIENT_SIZE];
+               unsigned int j = 0;
+
+               sprintf(tmpstr, "%ld", sourceValue.Short);
+               size_t tmplen = strlen(tmpstr);
+               if ((tmplen > max_length) || (outptr == 0))
+               {
+                  return 0;
+               }
+               for (j = 0; j < tmplen; j++)
+               {
+                  outptr[j] = tmpstr[j];
+               }
+               return j;
+
+            }
+            case DataTypeInfo::TDTlong:
+            {
+               char tmpstr[DataTypeInfo::MAX_TRANSIENT_SIZE];
+               unsigned int j = 0;
+               
+               sprintf(tmpstr, "%ld", sourceValue.Integer);
+               size_t tmplen = strlen(tmpstr);
+               if ((tmplen > max_length) || (outptr == 0))
+               {
+                  return 0;
+               }
+               for (j = 0; j < tmplen; j++)
+               {
+                  outptr[j] = tmpstr[j];
+               }
+               return j;
+
+            }
+            case DataTypeInfo::TDTint64_t:
+            {
+               char tmpstr[DataTypeInfo::MAX_TRANSIENT_SIZE];
+               unsigned int j = 0;
+               
+               sprintf(tmpstr, "%lld", sourceValue.Int64);
+               size_t tmplen = strlen(tmpstr);
+               if ((tmplen > max_length) || (outptr == 0))
+               {
+                  return 0;
+               }
+               for (j = 0; j < tmplen; j++)
+               {
+                  outptr[j] = tmpstr[j];
+               }
+               return j;
+
+            }
+            case DataTypeInfo::TDTfloat:
+            {
+               char tmpstr[DataTypeInfo::MAX_TRANSIENT_SIZE];
+               unsigned int j = 0;
+               
+               sprintf(tmpstr, "%.3e", sourceValue.Float);
+               size_t tmplen = strlen(tmpstr);
+               if ((tmplen > max_length) || (outptr == 0))
+               {
+                  return 0;
+               }
+               for (j = 0; j < tmplen; j++)
+               {
+                  outptr[j] = tmpstr[j];
+               }
+               return j;
+
+            }
+            case DataTypeInfo::TDTdouble:
+            {
+               char tmpstr[DataTypeInfo::MAX_TRANSIENT_SIZE];
+               unsigned int j = 0;
+               
+               sprintf(tmpstr, "%.3Le", sourceValue.Double);
+               size_t tmplen = strlen(tmpstr);
+               if ((tmplen > max_length) || (outptr == 0))
+               {
+                  return 0;
+               }
+               for (j = 0; j < tmplen; j++)
+               {
+                  outptr[j] = tmpstr[j];
+               }
+               return j;
+
+            }
+            case DataTypeInfo::TDTSDODate:
+            {
+               std::string msg("Conversion to bytes not implemented from type: SDODate");
+               SDO_THROW_EXCEPTION("getString",
+                                   SDOInvalidConversionException,
+                                   msg.c_str());
+               break;
+            }
+
+            case DataTypeInfo::TDTByteArray:
+            case DataTypeInfo::TDTCString:
+            {
+               if (max_length == 0)
+               {
+                  return (sourceValue.TextString)->length();
+               }
+               else
+               {
+                  unsigned int copy_count = (sourceValue.TextString)->length();
+                  if (max_length < copy_count)
+                  {
+                     copy_count = max_length;
+                  }
+                  for (unsigned int i = 0; (i < copy_count); i++)
+                  {
+                     outptr[i] = (*sourceValue.TextString)[i];
+                  }
+                  return copy_count;
+               }
+            }
+
+            case DataTypeInfo::TDTWideString:
+            {
+               if (max_length == 0)
+               {
+                  return sourceValue.WideString.length;
+               }
+               else
+               {
+                  unsigned int copy_count = sourceValue.WideString.length;
+                  if (max_length < copy_count)
+                  {
+                     copy_count = max_length;
+                  }
+                  for (unsigned int i = 0; i < copy_count; i++)
+                  {
+                     outptr[i] = (char) (sourceValue.WideString.data)[i];
+                  }
+                  return copy_count;
+               }
+            }
+            
+            default:
+            {
+               std::string msg("Invalid conversion to bytes from SDOValue of type: ");
+               msg += DataTypeInfo::convertTypeEnumToString(dataType);
+               SDO_THROW_EXCEPTION("SDODataConverter::convertToBytes",
+                                   SDOInvalidConversionException,
+                                   msg.c_str());
+               break;
+            }
+         }
+      }
+
+      unsigned int SDODataConverter::convertToString(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+                                                     const DataTypeInfo::TrueDataType& dataType,
+                                                     wchar_t* outptr,
+                                                     unsigned int max_length)
+      {
+         // max_length and outptr are allowed to be zero for some data types,
+         // to request that the length required to hold this value be returned
+         // rather than the actual data. This is a now obselete alternative to
+         // the getLength method. It creates a confusing situation because
+         // some datatypes respond to this and some return 0.
+         // if ((outptr == 0) || (max_length == 0))
+
+         switch (dataType)
+         {
+            case DataTypeInfo::TDTbool:
+               if (outptr == 0)
+               {
+                  return 0;
+               }
+
+               if (sourceValue.Boolean)
+               {
+                  if (max_length < 4)
+                  {
+                     return 0;
+                  }
+                  else
+                  {
+                    outptr[0] = (wchar_t) 't';
+                    outptr[1] = (wchar_t) 'r';
+                    outptr[2] = (wchar_t) 'u';
+                    outptr[3] = (wchar_t) 'e';
+                    return 4;
+                  }
+               }
+               else
+               {
+                  if (max_length < 5)
+                  {
+                     return 0;
+                  }
+                  else
+                  {
+                    outptr[0] = (wchar_t) 'f';
+                    outptr[1] = (wchar_t) 'a';
+                    outptr[2] = (wchar_t) 'l';
+                    outptr[3] = (wchar_t) 's';
+                    outptr[4] = (wchar_t) 'e';
+                    return 5;
+                  }
+               }
+            case DataTypeInfo::TDTchar:
+               if (outptr == 0)
+               {
+                  return 0;
+               }
+               outptr[0] = (wchar_t) sourceValue.Character;
+               return 1;
+
+            case DataTypeInfo::TDTwchar_t:
+               if (outptr == 0)
+               {
+                  return 0;
+               }
+               outptr[0] = sourceValue.WideChar;
+               return 1;
+
+            case DataTypeInfo::TDTshort:
+            {
+               char tmpstr[DataTypeInfo::MAX_TRANSIENT_SIZE];
+               unsigned int j = 0;
+               
+               sprintf(tmpstr, "%ld", sourceValue.Short);
+               size_t tmplen = strlen(tmpstr);
+               if ((tmplen > max_length) || (outptr == 0))
+               {
+                  return 0;
+               }
+               for (j = 0; j < tmplen; j++)
+               {
+                  outptr[j] = (wchar_t) tmpstr[j];
+               }
+               return j;
+            }
+
+            case DataTypeInfo::TDTlong:
+            {
+               char tmpstr[DataTypeInfo::MAX_TRANSIENT_SIZE];
+               unsigned int j = 0;
+               
+               sprintf(tmpstr, "%ld", sourceValue.Integer);
+               size_t tmplen = strlen(tmpstr);
+               if ((tmplen > max_length) || (outptr == 0))
+               {
+                  return 0;
+               }
+               for (j = 0; j < tmplen; j++)
+               {
+                  outptr[j] = (wchar_t) tmpstr[j];
+               }
+               return j;
+            }
+
+            case DataTypeInfo::TDTint64_t:
+            {
+               char tmpstr[DataTypeInfo::MAX_TRANSIENT_SIZE];
+               unsigned int j = 0;
+               
+               sprintf(tmpstr, "%lld", sourceValue.Integer);
+               size_t tmplen = strlen(tmpstr);
+               if ((tmplen > max_length) || (outptr == 0))
+               {
+                  return 0;
+               }
+               for (j = 0; j < tmplen; j++)
+               {
+                  outptr[j] = (wchar_t) tmpstr[j];
+               }
+               return j;
+            }
+
+            case DataTypeInfo::TDTfloat:
+            {
+               char tmpstr[DataTypeInfo::MAX_TRANSIENT_SIZE];
+               unsigned int j = 0;
+               
+               sprintf(tmpstr, "%.3e", sourceValue.Float);
+               size_t tmplen = strlen(tmpstr);
+               if ((tmplen > max_length) || (outptr == 0))
+               {
+                  return 0;
+               }
+               for (j = 0; j < tmplen; j++)
+               {
+                  outptr[j] = (wchar_t) tmpstr[j];
+               }
+               return j;
+            }
+
+            case DataTypeInfo::TDTdouble:
+            {
+               char tmpstr[DataTypeInfo::MAX_TRANSIENT_SIZE];
+               unsigned int j = 0;
+               
+               sprintf(tmpstr, "%.3Le", sourceValue.Double);
+               size_t tmplen = strlen(tmpstr);
+               if ((tmplen > max_length) || (outptr == 0))
+               {
+                  return 0;
+               }
+               for (j = 0; j < tmplen; j++)
+               {
+                  outptr[j] = (wchar_t) tmpstr[j];
+               }
+               return j;
+            }
+
+            case DataTypeInfo::TDTSDODate:
+            {
+               std::string msg("Conversion to string not implemented from type: SDODate");
+               SDO_THROW_EXCEPTION("getString",
+                                   SDOInvalidConversionException,
+                                   msg.c_str());
+               break;
+            }
+
+            case DataTypeInfo::TDTByteArray:
+            case DataTypeInfo::TDTCString:
+            {
+               if (max_length == 0)
+               {
+                  return (sourceValue.TextString)->length();
+               }
+               else
+               {
+                  unsigned int copy_count = (sourceValue.TextString)->length();
+                  if (max_length < copy_count)
+                  {
+                     copy_count = max_length;
+                  }
+                  for (unsigned int i = 0; (i < copy_count); i++)
+                  {
+                     outptr[i] = (wchar_t) (*sourceValue.TextString)[i];
+                  }
+                  return copy_count;
+               }
+            }
+
+            case DataTypeInfo::TDTWideString:
+            {
+               if (max_length == 0)
+               {
+                  return sourceValue.WideString.length;
+               }
+               else
+               {
+                  unsigned int copy_count = sourceValue.WideString.length;
+                  if (max_length < copy_count)
+                  {
+                     copy_count = max_length;
+                  }
+                  for (unsigned int i = 0; i < copy_count; i++)
+                  {
+                     outptr[i] = (sourceValue.WideString.data)[i];
+                  }
+                  return copy_count;
+               }
+            }
+
+            default:
+            {
+               std::string msg("Invalid conversion to String from SDOValue of type: ");
+               msg += DataTypeInfo::convertTypeEnumToString(dataType);
+               SDO_THROW_EXCEPTION("SDODataConverter::convertToString",
+                                   SDOInvalidConversionException,
+                                   msg.c_str());
+               break;
+            }
+         }
+      }
+   }
+}

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDODataConverter.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDODataConverter.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDODataConverter.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDODataConverter.h?view=auto&rev=502599
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDODataConverter.h (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDODataConverter.h Fri Feb  2 05:12:45 2007
@@ -0,0 +1,76 @@
+/*
+*
+*  Copyright 2007 The Apache Software Foundation or its licensors, as applicable.
+*
+*  Licensed 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.
+*/
+
+/* $Rev$ $Date$ */
+
+#ifndef _SDODATACONVERTER_H_
+#define _SDODATACONVERTOR_H_
+
+#include "commonj/sdo/DataTypeInfo.h"
+#include "commonj/sdo/SDODate.h"
+
+namespace commonj
+{
+   namespace sdo
+   {
+      // The SDODataConverter class provides methods that convert between the
+      // many primitive data types that SDO must support. In general, the
+      // inputs to a method are a DataTypeInfo::SDODataTypeUnion that gives
+      // the source value that is to be converted and a
+      // DataTypeInfo::TrueDataType that says which member of the union is
+      // actually set. The target of the conversion is determined by the
+      // method name.
+
+      class SDODataConverter
+      {
+
+         public:
+            static const bool convertToBoolean(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+                                               const DataTypeInfo::TrueDataType& dataType);
+            static const char convertToByte(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+                                            const DataTypeInfo::TrueDataType& dataType);
+            static const wchar_t convertToCharacter(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+                                                    const DataTypeInfo::TrueDataType& dataType);
+            static const short convertToShort(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+                                              const DataTypeInfo::TrueDataType& dataType);
+            static const long convertToInteger(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+                                               const DataTypeInfo::TrueDataType& dataType);
+            static const int64_t convertToLong(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+                                               const DataTypeInfo::TrueDataType& dataType);
+            static const float convertToFloat(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+                                              const DataTypeInfo::TrueDataType& dataType);
+            static const double convertToDouble(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+                                                const DataTypeInfo::TrueDataType& dataType);
+            static const SDODate convertToDate(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+                                               const DataTypeInfo::TrueDataType& dataType);
+
+            static SDOString* convertToSDOString(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+                                                 const DataTypeInfo::TrueDataType& dataType);
+
+            static unsigned int convertToBytes(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+                                               const DataTypeInfo::TrueDataType& dataType,
+                                               char* outptr,
+                                               unsigned int max_length);
+            static unsigned int convertToString(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+                                                const DataTypeInfo::TrueDataType& dataType,
+                                                wchar_t* outptr,
+                                                unsigned int max_length);
+      };
+   }
+}
+
+#endif // _SDODATACONVERTER_H

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDODataConverter.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDODataConverter.h
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOValue.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOValue.cpp?view=auto&rev=502599
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOValue.cpp (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOValue.cpp Fri Feb  2 05:12:45 2007
@@ -0,0 +1,235 @@
+/*
+ *
+ *  Copyright 2007 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed 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.
+ */
+
+/* $Rev$ $Date$ */
+
+#include "commonj/sdo/SDOValue.h"
+
+namespace commonj
+{
+  namespace sdo
+  {
+
+     SDOValue::SDOValue(const char* inValue, unsigned int len) : 
+        typeOfValue(DataTypeInfo::SDOByteArray), transient_buffer(0)
+     {
+        char* temp_buffer = new char[len + 1];
+
+        // We would like to use strncpy at this point, but it is
+        // deprecated and its preferred alternative, strncpy_s, does
+        // not copy nulls if they appear in the input stream so we'll
+        // do it by hand.
+        for (unsigned int i = 0; i < len; i++)
+        {
+           temp_buffer[i] = (char) inValue[i];
+        }
+        temp_buffer[len] = 0;
+
+        value.TextString = new SDOString(temp_buffer, len);
+
+        delete temp_buffer;
+     }
+
+     SDOValue::SDOValue(const wchar_t* inValue, unsigned int len) : 
+        typeOfValue(DataTypeInfo::SDOWideString), transient_buffer(0)
+     {
+        value.WideString.data = new wchar_t[len + 1];
+
+        for (unsigned int i = 0; i < len; i++)
+        {
+           value.WideString.data[i] = (wchar_t) inValue[i];
+        }
+        value.WideString.data[len] = (wchar_t) 0;
+
+        value.WideString.length = len; // NOTE: length is the number of _real_
+                                       // characters in the WideString 
+
+     }
+
+     // Copy constructor
+     SDOValue::SDOValue(const SDOValue& inValue) : 
+        typeOfValue(inValue.typeOfValue), transient_buffer(0)
+     {
+        switch (inValue.typeOfValue)
+        {
+           case DataTypeInfo::SDObool:
+              value.Boolean = inValue.value.Boolean;
+              break;
+           case DataTypeInfo::SDOchar:
+              value.Character = inValue.value.Character;
+              break;
+           case DataTypeInfo::SDOwchar_t:
+              value.WideChar = inValue.value.WideChar;
+              break;
+           case DataTypeInfo::SDOshort:
+              value.Short = inValue.value.Short;
+              break;
+           case DataTypeInfo::SDOlong:
+              value.Integer = inValue.value.Integer;
+              break;
+           case DataTypeInfo::SDOfloat:
+              value.Float = inValue.value.Float;
+              break;
+           case DataTypeInfo::SDOdouble:
+              value.Double = inValue.value.Double;
+              break;
+           case DataTypeInfo::SDOSDODate:
+              value.Date = new SDODate((inValue.value.Date)->getTime());
+              break;
+           case DataTypeInfo::SDOCString:
+           case DataTypeInfo::SDOByteArray:
+              value.TextString = new SDOString(*(inValue.value.TextString));
+           case DataTypeInfo::SDOWideString:
+              value.WideString.data = new wchar_t[inValue.value.WideString.length + 1];
+              // The loop copies the null terminator that was added to the end
+              // of the source data when _it_ was constructed.
+              for (unsigned int i = 0; i <= inValue.value.WideString.length; i++)
+              {
+                 value.WideString.data[i] = inValue.value.WideString.data[i];
+              }
+              value.WideString.length = inValue.value.WideString.length;
+              break;
+        }
+     }
+     // End of copy constructor
+
+     // Copy assignment
+     SDOValue& SDOValue::operator=(const SDOValue& inValue)
+     {
+        if (this != &inValue)   // sval = sval is a no-op.
+        {
+           // Clear out any allocated data in the target SDOValue.
+           switch (typeOfValue)
+           {
+              case DataTypeInfo::SDOSDODate:
+                 delete value.Date;
+                 value.Date = 0;
+                 break;
+             case DataTypeInfo::SDOCString:
+             case DataTypeInfo::SDOByteArray:
+                 delete value.TextString;
+                 value.TextString = 0;
+                 break;
+              case DataTypeInfo::SDOWideString:
+                 delete value.WideString.data;
+                 value.WideString.data = 0;
+                 value.WideString.length = 0;
+                 break;
+              default:
+                 // Nothing to delete.
+                 break;
+           }           
+
+           if (transient_buffer != 0)
+           {
+              delete transient_buffer;
+              transient_buffer = 0;
+           }
+
+           // Copy the source data into the target
+           switch (inValue.typeOfValue)
+           {
+              case DataTypeInfo::SDObool:
+                 value.Boolean = inValue.value.Boolean;
+                 break;
+              case DataTypeInfo::SDOchar:
+                 value.Character = inValue.value.Character;
+                 break;
+              case DataTypeInfo::SDOwchar_t:
+                 value.WideChar = inValue.value.WideChar;
+                 break;
+              case DataTypeInfo::SDOshort:
+                 value.Short = inValue.value.Short;
+                 break;
+              case DataTypeInfo::SDOlong:
+                 value.Integer = inValue.value.Integer;
+                 break;
+              case DataTypeInfo::SDOint64_t:
+                 value.Int64 = inValue.value.Int64;
+                 break;
+              case DataTypeInfo::SDOfloat:
+                 value.Float = inValue.value.Float;
+                 break;
+              case DataTypeInfo::SDOdouble:
+                 value.Double = inValue.value.Double;
+                 break;
+              case DataTypeInfo::SDOSDODate:
+                 value.Date = new SDODate((inValue.value.Date)->getTime());
+                 break;
+              case DataTypeInfo::SDOCString:
+              case DataTypeInfo::SDOByteArray:
+                 value.TextString = new SDOString(*(inValue.value.TextString));
+                 break;
+              case DataTypeInfo::SDOWideString:
+                 value.WideString.data = new wchar_t[inValue.value.WideString.length + 1];
+                 // The loop copies the null terminator that was added to the end
+                 // of the source data when _it_ was constructed.
+                 for (unsigned int i = 0; i <= inValue.value.WideString.length; i++)
+                 {
+                    value.WideString.data[i] = inValue.value.WideString.data[i];
+                 }
+                 value.WideString.length = inValue.value.WideString.length;
+                 break;
+           }
+           // Finally, set the new type.
+           typeOfValue = inValue.typeOfValue;
+        }
+        return *this;
+     }
+     // End of copy assignment
+
+     // Destructor
+     SDOValue::~SDOValue()
+     {
+
+        // Clear out any allocated data in the target SDOValue.
+        switch (typeOfValue)
+        {
+           case DataTypeInfo::SDOSDODate:
+              delete value.Date;
+              value.Date = 0;
+              break;
+          case DataTypeInfo::SDOCString:
+          case DataTypeInfo::SDOByteArray:
+              delete value.TextString;
+              value.TextString = 0;
+              break;
+           case DataTypeInfo::SDOWideString:
+              delete value.WideString.data;
+              value.WideString.data = 0;
+              value.WideString.length = 0;
+              break;
+           default:
+              // Nothing to delete.
+              break;
+        }
+
+        if (transient_buffer != 0)
+        {
+           delete transient_buffer;
+           transient_buffer = 0;
+        }
+
+        typeOfValue = DataTypeInfo::SDOunset;
+     }
+     // End of Destructor
+
+
+     const SDOValue SDOValue::nullSDOValue = SDOValue(DataTypeInfo::SDOnull);
+     const SDOValue SDOValue::unsetSDOValue = SDOValue(DataTypeInfo::SDOunset);
+  } // End - namespace sdo
+} // End - namespace commonj

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOValue.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOValue.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOValue.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOValue.h?view=auto&rev=502599
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOValue.h (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOValue.h Fri Feb  2 05:12:45 2007
@@ -0,0 +1,252 @@
+/*
+*
+*  Copyright 2007 The Apache Software Foundation or its licensors, as applicable.
+*
+*  Licensed 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.
+*/
+
+/* $Rev$ $Date$ */
+
+#ifndef _SDOValue_H_
+#define _SDOValue_H_
+
+#include "commonj/sdo/export.h"
+#include "commonj/sdo/SDODate.h"
+#include "commonj/sdo/SDOString.h"
+#include "commonj/sdo/SDODataConverter.h"
+#include "commonj/sdo/DataTypeInfo.h"
+
+#include <iostream>
+
+namespace commonj
+{
+   namespace sdo
+   {
+
+      // The SDOValue class provides a discriminated data type that wraps the
+      // many different primitive data types that SDO must use. This allows
+      // common treatment of SDO values by all methods except those that
+      // really must do different things for different types. The key point is
+      // that instances of the class combine a union with and enum that says
+      // which member of the union is actually present. The enum also allows
+      // for the possibility that the value is unset or has been explicitly
+      // set to null.
+
+      class SDOValue
+      {
+         private:
+            // Entities with copy constructors/destructors are not allowed in a union,
+            // since in general, the compiler doesn't know what type is
+            // actually in there so it can't know which constructor/destructor
+            // to call, hence the use of pointers for certain datatypes.
+            DataTypeInfo::SDODataTypeUnion value;
+
+            DataTypeInfo::RawDataType typeOfValue;
+
+            mutable SDOString* transient_buffer;
+
+         public:
+
+            // Constructors
+            SDO_API SDOValue(bool inValue) : 
+               typeOfValue(DataTypeInfo::SDObool), transient_buffer(0)
+            {
+               value.Boolean = inValue;
+            }
+            SDO_API SDOValue(float inValue) : 
+               typeOfValue(DataTypeInfo::SDOfloat), transient_buffer(0)
+            {
+               value.Float = inValue;
+            }
+            SDO_API SDOValue(long double inValue) : 
+               typeOfValue(DataTypeInfo::SDOdouble), transient_buffer(0)
+            {
+               value.Double = inValue;
+            }
+            SDO_API SDOValue(short inValue) : 
+               typeOfValue(DataTypeInfo::SDOshort), transient_buffer(0)
+            {
+               value.Short = inValue;
+            }
+#if __WORDSIZE != 64
+            SDO_API SDOValue(long inValue) : 
+               typeOfValue(DataTypeInfo::SDOlong), transient_buffer(0)
+            {
+               value.Integer = inValue;
+            }
+#endif
+            SDO_API SDOValue(int64_t inValue) : 
+               typeOfValue(DataTypeInfo::SDOint64_t), transient_buffer(0)
+            {
+               value.Int64 = inValue;
+            }
+            SDO_API SDOValue(char inValue) : 
+               typeOfValue(DataTypeInfo::SDOchar), transient_buffer(0)
+            {
+               value.Character = inValue;
+            }
+            SDO_API SDOValue(wchar_t inValue) : 
+               typeOfValue(DataTypeInfo::SDOwchar_t), transient_buffer(0)
+            {
+               value.WideChar = inValue;
+            }
+            SDO_API SDOValue(const SDODate inValue) : 
+               typeOfValue(DataTypeInfo::SDOSDODate), transient_buffer(0)
+            {
+               value.Date = new SDODate(inValue.getTime());
+            }
+            SDO_API SDOValue(const SDOString& inValue) : 
+               typeOfValue(DataTypeInfo::SDOCString), transient_buffer(0)
+            {
+               value.TextString = new SDOString(inValue);
+            }
+
+            SDO_API SDOValue(const char* inValue, unsigned int len);
+
+            SDO_API SDOValue(const wchar_t* inValue, unsigned int len);
+
+            SDO_API SDOValue() : typeOfValue(DataTypeInfo::SDOunset), transient_buffer(0)
+            {
+            }
+            //End of Constructors
+
+            // Copy constructor
+            SDO_API SDOValue(const SDOValue& inValue);
+            
+            // Copy assignment
+            SDO_API SDOValue& operator=(const SDOValue& inValue);
+            
+            // Destructor
+            SDO_API virtual ~SDOValue();
+
+            inline SDO_API bool isSet() const
+            {
+               return (typeOfValue != DataTypeInfo::SDOunset);
+            }
+            inline SDO_API bool isNull() const
+            {
+               return (typeOfValue == DataTypeInfo::SDOnull);
+            }
+
+            // Get methods to retrieve the stored value.
+            SDO_API bool getBoolean() const
+            {
+               return SDODataConverter::convertToBoolean(value,
+                                                         (DataTypeInfo::TrueDataType) typeOfValue);
+            }
+
+            SDO_API float getFloat() const
+            {
+               return SDODataConverter::convertToFloat(value,
+                                                       (DataTypeInfo::TrueDataType) typeOfValue);
+            }
+
+            SDO_API long double getDouble() const
+            {
+               return SDODataConverter::convertToDouble(value,
+                                                        (DataTypeInfo::TrueDataType) typeOfValue);
+            }
+
+            SDO_API const SDODate getDate() const
+            {
+               return SDODataConverter::convertToDate(value,
+                                                      (DataTypeInfo::TrueDataType) typeOfValue);
+            }
+
+            SDO_API short getShort() const
+            {
+               return SDODataConverter::convertToShort(value,
+                                                      (DataTypeInfo::TrueDataType) typeOfValue);
+            }
+
+            SDO_API long getInteger() const
+            {
+               return SDODataConverter::convertToInteger(value,
+                                                         (DataTypeInfo::TrueDataType) typeOfValue);
+            }
+
+            SDO_API char getByte() const
+            {
+               return SDODataConverter::convertToByte(value,
+                                                      (DataTypeInfo::TrueDataType) typeOfValue);
+            }
+
+            SDO_API wchar_t getCharacter() const
+            {
+               return SDODataConverter::convertToCharacter(value,
+                                                           (DataTypeInfo::TrueDataType) typeOfValue);
+            }
+
+            SDO_API int64_t getLong() const
+            {
+               return SDODataConverter::convertToLong(value,
+                                                      (DataTypeInfo::TrueDataType) typeOfValue);
+            }
+
+            // The following method is regrettably necessary to provide the
+            // CString style interface for the V2.01 spec.
+            SDO_API const char* getCString() const
+            {
+               if (transient_buffer != 0)
+               {
+                  delete transient_buffer;
+               }
+               transient_buffer =
+                  SDODataConverter::convertToSDOString(value,
+                                                       (DataTypeInfo::TrueDataType) typeOfValue);
+               return transient_buffer->c_str();
+            }
+
+            // This method is the preferred way to retrieve a string value
+            SDO_API SDOString getString() const
+            {
+               return *SDODataConverter::convertToSDOString(value,
+                                                            (DataTypeInfo::TrueDataType) typeOfValue);
+            }
+
+            SDO_API unsigned int getString(wchar_t* outptr, const unsigned int max_length) const
+            {
+               return SDODataConverter::convertToString(value,
+                                                        (DataTypeInfo::TrueDataType) typeOfValue,
+                                                        outptr,
+                                                        max_length);
+            }
+
+            SDO_API unsigned int getBytes(char* outptr, const unsigned int max_length) const
+            {
+               return SDODataConverter::convertToBytes(value,
+                                                       (DataTypeInfo::TrueDataType) typeOfValue,
+                                                       outptr,
+                                                       max_length);
+            }
+
+            // Beware, the array does not contain values for all the
+            // enumeration values and it is the callers job to avoid
+            // triggering that.
+            SDO_API const SDOString& convertTypeEnumToString() const
+            {
+               return DataTypeInfo::convertTypeEnumToString((DataTypeInfo::TrueDataType) typeOfValue);
+            }
+            
+            static SDO_API const SDOValue nullSDOValue;
+            static SDO_API const SDOValue unsetSDOValue;
+            // static SDO_API const SDOString rawTypeNames[];
+
+         private:
+            SDO_API SDOValue(DataTypeInfo::RawDataType rdt) : typeOfValue(rdt), transient_buffer(0) {}
+
+      };
+   } // End - namespace sdo
+} // End - namespace commonj
+
+#endif // _SDOValue_H_

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOValue.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOValue.h
------------------------------------------------------------------------------
    svn:keywords = Rev Date



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org