op_td_is_set()
Abstract
Determines if the specified transmission data attribute has an assigned value.
Syntax
op_td_is_set (pkptr, tda_index)
| Argument | Type | Description |
|---|---|---|
pkptr |
Packet* |
pointer to the packet-of-interest |
tda_index |
int |
numeric index of the transmission data attribute-of-interest. [This value is an integer code that specifies the transmission data attribute. Predefined values for this argument appear in “Transmission Data Attribute“ on page 28.] |
Return Type
Boolean
Boolean value indicating if the specified transmission data attribute has received an assignment. The constant OPC_TRUE is returned if the TDA is set; OPC_FALSE if it is not.
Example
Excerpt from: example model (models/std/base); pipeline model (dra_power).
/* If the incoming packet is ’valid’, it may cause the receiver to */
/* lock onto it. However, if the receiving node is disabled, then */
/* the channel match should be set to noise. */
if (op_td_get_int (pkptr, OPC_TDA_RA_MATCH_STATUS) == OPC_TDA_RA_MATCH_VALID)
{
if (op_td_is_set (pkptr, OPC_TDA_RA_ND_FAIL))
{
/* The receiving node is disabled. Change the channel */
/* match status to noise. */
op_td_set_int (pkptr, OPC_TDA_RA_MATCH_STATUS, OPC_TDA_RA_MATCH_NOISE);
}
else
{
. . .
}
}
Details
Transmission data attributes are used to convey link modeling data between the Simulation Kernel and successive Transceiver Pipeline stages. The Td package KPs provide primitive operations (set and get) for operating on transmission data attributes. If the value is set (i.e., if it has at any time received an assignment), this KP will return OPC_TRUE; otherwise, OPC_FALSE.
Purpose
Provides a mechanism to determine if the transmission data attribute value is currently set. This is useful when pipeline stages cannot necessarily depend on particular attributes being present in a packet, either because they are written generically so as to operate with a variety of other stages, or because it is known that another (previous) stage in the pipeline might leave an attribute that is of interest unset. Attempting to access an attribute that is unset causes a simulation error. Therefore, if such a condition can be anticipated as a possibility, it should be tested for with op_td_is_set() prior to attempting extraction of a TDA value.
Errors
- Program Abort: Segmentation violation. (due to an invalid packet pointer or malformed packet)
- Program Abort: Packet pointer is NIL.
- Program Abort: Packet pointer references destroyed packet (
<pk_id>). - Program Abort: Tda index (
<tda_index>) is out-of-range for packet (<pk_id>).
Reference
- Use the KP op_td_get_int() or op_td_get_int64() to obtain the value of an integer transmission data attribute
- Use the KP op_td_get_dbl() to obtain the value of an double transmission data attribute
- Use the KP op_td_get_ptr() to obtain the value of a pointer transmission data attribute
- Use the KP op_td_set_int() or op_td_set_int64() to assign the value of an integer transmission data attribute
- Use the KP op_td_set_dbl() to assign the value of a double transmission data attribute
- Use the KP op_td_set_ptr() to assign the value of a pointer transmission data attribute