Version 6.0 enhancements
This chapter presents the improvements added to the TCE-C++ v6.0 release with regards to the TCE-C++ v5.2 release.
The TCE-C++ Compiler and runtime are now compliant with the 2008 release of the ASN.1 standards.
It supports the following new features:
The new types are available with all encoding rules and both technologies, tabledriven and code generation. All features can be used with the new types.
- New types: TIME, DATE, DATE-TIME, TIME-OF-DAY, DURATION, OID-IRI and RELATIVE-OID-IRI,
- A predefined module DefinedTimeTypes for time-related types.
- A predefined module ASN1-Object-Identifier-Module for object identifier value defined in the ASN.1 standards.
Using code-generation with tabledriven
The default encoding and decoding technology is tabledriven which offers a good ratio between runtime performance and memory usage. Further performance improvements can be achieved with code-generation technology (ASN.1 Compiler option -tech codegen). The ASN.1 Compiler then generates additional source code for specific encoding, decoding and constraint checking functions. This increases code size.
In order to decrease code size but benefit from the code-generation technology, TCE-C++ v6.0 introduces a new ASN.1 Compiler option and ASN.1 Runtime flag in order to use code-generation technology for encoding and decoding and tabledriven for constraint checking:
- When the ASN.1 Compiler options -tech codegen -chkcst are used the ASN.1 Runtime will use code-generation technology for encoding, decoding and constraint checking.
- When the ASN.1 Compiler options -tech codegen -chkcst tabledriven are used the ASN.1 Runtime will use code-generation technology for encoding and decoding and tabledriven technology for constraint checking.
The ASN.1 Runtime flag asnCodChkTABLE must be enabled.
This configuration will be faster than using only tabledriven technology and smaller than using only code-generation technology.
Force prefixing of identifiers
The ASN.1 Compiler always generates the shortest possible unique identifiers for constants, e.g. ENUMERATED, named integers, and class names. Name conflicts are resolved by prefixing identifiers with enclosing type names. For some ASN.1 syntaxes, this can lead to identifiers belonging to the same type but having different prefixes.
In order to apply the same prefix to all identifiers belonging to the same type, the ASN.1 Compiler now supports the option -idlevel which forces prefixing by enclosing types even if there is no conflict for identifiers.
Support for changing ASN.1 syntaxes
When updating an ASN.1 syntax with a newer version, the TCE-C++ API must be regenerated. When already existing ASN.1 identifiers are reused in some other ASN.1 definitions, this may lead to changed identifier names. In order to track these changes a new optional file asnids.h is generated. This file contains all identifiers with their fully qualified name starting from the module name. Two applications are possible:
Similar behaviour can be achieved by using the formal comment $id or the newly available ASN.1 Compiler option -idlevel.
- By comparing the generated asnids.h for different versions of the same ASN.1 syntax, differences can easily be identified.
- In order to reduce application changes when updating an ASN.1 syntax the fully qualified identifiers of asnids.h can directly be used in the application.
Decode without input stream copy
In order to support multi-threaded ASN.1 applications the memory input stream is, by default, always copied before decoding. For single-threaded ASN.1 applications this copy may not be required and performance improvements may be preferred. Copying the input stream can be disabled by calling the context member setCopySourceInInputStream(false).
Usage of opened file streams
ASN.1 values can be decoded from memory and file streams. Up to the previous release, a file name must have been provided for opening the file by the ASN.1 runtime. TCE-C++ v6.0 introduced a new constructor in order to decode from an already opened file:
asnFileStream(asnFILE fileObject, asnMINUINT mode)