Пример #1
0
// FUNCTION: BEnc()
// PUPROSE: Encode ANY DEFINED BY if "value" is present otherwise encode ANY if 
//          anyBuf is present.  If neither is present an exception is thrown.
//
AsnLen
AsnAny::BEnc (AsnBuf &b) const
{
   FUNC("AsnAny::BEnc()");

   if (value != NULL)
      return value->BEnc(b);
   else if (anyBuf != NULL)
   {
		anyBuf->ResetMode();
		b.insert(*anyBuf);
		return anyBuf->length();

#ifdef OLD
      std::string data;
      
		// PIERCE: make this more efficient
      //
      anyBuf->ResetMode();
      anyBuf->GetSeg(data);
      anyBuf->ResetMode();
      b.PutSegRvs(data.data(), data.length());
      return anyBuf->length();
#endif
   }
   else
      throw EXCEPT("Unknown any with no value", ENCODE_ERROR);
}
Пример #2
0
// FUNCTION: BEnc()
// PUPROSE: Encode ANY DEFINED BY if "value" is present otherwise encode ANY if 
//          anyBuf is present.  If neither is present an exception is thrown.
//
AsnLen
AsnAny::BEnc (AsnBuf &b) const
{
   FUNC("AsnAny::BEnc()");

   if (value != NULL)
      return value->BEnc(b);
   else if (anyBuf != NULL)
   {
		anyBuf->ResetMode();
		b.insert(*anyBuf);
		return anyBuf->length();

   }
   else
      throw EXCEPT("Unknown any with no value", ENCODE_ERROR);
}