コード例 #1
0
ファイル: asn-any.cpp プロジェクト: neeraj9/esnacc-ng
// 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
ファイル: asn-any.cpp プロジェクト: atigyi/esnacc-ng
// 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);
}