Quick Links:

bal | bbl | bdl | bsl

Namespaces

Component balber_beruniversaltagnumber
[Package balber]

Enumerate the set of BER universal tag numbers. More...

Namespaces

namespace  balber

Detailed Description

Outline
Purpose:
Enumerate the set of BER universal tag numbers.
Classes:
balber::BerUniversalTagNumber namespace universal tag number enumeration
See also:
Component balber_berencoder, Component balber_berdecoder http://www.itu.int/ITU-T/studygroups/com17/languages/X.680-0207.pdf
Description:
This component provides a namespace for the enum type balber::BerUniversalTagNumber::Value. Value enumerates the set of BER universal tag numbers used by the BER encoder and decoder. The universal tag numbers are defined in the X.680 standard, in section 8.
In addition, this component supports functions that convert the Value enumerations to a well-defined ASCII representation.
This component also provides a function that returns the universal tag number for an object with formatting mode, according to the following table:
  C++ Type                           Formatting Mode  Universal Tag Number
  --------                           ---------------  --------------------
  bool                               DEFAULT          e_BER_BOOL
                                     DEC              e_BER_BOOL
                                     TEXT             e_BER_BOOL
  char                               DEFAULT          e_BER_INT
                                     DEC              e_BER_INT
                                     TEXT             e_BER_UTF8_STRING
  unsigned char                      DEFAULT          e_BER_INT
                                     DEC              e_BER_INT
  [unsigned] short                   DEFAULT          e_BER_INT
                                     DEC              e_BER_INT
  [unsigned] int                     DEFAULT          e_BER_INT
                                     DEC              e_BER_INT
  [unsigned] long                    DEFAULT          e_BER_INT
                                     DEC              e_BER_INT
  bsls::Types::[Uint64|Int64]        DEFAULT          e_BER_INT
                                     DEC              e_BER_INT
  float                              DEFAULT          e_BER_REAL
  double                             DEFAULT          e_BER_REAL
  bdldfp::Decimal64                  DEFAULT          e_BER_OCTET_STRING
  bsl::string                        DEFAULT          e_BER_UTF8_STRING
                                     TEXT             e_BER_UTF8_STRING
                                     BASE64           e_BER_OCTET_STRING
                                     HEX              e_BER_OCTET_STRING
  bdlt::Date                         DEFAULT          e_BER_VISIBLE_STRING
  bdlt::DateTz                       DEFAULT          e_BER_VISIBLE_STRING
  bdlt::Datetime                     DEFAULT          e_BER_VISIBLE_STRING
  bdlt::DateTimeTz                   DEFAULT          e_BER_VISIBLE_STRING
  bdlt::Time                         DEFAULT          e_BER_VISIBLE_STRING
  bdlt::TimeTz                       DEFAULT          e_BER_VISIBLE_STRING
  bsl::vector<char>                  DEFAULT          e_BER_OCTET_STRING
                                     BASE64           e_BER_OCTET_STRING
                                     HEX              e_BER_OCTET_STRING
                                     TEXT             e_BER_UTF8_STRING
If the object is not one of these types, then the universal tag number is selected based on the object's type category, as follows:
  Category             Universal Tag Number
  --------             --------------------
  CustomizedType       Use universal tag number of the base type.
  Enumeration          'e_BER_ENUMERATION' when formatting mode is either
                       'DEFAULT', 'DEC', or 'TEXT'.
  Sequence             'e_BER_SEQUENCE' when formatting mode is 'DEFAULT'.
  Choice               'e_BER_SEQUENCE' when formatting mode is 'DEFAULT'.
  Array                'e_BER_SEQUENCE' when formatting mode is 'DEFAULT'.
The behavior is undefined if the object does not fall into one the above categories or formatting modes.
Usage:
This section illustrates intended use of this component.
Exercise 1: Basic Syntax:
The following snippets of code provide a simple illustration of balber::BerUniversalTagNumber operation.
First, create a variable tagNumber of type balber::BerUniversalTagNumber::Value and initialize it to the value balber::BerUniversalTagNumber::e_BER_INT:
  balber::BerUniversalTagNumber::Value tagNumber
                                  = balber::BerUniversalTagNumber::e_BER_INT;
Next, store its representation in a variable rep of type const char *:
  const char *rep = balber::BerUniversalTagNumber::toString(tagNumber);
  assert(0 == strcmp(rep, "INT"));
Finally, print the value of tagNumber to bsl::cout:
  bsl::cout << tagNumber << bsl::endl;
This statement produces the following output on bsl::cout:
  INT