Skip to content

Name of Getter/Setter Functions for Parameters in Derived Packets #13

@pasetti

Description

@pasetti

Consider the function to get parameter 'Par' from the 'InfoRep' packet (formerly called 'Rep1') with discriminant EVT_DUMMY_1. In the past, its getter function had the following structure:

/**
 * Get "Par" from "Rep1_EVT_DUMMY_1" packet.
 * @param p Pointer to the packet.
 * @return Value of "Par".
 */
static inline CrPsEightBit_t getEvtRep1_EVT_DUMMY_1Par(void* p) {
   Rep1_EVT_DUMMY_1_t* t;
   t = (Rep1_EVT_DUMMY_1_t*)p;
   return t->Par;
}

Now instead it looks like this:

/**
 * Getter function for parameter Par in packet InfoRep_Dummy1
 * @param p Pointer to the packet
 * @return Value of parameter InfoRep_Dummy1
 */
static inline CrPsEightBit_t getEvtInfoRep_Dummy1Par(void* p) {
    InfoRep_Dummy1_t* t;
     t = (InfoRep_Dummy1_t*)p;
    return __builtin_bswap16(t->Par);
}

What has happened is that now we build the name of the getter function using the name of the packet ('InfoRep_Dummy1') rather than the name of the packet's distriminant ('EVT_DUMMY_1'). I think that the new format is preferable but its use will require some changes to the test suite.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions