class cmpi::CMPIObjectPath
* */
Public Instance Methods
add_key(p1, p2, p3)
click to toggle source
Adds/replaces a named key property.
name: Key property name. value: Address of value structure. type: Value type.
void add_key( const char *name, const CMPIValue* value, const CMPIType type) { RAISE_IF(CMAddKey($self, name, value, type)); } %rename("key") get_key(const char *name); %alias get_key "[]"; /* Gets a named key property value. * name: Key property name. */ VALUE get_key(VALUE property) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; const char *name; name = target_charptr(property); result = CMGetKey($self, name, &st); /* key not found is ok, will return NULL */ if (st.rc != CMPI_RC_ERR_NOT_FOUND) { RAISE_IF(st); } return data_value(&result); } %newobject get_key_at; #if defined (SWIGRUBY) %rename("key_at") get_key_at(int index); VALUE #endif #if defined (SWIGPYTHON) PyObject* #endif #if defined (SWIGPERL) SV* #endif /* Gets a key property [value,name] defined by its index. * name: [out] Key property name */ __type get_key_at(int index) { Target_Type tdata; CMPIString *s = NULL; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData data = CMGetKeyAt($self, index, &s, &st); Target_Type result; if (st.rc) { RAISE_IF(st); result = Target_Null; Target_INCREF(result); return result; } TARGET_THREAD_BEGIN_BLOCK; tdata = data_data(&data); #if defined (SWIGPYTHON) result = PyTuple_New(2); PyTuple_SetItem(result, 0, tdata); PyTuple_SetItem(result, 1, PyString_FromString(CMGetCharPtr(s))); #else result = Target_SizedArray(2); Target_Append(result, tdata); Target_Append(result, Target_String(CMGetCharPtr(s))); #endif TARGET_THREAD_END_BLOCK; CMRelease(s); return result; } /* Gets the number of key properties contained in this ObjectPath. */ int key_count() { CMPIStatus st = { CMPI_RC_OK, NULL }; int result; result = CMGetKeyCount($self, &st); RAISE_IF(st); return result; } /* iterate over keys as [<value>,<name>] pairs */ void each() { int i; int count = CMGetKeyCount($self, NULL); CMPIString *name; for (i = 0; i < count; ++i ) { VALUE yield = rb_ary_new2(2); name = NULL; CMPIData data = CMGetKeyAt($self, i, &name, NULL); VALUE rbdata = data_data(&data); rb_ary_push(yield, rbdata); rb_ary_push(yield, rb_str_new2(CMGetCharPtr(name))); CMRelease(name); rb_yield(yield); } } /* Set/replace namespace and classname components from +src+. */ void replace_from(const CMPIObjectPath * src) { RAISE_IF(CMSetNameSpaceFromObjectPath($self, src)); } /* Set/replace hostname, namespace and classname components from +src+. */ void replace_all_from(const CMPIObjectPath * src) { RAISE_IF(CMSetHostAndNameSpaceFromObjectPath($self, src)); } /* Get class qualifier value. * +qName+: Qualifier name. */ CMPIData qualifier(const char *qname) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetClassQualifier($self, qname, &st); RAISE_IF(st); return result; } /* Get property qualifier value. * +pName+: Property name. * +qName+: Qualifier name. */ CMPIData property_qualifier(const char *pName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetPropertyQualifier($self, pName, qName, &st); RAISE_IF(st); return result; } /* Get method qualifier value. * mName: Method name. * qName: Qualifier name. */ CMPIData method_qualifier(const char *methodName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetMethodQualifier($self, methodName, qName, &st); RAISE_IF(st); return result; } /* Get method parameter qualifier value. * mName: Method name. * pName: Parameter name. * qName: Qualifier name. */ CMPIData parameter_qualifier( const char *mName, const char *pName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetParameterQualifier($self, mName, pName, qName, &st); RAISE_IF(st); return result; } /* Get the namespace component. */ %newobject namespace; const char *namespace() { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetNameSpace($self, &st); const char* result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } /* Set/replace the namespace component. */ %rename("namespace=") set_namespace(const char *nm); void set_namespace(const char *nm) { RAISE_IF(CMSetNameSpace($self, nm)); } /* Set/replace the hostname component. */ %rename("hostname=") set_hostname(const char *hostname); void set_hostname(const char *hostname) { RAISE_IF(CMSetHostname($self, hostname)); } /* Get the hostname component. */ %newobject hostname; const char *hostname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetHostname($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } /* Set/replace the classname component. */ %rename("classname=") set_classname(const char *classname); void set_classname(const char *classname) { RAISE_IF(CMSetClassName($self, classname)); } /* Get the classname component. */ %newobject classname; const char *classname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetClassName($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } }
classname()
click to toggle source
const char *classname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetClassName($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } }
classname=(p1)
click to toggle source
void set_classname(const char *classname) { RAISE_IF(CMSetClassName($self, classname)); } /* Get the classname component. */ %newobject classname; const char *classname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetClassName($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } }
clone()
click to toggle source
if clone()
each()
click to toggle source
iterate over keys as [<value>,<name>] pairs
void each() { int i; int count = CMGetKeyCount($self, NULL); CMPIString *name; for (i = 0; i < count; ++i ) { VALUE yield = rb_ary_new2(2); name = NULL; CMPIData data = CMGetKeyAt($self, i, &name, NULL); VALUE rbdata = data_data(&data); rb_ary_push(yield, rbdata); rb_ary_push(yield, rb_str_new2(CMGetCharPtr(name))); CMRelease(name); rb_yield(yield); } } /* Set/replace namespace and classname components from +src+. */ void replace_from(const CMPIObjectPath * src) { RAISE_IF(CMSetNameSpaceFromObjectPath($self, src)); } /* Set/replace hostname, namespace and classname components from +src+. */ void replace_all_from(const CMPIObjectPath * src) { RAISE_IF(CMSetHostAndNameSpaceFromObjectPath($self, src)); } /* Get class qualifier value. * +qName+: Qualifier name. */ CMPIData qualifier(const char *qname) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetClassQualifier($self, qname, &st); RAISE_IF(st); return result; } /* Get property qualifier value. * +pName+: Property name. * +qName+: Qualifier name. */ CMPIData property_qualifier(const char *pName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetPropertyQualifier($self, pName, qName, &st); RAISE_IF(st); return result; } /* Get method qualifier value. * mName: Method name. * qName: Qualifier name. */ CMPIData method_qualifier(const char *methodName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetMethodQualifier($self, methodName, qName, &st); RAISE_IF(st); return result; } /* Get method parameter qualifier value. * mName: Method name. * pName: Parameter name. * qName: Qualifier name. */ CMPIData parameter_qualifier( const char *mName, const char *pName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetParameterQualifier($self, mName, pName, qName, &st); RAISE_IF(st); return result; } /* Get the namespace component. */ %newobject namespace; const char *namespace() { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetNameSpace($self, &st); const char* result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } /* Set/replace the namespace component. */ %rename("namespace=") set_namespace(const char *nm); void set_namespace(const char *nm) { RAISE_IF(CMSetNameSpace($self, nm)); } /* Set/replace the hostname component. */ %rename("hostname=") set_hostname(const char *hostname); void set_hostname(const char *hostname) { RAISE_IF(CMSetHostname($self, hostname)); } /* Get the hostname component. */ %newobject hostname; const char *hostname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetHostname($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } /* Set/replace the classname component. */ %rename("classname=") set_classname(const char *classname); void set_classname(const char *classname) { RAISE_IF(CMSetClassName($self, classname)); } /* Get the classname component. */ %newobject classname; const char *classname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetClassName($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } }
hostname()
click to toggle source
const char *hostname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetHostname($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } /* Set/replace the classname component. */ %rename("classname=") set_classname(const char *classname); void set_classname(const char *classname) { RAISE_IF(CMSetClassName($self, classname)); } /* Get the classname component. */ %newobject classname; const char *classname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetClassName($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } }
hostname=(p1)
click to toggle source
void set_hostname(const char *hostname) { RAISE_IF(CMSetHostname($self, hostname)); } /* Get the hostname component. */ %newobject hostname; const char *hostname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetHostname($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } /* Set/replace the classname component. */ %rename("classname=") set_classname(const char *classname); void set_classname(const char *classname) { RAISE_IF(CMSetClassName($self, classname)); } /* Get the classname component. */ %newobject classname; const char *classname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetClassName($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } }
key(p1)
click to toggle source
Gets a named key property value.
name: Key property name.
VALUE get_key(VALUE property) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; const char *name; name = target_charptr(property); result = CMGetKey($self, name, &st); /* key not found is ok, will return NULL */ if (st.rc != CMPI_RC_ERR_NOT_FOUND) { RAISE_IF(st); } return data_value(&result); } %newobject get_key_at; #if defined (SWIGRUBY) %rename("key_at") get_key_at(int index); VALUE #endif #if defined (SWIGPYTHON) PyObject* #endif #if defined (SWIGPERL) SV* #endif /* Gets a key property [value,name] defined by its index. * name: [out] Key property name */ __type get_key_at(int index) { Target_Type tdata; CMPIString *s = NULL; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData data = CMGetKeyAt($self, index, &s, &st); Target_Type result; if (st.rc) { RAISE_IF(st); result = Target_Null; Target_INCREF(result); return result; } TARGET_THREAD_BEGIN_BLOCK; tdata = data_data(&data); #if defined (SWIGPYTHON) result = PyTuple_New(2); PyTuple_SetItem(result, 0, tdata); PyTuple_SetItem(result, 1, PyString_FromString(CMGetCharPtr(s))); #else result = Target_SizedArray(2); Target_Append(result, tdata); Target_Append(result, Target_String(CMGetCharPtr(s))); #endif TARGET_THREAD_END_BLOCK; CMRelease(s); return result; } /* Gets the number of key properties contained in this ObjectPath. */ int key_count() { CMPIStatus st = { CMPI_RC_OK, NULL }; int result; result = CMGetKeyCount($self, &st); RAISE_IF(st); return result; } /* iterate over keys as [<value>,<name>] pairs */ void each() { int i; int count = CMGetKeyCount($self, NULL); CMPIString *name; for (i = 0; i < count; ++i ) { VALUE yield = rb_ary_new2(2); name = NULL; CMPIData data = CMGetKeyAt($self, i, &name, NULL); VALUE rbdata = data_data(&data); rb_ary_push(yield, rbdata); rb_ary_push(yield, rb_str_new2(CMGetCharPtr(name))); CMRelease(name); rb_yield(yield); } } /* Set/replace namespace and classname components from +src+. */ void replace_from(const CMPIObjectPath * src) { RAISE_IF(CMSetNameSpaceFromObjectPath($self, src)); } /* Set/replace hostname, namespace and classname components from +src+. */ void replace_all_from(const CMPIObjectPath * src) { RAISE_IF(CMSetHostAndNameSpaceFromObjectPath($self, src)); } /* Get class qualifier value. * +qName+: Qualifier name. */ CMPIData qualifier(const char *qname) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetClassQualifier($self, qname, &st); RAISE_IF(st); return result; } /* Get property qualifier value. * +pName+: Property name. * +qName+: Qualifier name. */ CMPIData property_qualifier(const char *pName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetPropertyQualifier($self, pName, qName, &st); RAISE_IF(st); return result; } /* Get method qualifier value. * mName: Method name. * qName: Qualifier name. */ CMPIData method_qualifier(const char *methodName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetMethodQualifier($self, methodName, qName, &st); RAISE_IF(st); return result; } /* Get method parameter qualifier value. * mName: Method name. * pName: Parameter name. * qName: Qualifier name. */ CMPIData parameter_qualifier( const char *mName, const char *pName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetParameterQualifier($self, mName, pName, qName, &st); RAISE_IF(st); return result; } /* Get the namespace component. */ %newobject namespace; const char *namespace() { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetNameSpace($self, &st); const char* result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } /* Set/replace the namespace component. */ %rename("namespace=") set_namespace(const char *nm); void set_namespace(const char *nm) { RAISE_IF(CMSetNameSpace($self, nm)); } /* Set/replace the hostname component. */ %rename("hostname=") set_hostname(const char *hostname); void set_hostname(const char *hostname) { RAISE_IF(CMSetHostname($self, hostname)); } /* Get the hostname component. */ %newobject hostname; const char *hostname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetHostname($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } /* Set/replace the classname component. */ %rename("classname=") set_classname(const char *classname); void set_classname(const char *classname) { RAISE_IF(CMSetClassName($self, classname)); } /* Get the classname component. */ %newobject classname; const char *classname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetClassName($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } }
key_at(p1)
click to toggle source
Gets a key property [value,name] defined by its index.
name: [out] Key property name
__type get_key_at(int index) { Target_Type tdata; CMPIString *s = NULL; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData data = CMGetKeyAt($self, index, &s, &st); Target_Type result; if (st.rc) { RAISE_IF(st); result = Target_Null; Target_INCREF(result); return result; } TARGET_THREAD_BEGIN_BLOCK; tdata = data_data(&data); #if defined (SWIGPYTHON) result = PyTuple_New(2); PyTuple_SetItem(result, 0, tdata); PyTuple_SetItem(result, 1, PyString_FromString(CMGetCharPtr(s))); #else result = Target_SizedArray(2); Target_Append(result, tdata); Target_Append(result, Target_String(CMGetCharPtr(s))); #endif TARGET_THREAD_END_BLOCK; CMRelease(s); return result; } /* Gets the number of key properties contained in this ObjectPath. */ int key_count() { CMPIStatus st = { CMPI_RC_OK, NULL }; int result; result = CMGetKeyCount($self, &st); RAISE_IF(st); return result; } /* iterate over keys as [<value>,<name>] pairs */ void each() { int i; int count = CMGetKeyCount($self, NULL); CMPIString *name; for (i = 0; i < count; ++i ) { VALUE yield = rb_ary_new2(2); name = NULL; CMPIData data = CMGetKeyAt($self, i, &name, NULL); VALUE rbdata = data_data(&data); rb_ary_push(yield, rbdata); rb_ary_push(yield, rb_str_new2(CMGetCharPtr(name))); CMRelease(name); rb_yield(yield); } } /* Set/replace namespace and classname components from +src+. */ void replace_from(const CMPIObjectPath * src) { RAISE_IF(CMSetNameSpaceFromObjectPath($self, src)); } /* Set/replace hostname, namespace and classname components from +src+. */ void replace_all_from(const CMPIObjectPath * src) { RAISE_IF(CMSetHostAndNameSpaceFromObjectPath($self, src)); } /* Get class qualifier value. * +qName+: Qualifier name. */ CMPIData qualifier(const char *qname) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetClassQualifier($self, qname, &st); RAISE_IF(st); return result; } /* Get property qualifier value. * +pName+: Property name. * +qName+: Qualifier name. */ CMPIData property_qualifier(const char *pName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetPropertyQualifier($self, pName, qName, &st); RAISE_IF(st); return result; } /* Get method qualifier value. * mName: Method name. * qName: Qualifier name. */ CMPIData method_qualifier(const char *methodName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetMethodQualifier($self, methodName, qName, &st); RAISE_IF(st); return result; } /* Get method parameter qualifier value. * mName: Method name. * pName: Parameter name. * qName: Qualifier name. */ CMPIData parameter_qualifier( const char *mName, const char *pName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetParameterQualifier($self, mName, pName, qName, &st); RAISE_IF(st); return result; } /* Get the namespace component. */ %newobject namespace; const char *namespace() { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetNameSpace($self, &st); const char* result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } /* Set/replace the namespace component. */ %rename("namespace=") set_namespace(const char *nm); void set_namespace(const char *nm) { RAISE_IF(CMSetNameSpace($self, nm)); } /* Set/replace the hostname component. */ %rename("hostname=") set_hostname(const char *hostname); void set_hostname(const char *hostname) { RAISE_IF(CMSetHostname($self, hostname)); } /* Get the hostname component. */ %newobject hostname; const char *hostname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetHostname($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } /* Set/replace the classname component. */ %rename("classname=") set_classname(const char *classname); void set_classname(const char *classname) { RAISE_IF(CMSetClassName($self, classname)); } /* Get the classname component. */ %newobject classname; const char *classname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetClassName($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } }
key_count()
click to toggle source
Gets the number of key properties contained in this ObjectPath.
int key_count() { CMPIStatus st = { CMPI_RC_OK, NULL }; int result; result = CMGetKeyCount($self, &st); RAISE_IF(st); return result; } /* iterate over keys as [<value>,<name>] pairs */ void each() { int i; int count = CMGetKeyCount($self, NULL); CMPIString *name; for (i = 0; i < count; ++i ) { VALUE yield = rb_ary_new2(2); name = NULL; CMPIData data = CMGetKeyAt($self, i, &name, NULL); VALUE rbdata = data_data(&data); rb_ary_push(yield, rbdata); rb_ary_push(yield, rb_str_new2(CMGetCharPtr(name))); CMRelease(name); rb_yield(yield); } } /* Set/replace namespace and classname components from +src+. */ void replace_from(const CMPIObjectPath * src) { RAISE_IF(CMSetNameSpaceFromObjectPath($self, src)); } /* Set/replace hostname, namespace and classname components from +src+. */ void replace_all_from(const CMPIObjectPath * src) { RAISE_IF(CMSetHostAndNameSpaceFromObjectPath($self, src)); } /* Get class qualifier value. * +qName+: Qualifier name. */ CMPIData qualifier(const char *qname) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetClassQualifier($self, qname, &st); RAISE_IF(st); return result; } /* Get property qualifier value. * +pName+: Property name. * +qName+: Qualifier name. */ CMPIData property_qualifier(const char *pName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetPropertyQualifier($self, pName, qName, &st); RAISE_IF(st); return result; } /* Get method qualifier value. * mName: Method name. * qName: Qualifier name. */ CMPIData method_qualifier(const char *methodName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetMethodQualifier($self, methodName, qName, &st); RAISE_IF(st); return result; } /* Get method parameter qualifier value. * mName: Method name. * pName: Parameter name. * qName: Qualifier name. */ CMPIData parameter_qualifier( const char *mName, const char *pName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetParameterQualifier($self, mName, pName, qName, &st); RAISE_IF(st); return result; } /* Get the namespace component. */ %newobject namespace; const char *namespace() { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetNameSpace($self, &st); const char* result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } /* Set/replace the namespace component. */ %rename("namespace=") set_namespace(const char *nm); void set_namespace(const char *nm) { RAISE_IF(CMSetNameSpace($self, nm)); } /* Set/replace the hostname component. */ %rename("hostname=") set_hostname(const char *hostname); void set_hostname(const char *hostname) { RAISE_IF(CMSetHostname($self, hostname)); } /* Get the hostname component. */ %newobject hostname; const char *hostname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetHostname($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } /* Set/replace the classname component. */ %rename("classname=") set_classname(const char *classname); void set_classname(const char *classname) { RAISE_IF(CMSetClassName($self, classname)); } /* Get the classname component. */ %newobject classname; const char *classname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetClassName($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } }
method_qualifier(p1, p2)
click to toggle source
Get method qualifier value.
mName: Method name. qName: Qualifier name.
CMPIData method_qualifier(const char *methodName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetMethodQualifier($self, methodName, qName, &st); RAISE_IF(st); return result; } /* Get method parameter qualifier value. * mName: Method name. * pName: Parameter name. * qName: Qualifier name. */ CMPIData parameter_qualifier( const char *mName, const char *pName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetParameterQualifier($self, mName, pName, qName, &st); RAISE_IF(st); return result; } /* Get the namespace component. */ %newobject namespace; const char *namespace() { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetNameSpace($self, &st); const char* result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } /* Set/replace the namespace component. */ %rename("namespace=") set_namespace(const char *nm); void set_namespace(const char *nm) { RAISE_IF(CMSetNameSpace($self, nm)); } /* Set/replace the hostname component. */ %rename("hostname=") set_hostname(const char *hostname); void set_hostname(const char *hostname) { RAISE_IF(CMSetHostname($self, hostname)); } /* Get the hostname component. */ %newobject hostname; const char *hostname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetHostname($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } /* Set/replace the classname component. */ %rename("classname=") set_classname(const char *classname); void set_classname(const char *classname) { RAISE_IF(CMSetClassName($self, classname)); } /* Get the classname component. */ %newobject classname; const char *classname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetClassName($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } }
namespace()
click to toggle source
const char *namespace() { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetNameSpace($self, &st); const char* result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } /* Set/replace the namespace component. */ %rename("namespace=") set_namespace(const char *nm); void set_namespace(const char *nm) { RAISE_IF(CMSetNameSpace($self, nm)); } /* Set/replace the hostname component. */ %rename("hostname=") set_hostname(const char *hostname); void set_hostname(const char *hostname) { RAISE_IF(CMSetHostname($self, hostname)); } /* Get the hostname component. */ %newobject hostname; const char *hostname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetHostname($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } /* Set/replace the classname component. */ %rename("classname=") set_classname(const char *classname); void set_classname(const char *classname) { RAISE_IF(CMSetClassName($self, classname)); } /* Get the classname component. */ %newobject classname; const char *classname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetClassName($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } }
namespace=(p1)
click to toggle source
void set_namespace(const char *nm) { RAISE_IF(CMSetNameSpace($self, nm)); } /* Set/replace the hostname component. */ %rename("hostname=") set_hostname(const char *hostname); void set_hostname(const char *hostname) { RAISE_IF(CMSetHostname($self, hostname)); } /* Get the hostname component. */ %newobject hostname; const char *hostname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetHostname($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } /* Set/replace the classname component. */ %rename("classname=") set_classname(const char *classname); void set_classname(const char *classname) { RAISE_IF(CMSetClassName($self, classname)); } /* Get the classname component. */ %newobject classname; const char *classname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetClassName($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } }
parameter_qualifier(p1, p2, p3)
click to toggle source
Get method parameter qualifier value.
mName: Method name. pName: Parameter name. qName: Qualifier name.
CMPIData parameter_qualifier( const char *mName, const char *pName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetParameterQualifier($self, mName, pName, qName, &st); RAISE_IF(st); return result; } /* Get the namespace component. */ %newobject namespace; const char *namespace() { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetNameSpace($self, &st); const char* result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } /* Set/replace the namespace component. */ %rename("namespace=") set_namespace(const char *nm); void set_namespace(const char *nm) { RAISE_IF(CMSetNameSpace($self, nm)); } /* Set/replace the hostname component. */ %rename("hostname=") set_hostname(const char *hostname); void set_hostname(const char *hostname) { RAISE_IF(CMSetHostname($self, hostname)); } /* Get the hostname component. */ %newobject hostname; const char *hostname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetHostname($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } /* Set/replace the classname component. */ %rename("classname=") set_classname(const char *classname); void set_classname(const char *classname) { RAISE_IF(CMSetClassName($self, classname)); } /* Get the classname component. */ %newobject classname; const char *classname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetClassName($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } }
property_qualifier(p1, p2)
click to toggle source
Get property qualifier value.
+pName+: Property name. +qName+: Qualifier name.
CMPIData property_qualifier(const char *pName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetPropertyQualifier($self, pName, qName, &st); RAISE_IF(st); return result; } /* Get method qualifier value. * mName: Method name. * qName: Qualifier name. */ CMPIData method_qualifier(const char *methodName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetMethodQualifier($self, methodName, qName, &st); RAISE_IF(st); return result; } /* Get method parameter qualifier value. * mName: Method name. * pName: Parameter name. * qName: Qualifier name. */ CMPIData parameter_qualifier( const char *mName, const char *pName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetParameterQualifier($self, mName, pName, qName, &st); RAISE_IF(st); return result; } /* Get the namespace component. */ %newobject namespace; const char *namespace() { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetNameSpace($self, &st); const char* result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } /* Set/replace the namespace component. */ %rename("namespace=") set_namespace(const char *nm); void set_namespace(const char *nm) { RAISE_IF(CMSetNameSpace($self, nm)); } /* Set/replace the hostname component. */ %rename("hostname=") set_hostname(const char *hostname); void set_hostname(const char *hostname) { RAISE_IF(CMSetHostname($self, hostname)); } /* Get the hostname component. */ %newobject hostname; const char *hostname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetHostname($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } /* Set/replace the classname component. */ %rename("classname=") set_classname(const char *classname); void set_classname(const char *classname) { RAISE_IF(CMSetClassName($self, classname)); } /* Get the classname component. */ %newobject classname; const char *classname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetClassName($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } }
qualifier(p1)
click to toggle source
Get class qualifier value.
+qName+: Qualifier name.
CMPIData qualifier(const char *qname) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetClassQualifier($self, qname, &st); RAISE_IF(st); return result; } /* Get property qualifier value. * +pName+: Property name. * +qName+: Qualifier name. */ CMPIData property_qualifier(const char *pName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetPropertyQualifier($self, pName, qName, &st); RAISE_IF(st); return result; } /* Get method qualifier value. * mName: Method name. * qName: Qualifier name. */ CMPIData method_qualifier(const char *methodName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetMethodQualifier($self, methodName, qName, &st); RAISE_IF(st); return result; } /* Get method parameter qualifier value. * mName: Method name. * pName: Parameter name. * qName: Qualifier name. */ CMPIData parameter_qualifier( const char *mName, const char *pName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetParameterQualifier($self, mName, pName, qName, &st); RAISE_IF(st); return result; } /* Get the namespace component. */ %newobject namespace; const char *namespace() { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetNameSpace($self, &st); const char* result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } /* Set/replace the namespace component. */ %rename("namespace=") set_namespace(const char *nm); void set_namespace(const char *nm) { RAISE_IF(CMSetNameSpace($self, nm)); } /* Set/replace the hostname component. */ %rename("hostname=") set_hostname(const char *hostname); void set_hostname(const char *hostname) { RAISE_IF(CMSetHostname($self, hostname)); } /* Get the hostname component. */ %newobject hostname; const char *hostname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetHostname($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } /* Set/replace the classname component. */ %rename("classname=") set_classname(const char *classname); void set_classname(const char *classname) { RAISE_IF(CMSetClassName($self, classname)); } /* Get the classname component. */ %newobject classname; const char *classname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetClassName($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } }
replace_all_from(p1)
click to toggle source
Set/replace hostname, namespace and classname components from
src
.
void replace_all_from(const CMPIObjectPath * src) { RAISE_IF(CMSetHostAndNameSpaceFromObjectPath($self, src)); } /* Get class qualifier value. * +qName+: Qualifier name. */ CMPIData qualifier(const char *qname) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetClassQualifier($self, qname, &st); RAISE_IF(st); return result; } /* Get property qualifier value. * +pName+: Property name. * +qName+: Qualifier name. */ CMPIData property_qualifier(const char *pName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetPropertyQualifier($self, pName, qName, &st); RAISE_IF(st); return result; } /* Get method qualifier value. * mName: Method name. * qName: Qualifier name. */ CMPIData method_qualifier(const char *methodName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetMethodQualifier($self, methodName, qName, &st); RAISE_IF(st); return result; } /* Get method parameter qualifier value. * mName: Method name. * pName: Parameter name. * qName: Qualifier name. */ CMPIData parameter_qualifier( const char *mName, const char *pName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetParameterQualifier($self, mName, pName, qName, &st); RAISE_IF(st); return result; } /* Get the namespace component. */ %newobject namespace; const char *namespace() { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetNameSpace($self, &st); const char* result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } /* Set/replace the namespace component. */ %rename("namespace=") set_namespace(const char *nm); void set_namespace(const char *nm) { RAISE_IF(CMSetNameSpace($self, nm)); } /* Set/replace the hostname component. */ %rename("hostname=") set_hostname(const char *hostname); void set_hostname(const char *hostname) { RAISE_IF(CMSetHostname($self, hostname)); } /* Get the hostname component. */ %newobject hostname; const char *hostname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetHostname($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } /* Set/replace the classname component. */ %rename("classname=") set_classname(const char *classname); void set_classname(const char *classname) { RAISE_IF(CMSetClassName($self, classname)); } /* Get the classname component. */ %newobject classname; const char *classname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetClassName($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } }
replace_from(p1)
click to toggle source
Set/replace namespace and classname components from src
.
void replace_from(const CMPIObjectPath * src) { RAISE_IF(CMSetNameSpaceFromObjectPath($self, src)); } /* Set/replace hostname, namespace and classname components from +src+. */ void replace_all_from(const CMPIObjectPath * src) { RAISE_IF(CMSetHostAndNameSpaceFromObjectPath($self, src)); } /* Get class qualifier value. * +qName+: Qualifier name. */ CMPIData qualifier(const char *qname) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetClassQualifier($self, qname, &st); RAISE_IF(st); return result; } /* Get property qualifier value. * +pName+: Property name. * +qName+: Qualifier name. */ CMPIData property_qualifier(const char *pName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetPropertyQualifier($self, pName, qName, &st); RAISE_IF(st); return result; } /* Get method qualifier value. * mName: Method name. * qName: Qualifier name. */ CMPIData method_qualifier(const char *methodName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetMethodQualifier($self, methodName, qName, &st); RAISE_IF(st); return result; } /* Get method parameter qualifier value. * mName: Method name. * pName: Parameter name. * qName: Qualifier name. */ CMPIData parameter_qualifier( const char *mName, const char *pName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetParameterQualifier($self, mName, pName, qName, &st); RAISE_IF(st); return result; } /* Get the namespace component. */ %newobject namespace; const char *namespace() { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetNameSpace($self, &st); const char* result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } /* Set/replace the namespace component. */ %rename("namespace=") set_namespace(const char *nm); void set_namespace(const char *nm) { RAISE_IF(CMSetNameSpace($self, nm)); } /* Set/replace the hostname component. */ %rename("hostname=") set_hostname(const char *hostname); void set_hostname(const char *hostname) { RAISE_IF(CMSetHostname($self, hostname)); } /* Get the hostname component. */ %newobject hostname; const char *hostname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetHostname($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } /* Set/replace the classname component. */ %rename("classname=") set_classname(const char *classname); void set_classname(const char *classname) { RAISE_IF(CMSetClassName($self, classname)); } /* Get the classname component. */ %newobject classname; const char *classname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetClassName($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } }
set(p1, p2, p3)
click to toggle source
Property setting in Ruby
Set property of ObjectPath by name and type type is optional for string and boolean
reference = data # set by name (symbol) reference[:propname, CMPI::uint16] = data # set by name (symbol) reference = data # set by name (string)
CMPIStatus set(VALUE property, VALUE data, VALUE expected_type = Qnil) { const char *name; CMPIValue value; CMPIType actual_type; CMPIType type; CMPIStatus status; if (NIL_P(expected_type)) { type = CMPI_null; } else if (FIXNUM_P(expected_type)) { type = FIX2LONG(expected_type); } else { SWIG_exception(SWIG_ValueError, "bad expected_type"); } name = target_charptr(property); if (NIL_P(data)) { actual_type = type; /* prevent type error */ value.chars = NULL; } else { actual_type = target_to_value(data, &value, type); } /* fprintf(stderr, "CMPIObjectPath.%s <expected %04x, actual %04x>\n",name, type, actual_type); */ status = CMAddKey($self, name, &value, actual_type); RAISE_IF(status); return status; } /* Adds/replaces a named key property. * name: Key property name. * value: Address of value structure. * type: Value type. */ void add_key( const char *name, const CMPIValue* value, const CMPIType type) { RAISE_IF(CMAddKey($self, name, value, type)); } %rename("key") get_key(const char *name); %alias get_key "[]"; /* Gets a named key property value. * name: Key property name. */ VALUE get_key(VALUE property) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; const char *name; name = target_charptr(property); result = CMGetKey($self, name, &st); /* key not found is ok, will return NULL */ if (st.rc != CMPI_RC_ERR_NOT_FOUND) { RAISE_IF(st); } return data_value(&result); } %newobject get_key_at; #if defined (SWIGRUBY) %rename("key_at") get_key_at(int index); VALUE #endif #if defined (SWIGPYTHON) PyObject* #endif #if defined (SWIGPERL) SV* #endif /* Gets a key property [value,name] defined by its index. * name: [out] Key property name */ __type get_key_at(int index) { Target_Type tdata; CMPIString *s = NULL; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData data = CMGetKeyAt($self, index, &s, &st); Target_Type result; if (st.rc) { RAISE_IF(st); result = Target_Null; Target_INCREF(result); return result; } TARGET_THREAD_BEGIN_BLOCK; tdata = data_data(&data); #if defined (SWIGPYTHON) result = PyTuple_New(2); PyTuple_SetItem(result, 0, tdata); PyTuple_SetItem(result, 1, PyString_FromString(CMGetCharPtr(s))); #else result = Target_SizedArray(2); Target_Append(result, tdata); Target_Append(result, Target_String(CMGetCharPtr(s))); #endif TARGET_THREAD_END_BLOCK; CMRelease(s); return result; } /* Gets the number of key properties contained in this ObjectPath. */ int key_count() { CMPIStatus st = { CMPI_RC_OK, NULL }; int result; result = CMGetKeyCount($self, &st); RAISE_IF(st); return result; } /* iterate over keys as [<value>,<name>] pairs */ void each() { int i; int count = CMGetKeyCount($self, NULL); CMPIString *name; for (i = 0; i < count; ++i ) { VALUE yield = rb_ary_new2(2); name = NULL; CMPIData data = CMGetKeyAt($self, i, &name, NULL); VALUE rbdata = data_data(&data); rb_ary_push(yield, rbdata); rb_ary_push(yield, rb_str_new2(CMGetCharPtr(name))); CMRelease(name); rb_yield(yield); } } /* Set/replace namespace and classname components from +src+. */ void replace_from(const CMPIObjectPath * src) { RAISE_IF(CMSetNameSpaceFromObjectPath($self, src)); } /* Set/replace hostname, namespace and classname components from +src+. */ void replace_all_from(const CMPIObjectPath * src) { RAISE_IF(CMSetHostAndNameSpaceFromObjectPath($self, src)); } /* Get class qualifier value. * +qName+: Qualifier name. */ CMPIData qualifier(const char *qname) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetClassQualifier($self, qname, &st); RAISE_IF(st); return result; } /* Get property qualifier value. * +pName+: Property name. * +qName+: Qualifier name. */ CMPIData property_qualifier(const char *pName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetPropertyQualifier($self, pName, qName, &st); RAISE_IF(st); return result; } /* Get method qualifier value. * mName: Method name. * qName: Qualifier name. */ CMPIData method_qualifier(const char *methodName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetMethodQualifier($self, methodName, qName, &st); RAISE_IF(st); return result; } /* Get method parameter qualifier value. * mName: Method name. * pName: Parameter name. * qName: Qualifier name. */ CMPIData parameter_qualifier( const char *mName, const char *pName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetParameterQualifier($self, mName, pName, qName, &st); RAISE_IF(st); return result; } /* Get the namespace component. */ %newobject namespace; const char *namespace() { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetNameSpace($self, &st); const char* result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } /* Set/replace the namespace component. */ %rename("namespace=") set_namespace(const char *nm); void set_namespace(const char *nm) { RAISE_IF(CMSetNameSpace($self, nm)); } /* Set/replace the hostname component. */ %rename("hostname=") set_hostname(const char *hostname); void set_hostname(const char *hostname) { RAISE_IF(CMSetHostname($self, hostname)); } /* Get the hostname component. */ %newobject hostname; const char *hostname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetHostname($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } /* Set/replace the classname component. */ %rename("classname=") set_classname(const char *classname); void set_classname(const char *classname) { RAISE_IF(CMSetClassName($self, classname)); } /* Get the classname component. */ %newobject classname; const char *classname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetClassName($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } }
to_s()
click to toggle source
const char *string() { CMPIString *s = $self->ft->toString($self, NULL); const char *result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } %alias set "[]="; /* * Property setting in Ruby * Set property of ObjectPath by name and type * type is optional for string and boolean * reference[:propname] = data # set by name (symbol) * reference[:propname, CMPI::uint16] = data # set by name (symbol) * reference["propname"] = data # set by name (string) */ CMPIStatus set(VALUE property, VALUE data, VALUE expected_type = Qnil) { const char *name; CMPIValue value; CMPIType actual_type; CMPIType type; CMPIStatus status; if (NIL_P(expected_type)) { type = CMPI_null; } else if (FIXNUM_P(expected_type)) { type = FIX2LONG(expected_type); } else { SWIG_exception(SWIG_ValueError, "bad expected_type"); } name = target_charptr(property); if (NIL_P(data)) { actual_type = type; /* prevent type error */ value.chars = NULL; } else { actual_type = target_to_value(data, &value, type); } /* fprintf(stderr, "CMPIObjectPath.%s <expected %04x, actual %04x>\n",name, type, actual_type); */ status = CMAddKey($self, name, &value, actual_type); RAISE_IF(status); return status; } /* Adds/replaces a named key property. * name: Key property name. * value: Address of value structure. * type: Value type. */ void add_key( const char *name, const CMPIValue* value, const CMPIType type) { RAISE_IF(CMAddKey($self, name, value, type)); } %rename("key") get_key(const char *name); %alias get_key "[]"; /* Gets a named key property value. * name: Key property name. */ VALUE get_key(VALUE property) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; const char *name; name = target_charptr(property); result = CMGetKey($self, name, &st); /* key not found is ok, will return NULL */ if (st.rc != CMPI_RC_ERR_NOT_FOUND) { RAISE_IF(st); } return data_value(&result); } %newobject get_key_at; #if defined (SWIGRUBY) %rename("key_at") get_key_at(int index); VALUE #endif #if defined (SWIGPYTHON) PyObject* #endif #if defined (SWIGPERL) SV* #endif /* Gets a key property [value,name] defined by its index. * name: [out] Key property name */ __type get_key_at(int index) { Target_Type tdata; CMPIString *s = NULL; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData data = CMGetKeyAt($self, index, &s, &st); Target_Type result; if (st.rc) { RAISE_IF(st); result = Target_Null; Target_INCREF(result); return result; } TARGET_THREAD_BEGIN_BLOCK; tdata = data_data(&data); #if defined (SWIGPYTHON) result = PyTuple_New(2); PyTuple_SetItem(result, 0, tdata); PyTuple_SetItem(result, 1, PyString_FromString(CMGetCharPtr(s))); #else result = Target_SizedArray(2); Target_Append(result, tdata); Target_Append(result, Target_String(CMGetCharPtr(s))); #endif TARGET_THREAD_END_BLOCK; CMRelease(s); return result; } /* Gets the number of key properties contained in this ObjectPath. */ int key_count() { CMPIStatus st = { CMPI_RC_OK, NULL }; int result; result = CMGetKeyCount($self, &st); RAISE_IF(st); return result; } /* iterate over keys as [<value>,<name>] pairs */ void each() { int i; int count = CMGetKeyCount($self, NULL); CMPIString *name; for (i = 0; i < count; ++i ) { VALUE yield = rb_ary_new2(2); name = NULL; CMPIData data = CMGetKeyAt($self, i, &name, NULL); VALUE rbdata = data_data(&data); rb_ary_push(yield, rbdata); rb_ary_push(yield, rb_str_new2(CMGetCharPtr(name))); CMRelease(name); rb_yield(yield); } } /* Set/replace namespace and classname components from +src+. */ void replace_from(const CMPIObjectPath * src) { RAISE_IF(CMSetNameSpaceFromObjectPath($self, src)); } /* Set/replace hostname, namespace and classname components from +src+. */ void replace_all_from(const CMPIObjectPath * src) { RAISE_IF(CMSetHostAndNameSpaceFromObjectPath($self, src)); } /* Get class qualifier value. * +qName+: Qualifier name. */ CMPIData qualifier(const char *qname) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetClassQualifier($self, qname, &st); RAISE_IF(st); return result; } /* Get property qualifier value. * +pName+: Property name. * +qName+: Qualifier name. */ CMPIData property_qualifier(const char *pName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetPropertyQualifier($self, pName, qName, &st); RAISE_IF(st); return result; } /* Get method qualifier value. * mName: Method name. * qName: Qualifier name. */ CMPIData method_qualifier(const char *methodName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetMethodQualifier($self, methodName, qName, &st); RAISE_IF(st); return result; } /* Get method parameter qualifier value. * mName: Method name. * pName: Parameter name. * qName: Qualifier name. */ CMPIData parameter_qualifier( const char *mName, const char *pName, const char *qName) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData result; result = CMGetParameterQualifier($self, mName, pName, qName, &st); RAISE_IF(st); return result; } /* Get the namespace component. */ %newobject namespace; const char *namespace() { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetNameSpace($self, &st); const char* result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } /* Set/replace the namespace component. */ %rename("namespace=") set_namespace(const char *nm); void set_namespace(const char *nm) { RAISE_IF(CMSetNameSpace($self, nm)); } /* Set/replace the hostname component. */ %rename("hostname=") set_hostname(const char *hostname); void set_hostname(const char *hostname) { RAISE_IF(CMSetHostname($self, hostname)); } /* Get the hostname component. */ %newobject hostname; const char *hostname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetHostname($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } /* Set/replace the classname component. */ %rename("classname=") set_classname(const char *classname); void set_classname(const char *classname) { RAISE_IF(CMSetClassName($self, classname)); } /* Get the classname component. */ %newobject classname; const char *classname() { const char* result; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *s = CMGetClassName($self, &st); RAISE_IF(st); result = strdup(CMGetCharPtr(s)); CMRelease(s); return result; } }