ObjectGeode profile

ObjectGeode is an SDL tool and is, by design, used to create asynchronous systems. It therefore falls into the Asynchronous API described in section 3.2. The code for the mapper is inside file og_B_mapper.py.

Combined with the work done inside buildSupport, the mapper is responsible for writing the code for the following macros (per ASN.1 Type):

DECODE_UPER_TypeName:
Works on an input stream, decoding the Unaligned Packed Encoding Rules bitstream into ASN.1 structures. These structures have been generated by ASN1SCC (Semantix's Space Certifiable ASN.1 Compiler) or OSS Nokalva's ASN.1 compiler. It then proceeds to map the data, field by field, to the appropriate destination data structures as generated by ObjectGeode's code generator. The macro syntax is DECODE_UPER_TypeName(pBuffer, iBufferSize, pSdlVar), with pBuffer and iBufferSize pointing to the input buffer and input buffer size, respectively. pSdlVar points to the ObjectGeode variable that will receive the data. The choice between OSS and Semantix's compiler is done on the command line of aadl2glueC (depending on the existence or absence of the argument -useOSS).
DECODE_NATIVE_TypeName:
When not crossing process boundaries, communication across APLCs need not suffer the unnecessary encoding/decoding of ASN.1 streams. In that case, the self-contained (pointerless) structures generated by ASN1SCC are used as carriers of semantic content. This macro operates on said structures, reading the passed-in information and mapping it, field by field, to the appropriate destination data structures as generated by ObjectGeode's code generator. The macro syntax is DECODE_NATIVE_TypeName(pBuffer, iBufferSize, pSdlVar), with pBuffer and iBufferSize pointing to the input buffer and input buffer size, respectively. pSdlVar points to the ObjectGeode variable that will receive the data. Notice that the data pointed to by pBuffer are in fact the memory dump of the corresponding ASN1SCC generated data structures.
ENCODE_UPER_TypeName:
The reverse of DECODE_UPER_TypeName: encodes the contents of an ObjectGeode variable into the data structures generated by an ASN.1 Compiler (Semantix's ASN1SCC or OSS/Nokalva's). It then proceeds to call the ASN.1 encoder function, and stores the resulting bitstream into the destination buffer. The macro syntax is ENCODE_UPER_NAME(varName, param1), with varName being the output buffer (declared with DECLARE and DEFINE_Typename, see below) and param1 pointing to the source ObjectGeode variable.
ENCODE_NATIVE_Typename:
The reverse of DECODE_NATIVE_Typename: encodes the contents of an ObjectGeode variable into the data structure generated for the ASN.1 Typename by Semantix's ASN1SCC ASN.1 compiler. The memory dump of the structure is then taken and copied in the destination buffer. The macro syntax is ENCODE_NATIVE_NAME(varName, param1), with varName being the output buffer (declared with DECLARE and DEFINE_Typename, see below) and param1 pointing to the source ObjectGeode variable.
DECLARE_Typename:
This macro is used to declare enough buffer space (statically allocated) for an ASN.1 type. The macro syntax is DECLARE_Typename(varName) which translates to an appropriate declaration for a buffer named varname.
DEFINE_Typename:
This macro is used to reserve (define) enough buffer space (statically allocated) for an ASN.1 type. The macro syntax is DEFINE_Typename(varName) which translates to an appropriate definition for a buffer named varname.
The above macros are put to use by the signal sending and receiving macros of ObjectGeode. Their use is limited to the files vm_if.c, hpostdef.h and hpredef.h. More specifically:
vm_if.c:
For each Provided Interface which is provided by the modeled APLC, a "bridge" function is created inside this file. This function is in one of two forms:
  1. if the PI has no associated PARAMETER with it, then this function is simply doing
    1. G2S_OUTPUT(...);
    2. sdl_loop_FVNAME();

  2. if the PI has an associated PARAMETER with it, then this function has to...
    1. Decode the ASN.1 message (incoming arguments: pointer,length)
    2. place the decoded values in the appropriate ObjectGeode generated global variable (for this PI)
    3. G2S_OUTPUT(...);
    4. sdl_loop_FVNAME();
hpostdef.h:
For each type used by this APLC, a call to DEFINE_ASN1TYPENAME(name_of_variable) must be issued, to reserve space for the variable. The macro knows (by construction) what size to reserve to accomodate the maximum configuration of this message.

Also, for each Required Interface used by the modeled APLC, this header file must also declare a C MACRO:

#define riname(param1, param2, ...)
...which will:
  1. encode all the input data from the input params, via the ENCODE_ macros, into the reserved spaces (the DEFINE_ASN1TYPENAME ones)
  2. call the vm callback to access the RI (vm_fvname_riname)
  3. decode all the output data from the output params, via the DECODE_ macros.
This MACRO will be called by the ObjectGeode generated code whenever the RI is to be called.
hpredef.h:
Contains the prototypes (extern declarations) of the vm callbacks.