Helper Functions and Macros.
The helper functions and macros encapsulate the access to selected structure members or otherwise provide functionality that is not directly available through an MB function.
Return the calling function with CMPIStatus specifying a return code and no message.
The CMReturn() macro builds a CMPIStatus object specifying a return code and no message and exits the function in which it was called, causing it to return that CMPIStatus object. CMReturn() can only be used in functions that return CMPIStatus.
- Parameters
-
rc | A CMPIrc value specifying the return code. |
- Returns
- This macro never returns to its caller; it contains a
return
statement and therefore exits the function from which it was called.
- Examples
- Example of enumerateInstanceNames() MI function that returns CMPI_RC_OK to the MB.
- Status for OpenPegasus:
- TBD
#define CMReturnWithString |
( |
|
rc, |
|
|
|
str |
|
) |
| |
Return the calling function with CMPIStatus specifying a return code and a message (from CMPIString object).
The CMReturnWithString() macro builds a CMPIStatus object specifying a return code and a message and exits the function in which it was executed, causing it to return that CMPIStatus object. CMReturnWithString() can only be used in functions that return CMPIStatus.
- Parameters
-
rc | A CMPIrc value specifying the return code. |
str | Points to a CMPIString object specifying the message. |
- Returns
- This macro never returns to its caller; it contains a
return
statement and therefore exits the function from which it was called.
- Examples
- Example of code in an MI function that checks for an optional MB capability and returns with an error to the MB if the capability is not available.
(.c)
{
}
else
{
CMNewString(_broker,
"Property Filtering capability not available",
NULL));
}
- See Also
- CMPIStatus
- Status for OpenPegasus:
- TBD
#define CMReturnWithChars |
( |
|
mb, |
|
|
|
rc, |
|
|
|
chars |
|
) |
| |
Return the calling function with CMPIStatus specifying a return code and a message (from C string).
The CMReturnWithChars() macro builds a CMPIStatus object specifying a return code and a message and exits the function in which it was executed, causing it to return that CMPIStatus object. CMReturnWithChars() can only be used in functions that return CMPIStatus.
- Parameters
-
mb | CMPIBroker structure. |
rc | A CMPIrc value specifying the return code. |
chars | A C string (char* ) specifying the message. |
- Returns
- This macro never returns to its caller; it contains a
return
statement and therefore exits the function from which it was called.
- Examples
- Example of code in a modifyInstance() MI function that is not implemented and returns to the MB with CMPI_RC_ERR_NOT_SUPPORTED and an according error message.
(.c)
{
"ModifyInstance is not supported");
}
- See Also
- CMPIStatus
- Status for OpenPegasus:
- TBD
static CMPIBoolean CMIsNullObject |
( |
const void * |
objptr | ) |
|
|
inlinestatic |
Test an encapsulated data type object pointer for NULL.
This test is suitable for checking any pointers to encapsulated data type objects for NULL, including the pointers returned by their factory functions.
- Parameters
-
objptr | Pointer to the encapsulated data type object to be tested. This argument is defined as void* to encompass any encapsulated data type object. |
- Return values
-
true | The object is NULL. |
false | The object is NOT NULL. |
- Examples
- Status for OpenPegasus:
- TBD
- Todo:
- TODO_KS The example seems to be somewhat confused. Why is a test of cop meaningful when it is not used at all, and cop2 is used instead?
Karl to review the example.
Test a CMPIData value for NULL.
CMIsNullValue() tests a CMPIData value for NULL. This is done based on the CMPI_nullValue flag in its state
member.
- Parameters
-
- Return values
-
- Examples
- Process received method call that includes a CIMObject path
ref
for classname, method name, arguments, argument name and value in the argument (.c)
if (!strcmp(name, _ClassName))
{
if (!strcmp ("SayHello", methodName))
{
{
{
strcat(result, strCat);
strcat(result, "!");
val1.string = str1;
}
. . .
- See Also
- CMPIData, CMPIValueState
- Status for OpenPegasus:
- TBD
- Todo:
- TODO_KS The example is way too complex if it just intends to show how to use this function.
Karl to come up with simpler example.
static unsigned int CBGetCapabilities |
( |
const CMPIBroker * |
mb | ) |
|
|
inlinestatic |
static const char* CBBrokerName |
( |
const CMPIBroker * |
mb | ) |
|
|
inlinestatic |