ASN1C C/C++ Common Runtime  ASN1C v7.5.x
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members

#include <ASN1CBitStr.h>

Inheritance diagram for ASN1CBitStr:
ASN1CType

Public Member Functions

EXTRTMETHOD ASN1CBitStr (OSRTMessageBufferIF &msgbuf, OSSIZE nbits)
 
EXTRTMETHOD ASN1CBitStr (OSRTMessageBufferIF &msgbuf, OSOCTET *bitStr, OSUINT32 &numbits, OSSIZE maxNumbits_, OSOCTET **ppExtData=0)
 
EXTRTMETHOD ASN1CBitStr (OSRTMessageBufferIF &msgbuf, OSOCTET *bitStr, OSUINT8 &numbits, OSSIZE maxNumbits_, OSOCTET **ppExtData=0)
 
EXTRTMETHOD ASN1CBitStr (OSRTMessageBufferIF &msgbuf, OSOCTET *bitStr, OSUINT16 &numbits, OSSIZE maxNumbits_, OSOCTET **ppExtData=0)
 
EXTRTMETHOD ASN1CBitStr (OSRTMessageBufferIF &msgbuf, OSOCTET *bitStr, OSSIZE maxNumbits_)
 
EXTRTMETHOD ASN1CBitStr (OSRTMessageBufferIF &msgBuf, ASN1TDynBitStr &bitStr)
 
EXTRTMETHOD ASN1CBitStr (OSRTMessageBufferIF &msgBuf, ASN1TDynBitStr64 &bitStr)
 
EXTRTMETHOD ASN1CBitStr (OSRTContext &ctxt, OSSIZE nbits)
 
EXTRTMETHOD ASN1CBitStr (OSRTContext &ctxt, OSOCTET *bitStr, OSUINT32 &octsNumbits, OSSIZE maxNumbits_, OSOCTET **ppExtData=0)
 
EXTRTMETHOD ASN1CBitStr (OSRTContext &ctxt, OSOCTET *bitStr, OSUINT8 &octsNumbits, OSSIZE maxNumbits_, OSOCTET **ppExtData=0)
 
EXTRTMETHOD ASN1CBitStr (OSRTContext &ctxt, OSOCTET *bitStr, OSUINT16 &octsNumbits, OSSIZE maxNumbits_, OSOCTET **ppExtData=0)
 
EXTRTMETHOD ASN1CBitStr (OSRTContext &ctxt, OSOCTET *bitStr, OSSIZE maxNumbits_)
 
EXTRTMETHOD ASN1CBitStr (OSRTContext &ctxt, ASN1TDynBitStr &bitStr)
 
EXTRTMETHOD ASN1CBitStr (OSRTContext &ctxt, ASN1TDynBitStr64 &bitStr)
 
EXTRTMETHOD ASN1CBitStr (const ASN1CBitStr &bitStr)
 
EXTRTMETHOD ASN1CBitStr (const ASN1CBitStr &bitStr, OSBOOL extendable)
 
EXTRTMETHOD int set (OSSIZE bitIndex)
 
EXTRTMETHOD int set (OSSIZE fromIndex, OSSIZE toIndex)
 
int change (OSSIZE bitIndex, OSBOOL value)
 
EXTRTMETHOD int clear (OSSIZE bitIndex)
 
EXTRTMETHOD int clear (OSSIZE fromIndex, OSSIZE toIndex)
 
EXTRTMETHOD void clear ()
 
EXTRTMETHOD int invert (OSSIZE bitIndex)
 
EXTRTMETHOD int invert (OSSIZE fromIndex, OSSIZE toIndex)
 
EXTRTMETHOD OSBOOL get (OSSIZE bitIndex)
 
OSBOOL isSet (OSSIZE bitIndex)
 
OSBOOL isEmpty ()
 
EXTRTMETHOD OSSIZE size () const
 
EXTRTMETHOD OSSIZE length () const
 
EXTRTMETHOD OSSIZE cardinality () const
 
EXTRTMETHOD int getBytes (OSOCTET *pBuf, OSSIZE bufSz)
 
EXTRTMETHOD int get (OSSIZE fromIndex, OSSIZE toIndex, OSOCTET *pBuf, OSSIZE bufSz)
 
EXTRTMETHOD int doAnd (const OSOCTET *pOctstr, OSSIZE octsNumbits)
 
int doAnd (const ASN1TDynBitStr &bitStr)
 
int doAnd (const ASN1CBitStr &bitStr)
 
EXTRTMETHOD int doOr (const OSOCTET *pOctstr, OSSIZE octsNumbits)
 
int doOr (const ASN1TDynBitStr &bitStr)
 
int doOr (const ASN1CBitStr &bitStr)
 
EXTRTMETHOD int doXor (const OSOCTET *pOctstr, OSSIZE octsNumbits)
 
int doXor (const ASN1TDynBitStr &bitStr)
 
int doXor (const ASN1CBitStr &bitStr)
 
EXTRTMETHOD int doAndNot (const OSOCTET *pOctstr, OSSIZE octsNumbits)
 
int doAndNot (const ASN1TDynBitStr &bitStr)
 
int doAndNot (const ASN1CBitStr &bitStr)
 
EXTRTMETHOD int shiftLeft (OSSIZE shift)
 
EXTRTMETHOD int shiftRight (OSSIZE shift)
 
EXTRTMETHOD OSUINT32 unusedBitsInLastUnit ()
 
EXTRTMETHOD operator ASN1TDynBitStr ()
 
EXTRTMETHOD operator ASN1TDynBitStr * ()
 
- Public Member Functions inherited from ASN1CType
EXTRTMETHOD ASN1CType (OSRTMessageBufferIF &msgBuf)
 
EXTRTMETHOD ASN1CType (const ASN1CType &orig)
 
virtual ~ASN1CType ()
 
void append (OSRTDList &llist, void *pdata)
 
OSRTCtxtPtr getContext ()
 
OSCTXTgetCtxtPtr ()
 
char * getErrorText (char *textbuf=(char *) 0, OSSIZE bufsize=0)
 
int getStatus () const
 
void * memAlloc (OSSIZE numocts)
 
void * memAllocZ (OSSIZE numocts)
 
void memFreeAll ()
 
void * memRealloc (void *ptr, OSSIZE numocts)
 
void memReset ()
 
void memFreePtr (void *ptr)
 
void printErrorInfo ()
 
void resetError ()
 
OSBOOL setDiag (OSBOOL value)
 
virtual EXTRTMETHOD int Encode ()
 
virtual EXTRTMETHOD int Decode (OSBOOL free=FALSE)
 
virtual int EncodeTo (OSRTMessageBufferIF &)
 
virtual int DecodeFrom (OSRTMessageBufferIF &, OSBOOL free=TRUE)
 
virtual void MemFree ()
 

Protected Member Functions

EXTRTMETHOD ASN1CBitStr (OSRTMessageBufferIF &msgBuf)
 
EXTRTMETHOD ASN1CBitStr (OSRTContext &ctxt)
 
EXTRTMETHOD ASN1CBitStr (OSOCTET *pBits, OSUINT32 &numbits, OSSIZE maxNumbits, OSOCTET **ppExtData=0)
 
EXTRTMETHOD ASN1CBitStr (OSOCTET *pBits, OSUINT8 &numbits, OSSIZE maxNumbits, OSOCTET **ppExtData=0)
 
EXTRTMETHOD ASN1CBitStr (OSOCTET *pBits, OSUINT16 &numbits, OSSIZE maxNumbits, OSOCTET **ppExtData=0)
 
EXTRTMETHOD ASN1CBitStr (OSOCTET *pBits, OSSIZE maxNumbits)
 
EXTRTMETHOD ASN1CBitStr (ASN1TDynBitStr &bitStr)
 
EXTRTMETHOD ASN1CBitStr (ASN1TDynBitStr64 &bitStr)
 
void initBase (OSOCTET *pBits, OSSIZE numbits, OSSIZE maxNumbits)
 
EXTRTMETHOD void init (OSOCTET *pBits, OSUINT32 &numbits, OSSIZE maxNumbits)
 
EXTRTMETHOD void init (OSOCTET *pBits, OSUINT8 &numbits, OSSIZE maxNumbits)
 
EXTRTMETHOD void init (OSOCTET *pBits, OSUINT16 &numbits, OSSIZE maxNumbits)
 
EXTRTMETHOD void init (ASN1TDynBitStr &bitStr)
 
- Protected Member Functions inherited from ASN1CType
EXTRTMETHOD ASN1CType ()
 
EXTRTMETHOD ASN1CType (OSRTContext &ctxt)
 
EXTRTMETHOD int setMsgBuf (OSRTMessageBufferIF &msgBuf, OSBOOL initBuf=FALSE)
 
EXTRTMETHOD int setRunTimeKey (const OSOCTET *key, OSSIZE keylen)
 

Protected Attributes

OSOCTET ** mpUnits
 
OSOCTET ** mppExtData
 
OSSIZE mMaxNumBits
 
ASN1CBitStrSizeHoldermpNumBits
 
OSSIZE mUnitsUsed
 
OSSIZE mUnitsAllocated
 
OSBOOL mDynAlloc
 
- Protected Attributes inherited from ASN1CType
OSRTCtxtPtr mpContext
 
OSRTMessageBufferIF * mpMsgBuf
 

Detailed Description

ASN.1 bit string control class. The ASN1CBitStr class is derived from the ASN1CType base class. It is used as the base class for generated control classes for the ASN.1 BIT STRING type. This class provides utility methods for operating on the bit string referenced by the generated class. This class can also be used inline to operate on bits within generated BIT STRING elements in a SEQUENCE, SET, or CHOICE construct.

Constructor & Destructor Documentation

◆ ASN1CBitStr() [1/2]

EXTRTMETHOD ASN1CBitStr::ASN1CBitStr ( OSRTMessageBufferIF &  msgbuf,
OSSIZE  nbits 
)

This constructor creates an empty bit string. If the nbits argument is zero, the bit string is set to be dynamic; otherwise, the capacity is set to nbits.

Parameters
msgbuf- ASN.1 message buffer or stream object.
nbits- Number of bits this bit string can contain (zero if unbounded.

◆ ASN1CBitStr() [2/2]

EXTRTMETHOD ASN1CBitStr::ASN1CBitStr ( OSRTMessageBufferIF &  msgbuf,
OSOCTET *  bitStr,
OSUINT32 &  numbits,
OSSIZE  maxNumbits_,
OSOCTET **  ppExtData = 0 
)

This constructor creates a bit string from an array of bits. The constructor does not copy the bit string data, it just references the given data variables. All operations on the bit string cause the referenced items to be updated directly.

Parameters
msgbuf- ASN.1 message buffer or stream object.
bitStr- Pointer to static byte array
numbits- Reference to length of bit string (in bits)
maxNumbits_- sets maximum length in bits

Member Function Documentation

◆ cardinality()

EXTRTMETHOD OSSIZE ASN1CBitStr::cardinality ( ) const

This method calculates the cardinality of the target bit string.

Cardinality of the bit string is the number of bits set to 1.

Parameters
-none
Returns
The number of bytes of space actually in use by this bit string to represent the bit values.

◆ change()

int ASN1CBitStr::change ( OSSIZE  bitIndex,
OSBOOL  value 
)
inline

Changes the bit at the specified index to the specified value.

Parameters
bitIndexRelative index of bit to set in string. Bit index 0 refers to the MS bit (bit 8) in the first octet. The index values then progress from left to right (MS to LS bits).
valueBoolean value to which the bit is to be set.
Returns
Completion status of operation: 0 - if succeed
  • 0 (0) = success
  • negative return value is error.

◆ clear() [1/3]

EXTRTMETHOD int ASN1CBitStr::clear ( OSSIZE  bitIndex)

This version of the clear method sets the given bit in the target string to zero.

Parameters
bitIndexRelative index of bit in string. Bit index 0 refers to the MS bit (bit 8) in the first octet. The index values then progress from left to right (MS to LS bits).
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

◆ clear() [2/3]

EXTRTMETHOD int ASN1CBitStr::clear ( OSSIZE  fromIndex,
OSSIZE  toIndex 
)

This version of the clear method sets the bits from the specified fromIndex (inclusive) to the specified toIndex (exclusive) to zero.

Parameters
fromIndexRelative start index (inclusive) of bits in string. Bit index 0 refers to the MS bit (bit 8) in the first octet. The index values then progress from left to right (MS to LS bits).
toIndexRelative end index (exclusive) of bits in string. Bit index 0 refers to the MS bit (bit 8) in the first octet. The index values then progress from left to right (MS to LS bits).
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

◆ clear() [3/3]

EXTRTMETHOD void ASN1CBitStr::clear ( )

This version of the clear method sets all bits in the bit string to zero.

Parameters
-none
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

◆ doAnd() [1/3]

EXTRTMETHOD int ASN1CBitStr::doAnd ( const OSOCTET *  pOctstr,
OSSIZE  octsNumbits 
)

Performs a logical AND of this target bit set with the argument bit set.

Returns: 0 - if succeed, or ASN_E_INVLEN - if 'octsNumbits' is negative, or RTERR_INVPARAM - if pOctstr is the same bit string as this or null, or other error codes (see asn1type.h).

Parameters
pOctstrA pointer to octets of another bit string for performing logical operation.
octsNumbitsA number of bits in arguent bit string.
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

◆ doAnd() [2/3]

int ASN1CBitStr::doAnd ( const ASN1TDynBitStr bitStr)
inline

This method performs a logical AND of the target bit string with the argument bit string.

Parameters
bitStrA reference t another bit string represented by ASN1TDynBitStr type for performing logical operation.
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

◆ doAnd() [3/3]

int ASN1CBitStr::doAnd ( const ASN1CBitStr bitStr)
inline

This method performs a logical AND of the target bit string with the argument bit string.

Parameters
bitStrA reference to another bit string represented by ASN1CBitStr type for performing logical operation.
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

References length().

◆ doAndNot() [1/3]

EXTRTMETHOD int ASN1CBitStr::doAndNot ( const OSOCTET *  pOctstr,
OSSIZE  octsNumbits 
)

This method performs a logical ANDNOT of the target bit string with the argument bit string.

Logical ANDNOT clars all of the bits in this bit string whose corresponding bit is set in the specified bit string.

Parameters
pOctstrA pointer to octets of another bit string for performing logical operation.
octsNumbitsA number of bits in arguent bit string.
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

◆ doAndNot() [2/3]

int ASN1CBitStr::doAndNot ( const ASN1TDynBitStr bitStr)
inline

This method performs a logical ANDNOT of the target bit string with the argument bit string.

Logical ANDNOT clears all of the bits in this bit string whose corresponding bit is set in the specified bit string.

Parameters
bitStrA reference t another bit string represented by ASN1TDynBitStr type for performing logical operation.
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

◆ doAndNot() [3/3]

int ASN1CBitStr::doAndNot ( const ASN1CBitStr bitStr)
inline

This method performs a logical ANDNOT of the target bit string with the argument bit string.

Logical ANDNOT clears all of the bits in this bit string whose corresponding bit is set in the specified bit string.

Parameters
bitStrA reference to another bit string represented by ASN1CBitStr type for performing logical operation.
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

References length().

◆ doOr() [1/3]

EXTRTMETHOD int ASN1CBitStr::doOr ( const OSOCTET *  pOctstr,
OSSIZE  octsNumbits 
)

Performs a logical OR of this target bit set with the argument bit set.

Returns: 0 - if succeed, or ASN_E_INVLEN - if 'octsNumbits' is negative, or RTERR_INVPARAM - if pOctstr is the same bit string as this or null, or other error codes (see asn1type.h).

Parameters
pOctstrA pointer to octets of another bit string for performing logical operation.
octsNumbitsA number of bits in arguent bit string.
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

◆ doOr() [2/3]

int ASN1CBitStr::doOr ( const ASN1TDynBitStr bitStr)
inline

This method performs a logical OR of the target bit string with the argument bit string.

Parameters
bitStrA reference t another bit string represented by ASN1TDynBitStr type for performing logical operation.
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

◆ doOr() [3/3]

int ASN1CBitStr::doOr ( const ASN1CBitStr bitStr)
inline

This method performs a logical OR of the target bit string with the argument bit string.

Parameters
bitStrA reference to another bit string represented by ASN1CBitStr type for performing logical operation.
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

References length().

◆ doXor() [1/3]

EXTRTMETHOD int ASN1CBitStr::doXor ( const OSOCTET *  pOctstr,
OSSIZE  octsNumbits 
)

Performs a logical XOR of this target bit set with the argument bit set.

Returns: 0 - if succeed, or ASN_E_INVLEN - if 'octsNumbits' is negative, or RTERR_INVPARAM - if pOctstr is null, or other error codes (see asn1type.h).

Parameters
pOctstrA pointer to octets of another bit string for performing logical operation.
octsNumbitsA number of bits in arguent bit string.
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

◆ doXor() [2/3]

int ASN1CBitStr::doXor ( const ASN1TDynBitStr bitStr)
inline

This method performs a logical XOR of the target bit string with the argument bit string.

Parameters
bitStrA reference t another bit string represented by ASN1TDynBitStr type for performing logical operation.
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

◆ doXor() [3/3]

int ASN1CBitStr::doXor ( const ASN1CBitStr bitStr)
inline

This method performs a logical OR of the target bit string with the argument bit string.

Parameters
bitStrA reference to another bit string represented by ASN1CBitStr type for performing logical operation.
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

References length().

◆ get() [1/2]

EXTRTMETHOD OSBOOL ASN1CBitStr::get ( OSSIZE  bitIndex)

This method returns the value of the bit with the specified index.

Parameters
bitIndexRelative index of bit in string. Bit index 0 refers to the MS bit (bit 8) in the first octet. The index values then progress from left to right (MS to LS bits).
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

◆ get() [2/2]

EXTRTMETHOD int ASN1CBitStr::get ( OSSIZE  fromIndex,
OSSIZE  toIndex,
OSOCTET *  pBuf,
OSSIZE  bufSz 
)

This version of the get method copies the bit string composed of bits from this bit string from the specified fromIndex (inclusive) to the specified toIndex (exclusive) into the given buffer.

Parameters
fromIndexRelative start index (inclusive) of bits in string. Bit index 0 refers to the MS bit (bit 8) in the first octet. The index values then progress from left to right (MS to LS bits).
toIndexRelative end index (exclusive) of bits in string. Bit index 0 refers to the MS bit (bit 8) in the first octet. The index values then progress from left to right (MS to LS bits).
pBufPointer to destination buffer where bytes will be copied.
bufSzSize of the destination buffer. If the size of the buffer is not large enough to receive the entire bit string, a negative status value (RTERR_BUFOVFLOW) will be returned.
Returns
Completion status of operation:
  • 0 (0) = success,
  • RTERR_OUTOFBND index value is out of bounds
  • RTERR_RANGERR fromIndex > toIndex
  • other error codes (see asn1type.h).

◆ getBytes()

EXTRTMETHOD int ASN1CBitStr::getBytes ( OSOCTET *  pBuf,
OSSIZE  bufSz 
)

This method copies the bit string to the given buffer.

Parameters
pBufPointer to the destination buffer where bytes will be copied.
bufSzSize of the destination buffer. If the size of the buffer is not large enough to receive the entire bit string, a negative status value (RTERR_BUFOVFLOW) will be returned.
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

◆ invert() [1/2]

EXTRTMETHOD int ASN1CBitStr::invert ( OSSIZE  bitIndex)

This version of the invert method inverts the given bit in the target string.

If the bit in the bit string is a zero, it will be set to 1; if the bit is a one, it will be set to 0.

Parameters
bitIndexRelative index of bit in string. Bit index 0 refers to the MS bit (bit 8) in the first octet. The index values then progress from left to right (MS to LS bits).
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

◆ invert() [2/2]

EXTRTMETHOD int ASN1CBitStr::invert ( OSSIZE  fromIndex,
OSSIZE  toIndex 
)

This version inverts the bits from the specified fromIndex (inclusive) to the specified toIndex (exclusive).

If the bit in the bit string is a zero, it will be set to 1; if the bit is a one, it will be set to 0.

Parameters
fromIndexRelative start index (inclusive) of bits in string. Bit index 0 refers to the MS bit (bit 8) in the first octet. The index values then progress from left to right (MS to LS bits).
toIndexRelative end index (exclusive) of bits in string. Bit index 0 refers to the MS bit (bit 8) in the first octet. The index values then progress from left to right (MS to LS bits).
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

◆ isEmpty()

OSBOOL ASN1CBitStr::isEmpty ( )
inline

This method returns TRUE if this bit string contains no bits that are set to 1.

Parameters
-none
Returns
TRUE, if the bit string contains no bits that are set to 1.

◆ isSet()

OSBOOL ASN1CBitStr::isSet ( OSSIZE  bitIndex)
inline

This method is the same as ASN1CBitStr::get.

See also
get (OSSIZE bitIndex)

◆ length()

EXTRTMETHOD OSSIZE ASN1CBitStr::length ( ) const

This method calculates the "logical size" of the bit string.

The "logical size" is calculated by noting the index of the highest set bit in the bit string, plus one. Zero will be returned if the bit string contains no set bits. The highest bit in the bit string is the least significant bit in the last octet set to 1.

Parameters
-none
Returns
Returns the "logical size" of this bit string.

Referenced by doAnd(), doAndNot(), doOr(), and doXor().

◆ operator ASN1TDynBitStr()

EXTRTMETHOD ASN1CBitStr::operator ASN1TDynBitStr ( )

This method returns a filled ANSDITDynBitStr variable.

Memory is not allocated when calling this method; only a pointer is assigned. Thus, the ASN1TDynBitStr variable is only valid while this ASN1CBitStr is in scope, and could become invalid if this object is modified. Upon return, retval.data will point to this bit string and retval.numbits will equal length().

Do not call this function if length() is outside the range of OSUINT32.

Parameters
-none
Returns
Filled ASN1TDynBitStr.

◆ operator ASN1TDynBitStr *()

EXTRTMETHOD ASN1CBitStr::operator ASN1TDynBitStr * ( )

This method returns a pointer to a newly allocated ASN1TDynBitStr object. Upon return, retval->data will point to newly allocated copy of the data in this bit string and retval->numbits will equal length().

Do not call this function if length() is outside the range of OSUINT32.

Memory for the ASN1DynBitStr variable is alloced using memory memAlloc and bits are copied into it.

Parameters
-none
Returns
Pointer to a filled ASN1TDynBitStr.

◆ set() [1/2]

EXTRTMETHOD int ASN1CBitStr::set ( OSSIZE  bitIndex)

This version of the set method sets the given bit in the target string.

Parameters
bitIndexRelative index of the bit to set in the string. The bit idex 0 refers to the MS bit (bit 8) in the first octet. The index values then progress from the left to right (MS to LS).
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

◆ set() [2/2]

EXTRTMETHOD int ASN1CBitStr::set ( OSSIZE  fromIndex,
OSSIZE  toIndex 
)

This version of teh set method sets the bits from the specified fromIndex (inclusive) to the specified toIndex (exclusive) to one.

Parameters
fromIndexRelative start index (inclusive) of bits in the string. The bit index 0 refers to the MS bit (bit 8) in the first octet. The index values then progress from the left to right (MS to LS).
toIndexRelative end index (exclusive) of bits in the string. The bit index 0 refers to the MS bit (bit 8) in the first octet. The index values then progress from the left to right (MS to LS).
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

◆ shiftLeft()

EXTRTMETHOD int ASN1CBitStr::shiftLeft ( OSSIZE  shift)

This method shifts all bits to the left by the number of specified in the shift operand.

If the bit string can dynamically grow, then the length of the bit string will be decreased by shift bits. Otherwise, bits that are shifted into the bitstring are filled with zeros from the right. Most left bits are lost.

Parameters
shiftNumber of bits to be shifted.
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

◆ shiftRight()

EXTRTMETHOD int ASN1CBitStr::shiftRight ( OSSIZE  shift)

This method shifts all bits to the right by the number of specified in the shift operand.

If the bit string can dynamically grow, then the length of the bit string will be decreased by shift bits. Otherwise, bits that are shifted into the bitstring are filled with zeros from the left. Most right bits are lost.

Parameters
shiftNumber of bits to be shifted.
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

◆ size()

EXTRTMETHOD OSSIZE ASN1CBitStr::size ( ) const

This method returns the number of bytes of space actually in use by this bit string to represent bit values.

Parameters
-none
Returns
Number of bytes of space actually in use by this bit string to represent bit values.

◆ unusedBitsInLastUnit()

EXTRTMETHOD OSUINT32 ASN1CBitStr::unusedBitsInLastUnit ( )

This method returns the number of unused bits in the last octet.

Returns
Number of bits in the last octet. It is equal to length() % 8.

The documentation for this class was generated from the following file: