PTLib  Version 2.10.11
PASN_BitString Class Reference

Class for ASN Bit String type. More...

#include <asner.h>

Inheritance diagram for PASN_BitString:
PASN_ConstrainedObject PASN_Object PObject

Public Member Functions

 PASN_BitString (unsigned nBits=0, const BYTE *buf=NULL)
 
 PASN_BitString (unsigned tag, TagClass tagClass, unsigned nBits=0)
 
 PASN_BitString (const PASN_BitString &other)
 
PASN_BitStringoperator= (const PASN_BitString &other)
 
void SetData (unsigned nBits, const PBYTEArray &bytes)
 
void SetData (unsigned nBits, const BYTE *buf, PINDEX size=0)
 
const BYTE * GetDataPointer () const
 
unsigned GetSize () const
 
PBoolean SetSize (unsigned nBits)
 
bool operator[] (PINDEX bit) const
 
void Set (unsigned bit)
 
void Clear (unsigned bit)
 
void Invert (unsigned bit)
 
virtual Comparison Compare (const PObject &obj) const
 Compare the two objects and return their relative rank. More...
 
virtual PObjectClone () const
 Create a copy of the class on the heap. More...
 
virtual void PrintOn (ostream &strm) const
 Output the contents of the object to the stream. More...
 
virtual void SetConstraintBounds (ConstraintType type, int lower, unsigned upper)
 
virtual PString GetTypeAsString () const
 Return a string giving the type of the object. More...
 
virtual PINDEX GetDataLength () const
 
virtual PBoolean Decode (PASN_Stream &)
 
virtual void Encode (PASN_Stream &) const
 
PBoolean DecodeBER (PBER_Stream &strm, unsigned len)
 
void EncodeBER (PBER_Stream &strm) const
 
PBoolean DecodePER (PPER_Stream &strm)
 
void EncodePER (PPER_Stream &strm) const
 
PBoolean DecodeSequenceExtensionBitmap (PPER_Stream &strm)
 
void EncodeSequenceExtensionBitmap (PPER_Stream &strm) const
 
- Public Member Functions inherited from PASN_ConstrainedObject
PBoolean IsConstrained () const
 
int GetLowerLimit () const
 
unsigned GetUpperLimit () const
 
PBoolean ConstrainedLengthDecode (PPER_Stream &strm, unsigned &length)
 
void ConstrainedLengthEncode (PPER_Stream &strm, unsigned length) const
 
PBoolean ConstraintEncode (PPER_Stream &strm, unsigned value) const
 
- Public Member Functions inherited from PASN_Object
PINDEX GetObjectLength () const
 
virtual PBoolean IsPrimitive () const
 
PBoolean IsExtendable () const
 
void SetExtendable (PBoolean ext=true)
 
TagClass GetTagClass () const
 
unsigned GetTag () const
 
virtual void SetTag (unsigned newTag, TagClass tagClass=DefaultTagClass)
 
void SetConstraints (ConstraintType type, int value)
 
void SetConstraints (ConstraintType, int lower, MaximumValueTag)
 
void SetConstraints (ConstraintType, MinimumValueTag lower, unsigned upper)
 
void SetConstraints (ConstraintType, MinimumValueTag lower, MaximumValueTag upper)
 
void SetConstraints (ConstraintType type, int lower, unsigned upper)
 
virtual void SetCharacterSet (ConstraintType ctype, const char *charSet)
 
virtual void SetCharacterSet (ConstraintType ctype, unsigned firstChar, unsigned lastChar)
 
- Public Member Functions inherited from PObject
virtual ~PObject ()
 
virtual PINDEX HashFunction () const
 This function yields a hash value required by the PDictionary class. More...
 
virtual Comparison CompareObjectMemoryDirect (const PObject &obj) const
 Determine the byte wise comparison of two objects. More...
 
bool operator== (const PObject &obj) const
 Compare the two objects. More...
 
bool operator!= (const PObject &obj) const
 Compare the two objects. More...
 
bool operator< (const PObject &obj) const
 Compare the two objects. More...
 
bool operator> (const PObject &obj) const
 Compare the two objects. More...
 
bool operator<= (const PObject &obj) const
 Compare the two objects. More...
 
bool operator>= (const PObject &obj) const
 Compare the two objects. More...
 
virtual const char * GetClass (unsigned ancestor=0) const
 Get the current dynamic type of the object instance. More...
 
PBoolean IsClass (const char *cls) const
 
virtual PBoolean InternalIsDescendant (const char *clsName) const
 Determine if the dynamic type of the current instance is a descendent of the specified class. More...
 
virtual void ReadFrom (istream &strm)
 Input the contents of the object from the stream. More...
 

Protected Attributes

unsigned totalBits
 
PBYTEArray bitData
 
- Protected Attributes inherited from PASN_ConstrainedObject
ConstraintType constraint
 
int lowerLimit
 
unsigned upperLimit
 
- Protected Attributes inherited from PASN_Object
PBoolean extendable
 PER extension capability. More...
 
TagClass tagClass
 BER tag class. More...
 
unsigned tag
 ASN object tag. More...
 

Additional Inherited Members

- Public Types inherited from PASN_Object
enum  TagClass {
  UniversalTagClass, ApplicationTagClass, ContextSpecificTagClass, PrivateTagClass,
  DefaultTagClass
}
 
enum  UniversalTags {
  InvalidUniversalTag, UniversalBoolean, UniversalInteger, UniversalBitString,
  UniversalOctetString, UniversalNull, UniversalObjectId, UniversalObjectDescriptor,
  UniversalExternalType, UniversalReal, UniversalEnumeration, UniversalEmbeddedPDV,
  UniversalSequence = 16, UniversalSet, UniversalNumericString, UniversalPrintableString,
  UniversalTeletexString, UniversalVideotexString, UniversalIA5String, UniversalUTCTime,
  UniversalGeneralisedTime, UniversalGeneralizedTime = UniversalGeneralisedTime, UniversalGraphicString, UniversalVisibleString,
  UniversalGeneralString, UniversalUniversalString, UniversalBMPString = 30
}
 
enum  ConstraintType { Unconstrained, PartiallyConstrained, FixedConstraint, ExtendableConstraint }
 
enum  MinimumValueTag { MinimumValue = INT_MIN }
 
enum  MaximumValueTag { MaximumValue = INT_MAX }
 
- Public Types inherited from PObject
enum  Comparison { LessThan = -1, EqualTo = 0, GreaterThan = 1 }
 Result of the comparison operation performed by the Compare() function. More...
 
- Static Public Member Functions inherited from PASN_Object
static PINDEX GetMaximumArraySize ()
 
static void SetMaximumArraySize (PINDEX sz)
 
static PINDEX GetMaximumStringSize ()
 
static void SetMaximumStringSize (PINDEX sz)
 
- Static Public Member Functions inherited from PObject
static Comparison InternalCompareObjectMemoryDirect (const PObject *obj1, const PObject *obj2, PINDEX size)
 Internal function caled from CompareObjectMemoryDirect() More...
 
static const char * Class ()
 Get the name of the class as a C string. More...
 
- Protected Member Functions inherited from PASN_ConstrainedObject
 PASN_ConstrainedObject (unsigned tag, TagClass tagClass)
 
- Protected Member Functions inherited from PASN_Object
 PASN_Object (unsigned tag, TagClass tagClass, PBoolean extend=false)
 
- Protected Member Functions inherited from PObject
 PObject ()
 Constructor for PObject, made protected so cannot ever create one on its own. More...
 

Detailed Description

Class for ASN Bit String type.

Constructor & Destructor Documentation

PASN_BitString::PASN_BitString ( unsigned  nBits = 0,
const BYTE *  buf = NULL 
)
PASN_BitString::PASN_BitString ( unsigned  tag,
TagClass  tagClass,
unsigned  nBits = 0 
)
PASN_BitString::PASN_BitString ( const PASN_BitString other)

Member Function Documentation

void PASN_BitString::Clear ( unsigned  bit)
virtual PObject* PASN_BitString::Clone ( ) const
virtual

Create a copy of the class on the heap.

The exact semantics of the descendent class determine what is required to make a duplicate of the instance. Not all classes can even do a clone operation.

The main user of the clone function is the PDictionary class as it requires copies of the dictionary keys.

The default behaviour is for this function to assert.

Returns
pointer to new copy of the class instance.

Reimplemented from PObject.

virtual Comparison PASN_BitString::Compare ( const PObject obj) const
virtual

Compare the two objects and return their relative rank.

This function is usually overridden by descendent classes to yield the ranking according to the semantics of the object.

The default function is to use the CompareObjectMemoryDirect() function to do a byte wise memory comparison of the two objects.

Returns
LessThan, EqualTo or GreaterThan according to the relative rank of the objects.

Reimplemented from PObject.

virtual PBoolean PASN_BitString::Decode ( PASN_Stream )
virtual

Implements PASN_Object.

PBoolean PASN_BitString::DecodeBER ( PBER_Stream &  strm,
unsigned  len 
)
PBoolean PASN_BitString::DecodePER ( PPER_Stream &  strm)
PBoolean PASN_BitString::DecodeSequenceExtensionBitmap ( PPER_Stream &  strm)
virtual void PASN_BitString::Encode ( PASN_Stream ) const
virtual

Implements PASN_Object.

void PASN_BitString::EncodeBER ( PBER_Stream &  strm) const
void PASN_BitString::EncodePER ( PPER_Stream &  strm) const
void PASN_BitString::EncodeSequenceExtensionBitmap ( PPER_Stream &  strm) const
virtual PINDEX PASN_BitString::GetDataLength ( ) const
virtual

Implements PASN_Object.

const BYTE* PASN_BitString::GetDataPointer ( ) const
inline
virtual PString PASN_BitString::GetTypeAsString ( ) const
virtual

Return a string giving the type of the object.

Implements PASN_Object.

void PASN_BitString::Invert ( unsigned  bit)
PASN_BitString& PASN_BitString::operator= ( const PASN_BitString other)
bool PASN_BitString::operator[] ( PINDEX  bit) const
virtual void PASN_BitString::PrintOn ( ostream &  strm) const
virtual

Output the contents of the object to the stream.

The exact output is dependent on the exact semantics of the descendent class. This is primarily used by the standard operator<< function.

The default behaviour is to print the class name.

Reimplemented from PObject.

void PASN_BitString::Set ( unsigned  bit)
virtual void PASN_BitString::SetConstraintBounds ( ConstraintType  type,
int  lower,
unsigned  upper 
)
virtual

Reimplemented from PASN_ConstrainedObject.

void PASN_BitString::SetData ( unsigned  nBits,
const PBYTEArray bytes 
)
void PASN_BitString::SetData ( unsigned  nBits,
const BYTE *  buf,
PINDEX  size = 0 
)
PBoolean PASN_BitString::SetSize ( unsigned  nBits)

Member Data Documentation

PBYTEArray PASN_BitString::bitData
protected
unsigned PASN_BitString::totalBits
protected

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