BRM provides certain functions to perform object manipulation operations. These functions are defined as macros which are widely used in opcodes to access BRM database and modify objects in BRM.
1. POID Management Macros (POID is a special datatype of BRM which identifies a unique object in database. Each object is defined as a storable class and has a unique POID. For example /account )
PIN_POID_GET_TYPE – This macro returns the poid object type for the poid object
PIN_POID_FROM_STR – Function to convert string value to poid value
PIN_POID_GET_ID – It gives the unique id from a poid value
2. FLIST Management Macros (All the opcodes performing business logic understand the flist data type as input. The flist is a the list of field value pairs of attributes for input/output to an opcode)-
PIN_FLIST_ELEM_GET – It fetches an ARRAY element from the flist
PIN_FLIST_ELEM_SET – This macro adds an array element into an input flist
PIN_FLIST_FLD_GET, PIN_FLIST_FLD_SET – As name suggests, these two macros gets and sets a field from/to an flist
PIN_FLIST_COPY - This macro can be used to copy field from one flist to other. Instead of doing PIN_FLIST_FLD_GET and then PIN_FLIST_FLD_SET, directly PIN_FLIST_COPY can be used.
3. Error Management and Logging Macros (All the logging of information is done in the file cm.pinlog which the main log to track and troubleshoot any issue while executing an opcode)
PIN_ERR_LOG_MSG – This macro sets a string message to troubleshoot issue in the opcode. This really helps to identify the location of the file where the error is occurring.
PIN_ERR_LOG_FLIST – This macro is to print flist in the log file (cm.pinlog). This is to debug the data which is being set in the flist.
PIN_ERR_IS_ERR – This is to check if the program has encountered an error.
PIN_ERR_SET_ERR – If error is encountered this opcode sets the error with proper error message logging.
4. POID/FLIST Creation Macros (POID/Flist needs to be created in order to generate the input data for the opcode)
PIN_POID_CREATE, PIN_FLIST_CREATE – As name suggests these macros helps in creation of poid and flist objects.
Note – After the execution of the opcode, the newly created flist objects must be destroyed in order to free unused memory space. If they are not killed it may lead to memory leak issues. PIN_FLIST_DESTROY_EX is the macro to delete the data of an flist and set the reference of the flist object to null.
5. There are different set of macros for decimal data type manipulations. For example for decimal addition operation there is a macro "pbo_decimal_add_assign" , other decimal macros are starting with pbo_decimal*.