C12Adapter Opensource C++ Interface
MIso8825 Class Reference

A set of utilities to work with ISO 8825 data types. More...

Inheritance diagram for MIso8825:

Public Types

enum  {
  LongestUidBinarySize = 64,
  LongestUidStringSize = 128,
  ShortestUidStringSize = 2
}
 

Static Public Member Functions

static bool IsTagRelative (char tag)
 Return true if the ISO8825 Universal Identifier tag stands for relative identifier. More...
 
static bool IsUidRelative (const MStdString &uid)
 True will mean the given UID string is relative. More...
 
static unsigned DecodeShortLength (char tag)
 Return short length of the data decoded according to ISO 8825 rules. More...
 
static unsigned DecodeLengthFromBuffer (const char *buff, unsigned size, unsigned *runningIndex=NULL)
 Return length of the data decoded according to ISO 8825 rules, which is either a short length, or a long length. More...
 
static unsigned DecodeLength (const MByteString &byteString)
 Return length of the data decoded according to ISO 8825 rules, which is either a short length, or a long length. More...
 
static unsigned DecodedLengthByteSize (const MByteString &byteString)
 Return the size of the length. More...
 
static unsigned EncodeLengthIntoBuffer (unsigned len, char *buff)
 Return length of the data encoded according to ISO 8825 rules, use the given buffer. More...
 
static MByteString EncodeLength (unsigned len)
 Return length of the data encoded according to ISO 8825 rules. More...
 
static void DecodeUidFromBuffer (MStdString &result, const char *uidBegin, unsigned length, bool isRelative)
 Return a string representation of the universal identifier, using pointer to denote start of the identifier. More...
 
static MStdString DecodeUid (const MByteString &uid, bool isRelative)
 Return a string representation of the whole packed ISO 8825 universal identifier. More...
 
static unsigned EncodeUidIntoBuffer (const MStdString &str, char *buff)
 Return a packed binary representation from the ISO 8825 universal identifier given as a string. More...
 
static MByteString EncodeUid (const MStdString &str)
 Return a packed binary representation from the ISO 8825 universal identifier given as a string. More...
 
static unsigned EncodeTaggedUidIntoBuffer (char acseTag, const MStdString &str, char *buff)
 Return a tagged packed binary representation from the ISO 8825 universal identifier given as a string. More...
 
static unsigned EncodeTaggedUnsignedIntoBuffer (char acseTag, unsigned value, char *buff)
 Return a tagged packed binary representation of a given unsigned number. More...
 
static M_NORETURN_FUNC void ThrowBadISOLength ()
 Throws 'ISO length is bad' exception.
 
- Static Public Member Functions inherited from MObject
static const MClassGetStaticClass ()
 Get the declared class of this particular object. More...
 
static bool IsClassPresent (const MStdString &name)
 Tells if the given class name is available. More...
 

Additional Inherited Members

- Public Member Functions inherited from MObject
virtual ~MObject ()
 Object destructor.
 
virtual const MClassGetClass () const =0
 Get the final class of the object. More...
 
virtual unsigned GetEmbeddedSizeof () const
 For embedded object types, return the size of the class. More...
 
bool IsEmbeddedObject () const
 Tell if the object is of embedded kind. More...
 
SHOW_INTERNAL MVariant Call (const MStdString &name, const MVariant &params)
 Call the object service with parameters, given as variant. More...
 
MVariant Call0 (const MStdString &name)
 Call the object service with no parameters. More...
 
MVariant Call1 (const MStdString &name, const MVariant &p1)
 Call the object service with one parameter. More...
 
MVariant Call2 (const MStdString &name, const MVariant &p1, const MVariant &p2)
 Call the object service with two parameter. More...
 
MVariant Call3 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3)
 Call the object service with three parameter. More...
 
MVariant Call4 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3, const MVariant &p4)
 Call the object service with four parameter. More...
 
MVariant Call5 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3, const MVariant &p4, const MVariant &p5)
 Call the object service with five parameter. More...
 
MVariant Call6 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3, const MVariant &p4, const MVariant &p5, const MVariant &p6)
 Call the object service with six parameter. More...
 
virtual MVariant CallV (const MStdString &name, const MVariant::VariantVector &params)
 Call the object service with parameters, given as variant vector. More...
 
virtual bool IsPropertyPresent (const MStdString &name) const
 Tell if the property with the given name exists.
 
virtual bool IsServicePresent (const MStdString &name) const
 Tell if the service with the given name exists.
 
virtual MVariant GetProperty (const MStdString &name) const
 Get the property value using name of the property. More...
 
virtual void SetProperty (const MStdString &name, const MVariant &value)
 Set the property using name of the property, and value. More...
 
virtual MStdStringVector GetAllPropertyNames () const
 Return the list of publicly available properties, persistent or not. More...
 
virtual MStdStringVector GetAllPersistentPropertyNames () const
 Return the list of persistent properties. More...
 
virtual void SetPersistentPropertiesToDefault ()
 Set the persistent properties of the object to their default values. More...
 
virtual MVariant GetPersistentPropertyDefaultValue (const MStdString &name) const
 Get the default value of persistent property with the name given. More...
 
virtual void SetPersistentPropertyToDefault (const MStdString &name)
 Set the persistent property with the name given to default value. More...
 
virtual const char * GetType () const
 Get the name of the type for the object (could be the same as class name).
 
virtual void SetType (const MStdString &)
 Intentionally, it will set the name of the type for the object, but the service will not allow setting the name to anything other than the current name. More...
 
virtual void Validate ()
 Validate internal structures of the object. More...
 
- Static Public Attributes inherited from MObject
static const MClass s_class
 Class of MObject.
 
- Protected Member Functions inherited from MObject
 MObject ()
 Object constructor, protected as the class is abstract.
 
void DoSetPersistentPropertiesToDefault (const MClass *staticClass)
 Set the persistent properties to their default values for one object provided the class for that object. More...
 

Detailed Description

A set of utilities to work with ISO 8825 data types.

Member Enumeration Documentation

anonymous enum
Enumerator
LongestUidBinarySize 

Longest size of binary representation of UID.

LongestUidStringSize 

Longest size of string representation of UID.

ShortestUidStringSize 

Shortest size of string representation of UID.

Member Function Documentation

static unsigned MIso8825::DecodedLengthByteSize ( const MByteString byteString)
static

Return the size of the length.

Use this method together with DecodeLength.

Precondition
The length should have proper format, and it should not be bigger than four bytes, otherwise an exception is thrown.
static unsigned MIso8825::DecodeLength ( const MByteString byteString)
static

Return length of the data decoded according to ISO 8825 rules, which is either a short length, or a long length.

Use the given string as the source. The given string can be longer than length. Use DecodedLengthByteSize to determine how long is the length in the given byte string.

Precondition
The length should have proper format, and it should not be bigger than four bytes, otherwise an exception is thrown.
static unsigned MIso8825::DecodeLengthFromBuffer ( const char *  buff,
unsigned  size,
unsigned *  runningIndex = NULL 
)
static

Return length of the data decoded according to ISO 8825 rules, which is either a short length, or a long length.

Use buffer, buffer size, and running index in the buffer.

Precondition
The length should have proper format, and it should not be bigger than four bytes, otherwise an exception is thrown.
static unsigned MIso8825::DecodeShortLength ( char  tag)
static

Return short length of the data decoded according to ISO 8825 rules.

Parameters
tagISO 8825 length, its byte value shall not have the upper bit set, otherwise an exception is thrown.
static MStdString MIso8825::DecodeUid ( const MByteString uid,
bool  isRelative 
)
static

Return a string representation of the whole packed ISO 8825 universal identifier.

This call interprets the start character, length and the body of the universal identifier.

The identifier returned for A2 0B A2 09 2A 86 48 CE 52 03 38 AA 4E would be 1.2.840.10066.3.56.5454.

Precondition
The universal identifier in the binary data is correct, otherwise an exception is thrown.
static void MIso8825::DecodeUidFromBuffer ( MStdString result,
const char *  uidBegin,
unsigned  length,
bool  isRelative 
)
static

Return a string representation of the universal identifier, using pointer to denote start of the identifier.

This call interprets only the universal identifier. Length shall be parsed separately.

The identifier returned for A2 0B A2 09 2A 86 48 CE 52 03 38 AA 4E would be 1.2.840.10066.3.56.5454.

Precondition
The universal identifier in the binary data is correct, otherwise an exception is thrown.
static MByteString MIso8825::EncodeLength ( unsigned  len)
static

Return length of the data encoded according to ISO 8825 rules.

The length can be a short length, or a long length.

Precondition
length of the data
static unsigned MIso8825::EncodeLengthIntoBuffer ( unsigned  len,
char *  buff 
)
static

Return length of the data encoded according to ISO 8825 rules, use the given buffer.

The length can be a short length, or a long length.

Parameters
lenthe length to encode
buffbuffer into which the length is to be encoded, at least 5 characters
Returns
result length of the buffer, 0 to 5
static unsigned MIso8825::EncodeTaggedUidIntoBuffer ( char  acseTag,
const MStdString str,
char *  buff 
)
static

Return a tagged packed binary representation from the ISO 8825 universal identifier given as a string.

The identifier returned for 1.2.840.10066.3.56.5454 would be A2 0B A2 09 2A 86 48 CE 52 03 38 AA 4E.

Precondition
The universal identifier in the string should be correct, otherwise an exception is thrown
Parameters
acseTagthe ACSE tag assigned to this UID
strstring representation of the buffer
buffoutput buffer, at least 64 bytes long
Returns
the result length of the buffer
static unsigned MIso8825::EncodeTaggedUnsignedIntoBuffer ( char  acseTag,
unsigned  value,
char *  buff 
)
static

Return a tagged packed binary representation of a given unsigned number.

Parameters
acseTagThe ACSE tag assigned to this unsigned integer
valueValue to encode
buffoutput buffer, at least 8 bytes long
Returns
the result length of the buffer
static MByteString MIso8825::EncodeUid ( const MStdString str)
static

Return a packed binary representation from the ISO 8825 universal identifier given as a string.

The identifier returned for 1.2.840.10066.3.56.5454 would be A2 0B A2 09 2A 86 48 CE 52 03 38 AA 4E.

Precondition
The universal identifier in the string should be correct, otherwise an exception is thrown
static unsigned MIso8825::EncodeUidIntoBuffer ( const MStdString str,
char *  buff 
)
static

Return a packed binary representation from the ISO 8825 universal identifier given as a string.

The identifier returned for 1.2.840.10066.3.56.5454 would be A2 0B A2 09 2A 86 48 CE 52 03 38 AA 4E.

Precondition
The universal identifier in the string should be correct, otherwise an exception is thrown
Parameters
strstring representation of the buffer
buffoutput buffer, at least 60 bytes long
Returns
the result length of the buffer
static bool MIso8825::IsTagRelative ( char  tag)
static

Return true if the ISO8825 Universal Identifier tag stands for relative identifier.

Recognized tags are these:

  • 0x0D : relative, as used in the data
  • 0x80 : relative, as used in ACSE
  • 0x06 : absolute, as used in both data and ACSE
Parameters
tagThe tag to check. The tag should be one of the above mentioned bytes, otherwise an exception is thrown that tells that the tag is bad
static bool MIso8825::IsUidRelative ( const MStdString uid)
static

True will mean the given UID string is relative.

To be relative, the UID shall have a period at the beginning.

Parameters
uidUID to check. The given UID shall have a good UID string format, or an exception is thrown.