ASN1C C# Runtime Library  7.6
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | List of all members
Asn1Real Class Reference
Inheritance diagram for Asn1Real:
Asn1Type Asn1TypeIF Asn1RealBase2

Public Member Functions

 Asn1Real ()
 
 Asn1Real (double value)
 
override void Decode (Asn1BerDecodeBuffer buffer, bool explicitTagging, int implicitLength)
 
override void Decode (Asn1PerDecodeBuffer buffer)
 
override void Decode (Asn1OerDecodeBuffer buffer)
 
void DecodeDouble (Asn1OerDecodeBuffer buffer)
 
void DecodeSingle (Asn1OerDecodeBuffer buffer)
 
virtual void DecodeXER (System.String buffer, System.String attrs, bool decodingElemName, bool modifiedEncodings)
 
override void DecodeXML (System.String buffer, System.String attrs)
 
override int Encode (Asn1BerEncodeBuffer buffer, bool explicitTagging)
 
override void Encode (Asn1PerEncodeBuffer buffer)
 
override void Encode (Asn1OerEncodeBuffer buffer)
 
override void Encode (Asn1XerEncoder buffer, System.String elemName)
 
override void Encode (Asn1XmlEncoder buffer, System.String elemName, System.String nsPrefix)
 
void Encode (Asn1XmlEncoder buffer, String elemName, String nsPrefix, bool asText)
 
override void Encode (Asn1BerOutputStream outs, bool explicitTagging)
 
override void Encode (Asn1PerOutputStream outs)
 
override void EncodeAttribute (Asn1XmlEncoder buffer, System.String attrName)
 
void EncodeDouble (Asn1OerEncodeBuffer buffer)
 
void EncodeSingle (Asn1OerEncodeBuffer buffer)
 
virtual void EncodeValue (Asn1XmlEncoder buffer)
 
virtual bool Equals (double value)
 
override bool Equals (System.Object value)
 
override int GetHashCode ()
 
override System.String ToString ()
 
- Public Member Functions inherited from Asn1Type
void _SetKey (byte[] rtkey)
 
virtual void Decode (Asn1BerDecodeBuffer buffer)
 
virtual void Decode (System.Object reader, System.String xmlURI)
 
virtual void Decode (System.Object reader, System.IO.Stream byteStream)
 
virtual void Decode (Asn1MderDecodeBuffer buffer)
 
virtual void DecodeXML (String buffer, String attrs)
 
virtual int Encode (Asn1BerEncodeBuffer buffer)
 
virtual void Encode (Asn1XerEncoder buffer)
 
virtual void Encode (Asn1XmlEncoder buffer)
 
virtual void Encode (Asn1XmlEncodeBuffer buffer)
 
virtual void Encode (Asn1MderOutputStream buffer)
 
virtual void Encode (Asn1MderOutputStream buffer, bool useCachedLength)
 
virtual void Encode (Asn1CerOutputStream outs, bool explicitTagging)
 
void EncodeAsOpenType (Asn1OerEncodeBuffer buffer)
 
virtual bool Equals (Asn1Type obj)
 
String GetNonParameterizedTypeName ()
 
virtual void Indent (System.IO.TextWriter outs, int level)
 
virtual bool IsOpenType ()
 
virtual bool MatchTypeName (System.String typeName)
 
virtual void Pdiag (System.String s)
 
virtual void Print (System.IO.TextWriter outs, System.String varName, int level)
 
virtual void Print (System.String varName)
 
void SetNonParameterizedTypeName (String value)
 
virtual void SetOpenType ()
 

Static Public Member Functions

static System.String NormalizedRealValueToString (double value)
 
- Static Public Member Functions inherited from Asn1Type
static void _SetKey2 (byte[] rtkey)
 
static void _SetLicLocation (String path)
 
static Asn1Type Decode (Asn1BerDecodeBuffer buffer, Asn1OpenTypeField openTypeField, bool explicitTag, int implicitLength)
 
static Asn1Type Decode (Asn1OerDecodeBuffer buffer, Asn1OpenTypeField openTypeField)
 
static Asn1Type Decode (Asn1PerDecodeBuffer buffer, Asn1OpenTypeField openTypeField)
 
static System.String GetTypeName (short typeCode)
 

Public Attributes

double mValue
 
- Public Attributes inherited from Asn1Type
const short BIT_STRING = 3
 
const short BMPString = 30
 
const short BOOLEAN = 1
 
const short DATE = 31
 
const short ENUMERATED = 10
 
const short EOC = 0
 
const short EXTERNAL = 8
 
const short GeneralString = 27
 
const short GeneralTime = 24
 
const short GraphicString = 25
 
const short IA5String = 22
 
const short INTEGER = 2
 
const short NULL = 5
 
const short NumericString = 18
 
const short OBJECT_IDENTIFIER = 6
 
const short ObjectDescriptor = 7
 
const short OCTET_STRING = 4
 
const short OpenType = 99
 
const short PrintableString = 19
 
const short REAL = 9
 
const short RELATIVE_OID_IRI = 36
 
const short RelativeOID = 13
 
const short SEQUENCE = 16
 
const short SET = 17
 
const short T61String = TeletexString
 
const short TeletexString = 20
 
const short TIME = 14
 
const short UniversalString = 28
 
const short UTCTime = 23
 
const short UTF8String = 12
 
const short VideotexString = 21
 
const short VisibleString = 26
 

Static Public Attributes

static new readonly Asn1Tag _TAG
 
- Static Public Attributes inherited from Asn1Type
static readonly Asn1Tag _TAG
 

Protected Member Functions

void Decode (Asn1DecodeBuffer buffer, int length, int baseflag)
 
void Decode (Asn1PerDecodeBuffer buffer, int baseflag)
 

Additional Inherited Members

- Properties inherited from Asn1Type
virtual String AsnTypeName [get]
 
virtual int Length [get]
 

Detailed Description

This class represents the ASN.1 REAL built-in type.

Constructor & Destructor Documentation

◆ Asn1Real() [1/2]

Asn1Real ( )

The default constructor sets the double value to zero.

◆ Asn1Real() [2/2]

Asn1Real ( double  value)

This constructor creates an REAL object from a double value.

Parameters
valuedouble value

Member Function Documentation

◆ Decode() [1/5]

void Decode ( Asn1DecodeBuffer  buffer,
int  length,
int  baseflag 
)
protected

This method decodes the content octets of an ASN.1 REAL value into this object, where the REAL was encoded as for BER and the length is taken to be as given.

Note that this method is used for OER also, since OER uses the same content octets as BER, at least in certain cases.

Parameters
bufferDecode message buffer object
lengthLength of contents
baseflagANY_BASE: encoding may use any base ANY_BINARY: encoding may any of bases 2, 8, 16 BASE_2_ONLY: encoding may only use base 2

References Diag.Prtln(), Asn1DecodeBuffer.Read(), Asn1DecodeBuffer.ReadByte(), Asn1Type.REAL, and Asn1MessageBufferBase.TypeCode.

◆ Decode() [2/5]

override void Decode ( Asn1BerDecodeBuffer  buffer,
bool  explicitTagging,
int  implicitLength 
)
virtual

This method decodes an ASN.1 REAL value including the UNIVERSAL tag value and length if explicit tagging is specified. This overloaded version uses the Basic Encoding Rules (BER).

Parameters
bufferDecode message buffer object
explicitTaggingFlag indicating element is explicitly tagged
implicitLengthLength of contents if implicit

Reimplemented from Asn1Type.

Reimplemented in Asn1RealBase2.

◆ Decode() [3/5]

void Decode ( Asn1PerDecodeBuffer  buffer,
int  baseflag 
)
protected

This method decodes ASN.1 REAL value using the Packed Encoding Rules (PER). The length and contents components of the message are decoded. The decoded result is stored in the public member 'mValue' in this object.

Parameters
bufferPER Decode message buffer object
baseflagANY_BASE: encoding may use base 2 or base 10 BASE_2_ONLY: encoding may only use base 2

◆ Decode() [4/5]

override void Decode ( Asn1PerDecodeBuffer  buffer)
virtual

This method decodes ASN.1 REAL value using the Packed Encoding Rules (PER). The length and contents components of the message are decoded. The decoded result is stored in the public member 'mValue' in this object.

Parameters
bufferPER Decode message buffer object

Reimplemented from Asn1Type.

Reimplemented in Asn1RealBase2.

◆ Decode() [5/5]

override void Decode ( Asn1OerDecodeBuffer  buffer)
virtual

Decode a REAL value, encoded according to OER, into this object.

This method applies to unconstrained REAL values and REAL values that are constrained but not meeting the requirements for encoding using IEEE 754 single or double precision format.

Parameters
buffer
Exceptions
IOException

Reimplemented from Asn1Type.

Reimplemented in Asn1RealBase2.

References Asn1OerDecodeBuffer.DecodeLength().

◆ DecodeDouble()

void DecodeDouble ( Asn1OerDecodeBuffer  buffer)

Decode a REAL value, encoded according to OER in double precision format.

Parameters
buffer
Exceptions
IOException

References Asn1DecodeBitBuffer.DecodeBitsToOctetArray().

◆ DecodeSingle()

void DecodeSingle ( Asn1OerDecodeBuffer  buffer)

Decode a REAL value, encoded according to OER in single precision format.

Parameters
buffer
Exceptions
IOException

References Asn1DecodeBitBuffer.DecodeBitsToOctetArray().

◆ DecodeXER()

virtual void DecodeXER ( System.String  buffer,
System.String  attrs,
bool  decodingElemName,
bool  modifiedEncodings 
)
virtual

This method decodes an ASN.1 real value using XER.

Parameters
bufferString containing data to be decoded
attrsAttributes string from element tag
decodingElemNamePass true if you the ASN.1 value being decoded was encoded as an empty element and buffer is the element name. Such an encoding occurs for the special real values under basic-XER, canonical-XER, and extended-XER without GLOBAL-DEFAULTS MODIFIED-ENCODINGS present.
modifiedEncodingsPass TRUE if decoding under extended-XER with GLOBAL-DEFAULTS MODIFIED-ENCODINGS present.

References Asn1XmlEncoder.EncodeEndElement(), and Asn1XmlEncoder.EncodeStartElement().

◆ DecodeXML()

override void DecodeXML ( System.String  buffer,
System.String  attrs 
)

This method decodes an ASN.1 real value using the XML schema encoding rules(asn2xsd).

Parameters
bufferString containing data to be decoded
attrsAttributes string from element tag

◆ Encode() [1/8]

override int Encode ( Asn1BerEncodeBuffer  buffer,
bool  explicitTagging 
)
virtual

This method encodes an ASN.1 REAL value including the UNIVERSAL tag value and length if explicit tagging is specified. This overloaded version uses the Basic Encoding Rules (BER).

Parameters
bufferEncode message buffer object
explicitTaggingFlag indicating explicit tagging should be done
Returns
Length of component or negative status value

Reimplemented from Asn1Type.

References Asn1EncodeBuffer.Copy(), Asn1PerDecodeBuffer.DecodeBitsToInt(), Asn1PerDecodeBuffer.DecodeBitsToLong(), Asn1PerDecodeBuffer.DecodeCharString(), Asn1PerDecodeBuffer.DecodeInt(), Asn1PerDecodeBuffer.DecodeLength(), Asn1EncodeBuffer.EncodeIntSigned(), Asn1EncodeBuffer.EncodeIntUnsigned(), Asn1BerEncodeBuffer.EncodeTagAndLength(), Asn1EncodeBuffer.GetMinimalOctetsSigned(), Asn1EncodeBuffer.GetMinimalOctetsUnsigned(), Diag.Prtln(), Asn1Type.REAL, Asn1MessageBufferBase.TypeCode, and Asn1Util.URShift().

◆ Encode() [2/8]

override void Encode ( Asn1PerEncodeBuffer  buffer)
virtual

This method encodes ASN.1 REAL value using the Packed Encoding Rules (PER). The length and contents components of the message are encoded.

Parameters
bufferPER Encode message buffer object

Reimplemented from Asn1Type.

References Asn1PerEncodeBuffer.EncodeBits(), Asn1PerEncodeBuffer.EncodeInt(), Asn1PerEncodeBuffer.EncodeLength(), Asn1Util.GetBytesCount(), Asn1Util.GetUlongBytesCount(), Asn1PerTraceHandler.NewBitField(), Diag.Prtln(), Asn1PerEncodeBuffer.TraceHandler, and Asn1Util.URShift().

◆ Encode() [3/8]

override void Encode ( Asn1OerEncodeBuffer  buffer)
virtual

Encode this REAL value, according to OER, into the buffer. This method applies to unconstrained REAL values and REAL values that are constrained but not meeting the requirements for encoding using IEEE 754 single or double precision format.

Reimplemented from Asn1Type.

References Asn1EncodeBuffer.Copy(), and Asn1OerEncodeBuffer.EncodeLength().

◆ Encode() [4/8]

override void Encode ( Asn1XerEncoder  buffer,
System.String  elemName 
)
virtual

This method encodes an ASN.1 real value using the XML encoding rules (XER).

Parameters
bufferEncode message buffer object
elemNameElement name

Reimplemented from Asn1Type.

◆ Encode() [5/8]

override void Encode ( Asn1XmlEncoder  buffer,
System.String  elemName,
System.String  nsPrefix 
)
virtual

This method encodes an ASN.1 real value according to Obj-Sys encoding rules. The value is encoded as text.

Parameters
bufferEncode message buffer object
elemNameElement name
nsPrefixElement namespace value

Reimplemented from Asn1Type.

◆ Encode() [6/8]

void Encode ( Asn1XmlEncoder  buffer,
String  elemName,
String  nsPrefix,
bool  asText 
)

This method encodes an ASN.1 real value according to XER encoding rules. It is for use with extended-XER.

Parameters
bufferEncode message buffer object
elemNameElement name
asTextIf TRUE, encode special values as text. Otherwise, special values are encoded as empty elements.

References Asn1XmlXerEncoder.Copy(), Asn1XmlEncoder.EncodeEmptyElement(), Asn1XmlEncoder.EncodeEndElement(), and Asn1XmlEncoder.EncodeStartElement().

◆ Encode() [7/8]

override void Encode ( Asn1BerOutputStream  outs,
bool  explicitTagging 
)
virtual

This method encodes and writes to the stream an ASN.1 real value including the UNIVERSAL tag value and length if explicit tagging is specified. This overloaded version uses the Basic Encoding Rules (BER).

Throws, Exception thrown by C# System.IO.Stream for I/O error

Parameters
outsBER Output Stream object
explicitTaggingFlag indicating explicit tagging should be done
Exceptions
Asn1ExceptionThrown, if operation is failed.

Reimplemented from Asn1Type.

◆ Encode() [8/8]

override void Encode ( Asn1PerOutputStream  outs)
virtual

This method encodes ASN.1 REAL value using the Packed Encoding Rules (PER). The length and contents components of the message are encoded.

Also throws any exception thrown by the Asn1PerOutputStream.

Parameters
outsPER Output Stream object
Exceptions
Asn1ExceptionThrown, if operation is failed.

Reimplemented from Asn1Type.

◆ EncodeAttribute()

override void EncodeAttribute ( Asn1XmlEncoder  buffer,
System.String  attrName 
)
virtual

This method encodes an ASN.1 real value using the XML Encoding as specified in the W3C XML schema standard(asn2xsd).

Parameters
bufferEncode message buffer object
attrNameAttribute name

Reimplemented from Asn1Type.

References Asn1XmlXerEncoder.Copy().

◆ EncodeDouble()

void EncodeDouble ( Asn1OerEncodeBuffer  buffer)

Encode this REAL value, according to OER, in double precision format, into the buffer.

Parameters
buffer
Exceptions
IOException

References Asn1EncodeBuffer.Copy(), and Asn1XerEncoder.EncodeRealValue().

◆ EncodeSingle()

void EncodeSingle ( Asn1OerEncodeBuffer  buffer)

Encode this REAL value, according to OER, in single precision format, into the buffer.

References Asn1EncodeBuffer.Copy().

◆ EncodeValue()

virtual void EncodeValue ( Asn1XmlEncoder  buffer)
virtual

This method encodes an ASN.1 real value using the XML encoding (non-XER).

Parameters
bufferEncode message buffer object

References Asn1XmlXerEncoder.Copy().

◆ Equals() [1/2]

virtual bool Equals ( double  value)
virtual

This method compares this REAL value to the given value for equality.

Parameters
valueThe double value to compare with the current Object.
Returns
true if the specified double value is equal to the current Object; otherwise, false.

◆ Equals() [2/2]

override bool Equals ( System.Object  value)

Determines whether the specified Object is equal to the current Object.

Parameters
valueThe Object to compare with the current Object. Object should be instance of Asn1Real.
Returns
true if the specified Object is equal to the current Object; otherwise, false.

References Asn1Real.mValue.

◆ GetHashCode()

override int GetHashCode ( )

Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.

Returns
A hash code for the current Object.

◆ NormalizedRealValueToString()

static System.String NormalizedRealValueToString ( double  value)
static

This method will return a string representation of the normalized REAL value.

The output format is value format [-]X.XXXXE[-]XXX.

The format is the ASN.1 value format for this type. This means it is a "NumericRealValue" as defined in X.680. Additionally, if there is a leading minus sign, there will be no whitespace between it and the first digit of the integer part, making it also an "XMLNumericRealValue".

Parameters
valuevalue to be normalized and stringified.
Returns
the string as described above

References Asn1BerOutputStream.EncodeIntValue(), Asn1BerOutputStream.EncodeLength(), Asn1BerOutputStream.EncodeTag(), Asn1BerOutputStream.EncodeUnsignedBinaryNumber(), Asn1Util.GetBytesCount(), Asn1Util.GetUlongBytesCount(), Asn1Tag.PRIM, Diag.Prtln(), Asn1Type.REAL, Asn1Tag.UNIV, Asn1Util.URShift(), and Asn1OutputStream.WriteByte().

Referenced by Asn1XmlUtil.EncodeDouble(), and Asn1XerUtil.EncodeReal().

◆ ToString()

override System.String ToString ( )

This method will return a string representation of the REAL value. The format is the ASN.1 value format for this type..

Returns
Stringified representation of the value

Member Data Documentation

◆ _TAG

new readonly Asn1Tag _TAG
static

The _TAG constant describes the universal tag for this data type (UNIVERSAL 9).

◆ mValue

double mValue

This public member variable is where the double value is stored. This is the value that is encoded when one of the encode methods is called. It is also where the decoded result is stored when a Decode method is called.

Referenced by Asn1Real.Equals().