本文整理汇总了C++中CMRelease函数的典型用法代码示例。如果您正苦于以下问题:C++ CMRelease函数的具体用法?C++ CMRelease怎么用?C++ CMRelease使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CMRelease函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dqRetry
int
dqRetry(CMPIContext * ctx, RTElement * cur)
{
_SFCB_ENTER(TRACE_INDPROVIDER, "dqRetry");
// Delete the instance in the repo
CMPIObjectPath * op=CMNewObjectPath(_broker,"root/interop","SFCB_IndicationElement",NULL);
CMAddKey(op,"IndicationID",&cur->instanceID,CMPI_uint32);
CBDeleteInstance(_broker,ctx,op);
CBDeleteInstance(_broker,ctx,cur->ind);
CMRelease(op);
// Remove the entry from the queue, closing the hole
if (cur->next == cur) {
// queue is empty
free(cur);
RQhead = NULL;
} else {
// not last
cur->prev->next = cur->next;
cur->next->prev = cur->prev;
CMRelease(cur->ref);
CMRelease(cur->sub);
if (cur)
free(cur);
}
_SFCB_RETURN(0);
}
示例2: TestInstanceProviderCreateInstance
/**
Create Instance from inst, using object-path op as reference.
*/
CMPIStatus TestInstanceProviderCreateInstance (
CMPIInstanceMI * mi,
const CMPIContext * ctx,
const CMPIResult * rslt,
const CMPIObjectPath * cop,
const CMPIInstance * ci)
{
CMPIStatus rc = { CMPI_RC_OK, NULL };
CMPIInstance * inst;
CMPIValue value_inst;
CMPIData key1,key2, retInst;
CMPIObjectPath *obp;
unsigned int j = 0;
if(ci)
{
/* clone the instance to be added to the array */
inst = CMClone(ci, &rc);
key1 = CMGetProperty(inst, "Identifier", &rc);
for (j=0; j < numOfInst ; j++)
{
/* check for validity of Instance, that its not deleted */
if (valid[j] == 1)
{
/* get element(instance) from array */
retInst = CMGetArrayElementAt(clone_arr_ptr, j, &rc);
/* get object-path of instance */
obp = CMGetObjectPath(retInst.value.inst, &rc);
/* get key from this object-path */
key2 = CMGetKey(obp, "Identifier", &rc);
/*compare key values.
If they match throw exception as two instance with same key
properties cannot exists. */
if(key1.value.uint8 == key2.value.uint8)
{
CMRelease(inst);
CMReturn (CMPI_RC_ERR_ALREADY_EXISTS);
}
}
}
value_inst.inst = inst;
/* If instance doesnot exists in array add it */
rc = CMSetArrayElementAt(
clone_arr_ptr,
numOfInst,
&value_inst,
CMPI_instance);
valid[numOfInst]=1;
numOfInst++;
/* return object-path of instance */
CMReturnObjectPath(rslt, cop);
CMReturnDone(rslt);
}
else
{
CMReturn (CMPI_RC_ERR_NOT_SUPPORTED);
}
CMRelease(inst);
CMReturn (CMPI_RC_OK);
}
示例3: main
int main()
{
CMCIClient *cc;
CMPIObjectPath * objectpath;
CMPIEnumeration * enumeration;
CMPIStatus status;
char *cim_host, *cim_host_passwd, *cim_host_userid;
/* Setup a connection to the CIMOM */
cim_host = getenv("CIM_HOST");
if (cim_host == NULL)
cim_host = "localhost";
cim_host_userid = getenv("CIM_HOST_USERID");
if (cim_host_userid == NULL)
cim_host_userid = "root";
cim_host_passwd = getenv("CIM_HOST_PASSWD");
if (cim_host_passwd == NULL)
cim_host_passwd = "password";
cc = cmciConnect(cim_host, NULL, "5988",
cim_host_userid, cim_host_passwd, NULL);
/* Test references() */
printf("\n----------------------------------------------------------\n");
printf("--> Testing references() ...\n");
objectpath = newCMPIObjectPath("root/cimv2", "Linux_ComputerSystem", NULL);
printf( "--> Adding keys to object path\n" );
CMAddKey(objectpath, "CreationClassName", "Linux_ComputerSystem", CMPI_chars);
CMAddKey(objectpath, "Name", "localhost.localdomain", CMPI_chars);
printf( "--> Enumerating Instances\n" );
enumeration = cc->ft->references(cc, objectpath, NULL, NULL, 0, NULL, &status);
printf( "--> Print the results \n" );
printf( "--> references() rc=%d, msg=%s\n",
status.rc, (status.msg)? (char *)status.msg->hdl : NULL);
if (!status.rc) {
printf("--> result(s):\n");
while (enumeration->ft->hasNext(enumeration, NULL))
{
CMPIData data = enumeration->ft->getNext(enumeration, NULL);
showInstance(data.value.inst);
}
}
if (enumeration) CMRelease(enumeration);
if (objectpath) CMRelease(objectpath);
if (status.msg) CMRelease(status.msg);
if (cc) CMRelease(cc);
return 0;
}
示例4: enqRetry
int
enqRetry(RTElement * element, const CMPIContext * ctx, int repo)
{
_SFCB_ENTER(TRACE_INDPROVIDER, "enqRetry");
// Put this one on the retry queue
if (pthread_mutex_lock(&RQlock) != 0) {
// lock failed
return 1;
}
if (RQhead == NULL) {
// Queue is empty
_SFCB_TRACE(1,("--- Adding indication to new retry queue."));
RQhead = element;
RQtail = element;
RQtail->next = element;
RQtail->prev = element;
} else {
_SFCB_TRACE(1,("--- Adding indication to retry queue."));
element->next = RQtail->next;
element->next->prev = element;
RQtail->next = element;
element->prev = RQtail;
RQtail = element;
}
if (repo==1) {
// If this needs to be persisted in the repo
// (not the initial fill from refillRetryQ)
_SFCB_TRACE(1,("--- Creating SFCB_IndicationElement instance."));
CMPIObjectPath * op=CMNewObjectPath(_broker,"root/interop","SFCB_IndicationElement",NULL);
// Add the indID as the only key
CMAddKey(op,"IndicationID",&element->instanceID,CMPI_uint32);
// Create the instance
//element->SFCBIndEle=op;
element->SFCBIndEle=op->ft->clone(op,NULL);
CMPIInstance * ci=CMNewInstance(_broker,op,NULL);
// Set all the properties
CMSetProperty(ci,"IndicationID",&element->instanceID,CMPI_uint32);
CMSetProperty(ci,"RetryCount",&(RQtail->count),CMPI_uint32);
CMSetProperty(ci,"LastDelivery",&(RQtail->lasttry),CMPI_sint32);
CMSetProperty(ci,"ld",&(element->ref),CMPI_ref);
CMSetProperty(ci,"ind",&element->ind,CMPI_ref);
CMSetProperty(ci,"sub",&element->sub,CMPI_ref);
CBCreateInstance(_broker, ctx, op, ci, NULL);
CMRelease(op);
CMRelease(ci);
}
if (pthread_mutex_unlock(&RQlock) != 0) {
// lock failed
return 1;
}
_SFCB_RETURN(0);
}
示例5: IndCIMXMLHandlerEnumInstanceNames
CMPIStatus IndCIMXMLHandlerEnumInstanceNames(CMPIInstanceMI * mi,
const CMPIContext * ctx,
const CMPIResult * rslt,
const CMPIObjectPath * ref)
{
CMPIStatus st;
CMPIEnumeration *enm;
CMPIContext *ctxLocal;
_SFCB_ENTER(TRACE_INDPROVIDER, "IndCIMXMLHandlerEnumInstanceNames");
if (interOpNameSpace(ref,&st)!=1) _SFCB_RETURN(st);
ctxLocal = prepareUpcall((CMPIContext *)ctx);
#ifdef HAVE_OPTIMIZED_ENUMERATION
CMPIString* cn;
CMPIObjectPath* refLocal;
cn = CMGetClassName(ref, &st);
if (strcasecmp(CMGetCharPtr(cn), "cim_listenerdestination") == 0) {
enm = _broker->bft->enumerateInstanceNames(_broker, ctxLocal, ref, &st);
while(enm && enm->ft->hasNext(enm, &st)) {
CMReturnObjectPath(rslt, (enm->ft->getNext(enm, &st)).value.ref);
}
refLocal = CMNewObjectPath(_broker,"root/interop","cim_listenerdestinationcimxml",&st);
enm = _broker->bft->enumerateInstanceNames(_broker, ctxLocal, refLocal, &st);
while(enm && enm->ft->hasNext(enm, &st)) {
CMReturnObjectPath(rslt, (enm->ft->getNext(enm, &st)).value.ref);
}
refLocal = CMNewObjectPath(_broker,"root/interop","cim_indicationhandlercimxml",&st);
enm = _broker->bft->enumerateInstanceNames(_broker, ctxLocal, refLocal, &st);
while(enm && enm->ft->hasNext(enm, &st)) {
CMReturnObjectPath(rslt, (enm->ft->getNext(enm, &st)).value.ref);
}
CMRelease(refLocal);
}
else {
enm = _broker->bft->enumerateInstanceNames(_broker, ctxLocal, ref, &st);
while(enm && enm->ft->hasNext(enm, &st)) {
CMReturnObjectPath(rslt, (enm->ft->getNext(enm, &st)).value.ref);
}
}
#else
enm = _broker->bft->enumerateInstanceNames(_broker, ctxLocal, ref, &st);
while(enm && enm->ft->hasNext(enm, &st)) {
CMReturnObjectPath(rslt, (enm->ft->getNext(enm, &st)).value.ref);
}
#endif
CMRelease(ctxLocal);
if(enm) CMRelease(enm);
_SFCB_RETURN(st);
}
示例6: main
int main()
{
CMCIClient *cc;
CMPIObjectPath * objectpath;
CMPIEnumeration * enumeration;
CMPIStatus status;
char *cim_host, *cim_host_passwd, *cim_host_userid,
*cim_host_cert, *cim_client_cert, *cim_client_key;
/* Setup a connection to the CIMOM */
cim_host = getenv("CIM_HOST");
if (cim_host == NULL)
cim_host = "localhost";
cim_host_userid = getenv("CIM_HOST_USERID");
if (cim_host_userid == NULL)
cim_host_userid = "root";
cim_host_passwd = getenv("CIM_HOST_PASSWD");
if (cim_host_passwd == NULL)
cim_host_passwd = "password";
cim_host_cert = getenv("CIM_HOST_CERT");
cim_client_cert = getenv("CIM_CLIENT_CERT");
cim_client_key = getenv("CIM_CLIENT_KEY");
cc = cmciConnect2(cim_host, "https", "5989",
cim_host_userid, cim_host_passwd,
CMCI_VERIFY_PEER, cim_host_cert,
cim_client_cert, cim_client_key,
NULL);
/* Test enumClassNames() */
printf("\n----------------------------------------------------------\n");
printf("Testing enumClassNames() ...\n");
objectpath = newCMPIObjectPath("root/cimv2", NULL, NULL);
enumeration = cc->ft->enumClassNames(cc, objectpath, 0, &status);
/* Print the results */
printf( "enumClassNames() rc=%d, msg=%s\n", status.rc,
(status.msg)? (char *)status.msg->hdl : NULL);
if (!status.rc) {
printf("result(s):\n");
while (enumeration->ft->hasNext(enumeration, NULL)) {
CMPIData data = enumeration->ft->getNext(enumeration, NULL);
showObjectPath(data.value.ref);
}
}
if (enumeration) CMRelease(enumeration);
if (objectpath) CMRelease(objectpath);
if (status.msg) CMRelease(status.msg);
if (cc) CMRelease(cc);
return 0;
}
示例7: sfcb_native_release_CMPIValue
void
sfcb_native_release_CMPIValue(CMPIType type, CMPIValue * val)
{
switch (type) {
case CMPI_instance:
CMRelease(val->inst);
break;
case CMPI_class:
CMRelease(val->inst);
break;
case CMPI_qualifierDecl:
CMRelease((CMPIQualifierDecl *) val->dataPtr.ptr);
break;
case CMPI_ref:
CMRelease(val->ref);
break;
case CMPI_args:
CMRelease(val->args);
break;
case CMPI_filter:
CMRelease(val->filter);
break;
case CMPI_enumeration:
CMRelease(val->Enum);
break;
case CMPI_string:
CMRelease(val->string);
break;
case CMPI_chars:
free(val->chars);
break;
case CMPI_dateTime:
CMRelease(val->dateTime);
break;
default:
if (type & CMPI_ARRAY) {
CMRelease(val->array);
}
}
}
示例8: ClassProviderCleanup
static CMPIStatus
ClassProviderCleanup(CMPIClassMI * mi, const CMPIContext *ctx)
{
HashTableIterator *hit,
*hitHt,
*hitIt;
char *key;
ClassRegister *cReg;
ClassRecord *crec;
UtilList *ul;
for (hit = nsHt->ft->getFirst(nsHt, (void **) &key, (void **) &cReg);
key && hit && cReg;
hit =
nsHt->ft->getNext(nsHt, hit, (void **) &key, (void **) &cReg)) {
gzclose(cReg->f);
free(cReg->vr);
free(cReg->fn);
ClassBase *cb = (ClassBase *) (cReg + 1);
for (hitIt =
cb->it->ft->getFirst(cb->it, (void **) &key, (void **) &ul);
key && hitIt && ul;
hitIt =
cb->it->ft->getNext(cb->it, hitIt, (void **) &key,
(void **) &ul)) {
if (ul)
CMRelease(ul);
}
CMRelease(cb->it);
for (hitHt =
cb->ht->ft->getFirst(cb->ht, (void **) &key, (void **) &crec);
key && hitHt && crec;
hitHt =
cb->ht->ft->getNext(cb->ht, hitHt, (void **) &key,
(void **) &crec)) {
free(key);
if (crec->parent)
free(crec->parent);
free(crec);
}
CMRelease(cb->ht);
free(cReg);
}
CMRelease(nsHt);
CMReturn(CMPI_RC_OK);
}
示例9: _testErrorPaths
static int
_testErrorPaths()
{
CMPIArgs *args_ptr = NULL;
CMPIStatus rc = { CMPI_RC_OK, NULL };
CMPIValue value;
char *str = NULL;
value.inst = NULL;
args_ptr = CMNewArgs(_broker, &rc);
rc = CMAddArg(args_ptr,
"EmptyInstance", (CMPIValue *) & value, CMPI_instance);
value.ref = NULL;
rc = CMAddArg(args_ptr, "EmptyRef", (CMPIValue *) & value, CMPI_ref);
value.dateTime = NULL;
rc = CMAddArg(args_ptr,
"EmptyDatetime", (CMPIValue *) & value, CMPI_dateTime);
rc = CMAddArg(args_ptr, "EmptyChars", (CMPIValue *) str, CMPI_chars);
rc = CMAddArg(args_ptr, "EmptyCharsPtrA", NULL, CMPI_charsptrA);
value.chars = NULL;
rc = CMAddArg(args_ptr, "EmptyCharsPtr", &value, CMPI_charsptr);
value.args = NULL;
rc = CMAddArg(args_ptr, "EmptyArgs", (CMPIValue *) & value, CMPI_args);
rc = CMRelease(args_ptr);
return 1;
}
示例10: releaseClass
void
releaseClass(CMPIConstClass * cls, char *from, int id)
{
printf("### RELEASE %s %p %s %d\n", cls->ft->getCharClassName(cls), cls,
from, id);
CMRelease(cls);
}
示例11: each_property
/**
* call-seq:
* instance.each_property do |name, value|
* ...
* end
*
* enumerates properties yielding the property name and
* its value
*
*/
static VALUE each_property(VALUE self)
{
CIMCInstance *ptr;
CIMCStatus status;
int k=0;
int num_props=0;
CIMCString *property_name = NULL;
CIMCData data;
Data_Get_Struct(self, CIMCInstance, ptr);
num_props = ptr->ft->getPropertyCount(ptr, &status);
if (!status.rc) {
for (; k < num_props; ++k) {
data = ptr->ft->getPropertyAt(ptr, k, &property_name, &status);
if (!status.rc) {
rb_yield_values(2, (property_name ? rb_str_intern(rb_str_new2(property_name->ft->getCharPtr(property_name, NULL))) : Qnil), sfcc_cimdata_to_value(data));
}
else {
sfcc_rb_raise_if_error(status, "Can't retrieve property #%d", k);
}
if (property_name) CMRelease(property_name);
}
}
else {
sfcc_rb_raise_if_error(status, "Can't retrieve property count");
}
return Qnil;
}
示例12: args2xml
int
args2xml(CMPIArgs * args, UtilStringBuffer * sb)
{
int i,
m;
_SFCB_ENTER(TRACE_CIMXMLPROC, "args2xml");
if (args == NULL)
_SFCB_RETURN(0);
m = CMGetArgCount(args, NULL);
if (m == 0)
_SFCB_RETURN(0);
for (i = 0; i < m; i++) {
CMPIString *name;
CMPIData data;
data = CMGetArgAt(args, i, &name, NULL);
DATA2XML(&data, args, name, NULL, "<PARAMVALUE NAME=\"",
"</PARAMVALUE>\n", sb, NULL, 1, 1);
if ((data.type & (CMPI_ENC | CMPI_ARRAY)) && data.value.inst) {
// don't get confused using generic release
data.value.inst->ft->release(data.value.inst);
}
CMRelease(name);
}
_SFCB_RETURN(0);
}
示例13: cmpiPerf_TestClassProviderEnumInstanceNames
CMPIStatus cmpiPerf_TestClassProviderEnumInstanceNames(
CMPIInstanceMI * mi,
const CMPIContext * ctx,
const CMPIResult * rslt,
const CMPIObjectPath * ref)
{
CMPIObjectPath * op = NULL;
CMPIStatus rc = {CMPI_RC_OK, NULL};
unsigned int index = 0;
unsigned int numInst = 1;
//
// While the instance itself is hard code, the number of instances
// is determined from an environment variable
//
numInst = getNumberOfInstances();
for (index=0; index < numInst; index++)
{
op = _makePath_TestClass( _broker, ctx, ref, index );
if (op == NULL)
{
return rc;
}
CMReturnObjectPath( rslt, op );
CMRelease( op );
}
CMReturnDone( rslt );
return rc;
}
示例14: mergeParents
static CMPIStatus
mergeParents(ClassRegister * cr, ClClass * cl, char *p,
CMPIConstClass * cc, ReadCtl * rctl)
{
CMPIStatus st = { CMPI_RC_OK, NULL };
CMPIConstClass *pcc = NULL;
unsigned char originId = 0;
char *np = NULL;
ReadCtl ctl;
if (cc) {
if (p)
originId = ClClassAddGrandParent(cl, p);
cpyClass(cl, cc, originId);
}
if (p) {
ctl = *rctl;
pcc = getClass(cr, p, &ctl);
if (pcc == NULL) {
st.rc = CMPI_RC_ERR_INVALID_SUPERCLASS;
return st;
}
np = (char *) pcc->ft->getCharSuperClassName(pcc);
st = mergeParents(cr, cl, np, pcc, rctl);
if (ctl != cached)
CMRelease(pcc);
}
return st;
}
示例15: main
int main()
{
CMCIClient *cc;
CMPIObjectPath * objectpath;
CMPIEnumeration * enumeration;
CMPIStatus status;
char *cim_host, *cim_host_passwd, *cim_host_userid;
/* Setup a connection to the CIMOM */
cim_host = getenv("CIM_HOST");
if (cim_host == NULL)
cim_host = "localhost";
cim_host_userid = getenv("CIM_HOST_USERID");
if (cim_host_userid == NULL)
cim_host_userid = "root";
cim_host_passwd = getenv("CIM_HOST_PASSWD");
if (cim_host_passwd == NULL)
cim_host_passwd = "password";
cc = cmciConnect(cim_host, NULL, "5988",
cim_host_userid, cim_host_passwd, NULL);
/* Test enumClasses() */
printf("\n----------------------------------------------------------\n");
printf("Testing enumClasses() ...\n");
objectpath = newCMPIObjectPath("root/cimv2", NULL, NULL);
enumeration = cc->ft->enumClasses(cc, objectpath,
CMPI_FLAG_DeepInheritance|CMPI_FLAG_IncludeQualifiers, &status);
/* Print the results */
printf( "enumClasses() rc=%d, msg=%s\n",
status.rc, (status.msg)? (char *)status.msg->hdl : NULL);
if (!status.rc) {
printf("result(s):\n");
while (enumeration->ft->hasNext(enumeration, NULL)) {
CMPIData data = enumeration->ft->getNext(enumeration, NULL);
showClass(data.value.cls);
}
}
if (enumeration) CMRelease(enumeration);
if (objectpath) CMRelease(objectpath);
if (status.msg) CMRelease(status.msg);
if (cc) CMRelease(cc);
return 0;
}