TOP

Coding Classes

Applies to: ASN.1/C++ 6.5

Specific PDU class <Typename>_PDU

The compiler generates one class derived from the PDU class for each PDU type. The class generated for an ASN.1 PDU type named A is normally named A_PDU (if no name conflict occurs).

Definition

class <Typename>_PDU : public PDU {
public:
<Typename>_PDU( );
  void set_data(<Typename>&);
<Typename> * get_data() const;
  void set_const_data(const <Typename>&);
  const <Typename> * get_const_data() const;
};

Methods

void set_data(<Typename>&rep);
This function sets the representation object pointer of a PDU object to a non-constant representation object. Typename is the corresponding representation class generated for this ASN.1 type. The representation object is owned by the caller. The PDU destructor does not deallocate it.
void set_const_data(const <Typename>&rep);
This function sets the representation object pointer of a PDU object to a constant object. Typename is the corresponding representation class generated for this ASN.1 type. In this case, the methods of the PDU class can only read the object and cannot make any changes to it.
<Typename> *get_data() const;
This function returns the non-constant representation object pointer contained in the PDU type. If the PDU object does not currently contain any representation object or the representation object is constant, a NULL pointer is returned. The returned representation object is owned by the caller. If it is the result of a decoding operation, you must properly deallocate it, if it is no longer needed.
const <Typename> *get_const_data() const;
This function returns the representation object pointer contained in the PDU type in the form of a constant. If the PDU object does not currently contain any representation object, a NULL pointer is returned. This method is useful when the PDU object contains the result of a decoding into a preallocated buffer.

Universal PDU class <projectname>_PDU

The compiler generates one such class per specification; this class can contain any of the PDU types defined in the specification. It can be used just like the other PDU classes. The universal PDU class holds the current object pointer, as well as some type information to distinguish between different types. Therefore, it can be used for generic processing when the exact type of the data contained in the object is not statically known (for instance, when decoding open type values). It can also be used for tag-controlled decoding. Tag-controlled decoding occurs when the exact ASN.1 type being decoded is not known and is determined from the tags during the decoding process. This is possible only for variants of BER (BER, DER, and CER) and XER (including CXER and E XER). It is completely impossible for PER, since PER encodings do not contain any tags signifying the encoded type. To use tag-controlled decoding, you must compile the specification with the –soed or –toed compiler option. The Lean encoder/decoder does not support tag-controlled decoding.

Definition

class <projectname>_PDU : public PDU {
public:
<projectname>_PDU( );
  ...
  void set_<Typename>(<Typename>&);
<Typename> *get_<Typename>( ) const;
  void set_const_<Typename>(const <Typename>&);
  const <Typename> *get_const_<Typename>( ) const;
  ...
};

Methods

void set_<Typename>(<Typename>&rep);
This method is generated for each PDU type in the specification. Each method sets the representation object pointer to a non-constant value of the corresponding <Typename> type. The representation object is owned by the caller. The PDU destructor does not deallocate it.
void set_const_<Typename>(const <Typename>&rep);
This method is generated for each PDU type in the specification. Each method sets the representation object pointer to a constant value of the corresponding <Typename> type. In this case, the methods of the PDU class can only read the object but cannot make any changes to it.
<Typename> *get_<Typename>() const;
This method is generated for each PDU type in the specification. Each method gets the non-constant representation object pointer in the form of the corresponding <Typename> type, if the PDU type currently contains a value of the <Typename> type. If the PDU type contains a value of another type or no value at all, a NULL pointer is returned. If the contained value is constant, a NULL pointer is also returned. Consequently, these functions can be used to determine the exact type of the data contained in the universal PDU class instance. The returned representation object is owned by the caller. If it is the result of a decoding operation, you must properly deallocate, it if it is no longer needed.
const <Typename> *get_const_<Typename>() const;
This method is generated for each PDU type in the specification. Each method gets the representation object pointer (in the form of a constant) of the corresponding <Typename> type, if the PDU type currently contains a value of the <Typename> type. This function returns the representation object pointer contained in the PDU type in the form of a constant. If the PDU object does not currently contain any representation object, a NULL pointer is returned. Consequently, these functions can be used to determine the exact type of the data contained in the universal PDU class instance, when the PDU object contains the result of a decoding into a preallocated buffer.

This documentation applies to release 6.5 and later of the OSS® ASN.1 Tools for C++.

Copyright © 2017 OSS Nokalva, Inc. All rights reserved.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means electronic, mechanical, photocopying, recording or otherwise, without the prior permission of OSS Nokalva, Inc.
Every distributed copy of the OSS® ASN.1 Tools for C++ is associated with a specific license and related unique license number. That license determines, among other things, what functions of the OSS ASN.1 Tools for C++ are available to you.