(file) Return to BinaryStreamer.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

   1 karl  1.30 //%2006////////////////////////////////////////////////////////////////////////
   2 schuur 1.1  //
   3 karl   1.9  // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
   4             // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
   5             // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
   6 schuur 1.1  // IBM Corp.; EMC Corporation, The Open Group.
   7 karl   1.9  // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
   8             // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
   9 karl   1.12 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
  10             // EMC Corporation; VERITAS Software Corporation; The Open Group.
  11 karl   1.30 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
  12             // EMC Corporation; Symantec Corporation; The Open Group.
  13 schuur 1.1  //
  14             // Permission is hereby granted, free of charge, to any person obtaining a copy
  15             // of this software and associated documentation files (the "Software"), to
  16             // deal in the Software without restriction, including without limitation the
  17             // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  18             // sell copies of the Software, and to permit persons to whom the Software is
  19             // furnished to do so, subject to the following conditions:
  20 karl   1.30 // 
  21 schuur 1.1  // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
  22             // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
  23             // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
  24             // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  25             // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  26             // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  27             // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  28             // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  29             //
  30             //==============================================================================
  31             //
  32             //%/////////////////////////////////////////////////////////////////////////////
  33             
  34             #include "XmlWriter.h"
  35             #include "XmlReader.h"
  36             #include "XmlParser.h"
  37             #include "CIMName.h"
  38 kumpf  1.41 #include "CIMNameCast.h"
  39 schuur 1.1  #include "BinaryStreamer.h"
  40             #include "CIMClassRep.h"
  41             #include "CIMInstanceRep.h"
  42             #include "CIMMethodRep.h"
  43             #include "CIMParameterRep.h"
  44             #include "CIMPropertyRep.h"
  45             #include "CIMQualifierRep.h"
  46             #include "CIMValue.h"
  47             #include "CIMValueRep.h"
  48 jim.wunderlich 1.21 #include "Packer.h"
  49                     
  50                     #define MAGIC_BYTE Uint8(0x11)
  51                     #define VERSION_NUMBER Uint8(1)
  52 schuur         1.1  
  53                     PEGASUS_USING_STD;
  54                     
  55                     PEGASUS_NAMESPACE_BEGIN
  56                     
  57 jim.wunderlich 1.21 enum BinaryObjectType
  58                     {
  59                         BINARY_CLASS,
  60                         BINARY_INSTANCE,
  61 jim.wunderlich 1.22     BINARY_QUALIFIER_DECL
  62 jim.wunderlich 1.21 };
  63 konrad.r       1.8  
  64 mike           1.24 static inline void _packMagicByte(Buffer& out)
  65 schuur         1.1  {
  66 jim.wunderlich 1.21     Packer::packUint8(out, MAGIC_BYTE);
  67 schuur         1.1  }
  68                     
  69 mike           1.24 static void _checkMagicByte(const Buffer& in, Uint32& pos)
  70 schuur         1.1  {
  71 jim.wunderlich 1.21     Uint8 magicByte;
  72                         Packer::unpackUint8(in, pos, magicByte);
  73                     
  74                         if (magicByte != MAGIC_BYTE)
  75 david.dillard  1.28         throw BinException("Bad magic byte");
  76 schuur         1.1  }
  77                     
  78 jim.wunderlich 1.21 struct Header
  79                     {
  80                         // A version number for this message.
  81                         Uint8 versionNumber;
  82                     
  83                         // The object type (see BinaryObjectType enum).
  84 david.dillard  1.28     Uint8 objectType;
  85 jim.wunderlich 1.21 };
  86                     
  87 mike           1.24 static void _packHeader(Buffer& out, Uint8 objectType)
  88 schuur         1.1  {
  89 jim.wunderlich 1.21     Packer::packUint8(out, VERSION_NUMBER);
  90                         Packer::packUint8(out, objectType);
  91 schuur         1.1  }
  92                     
  93 jim.wunderlich 1.21 static void _checkHeader(
  94 mike           1.24     const Buffer& in, Uint32& pos, Uint8 expectedObjectType)
  95 schuur         1.1  {
  96 jim.wunderlich 1.21     Header header;
  97                         Packer::unpackUint8(in, pos, header.versionNumber);
  98                         Packer::unpackUint8(in, pos, header.objectType);
  99                     
 100                         if (header.objectType != expectedObjectType)
 101 david.dillard  1.28         throw BinException("Unexpected object type");
 102 jim.wunderlich 1.21 
 103                         if (header.versionNumber != VERSION_NUMBER)
 104 david.dillard  1.28         throw BinException("Unsupported version");
 105 schuur         1.1  }
 106                     
 107 mike           1.24 inline void _unpack(const Buffer& in, Uint32& pos, Boolean& x)
 108 schuur         1.1  {
 109 jim.wunderlich 1.21     Packer::unpackBoolean(in, pos, x);
 110 schuur         1.1  }
 111                     
 112 mike           1.24 inline void _unpack(const Buffer& in, Uint32& pos, Uint8& x)
 113 schuur         1.1  {
 114 jim.wunderlich 1.21     Packer::unpackUint8(in, pos, x);
 115 schuur         1.1  }
 116                     
 117 mike           1.24 inline void _unpack(const Buffer& in, Uint32& pos, Sint8& x)
 118 jim.wunderlich 1.21 {
 119                         Packer::unpackUint8(in, pos, (Uint8&)x);
 120                     }
 121 schuur         1.1  
 122 mike           1.24 inline void _unpack(const Buffer& in, Uint32& pos, Uint16& x)
 123 jim.wunderlich 1.21 {
 124                         Packer::unpackUint16(in, pos, x);
 125                     }
 126 schuur         1.1  
 127 mike           1.24 inline void _unpack(const Buffer& in, Uint32& pos, Sint16& x)
 128 schuur         1.1  {
 129 jim.wunderlich 1.21     Packer::unpackUint16(in, pos, (Uint16&)x);
 130 schuur         1.1  }
 131                     
 132 mike           1.24 inline void _unpack(const Buffer& in, Uint32& pos, Uint32& x)
 133 schuur         1.1  {
 134 jim.wunderlich 1.21     Packer::unpackUint32(in, pos, x);
 135 schuur         1.1  }
 136                     
 137 mike           1.24 inline void _unpack(const Buffer& in, Uint32& pos, Sint32& x)
 138 schuur         1.1  {
 139 jim.wunderlich 1.21     Packer::unpackUint32(in, pos, (Uint32&)x);
 140 schuur         1.1  }
 141                     
 142 mike           1.24 inline void _unpack(const Buffer& in, Uint32& pos, Uint64& x)
 143 schuur         1.1  {
 144 jim.wunderlich 1.21     Packer::unpackUint64(in, pos, x);
 145 schuur         1.1  }
 146                     
 147 mike           1.24 inline void _unpack(const Buffer& in, Uint32& pos, Sint64& x)
 148 schuur         1.1  {
 149 jim.wunderlich 1.21     Packer::unpackUint64(in, pos, (Uint64&)x);
 150 schuur         1.1  }
 151                     
 152 mike           1.24 inline void _unpack(const Buffer& in, Uint32& pos, Real32& x)
 153 schuur         1.1  {
 154 jim.wunderlich 1.21     Packer::unpackReal32(in, pos, x);
 155 schuur         1.1  }
 156                     
 157 mike           1.24 inline void _unpack(const Buffer& in, Uint32& pos, Real64& x)
 158 jim.wunderlich 1.21 {
 159                         Packer::unpackReal64(in, pos, x);
 160                     }
 161 schuur         1.1  
 162 mike           1.24 inline void _unpack(const Buffer& in, Uint32& pos, Char16& x)
 163 jim.wunderlich 1.21 {
 164                         Packer::unpackChar16(in, pos, x);
 165                     }
 166 schuur         1.1  
 167 mike           1.24 inline void _unpack(const Buffer& in, Uint32& pos, String& x)
 168 schuur         1.1  {
 169 jim.wunderlich 1.21     Packer::unpackString(in, pos, x);
 170                     }
 171 konrad.r       1.5  
 172 mike           1.24 void _unpack(const Buffer& in, Uint32& pos, CIMDateTime& x)
 173 jim.wunderlich 1.21 {
 174                         String tmp;
 175                         Packer::unpackString(in, pos, tmp);
 176                         x.set(tmp);
 177 schuur         1.1  }
 178                     
 179 mike           1.24 void _unpack(const Buffer& in, Uint32& pos, CIMObjectPath& x)
 180 schuur         1.1  {
 181 jim.wunderlich 1.21     String tmp;
 182                         Packer::unpackString(in, pos, tmp);
 183                         x.set(tmp);
 184 schuur         1.1  }
 185                     
 186 dave.sudlik    1.29 void _unpack(const Buffer& in, Uint32& pos, CIMObject& x)
 187                     {
 188                         String tmp_String;
 189                         Packer::unpackString(in, pos, tmp_String);
 190 kumpf          1.35 
 191 dave.sudlik    1.29     if (tmp_String.size() == 0)
 192                         {
 193 dave.sudlik    1.31         // This should not occur since _unpackValue() won't call _unpack()
 194                             // if the value is Null.
 195                             PEGASUS_ASSERT(false);
 196 dave.sudlik    1.29     }
 197                         else
 198                         {
 199                             // Convert the non-NULL string to a CIMObject (containing either a
 200                             // CIMInstance or a CIMClass).
 201 kumpf          1.35 
 202 dave.sudlik    1.29         // First we need to create a new "temporary" XmlParser that is
 203                             // just the value of the Embedded Object in String representation.
 204                             CString cstr = tmp_String.getCString();
 205                             char* tmp_buffer = (char*)(const char*)cstr;
 206                             XmlParser tmp_parser(tmp_buffer);
 207                     
 208 kumpf          1.35         // The next bit of logic constructs a CIMObject from the Embedded
 209                             // Object String.
 210 dave.sudlik    1.29         // It is similar to the method XmlReader::getValueObjectElement().
 211                             CIMInstance cimInstance;
 212                             CIMClass cimClass;
 213                     
 214                             if (XmlReader::getInstanceElement(tmp_parser, cimInstance))
 215                             {
 216                                 x = CIMObject(cimInstance);
 217                             }
 218                             else if (XmlReader::getClassElement(tmp_parser, cimClass))
 219                             {
 220                                 x = CIMObject(cimClass);
 221                             }
 222                             else
 223                             {
 224 kumpf          1.35             // change "element" to "embedded object"
 225                                 MessageLoaderParms mlParms(
 226                                     "Common.XmlReader.EXPECTED_INSTANCE_OR_CLASS_ELEMENT",
 227                                     "Expected INSTANCE or CLASS element");
 228 dave.sudlik    1.29 
 229                                 throw XmlValidationError(0, mlParms);
 230                             }
 231                         }
 232                     }
 233 a.dunfey       1.32 void _unpack(const Buffer& in, Uint32& pos, CIMInstance& x)
 234                     {
 235                         CIMObject tmp;
 236                         _unpack(in, pos, tmp);
 237                         x = CIMInstance(tmp);
 238                     }
 239                     
 240 jim.wunderlich 1.21 template<class T>
 241                     struct UnpackArray
 242                     {
 243                         static void func(
 244 david.dillard  1.28         const Buffer& in, Uint32& pos, Uint32 n, CIMValue& value)
 245 jim.wunderlich 1.21     {
 246 david.dillard  1.28         Array<T> array;
 247                             array.reserveCapacity(n);
 248 jim.wunderlich 1.21 
 249 david.dillard  1.28         for (Uint32 i = 0; i < n; i++)
 250                             {
 251                                 T tmp;
 252                                 _unpack(in, pos, tmp);
 253                                 array.append(tmp);
 254                             }
 255 jim.wunderlich 1.21 
 256 david.dillard  1.28         value.set(array);
 257 jim.wunderlich 1.21     }
 258                     };
 259                     
 260                     template<class T>
 261                     struct UnpackScalar
 262 schuur         1.1  {
 263 jim.wunderlich 1.21     static void func(
 264 david.dillard  1.28         const Buffer& in, Uint32& pos, CIMValue& value)
 265 jim.wunderlich 1.21     {
 266 david.dillard  1.28         T tmp;
 267                             _unpack(in, pos, tmp);
 268                             value.set(tmp);
 269 jim.wunderlich 1.21     }
 270                     };
 271                     
 272                     template<class OBJECT>
 273                     struct UnpackQualifiers
 274                     {
 275 mike           1.24     static void func(const Buffer& in, Uint32& pos, OBJECT& x)
 276 jim.wunderlich 1.21     {
 277 david.dillard  1.28         Uint32 n;
 278                             Packer::unpackSize(in, pos, n);
 279 jim.wunderlich 1.21 
 280 david.dillard  1.28         CIMQualifier q;
 281 jim.wunderlich 1.21 
 282 david.dillard  1.28         for (size_t i = 0; i < n; i++)
 283                             {
 284                                 BinaryStreamer::_unpackQualifier(in, pos, q);
 285                                 x.addQualifier(q);
 286                             }
 287 jim.wunderlich 1.21     }
 288                     };
 289                     
 290                     template<class REP>
 291                     struct PackQualifiers
 292                     {
 293 mike           1.24     static void func(Buffer& out, REP* rep)
 294 jim.wunderlich 1.21     {
 295 david.dillard  1.28         Uint32 n = rep->getQualifierCount();
 296                             Packer::packSize(out, n);
 297 jim.wunderlich 1.21 
 298 david.dillard  1.28         for (Uint32 i = 0; i < n; i++)
 299                                 BinaryStreamer::_packQualifier(out, rep->getQualifier(i));
 300 jim.wunderlich 1.21     }
 301                     };
 302                     
 303                     template<class OBJECT>
 304                     struct UnpackProperties
 305                     {
 306 mike           1.24     static void func(const Buffer& in, Uint32& pos, OBJECT& x)
 307 jim.wunderlich 1.21     {
 308 david.dillard  1.28         Uint32 n;
 309                             Packer::unpackSize(in, pos, n);
 310 jim.wunderlich 1.21 
 311 david.dillard  1.28         CIMProperty p;
 312 jim.wunderlich 1.21 
 313 david.dillard  1.28         for (size_t i = 0; i < n; i++)
 314                             {
 315                                 BinaryStreamer::_unpackProperty(in, pos, p);
 316                                 x.addProperty(p);
 317                             }
 318 jim.wunderlich 1.21     }
 319                     };
 320                     
 321                     template<class OBJECT>
 322                     struct UnpackMethods
 323                     {
 324 mike           1.24     static void func(const Buffer& in, Uint32& pos, OBJECT& x)
 325 jim.wunderlich 1.21     {
 326 david.dillard  1.28         Uint32 n;
 327                             Packer::unpackSize(in, pos, n);
 328 jim.wunderlich 1.21 
 329 david.dillard  1.28         CIMMethod m;
 330 jim.wunderlich 1.21 
 331 david.dillard  1.28         for (size_t i = 0; i < n; i++)
 332                             {
 333                                 BinaryStreamer::_unpackMethod(in, pos, m);
 334                                 x.addMethod(m);
 335                             }
 336 jim.wunderlich 1.21     }
 337                     };
 338                     
 339 mike           1.24 void BinaryStreamer::_packName(Buffer& out, const CIMName& x)
 340 jim.wunderlich 1.21 {
 341                         Packer::packString(out, x.getString());
 342 schuur         1.1  }
 343                     
 344 jim.wunderlich 1.21 void BinaryStreamer::_unpackName(
 345 mike           1.24     const Buffer& in, Uint32& pos, CIMName& x)
 346 schuur         1.1  {
 347 jim.wunderlich 1.21     String tmp;
 348                         Packer::unpackString(in, pos, tmp);
 349 mike           1.40     x = tmp.size() ? CIMNameCast(tmp) : CIMName();
 350 schuur         1.1  }
 351                     
 352 mike           1.24 void BinaryStreamer::_packQualifier(Buffer& out, const CIMQualifier& x)
 353 schuur         1.1  {
 354 jim.wunderlich 1.21     CIMQualifierRep* rep = x._rep;
 355                     
 356                         _packMagicByte(out);
 357                         _packName(out, rep->getName());
 358                         _packValue(out, rep->getValue());
 359                         _packFlavor(out, rep->getFlavor());
 360                         Packer::packBoolean(out, rep->getPropagated());
 361 schuur         1.1  }
 362                     
 363 jim.wunderlich 1.21 void BinaryStreamer::_unpackQualifier(
 364 mike           1.24     const Buffer& in, Uint32& pos, CIMQualifier& x)
 365 schuur         1.1  {
 366 jim.wunderlich 1.21     _checkMagicByte(in, pos);
 367                     
 368                         CIMName name;
 369                         _unpackName(in, pos, name);
 370                     
 371                         CIMValue value;
 372                         _unpackValue(in, pos, value);
 373                     
 374                         CIMFlavor flavor;
 375                         BinaryStreamer::_unpackFlavor(in, pos, flavor);
 376                     
 377                         Boolean propagated;
 378                         Packer::unpackBoolean(in, pos, propagated);
 379                     
 380                         x = CIMQualifier(name, value, flavor, propagated);
 381 schuur         1.1  }
 382                     
 383 mike           1.24 void BinaryStreamer::_packValue(Buffer& out, const CIMValue& x)
 384 jim.wunderlich 1.21 {
 385                         CIMValueRep* rep = x._rep;
 386                     
 387                         _packMagicByte(out);
 388                         _packType(out, x.getType());
 389                         Packer::packBoolean(out, x.isArray());
 390                     
 391                         Uint32 n = x.getArraySize();
 392 schuur         1.1  
 393 jim.wunderlich 1.21     if (x.isArray())
 394 david.dillard  1.28         Packer::packSize(out, n);
 395 schuur         1.1  
 396 jim.wunderlich 1.21     Packer::packBoolean(out, x.isNull());
 397 schuur         1.1  
 398 jim.wunderlich 1.21     if (x.isNull())
 399 david.dillard  1.28         return;
 400 jim.wunderlich 1.21 
 401                         if (x.isArray())
 402                         {
 403 david.dillard  1.28         switch (x.getType())
 404                             {
 405                                 case CIMTYPE_BOOLEAN:
 406                                     Packer::packBoolean(
 407                                         out, CIMValueType<Boolean>::aref(rep).getData(), n);
 408                                     break;
 409                     
 410                                 case CIMTYPE_SINT8:
 411                                 case CIMTYPE_UINT8:
 412                                     Packer::packUint8(
 413                                         out, CIMValueType<Uint8>::aref(rep).getData(), n);
 414                                     break;
 415                     
 416                                 case CIMTYPE_SINT16:
 417                                 case CIMTYPE_UINT16:
 418                                 case CIMTYPE_CHAR16:
 419                                     Packer::packUint16(
 420                                         out, CIMValueType<Uint16>::aref(rep).getData(), n);
 421                                     break;
 422                     
 423                                 case CIMTYPE_SINT32:
 424 david.dillard  1.28             case CIMTYPE_UINT32:
 425                                 case CIMTYPE_REAL32:
 426                                     Packer::packUint32(
 427                                         out, CIMValueType<Uint32>::aref(rep).getData(), n);
 428                                     break;
 429                     
 430                                 case CIMTYPE_SINT64:
 431                                 case CIMTYPE_UINT64:
 432                                 case CIMTYPE_REAL64:
 433                                     Packer::packUint64(
 434                                         out, CIMValueType<Uint64>::aref(rep).getData(), n);
 435                                     break;
 436                     
 437                                 case CIMTYPE_STRING:
 438                                     Packer::packString(out,
 439                                         CIMValueType<String>::aref(rep).getData(), n);
 440                                     break;
 441                     
 442                                 case CIMTYPE_DATETIME:
 443                                 {
 444                                     const Array<CIMDateTime>& a =
 445 david.dillard  1.28                     CIMValueType<CIMDateTime>::aref(rep);
 446                     
 447                                     for (Uint32 i = 0; i < n; i++)
 448                                         Packer::packString(out, a[i].toString());
 449                                     break;
 450                                 }
 451                     
 452                                 case CIMTYPE_REFERENCE:
 453                                 {
 454                                     const Array<CIMObjectPath>& a =
 455                                         CIMValueType<CIMObjectPath>::aref(rep);
 456                     
 457                                     for (Uint32 i = 0; i < n; i++)
 458                                         Packer::packString(out, a[i].toString());
 459                                     break;
 460                                 }
 461                     
 462                                 case CIMTYPE_OBJECT:
 463 dave.sudlik    1.29             {
 464 kumpf          1.35                 const Array<CIMObject>& a =
 465 dave.sudlik    1.29                     CIMValueType<CIMObject>::aref(rep);
 466 kumpf          1.35 
 467                                     for (Uint32 i = 0; i < n; i++)
 468 dave.sudlik    1.29                     Packer::packString(out, a[i].toString());
 469 david.dillard  1.28                 break;
 470 dave.sudlik    1.29             }
 471 a.dunfey       1.32             case CIMTYPE_INSTANCE:
 472                                 {
 473 kumpf          1.35                 const Array<CIMInstance>& a =
 474 a.dunfey       1.32                     CIMValueType<CIMInstance>::aref(rep);
 475 kumpf          1.35 
 476                                     for (Uint32 i = 0; i < n; i++)
 477 a.dunfey       1.32                 {
 478                                         CIMObject tmp(a[i]);
 479                                         Packer::packString(out, tmp.toString());
 480                                     }
 481                                     break;
 482                                 }
 483 david.dillard  1.28         }
 484 jim.wunderlich 1.21     }
 485                         else
 486                         {
 487 david.dillard  1.28         switch (x.getType())
 488                             {
 489                                 case CIMTYPE_BOOLEAN:
 490                                     Packer::packBoolean(out, rep->u._booleanValue);
 491                                     break;
 492                     
 493                                 case CIMTYPE_SINT8:
 494                                 case CIMTYPE_UINT8:
 495                                     Packer::packUint8(out, rep->u._uint8Value);
 496                                     break;
 497                     
 498                                 case CIMTYPE_SINT16:
 499                                 case CIMTYPE_UINT16:
 500                                 case CIMTYPE_CHAR16:
 501                                     Packer::packUint16(out, rep->u._uint16Value);
 502                                     break;
 503                     
 504                                 case CIMTYPE_SINT32:
 505                                 case CIMTYPE_UINT32:
 506                                 case CIMTYPE_REAL32:
 507                                     Packer::packUint32(out, rep->u._uint32Value);
 508 david.dillard  1.28                 break;
 509                     
 510                                 case CIMTYPE_SINT64:
 511                                 case CIMTYPE_UINT64:
 512                                 case CIMTYPE_REAL64:
 513                                     Packer::packUint64(out, rep->u._uint64Value);
 514                                     break;
 515                     
 516                                 case CIMTYPE_STRING:
 517                                     Packer::packString(out, CIMValueType<String>::ref(rep));
 518                                     break;
 519                     
 520                                 case CIMTYPE_DATETIME:
 521                                     Packer::packString(
 522                                         out, CIMValueType<CIMDateTime>::ref(rep).toString());
 523                                     break;
 524                     
 525                                 case CIMTYPE_REFERENCE:
 526                                     Packer::packString(
 527                                         out, CIMValueType<CIMObjectPath>::ref(rep).toString());
 528                                     break;
 529 david.dillard  1.28 
 530                                 case CIMTYPE_OBJECT:
 531 dave.sudlik    1.29                 Packer::packString(
 532                                         out, CIMValueType<CIMObject>::ref(rep).toString());
 533 david.dillard  1.28                 break;
 534 a.dunfey       1.32             case CIMTYPE_INSTANCE:
 535                                 {
 536                                     CIMObject tmp(CIMValueType<CIMInstance>::ref(rep));
 537                                     Packer::packString(
 538                                         out, tmp.toString());
 539                                     break;
 540                                 }
 541 david.dillard  1.28         }
 542 jim.wunderlich 1.21     }
 543 schuur         1.1  }
 544                     
 545 jim.wunderlich 1.21 void BinaryStreamer::_unpackValue(
 546 mike           1.24     const Buffer& in, Uint32& pos, CIMValue& x)
 547 jim.wunderlich 1.21 {
 548                         _checkMagicByte(in, pos);
 549                     
 550                         CIMType type;
 551                         _unpackType(in, pos, type);
 552                     
 553                         Boolean isArray;
 554                         Packer::unpackBoolean(in, pos, isArray);
 555 schuur         1.1  
 556 jim.wunderlich 1.23     Uint32 arraySize = 0;
 557 konrad.r       1.8  
 558 jim.wunderlich 1.21     if (isArray)
 559 david.dillard  1.28         Packer::unpackSize(in, pos, arraySize);
 560 schuur         1.1  
 561 jim.wunderlich 1.21     Boolean isNull;
 562                         Packer::unpackBoolean(in, pos, isNull);
 563 schuur         1.1  
 564 jim.wunderlich 1.21     if (isNull)
 565                         {
 566 david.dillard  1.28         x = CIMValue(type, isArray, arraySize);
 567                             return;
 568 jim.wunderlich 1.21     }
 569 schuur         1.1  
 570 jim.wunderlich 1.21     if (isArray)
 571                         {
 572 david.dillard  1.28         CIMValue cimValue(type, isArray, arraySize);
 573 jim.wunderlich 1.21 
 574 david.dillard  1.28         switch (type)
 575                             {
 576                                 case CIMTYPE_BOOLEAN:
 577                                     UnpackArray<Boolean>::func(in, pos, arraySize, cimValue);
 578                                     break;
 579                     
 580                                 case CIMTYPE_UINT8:
 581                                     UnpackArray<Uint8>::func(in, pos, arraySize, cimValue);
 582                                     break;
 583                     
 584                                 case CIMTYPE_SINT8:
 585                                     UnpackArray<Sint8>::func(in, pos, arraySize, cimValue);
 586                                     break;
 587                     
 588                                 case CIMTYPE_UINT16:
 589                                     UnpackArray<Uint16>::func(in, pos, arraySize, cimValue);
 590                                     break;
 591                     
 592                                 case CIMTYPE_SINT16:
 593                                     UnpackArray<Sint16>::func(in, pos, arraySize, cimValue);
 594                                     break;
 595 david.dillard  1.28 
 596                                 case CIMTYPE_UINT32:
 597                                     UnpackArray<Uint32>::func(in, pos, arraySize, cimValue);
 598                                     break;
 599                     
 600                                 case CIMTYPE_SINT32:
 601                                     UnpackArray<Sint32>::func(in, pos, arraySize, cimValue);
 602                                     break;
 603                     
 604                                 case CIMTYPE_UINT64:
 605                                     UnpackArray<Uint64>::func(in, pos, arraySize, cimValue);
 606                                     break;
 607                     
 608                                 case CIMTYPE_SINT64:
 609                                     UnpackArray<Sint64>::func(in, pos, arraySize, cimValue);
 610                                     break;
 611                     
 612                                 case CIMTYPE_REAL32:
 613                                     UnpackArray<Real32>::func(in, pos, arraySize, cimValue);
 614                                     break;
 615                     
 616 david.dillard  1.28             case CIMTYPE_REAL64:
 617                                     UnpackArray<Real64>::func(in, pos, arraySize, cimValue);
 618                                     break;
 619                     
 620                                 case CIMTYPE_CHAR16:
 621                                     UnpackArray<Char16>::func(in, pos, arraySize, cimValue);
 622                                     break;
 623                     
 624                                 case CIMTYPE_STRING:
 625                                     UnpackArray<String>::func(in, pos, arraySize, cimValue);
 626                                     break;
 627                     
 628                                 case CIMTYPE_DATETIME:
 629                                     UnpackArray<CIMDateTime>::func(in, pos, arraySize, cimValue);
 630                                     break;
 631                     
 632                                 case CIMTYPE_REFERENCE:
 633                                     UnpackArray<CIMObjectPath>::func(in, pos, arraySize, cimValue);
 634                                     break;
 635                     
 636                                 case CIMTYPE_OBJECT:
 637 dave.sudlik    1.29                 UnpackArray<CIMObject>::func(in, pos, arraySize, cimValue);
 638 david.dillard  1.28                 break;
 639 a.dunfey       1.32             case CIMTYPE_INSTANCE:
 640                                     UnpackArray<CIMInstance>::func(in, pos, arraySize, cimValue);
 641                                     break;
 642 david.dillard  1.28         }
 643 schuur         1.1  
 644 david.dillard  1.28         x = cimValue;
 645 jim.wunderlich 1.21     }
 646                         else
 647                         {
 648 david.dillard  1.28         CIMValue cimValue(type, isArray);
 649 jim.wunderlich 1.21 
 650 david.dillard  1.28         switch (type)
 651                             {
 652                                 case CIMTYPE_BOOLEAN:
 653                                     UnpackScalar<Boolean>::func(in, pos, cimValue);
 654                                     break;
 655                     
 656                                 case CIMTYPE_UINT8:
 657                                     UnpackScalar<Uint8>::func(in, pos, cimValue);
 658                                     break;
 659                     
 660                                 case CIMTYPE_SINT8:
 661                                     UnpackScalar<Sint8>::func(in, pos, cimValue);
 662                                     break;
 663                     
 664                                 case CIMTYPE_UINT16:
 665                                     UnpackScalar<Uint16>::func(in, pos, cimValue);
 666                                     break;
 667                     
 668                                 case CIMTYPE_SINT16:
 669                                     UnpackScalar<Sint16>::func(in, pos, cimValue);
 670                                     break;
 671 david.dillard  1.28 
 672                                 case CIMTYPE_UINT32:
 673                                     UnpackScalar<Uint32>::func(in, pos, cimValue);
 674                                     break;
 675                     
 676                                 case CIMTYPE_SINT32:
 677                                     UnpackScalar<Sint32>::func(in, pos, cimValue);
 678                                     break;
 679                     
 680                                 case CIMTYPE_UINT64:
 681                                     UnpackScalar<Uint64>::func(in, pos, cimValue);
 682                                     break;
 683                     
 684                                 case CIMTYPE_SINT64:
 685                                     UnpackScalar<Sint64>::func(in, pos, cimValue);
 686                                     break;
 687                     
 688                                 case CIMTYPE_REAL32:
 689                                     UnpackScalar<Real32>::func(in, pos, cimValue);
 690                                     break;
 691                     
 692 david.dillard  1.28             case CIMTYPE_REAL64:
 693                                     UnpackScalar<Real64>::func(in, pos, cimValue);
 694                                     break;
 695                     
 696                                 case CIMTYPE_CHAR16:
 697                                     UnpackScalar<Char16>::func(in, pos, cimValue);
 698                                     break;
 699                     
 700                                 case CIMTYPE_STRING:
 701                                     UnpackScalar<String>::func(in, pos, cimValue);
 702                                     break;
 703                     
 704                                 case CIMTYPE_DATETIME:
 705                                     UnpackScalar<CIMDateTime>::func(in, pos, cimValue);
 706                                     break;
 707                     
 708                                 case CIMTYPE_REFERENCE:
 709                                     UnpackScalar<CIMObjectPath>::func(in, pos, cimValue);
 710                                     break;
 711                     
 712                                 case CIMTYPE_OBJECT:
 713 dave.sudlik    1.29                 UnpackScalar<CIMObject>::func(in, pos, cimValue);
 714 david.dillard  1.28                 break;
 715 a.dunfey       1.32             case CIMTYPE_INSTANCE:
 716                                     UnpackScalar<CIMInstance>::func(in, pos, cimValue);
 717                                     break;
 718 david.dillard  1.28         }
 719 schuur         1.1  
 720 david.dillard  1.28         x = cimValue;
 721 jim.wunderlich 1.21     }
 722 schuur         1.1  
 723 jim.wunderlich 1.21     return;
 724                     }
 725 schuur         1.1  
 726 mike           1.24 void BinaryStreamer::_packProperty(Buffer& out, const CIMProperty& x)
 727 jim.wunderlich 1.21 {
 728                         CIMPropertyRep* rep = x._rep;
 729 schuur         1.1  
 730 jim.wunderlich 1.21     _packMagicByte(out);
 731                         _packName(out, rep->getName());
 732                         _packValue(out, rep->getValue());
 733                         Packer::packSize(out, rep->getArraySize());
 734                         _packName(out, rep->getReferenceClassName());
 735                         _packName(out, rep->getClassOrigin());
 736                         Packer::packBoolean(out, rep->getPropagated());
 737                         PackQualifiers<CIMPropertyRep>::func(out, rep);
 738 schuur         1.1  }
 739                     
 740 jim.wunderlich 1.21 void BinaryStreamer::_unpackProperty(
 741 mike           1.24     const Buffer& in, Uint32& pos, CIMProperty& x)
 742 jim.wunderlich 1.21 {
 743                         _checkMagicByte(in, pos);
 744 schuur         1.1  
 745 jim.wunderlich 1.21     CIMName name;
 746                         _unpackName(in, pos, name);
 747 schuur         1.1  
 748 jim.wunderlich 1.21     CIMValue value;
 749                         _unpackValue(in, pos, value);
 750 schuur         1.1  
 751 jim.wunderlich 1.21     Uint32 arraySize;
 752                         Packer::unpackSize(in, pos, arraySize);
 753 schuur         1.1  
 754 jim.wunderlich 1.21     CIMName referenceClassName;
 755                         _unpackName(in, pos, referenceClassName);
 756 schuur         1.1  
 757 jim.wunderlich 1.21     CIMName classOrigin;
 758                         _unpackName(in, pos, classOrigin);
 759 schuur         1.1  
 760 jim.wunderlich 1.21     Boolean propagated;
 761                         Packer::unpackBoolean(in, pos, propagated);
 762 schuur         1.1  
 763 jim.wunderlich 1.21     CIMProperty cimProperty(
 764 david.dillard  1.28         name, value, arraySize, referenceClassName, classOrigin, propagated);
 765 schuur         1.1  
 766 jim.wunderlich 1.21     UnpackQualifiers<CIMProperty>::func(in, pos, cimProperty);
 767 kumpf          1.36     if (cimProperty.getType() == CIMTYPE_STRING)
 768 a.dunfey       1.32     {
 769                             CIMType realType = CIMTYPE_STRING;
 770 thilo.boehm    1.38         if (cimProperty.findQualifier(PEGASUS_QUALIFIERNAME_EMBEDDEDINSTANCE) 
 771                                 != PEG_NOT_FOUND)
 772 a.dunfey       1.32         {
 773                                 // Note that this condition should only happen for properties in
 774                                 // class definitions, and only NULL values are recognized. We
 775                                 // currently don't handle embedded instance types with default
 776                                 // values in the class definition.
 777                                 PEGASUS_ASSERT(value.isNull());
 778                                 realType = CIMTYPE_INSTANCE;
 779                             }
 780 thilo.boehm    1.38         else if (cimProperty.findQualifier(PEGASUS_QUALIFIERNAME_EMBEDDEDOBJECT)
 781                                      != PEG_NOT_FOUND)
 782 a.dunfey       1.32         {
 783                                 // Note that this condition should only happen for properties in
 784                                 // class definitions, and only NULL values are recognized. We
 785                                 // currently don't handle embedded object types with default
 786                                 // values in the class definition.
 787 mike           1.42 #if defined(PEGASUS_ENABLE_PROTOCOL_BINARY)
 788                                 // The binary protocol (unlike the XML protocol) successfully 
 789                                 // transmits embedded object default values. But since they are
 790                                 // not handled elsewhere, we discard the value.
 791                                 cimProperty.setValue(
 792                                     CIMValue(value.getType(),value.isArray(),value.getArraySize()));
 793                     #else
 794 a.dunfey       1.32             PEGASUS_ASSERT(value.isNull());
 795 mike           1.42 #endif
 796                     
 797 a.dunfey       1.32             realType = CIMTYPE_OBJECT;
 798                             }
 799                     
 800 kumpf          1.36         if (realType != CIMTYPE_STRING)
 801 a.dunfey       1.32         {
 802                                 CIMProperty tmpProperty(name, CIMValue(realType, value.isArray()),
 803                                     arraySize, referenceClassName, classOrigin, propagated);
 804 kumpf          1.36             for (unsigned int i = 0, n = cimProperty.getQualifierCount();
 805                                      i < n; ++i)
 806 a.dunfey       1.32             {
 807                                     tmpProperty.addQualifier(cimProperty.getQualifier(i));
 808                                 }
 809                                 cimProperty = tmpProperty;
 810                             }
 811                         }
 812 jim.wunderlich 1.21     x = cimProperty;
 813 schuur         1.1  }
 814                     
 815 mike           1.24 void BinaryStreamer::_packParameter(Buffer& out, const CIMParameter& x)
 816 jim.wunderlich 1.21 {
 817                         CIMParameterRep* rep = x._rep;
 818 schuur         1.1  
 819 jim.wunderlich 1.21     _packMagicByte(out);
 820                         _packName(out, rep->getName());
 821                         _packType(out, rep->getType());
 822                         Packer::packBoolean(out, rep->isArray());
 823                         Packer::packSize(out, rep->getArraySize());
 824                         _packName(out, rep->getReferenceClassName());
 825                         PackQualifiers<CIMParameterRep>::func(out, rep);
 826                     }
 827                     
 828                     void BinaryStreamer::_unpackParameter(
 829 mike           1.24     const Buffer& in, Uint32& pos, CIMParameter& x)
 830 schuur         1.1  {
 831 jim.wunderlich 1.21     _checkMagicByte(in, pos);
 832 konrad.r       1.8  
 833 jim.wunderlich 1.21     CIMName name;
 834                         _unpackName(in, pos, name);
 835 konrad.r       1.8  
 836 jim.wunderlich 1.21     CIMType type;
 837                         _unpackType(in, pos, type);
 838 schuur         1.1  
 839 jim.wunderlich 1.21     Boolean isArray;
 840                         Packer::unpackBoolean(in, pos, isArray);
 841 schuur         1.1  
 842 jim.wunderlich 1.21     Uint32 arraySize;
 843                         Packer::unpackSize(in, pos, arraySize);
 844 schuur         1.1  
 845 jim.wunderlich 1.21     CIMName referenceClassName;
 846                         _unpackName(in, pos, referenceClassName);
 847 schuur         1.1  
 848 jim.wunderlich 1.21     CIMParameter cimParameter(
 849 david.dillard  1.28         name, type, isArray, arraySize, referenceClassName);
 850 schuur         1.1  
 851 jim.wunderlich 1.21     UnpackQualifiers<CIMParameter>::func(in, pos, cimParameter);
 852 schuur         1.1  
 853 jim.wunderlich 1.21     x = cimParameter;
 854                     }
 855 schuur         1.1  
 856 mike           1.24 void BinaryStreamer::_packParameters(Buffer& out, CIMMethodRep* rep)
 857 jim.wunderlich 1.21 {
 858                         Uint32 n = rep->getParameterCount();
 859                         Packer::packSize(out, n);
 860 schuur         1.1  
 861 jim.wunderlich 1.21     for (Uint32 i = 0; i < n; i++)
 862 david.dillard  1.28         BinaryStreamer::_packParameter(out, rep->getParameter(i));
 863 schuur         1.1  }
 864                     
 865 jim.wunderlich 1.21 void BinaryStreamer::_unpackParameters(
 866 mike           1.24     const Buffer& in, Uint32& pos, CIMMethod& x)
 867 jim.wunderlich 1.21 {
 868                         Uint32 n;
 869                         Packer::unpackSize(in, pos, n);
 870 schuur         1.1  
 871 jim.wunderlich 1.21     for (size_t i = 0; i < n; i++)
 872                         {
 873 david.dillard  1.28         CIMParameter q;
 874                             _unpackParameter(in, pos, q);
 875                             x.addParameter(q);
 876 jim.wunderlich 1.21     }
 877                     }
 878 schuur         1.1  
 879 mike           1.24 void BinaryStreamer::_packMethod(Buffer& out, const CIMMethod& x)
 880 jim.wunderlich 1.21 {
 881                         CIMMethodRep* rep = x._rep;
 882 schuur         1.1  
 883 jim.wunderlich 1.21     _packMagicByte(out);
 884                         _packName(out, rep->getName());
 885                         _packType(out, rep->getType());
 886                         _packName(out, rep->getClassOrigin());
 887                         Packer::packBoolean(out, rep->getPropagated());
 888                         PackQualifiers<CIMMethodRep>::func(out, rep);
 889                         _packParameters(out, rep);
 890                     }
 891 schuur         1.1  
 892 jim.wunderlich 1.21 void BinaryStreamer::_unpackMethod(
 893 mike           1.24     const Buffer& in, Uint32& pos, CIMMethod& x)
 894 schuur         1.1  {
 895 jim.wunderlich 1.21     _checkMagicByte(in, pos);
 896 schuur         1.1  
 897 jim.wunderlich 1.21     CIMName name;
 898                         _unpackName(in, pos, name);
 899 schuur         1.1  
 900 jim.wunderlich 1.21     CIMType type;
 901                         _unpackType(in, pos, type);
 902 schuur         1.1  
 903 jim.wunderlich 1.21     CIMName classOrigin;
 904                         _unpackName(in, pos, classOrigin);
 905 schuur         1.1  
 906 jim.wunderlich 1.21     Boolean propagated;
 907                         Packer::unpackBoolean(in, pos, propagated);
 908 schuur         1.1  
 909 jim.wunderlich 1.21     CIMMethod cimMethod(name, type, classOrigin, propagated);
 910                         UnpackQualifiers<CIMMethod>::func(in, pos, cimMethod);
 911                         _unpackParameters(in, pos, cimMethod);
 912 schuur         1.1  
 913 jim.wunderlich 1.21     x = cimMethod;
 914 schuur         1.1  }
 915                     
 916 mike           1.24 void BinaryStreamer::_packObjectPath(Buffer& out, const CIMObjectPath& x)
 917 jim.wunderlich 1.21 {
 918                         Packer::packString(out, x.toString());
 919                     }
 920 schuur         1.1  
 921 jim.wunderlich 1.21 void BinaryStreamer::_unpackObjectPath(
 922 mike           1.24     const Buffer& in, Uint32& pos, CIMObjectPath& x)
 923 schuur         1.1  {
 924 jim.wunderlich 1.21     String tmp;
 925                         Packer::unpackString(in, pos, tmp);
 926                         x = CIMObjectPath(tmp);
 927                     }
 928 konrad.r       1.8  
 929 mike           1.24 void BinaryStreamer::_packProperties(Buffer& out, CIMObjectRep* rep)
 930 jim.wunderlich 1.21 {
 931                         Uint32 n = rep->getPropertyCount();
 932                         Packer::packSize(out, n);
 933 schuur         1.1  
 934 jim.wunderlich 1.21     for (Uint32 i = 0; i < n; i++)
 935 david.dillard  1.28         BinaryStreamer::_packProperty(out, rep->getProperty(i));
 936 jim.wunderlich 1.21 }
 937 schuur         1.1  
 938 mike           1.24 void BinaryStreamer::_packMethods(Buffer& out, CIMClassRep* rep)
 939 jim.wunderlich 1.21 {
 940                         Uint32 n = rep->getMethodCount();
 941                         Packer::packSize(out, n);
 942 schuur         1.1  
 943 jim.wunderlich 1.21     for (Uint32 i = 0; i < n; i++)
 944 david.dillard  1.28         BinaryStreamer::_packMethod(out, rep->getMethod(i));
 945 jim.wunderlich 1.21 }
 946 schuur         1.1  
 947 mike           1.24 void BinaryStreamer::_packScope(Buffer& out, const CIMScope& x)
 948 jim.wunderlich 1.21 {
 949                         Packer::packUint32(out, x.cimScope);
 950                     }
 951 schuur         1.1  
 952 jim.wunderlich 1.21 void BinaryStreamer::_unpackScope(
 953 mike           1.24     const Buffer& in, Uint32& pos, CIMScope& x)
 954 jim.wunderlich 1.21 {
 955                         Packer::unpackUint32(in, pos, x.cimScope);
 956                     }
 957 schuur         1.1  
 958 mike           1.24 void BinaryStreamer::_packFlavor(Buffer& out, const CIMFlavor& x)
 959 jim.wunderlich 1.21 {
 960                         Packer::packUint32(out, x.cimFlavor);
 961 schuur         1.1  }
 962                     
 963 jim.wunderlich 1.21 void BinaryStreamer::_unpackFlavor(
 964 mike           1.24     const Buffer& in, Uint32& pos, CIMFlavor& x)
 965 jim.wunderlich 1.21 {
 966                         Packer::unpackUint32(in, pos, x.cimFlavor);
 967                     }
 968 schuur         1.1  
 969 mike           1.24 void BinaryStreamer::_packType(Buffer& out, const CIMType& x)
 970 jim.wunderlich 1.21 {
 971                         Packer::packUint8(out, Uint8(x));
 972                     }
 973 schuur         1.1  
 974 jim.wunderlich 1.21 void BinaryStreamer::_unpackType(
 975 mike           1.24     const Buffer& in, Uint32& pos, CIMType& x)
 976 jim.wunderlich 1.21 {
 977                         Uint8 tmp;
 978                         Packer::unpackUint8(in, pos, tmp);
 979                         x = CIMType(tmp);
 980                     }
 981 schuur         1.1  
 982 jim.wunderlich 1.21 void BinaryStreamer::encode(
 983 david.dillard  1.28     Buffer& out,
 984 jim.wunderlich 1.21     const CIMClass& x)
 985                     {
 986                         CIMClassRep* rep = x._rep;
 987                         _packMagicByte(out);
 988                         _packHeader(out, BINARY_CLASS);
 989                         _packName(out, x.getClassName());
 990                         _packName(out, x.getSuperClassName());
 991                         PackQualifiers<CIMClassRep>::func(out, rep);
 992                         _packProperties(out, rep);
 993                         _packMethods(out, rep);
 994                     }
 995 schuur         1.1  
 996 jim.wunderlich 1.21 void BinaryStreamer::decode(
 997 david.dillard  1.28     const Buffer& in,
 998                         unsigned int pos,
 999 jim.wunderlich 1.21     CIMClass& x)
1000 schuur         1.1  {
1001 jim.wunderlich 1.21     _checkMagicByte(in, pos);
1002                         _checkHeader(in, pos, BINARY_CLASS);
1003                     
1004                         CIMName className;
1005                         _unpackName(in, pos, className);
1006                     
1007                         CIMName superClassName;
1008                         _unpackName(in, pos, superClassName);
1009 schuur         1.1  
1010 jim.wunderlich 1.21     CIMClass cimClass(className, superClassName);
1011 schuur         1.1  
1012 jim.wunderlich 1.21     UnpackQualifiers<CIMClass>::func(in, pos, cimClass);
1013                         UnpackProperties<CIMClass>::func(in, pos, cimClass);
1014                         UnpackMethods<CIMClass>::func(in, pos, cimClass);
1015 schuur         1.1  
1016 jim.wunderlich 1.21     x = cimClass;
1017                     }
1018 schuur         1.1  
1019 jim.wunderlich 1.21 void BinaryStreamer::encode(
1020 david.dillard  1.28     Buffer& out,
1021 jim.wunderlich 1.21     const CIMInstance& x)
1022                     {
1023                         CIMInstanceRep* rep = x._rep;
1024                         _packMagicByte(out);
1025                         _packHeader(out, BINARY_INSTANCE);
1026                         _packObjectPath(out, x.getPath());
1027                         PackQualifiers<CIMInstanceRep>::func(out, rep);
1028                         _packProperties(out, rep);
1029                     }
1030 schuur         1.1  
1031 jim.wunderlich 1.21 void BinaryStreamer::decode(
1032 david.dillard  1.28     const Buffer& in,
1033                         unsigned int pos,
1034 jim.wunderlich 1.21     CIMInstance& x)
1035                     {
1036                         _checkMagicByte(in, pos);
1037                         _checkHeader(in, pos, BINARY_INSTANCE);
1038 schuur         1.1  
1039 jim.wunderlich 1.21     CIMObjectPath objectPath;
1040                         _unpackObjectPath(in, pos, objectPath);
1041                         CIMInstance cimInstance(objectPath.getClassName());
1042                         cimInstance.setPath(objectPath);
1043 schuur         1.1  
1044 jim.wunderlich 1.21     UnpackQualifiers<CIMInstance>::func(in, pos, cimInstance);
1045                         UnpackProperties<CIMInstance>::func(in, pos, cimInstance);
1046                     
1047                         x = cimInstance;
1048 schuur         1.1  }
1049                     
1050 jim.wunderlich 1.21 void BinaryStreamer::encode(
1051 david.dillard  1.28     Buffer& out,
1052 jim.wunderlich 1.21     const CIMQualifierDecl& x)
1053                     {
1054                         _packMagicByte(out);
1055                         _packHeader(out, BINARY_QUALIFIER_DECL);
1056                         _packName(out , x.getName());
1057                         _packValue(out , x.getValue());
1058                         _packScope(out , x.getScope());
1059                         _packFlavor(out , x.getFlavor());
1060                         Packer::packSize(out, x.getArraySize());
1061                     }
1062 schuur         1.1  
1063 jim.wunderlich 1.21 void BinaryStreamer::decode(
1064 david.dillard  1.28     const Buffer& in,
1065                         unsigned int pos,
1066 jim.wunderlich 1.21     CIMQualifierDecl& x)
1067 schuur         1.1  {
1068 jim.wunderlich 1.21     _checkMagicByte(in, pos);
1069                         _checkHeader(in, pos, BINARY_QUALIFIER_DECL);
1070                     
1071                         CIMName qualifierName;
1072                         _unpackName(in, pos, qualifierName);
1073                     
1074                         CIMValue value;
1075                         _unpackValue(in, pos, value);
1076                     
1077                         CIMScope scope;
1078                         _unpackScope(in, pos, scope);
1079 konrad.r       1.8  
1080 jim.wunderlich 1.21     CIMFlavor flavor;
1081                         BinaryStreamer::_unpackFlavor(in, pos, flavor);
1082                     
1083                         Uint32 arraySize;
1084                         Packer::unpackSize(in, pos, arraySize);
1085                     
1086                         x = CIMQualifierDecl(qualifierName, value, scope, flavor, arraySize);
1087 schuur         1.1  }
1088                     
1089                     PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2