CmpiImpl.cpp

Go to the documentation of this file.
00001 /*
00002  *
00003  * CmpiImpl.cpp
00004  *
00005  * (C) Copyright IBM Corp. 2003
00006  *
00007  * THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE
00008  * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE
00009  * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT.
00010  *
00011  * You can obtain a current copy of the Common Public License from
00012  * http://oss.software.ibm.com/developerworks/opensource/license-cpl.html
00013  *
00014  * Author:        Adrian Schuur <schuur@de.ibm.com>
00015  * Contributors:
00016  *
00017  * Description: CMPI C++ implemenation support
00018  *
00019  */
00020 
00021 
00022 #include "CmpiInstance.h"
00023 #include "CmpiObjectPath.h"
00024 #include "CmpiResult.h"
00025 #include "CmpiDateTime.h"
00026 
00027 #include "CmpiBaseMI.h"
00028 #include "CmpiInstanceMI.h"
00029 #include "CmpiAssociationMI.h"
00030 #include "CmpiMethodMI.h"
00031 #include "CmpiPropertyMI.h"
00032 #include "CmpiIndicationMI.h"
00033 #include "CmpiArray.h"
00034 #include "CmpiBroker.h"
00035 #include "cmpisrv.h"
00036 
00037 //CMPIBroker *CmpiBaseMI::broker=NULL;
00038 //int CmpiBaseMI::oneTime=0;
00039 
00040 CmpiProviderBase* CmpiProviderBase::base = NULL;
00041 
00042 //---------------------------------------------------
00043 //--
00044 // C to C++ base provider function drivers
00045 //--
00046 //---------------------------------------------------
00047 
00048 
00049 CMPIStatus CmpiBaseMI::doDriveBaseCleanup
00050       (void* vi, CMPIContext* eCtx) {
00051    CMPIInstanceMI *mi=( CMPIInstanceMI*)vi;
00052    CmpiContext ctx(eCtx);
00053    CmpiStatus rc(CMPI_RC_OK);
00054    rc=((CmpiInstanceMI*)mi->hdl)->cleanup(ctx);
00055    delete (CmpiBaseMI*)mi->hdl;
00056    return rc.status();
00057 }
00058 CmpiStatus CmpiBaseMI::initialize(const CmpiContext& ctx) {
00059    return CmpiStatus(CMPI_RC_OK);
00060 }
00061 
00062 CmpiStatus CmpiBaseMI::cleanup(CmpiContext& ctx) {
00063    return CmpiStatus(CMPI_RC_OK);
00064 }
00065 
00066 //---------------------------------------------------
00067 //--
00068 // C to C++ instance provider function drivers
00069 //--
00070 //---------------------------------------------------
00071 
00072 CMPIStatus CmpiInstanceMI::driveEnumInstanceNames
00073    (CMPIInstanceMI* mi,CMPIContext* eCtx, CMPIResult* eRslt,
00074     CMPIObjectPath* eCop)
00075 {
00076    CmpiContext ctx(eCtx);
00077    CmpiResult rslt(eRslt);
00078    CmpiObjectPath cop(eCop);
00079    return ((CmpiInstanceMI*)mi->hdl)->enumInstanceNames
00080       (ctx,rslt,cop).status();
00081 }
00082 
00083 CMPIStatus CmpiInstanceMI::driveEnumInstances
00084    (CMPIInstanceMI* mi, CMPIContext* eCtx, CMPIResult* eRslt,
00085     CMPIObjectPath* eCop, char* *properties)
00086 {
00087    CmpiContext ctx(eCtx);
00088    CmpiResult rslt(eRslt);
00089    CmpiObjectPath cop(eCop);
00090    return ((CmpiInstanceMI*)mi->hdl)->enumInstances
00091       (ctx,rslt,cop,(const char**)properties).status();
00092 }
00093 
00094 CMPIStatus CmpiInstanceMI::driveGetInstance
00095    (CMPIInstanceMI* mi, CMPIContext* eCtx, CMPIResult* eRslt,
00096     CMPIObjectPath* eCop, char* *properties)
00097 {
00098    CmpiContext ctx(eCtx);
00099    CmpiResult rslt(eRslt);
00100    CmpiObjectPath cop(eCop);
00101    return ((CmpiInstanceMI*)mi->hdl)->getInstance
00102       (ctx,rslt,cop,(const char**)properties).status();
00103 }
00104 
00105 CMPIStatus CmpiInstanceMI::driveCreateInstance
00106    (CMPIInstanceMI* mi, CMPIContext* eCtx, CMPIResult* eRslt,
00107     CMPIObjectPath* eCop, CMPIInstance* eInst)
00108 {
00109    CmpiContext ctx(eCtx);
00110    CmpiResult rslt(eRslt);
00111    CmpiObjectPath cop(eCop);
00112    CmpiInstance inst(eInst);
00113    return ((CmpiInstanceMI*)mi->hdl)->createInstance
00114       (ctx,rslt,cop,inst).status();
00115 }
00116 
00117 CMPIStatus CmpiInstanceMI::driveSetInstance
00118    (CMPIInstanceMI* mi, CMPIContext* eCtx, CMPIResult* eRslt,
00119     CMPIObjectPath* eCop, CMPIInstance* eInst, char* *properties)
00120 {
00121    CmpiContext ctx(eCtx);
00122    CmpiResult rslt(eRslt);
00123    CmpiObjectPath cop(eCop);
00124    CmpiInstance inst(eInst);
00125    return ((CmpiInstanceMI*)mi->hdl)->setInstance
00126       (ctx,rslt,cop,inst,(const char**)properties).status();
00127 }
00128 
00129 CMPIStatus CmpiInstanceMI::driveDeleteInstance
00130    (CMPIInstanceMI* mi, CMPIContext* eCtx, CMPIResult* eRslt,
00131     CMPIObjectPath* eCop)
00132 {
00133    CmpiContext ctx(eCtx);
00134    CmpiResult rslt(eRslt);
00135    CmpiObjectPath cop(eCop);
00136    return ((CmpiInstanceMI*)mi->hdl)->deleteInstance
00137       (ctx,rslt,cop).status();
00138 }
00139 
00140 CMPIStatus CmpiInstanceMI::driveExecQuery
00141    (CMPIInstanceMI* mi, CMPIContext* eCtx, CMPIResult* eRslt,
00142     CMPIObjectPath* eCop, char* language ,char* query)
00143 {
00144    CmpiContext ctx(eCtx);
00145    CmpiResult rslt(eRslt);
00146    CmpiObjectPath cop(eCop);
00147    return ((CmpiInstanceMI*)mi->hdl)->execQuery
00148     (ctx,rslt,cop,language,query).status();
00149 }
00150 
00151 
00152 //---------------------------------------------------
00153 //--
00154 // Default Instance provider functions
00155 //--
00156 //---------------------------------------------------
00157 
00158 CmpiStatus CmpiInstanceMI::enumInstanceNames
00159               (const CmpiContext& ctx, CmpiResult& rslt, const CmpiObjectPath& cop) {
00160    return CmpiStatus(CMPI_RC_ERR_NOT_SUPPORTED);
00161 }
00162 
00163 CmpiStatus CmpiInstanceMI::enumInstances
00164               (const CmpiContext& ctx, CmpiResult& rslt, const CmpiObjectPath& cop,
00165           const char* *properties){
00166    return CmpiStatus(CMPI_RC_ERR_NOT_SUPPORTED);
00167 }
00168 
00169 CmpiStatus CmpiInstanceMI::getInstance
00170               (const CmpiContext& ctx, CmpiResult& rslt, const CmpiObjectPath& cop,
00171           const char* *properties) {
00172    return CmpiStatus(CMPI_RC_ERR_NOT_SUPPORTED);
00173 }
00174 
00175 CmpiStatus CmpiInstanceMI::createInstance
00176               (const CmpiContext& ctx, CmpiResult& rslt, const CmpiObjectPath& cop,
00177                const CmpiInstance& inst) {
00178    return CmpiStatus(CMPI_RC_ERR_NOT_SUPPORTED);
00179 }
00180 
00181 CmpiStatus CmpiInstanceMI::setInstance
00182               (const CmpiContext& ctx, CmpiResult& rslt, const CmpiObjectPath& cop,
00183               const  CmpiInstance& inst, const char* *properties) {
00184    return CmpiStatus(CMPI_RC_ERR_NOT_SUPPORTED);
00185 }
00186 
00187 CmpiStatus CmpiInstanceMI::deleteInstance
00188               (const CmpiContext& ctx, CmpiResult& rslt, const CmpiObjectPath& cop) {
00189    return CmpiStatus(CMPI_RC_ERR_NOT_SUPPORTED);
00190 }
00191 
00192 CmpiStatus CmpiInstanceMI::execQuery
00193               (const CmpiContext& ctx, CmpiResult& rslt, const CmpiObjectPath& cop,
00194                const char* language, const char* query) {
00195    return CmpiStatus(CMPI_RC_ERR_NOT_SUPPORTED);
00196 }
00197 
00198 
00199 //---------------------------------------------------
00200 //--
00201 // C to C++ association provider function drivers
00202 //--
00203 //---------------------------------------------------
00204 
00205 CMPIStatus CmpiAssociationMI::driveAssociators
00206       (CMPIAssociationMI* mi, CMPIContext* eCtx, CMPIResult* eRslt,
00207        CMPIObjectPath* eOp, char* assocClass, char* resultClass,
00208        char* role, char* resultRole, char** properties) {
00209    CmpiContext ctx(eCtx);
00210    CmpiResult rslt(eRslt);
00211    CmpiObjectPath cop(eOp);
00212    return ((CmpiAssociationMI*)mi->hdl)->associators
00213       (ctx,rslt,cop,
00214        (const char*)assocClass,(const char*)resultClass,
00215        (const char*)role,(const char*)resultRole,(const char**)properties).status();
00216 }
00217 
00218 CMPIStatus CmpiAssociationMI::driveAssociatorNames
00219       (CMPIAssociationMI* mi, CMPIContext* eCtx, CMPIResult* eRslt,
00220        CMPIObjectPath* eOp, char* assocClass, char* resultClass,
00221        char* role, char* resultRole) {
00222    CmpiContext ctx(eCtx);
00223    CmpiResult rslt(eRslt);
00224    CmpiObjectPath cop(eOp);
00225    return ((CmpiAssociationMI*)mi->hdl)->associatorNames
00226       (ctx,rslt,cop,
00227        (const char*)assocClass,(const char*)resultClass,
00228        (const char*)role,(const char*)resultRole).status();
00229 }
00230 
00231 CMPIStatus CmpiAssociationMI::driveReferences
00232       (CMPIAssociationMI* mi, CMPIContext* eCtx, CMPIResult* eRslt,
00233        CMPIObjectPath* eOp, char* resultClass, char* role ,
00234        char** properties) {
00235    CmpiContext ctx(eCtx);
00236    CmpiResult rslt(eRslt);
00237    CmpiObjectPath cop(eOp);
00238    return ((CmpiAssociationMI*)mi->hdl)->references
00239       (ctx,rslt,cop,
00240        (const char*)resultClass,(const char*)role,(const char**)properties).status();
00241 }
00242 
00243 CMPIStatus CmpiAssociationMI::driveReferenceNames
00244       (CMPIAssociationMI* mi, CMPIContext* eCtx, CMPIResult* eRslt,
00245        CMPIObjectPath* eOp, char* resultClass, char* role) {
00246    CmpiContext ctx(eCtx);
00247    CmpiResult rslt(eRslt);
00248    CmpiObjectPath cop(eOp);
00249    return ((CmpiAssociationMI*)mi->hdl)->referenceNames
00250       (ctx,rslt,cop,
00251        (const char*)resultClass,(const char*)role).status();
00252 }
00253 
00254 
00255 //---------------------------------------------------
00256 //--
00257 // Default Association provider functions
00258 //--
00259 //---------------------------------------------------
00260 
00261 CmpiStatus CmpiAssociationMI::associators
00262       (const CmpiContext& ctx, CmpiResult& rslt,
00263        const CmpiObjectPath& op, const char* assocClass, const char* resultClass,
00264        const char* role, const char* resultRole, const char** properties) {
00265    return CmpiStatus(CMPI_RC_ERR_NOT_SUPPORTED);
00266 }
00267 
00268 CmpiStatus CmpiAssociationMI::associatorNames
00269       (const CmpiContext& ctx, CmpiResult& rslt,
00270        const CmpiObjectPath& op, const char* assocClass, const char* resultClass,
00271        const char* role, const char* resultRole) {
00272    return CmpiStatus(CMPI_RC_ERR_NOT_SUPPORTED);
00273 }
00274 
00275 CmpiStatus CmpiAssociationMI::references
00276       (const CmpiContext& ctx, CmpiResult& rslt,
00277        const CmpiObjectPath& op, const char* resultClass, const char* role ,
00278        const char** properties) {
00279    return CmpiStatus(CMPI_RC_ERR_NOT_SUPPORTED);
00280 }
00281 
00282 CmpiStatus CmpiAssociationMI::referenceNames
00283       (const CmpiContext& ctx, CmpiResult& rslt,
00284        const CmpiObjectPath& op, const char* resultClass, const char* role) {
00285    return CmpiStatus(CMPI_RC_ERR_NOT_SUPPORTED);
00286 }
00287 
00288 
00289 //---------------------------------------------------
00290 //--
00291 // C to C++ method provider function drivers
00292 //--
00293 //---------------------------------------------------
00294 
00295 CMPIStatus CmpiMethodMI::driveInvokeMethod
00296    (CMPIMethodMI* mi, CMPIContext* eCtx, CMPIResult* eRslt,
00297     CMPIObjectPath* eCop, char* methodName,
00298     CMPIArgs* eIn, CMPIArgs* eOut)
00299 {
00300    const CmpiContext ctx(eCtx);
00301    CmpiResult rslt(eRslt);
00302    const CmpiObjectPath cop(eCop);
00303    const CmpiArgs in(eIn);
00304    CmpiArgs out(eOut);
00305    return ((CmpiMethodMI*)mi->hdl)->invokeMethod
00306       (ctx,rslt,cop,(const char*)methodName,in,out).status();
00307 }
00308 
00309 
00310 //---------------------------------------------------
00311 //--
00312 // Default Method provider functions
00313 //--
00314 //---------------------------------------------------
00315 
00316 CmpiStatus CmpiMethodMI::invokeMethod
00317               (const CmpiContext& ctx, CmpiResult& rslt,
00318           const CmpiObjectPath& ref, const char* methodName,
00319           const CmpiArgs& in, CmpiArgs& out) {
00320    return CmpiStatus(CMPI_RC_ERR_NOT_SUPPORTED);
00321 }
00322 
00323 
00324 //---------------------------------------------------
00325 //--
00326 // C to C++ property provider function drivers
00327 //--
00328 //---------------------------------------------------
00329 
00330 CMPIStatus CmpiPropertyMI::driveSetProperty
00331       (CMPIPropertyMI* mi, CMPIContext* eCtx, CMPIResult* eRslt,
00332        CMPIObjectPath* eCop, char* name, CMPIData eData) {
00333    const CmpiContext ctx(eCtx);
00334    CmpiResult rslt(eRslt);
00335    const CmpiObjectPath cop(eCop);
00336    const CmpiData data(eData);
00337    return ((CmpiPropertyMI*)mi->hdl)->setProperty
00338       (ctx,rslt,cop,(const char*)name,data).status();
00339 }
00340 
00341 CMPIStatus CmpiPropertyMI::driveGetProperty
00342       (CMPIPropertyMI* mi, CMPIContext* eCtx, CMPIResult* eRslt,
00343        CMPIObjectPath* eCop, char* name) {
00344    const CmpiContext ctx(eCtx);
00345    CmpiResult rslt(eRslt);
00346    const CmpiObjectPath cop(eCop);
00347    return ((CmpiPropertyMI*)mi->hdl)->getProperty
00348       (ctx,rslt,cop,(const char*)name).status();
00349 }
00350 
00351 
00352 //---------------------------------------------------
00353 //--
00354 // Default property provider functions
00355 //--
00356 //---------------------------------------------------
00357 
00358 CmpiStatus CmpiPropertyMI::setProperty
00359       (const CmpiContext& ctx, CmpiResult& rslt,
00360        const CmpiObjectPath& op, const char* name, const CmpiData& data) {
00361    return CmpiStatus(CMPI_RC_ERR_NOT_SUPPORTED);
00362 }
00363 
00364 CmpiStatus CmpiPropertyMI::getProperty
00365       (const CmpiContext& ctx, CmpiResult& rslt,
00366        const CmpiObjectPath& op, const char* name) {
00367    return CmpiStatus(CMPI_RC_ERR_NOT_SUPPORTED);
00368 }
00369 
00370 
00371 //---------------------------------------------------
00372 //--
00373 // C to C++ indication provider function drivers
00374 //--
00375 //---------------------------------------------------
00376 
00377 CMPIStatus CmpiIndicationMI::driveAuthorizeFilter
00378       (CMPIIndicationMI* mi, CMPIContext* eCtx, CMPIResult* eRslt,
00379        CMPISelectExp* eSe, char* ns, CMPIObjectPath* eCop, char* user){
00380    const CmpiContext ctx(eCtx);
00381    CmpiResult rslt(eRslt);
00382    const CmpiObjectPath cop(eCop);
00383    const CmpiSelectExp se(eSe);
00384    return ((CmpiIndicationMI*)mi->hdl)->authorizeFilter
00385       (ctx,rslt,se,(const char*)ns,cop,(const char*)user).status();
00386 }
00387 
00388 CMPIStatus CmpiIndicationMI::driveMustPoll
00389       (CMPIIndicationMI* mi, CMPIContext* eCtx, CMPIResult* eRslt,
00390        CMPISelectExp* eSe, char* ns, CMPIObjectPath* eCop){
00391    const CmpiContext ctx(eCtx);
00392    CmpiResult rslt(eRslt);
00393    const CmpiObjectPath cop(eCop);
00394    const CmpiSelectExp se(eSe);
00395    return ((CmpiIndicationMI*)mi->hdl)->mustPoll
00396       (ctx,rslt,se,(const char*)ns,cop).status();
00397 }
00398 
00399 CMPIStatus CmpiIndicationMI::driveActivateFilter
00400       (CMPIIndicationMI* mi, CMPIContext* eCtx, CMPIResult* eRslt,
00401        CMPISelectExp* eSe, char* ns, CMPIObjectPath* eCop, CMPIBoolean first){
00402    const CmpiContext ctx(eCtx);
00403    CmpiResult rslt(eRslt);
00404    const CmpiObjectPath cop(eCop);
00405    const CmpiSelectExp se(eSe);
00406    return ((CmpiIndicationMI*)mi->hdl)->activateFilter
00407       (ctx,rslt,se,(const char*)ns,cop,first).status();
00408 }
00409 
00410 CMPIStatus CmpiIndicationMI::driveDeActivateFilter
00411       (CMPIIndicationMI* mi, CMPIContext* eCtx, CMPIResult* eRslt,
00412        CMPISelectExp* eSe, char* ns, CMPIObjectPath* eCop, CMPIBoolean last){
00413    const CmpiContext ctx(eCtx);
00414    CmpiResult rslt(eRslt);
00415    const CmpiObjectPath cop(eCop);
00416    const CmpiSelectExp se(eSe);
00417    return ((CmpiIndicationMI*)mi->hdl)->deActivateFilter
00418       (ctx,rslt,se,(const char*)ns,cop,last).status();
00419 }
00420 
00421 
00422 //---------------------------------------------------
00423 //--
00424 // Default indication provider functions
00425 //--
00426 //---------------------------------------------------
00427 
00428 CmpiStatus CmpiIndicationMI::authorizeFilter
00429       (const CmpiContext& ctx, CmpiResult& rslt,
00430        const CmpiSelectExp& se, const char* ns, const CmpiObjectPath& op, const char* user) {
00431    return CmpiStatus(CMPI_RC_ERR_NOT_SUPPORTED);
00432 }
00433 
00434 CmpiStatus CmpiIndicationMI::mustPoll
00435       (const CmpiContext& ctx, CmpiResult& rslt,
00436        const CmpiSelectExp& se, const char* ns, const CmpiObjectPath& op) {
00437    return CmpiStatus(CMPI_RC_ERR_NOT_SUPPORTED);
00438 }
00439 
00440 CmpiStatus CmpiIndicationMI::activateFilter
00441       (const CmpiContext& ctx, CmpiResult& rslt,
00442        const CmpiSelectExp& se, const char* ns, const CmpiObjectPath& op,
00443        CMPIBoolean first) {
00444    return CmpiStatus(CMPI_RC_ERR_NOT_SUPPORTED);
00445 }
00446 
00447 CmpiStatus CmpiIndicationMI::deActivateFilter
00448       (const CmpiContext& ctx, CmpiResult& rslt,
00449        const CmpiSelectExp& se, const char* ns, const CmpiObjectPath& op,
00450        CMPIBoolean last) {
00451    return CmpiStatus(CMPI_RC_ERR_NOT_SUPPORTED);
00452 }
00453 
00454 
00455 
00456 
00457 
00458 
00459 //---------------------------------------------------
00460 //--
00461 // CmpiArray member functions
00462 //--
00463 //---------------------------------------------------
00464 
00465 void *CmpiArray::makeArray(CMPIBroker *mb, CMPICount max, CMPIType type) {
00466    CMPIStatus rc;
00467    void *array=mb->eft->newArray(mb,max,type,&rc);
00468    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00469    return array;
00470 }
00471 
00472 CMPICount CmpiArray::size() {
00473    CMPIStatus rc;
00474    CMPICount c=getEnc()->ft->getSize(getEnc(),&rc);
00475    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00476    return c;
00477 }
00478 
00479 //---------------------------------------------------
00480 //--
00481 // CmpiArrayIdx member functions
00482 //--
00483 //---------------------------------------------------
00484 
00485 
00486 void CmpiArrayIdx::operator=(const CmpiString v) {
00487    CMPIStatus rc;
00488    if (ar.getEnc()->ft->getSimpleType(ar.getEnc(),&rc)!=CMPI_string)
00489       throw CMPI_RC_ERR_TYPE_MISMATCH;
00490    rc=ar.getEnc()->ft->setElementAt(ar.getEnc(),idx,(CMPIValue*)&v,CMPI_string);
00491    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00492 }
00493 
00494 void CmpiArrayIdx::operator=(const char* v) {
00495    CMPIStatus rc;
00496    if (ar.getEnc()->ft->getSimpleType(ar.getEnc(),&rc)!=CMPI_chars)
00497       throw CMPI_RC_ERR_TYPE_MISMATCH;
00498    rc=ar.getEnc()->ft->setElementAt(ar.getEnc(),idx,(CMPIValue*)&v,CMPI_chars);
00499    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00500 }
00501 
00502 void CmpiArrayIdx::operator=(const CMPISint8 v) {
00503    CMPIStatus rc;
00504    if (ar.getEnc()->ft->getSimpleType(ar.getEnc(),&rc)!=CMPI_sint8)
00505       throw CMPI_RC_ERR_TYPE_MISMATCH;
00506    rc=ar.getEnc()->ft->setElementAt(ar.getEnc(),idx,(CMPIValue*)&v,CMPI_sint8);
00507    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00508 }
00509 
00510 void CmpiArrayIdx::operator=(const CMPISint16 v) {
00511    CMPIStatus rc;
00512    if (ar.getEnc()->ft->getSimpleType(ar.getEnc(),&rc)!=CMPI_sint16)
00513       throw CMPI_RC_ERR_TYPE_MISMATCH;
00514    rc=ar.getEnc()->ft->setElementAt(ar.getEnc(),idx,(CMPIValue*)&v,CMPI_sint16);
00515    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00516 }
00517 
00518 void CmpiArrayIdx::operator=(const CMPISint32 v) {
00519    CMPIStatus rc;
00520    if (ar.getEnc()->ft->getSimpleType(ar.getEnc(),&rc)!=CMPI_sint32)
00521       throw CMPI_RC_ERR_TYPE_MISMATCH;
00522    rc=ar.getEnc()->ft->setElementAt(ar.getEnc(),idx,(CMPIValue*)&v,CMPI_sint32);
00523    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00524 }
00525 
00526 void CmpiArrayIdx::operator=(const int v) {
00527    CMPIStatus rc;
00528    if (ar.getEnc()->ft->getSimpleType(ar.getEnc(),&rc)!=CMPI_sint32)
00529       throw CMPI_RC_ERR_TYPE_MISMATCH;
00530    rc=ar.getEnc()->ft->setElementAt(ar.getEnc(),idx,(CMPIValue*)&v,CMPI_sint32);
00531    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00532 }
00533 
00534 
00535 void CmpiArrayIdx::operator=(const CMPISint64 v) {
00536    CMPIStatus rc;
00537    if (ar.getEnc()->ft->getSimpleType(ar.getEnc(),&rc)!=CMPI_sint64)
00538       throw CMPI_RC_ERR_TYPE_MISMATCH;
00539    rc=ar.getEnc()->ft->setElementAt(ar.getEnc(),idx,(CMPIValue*)&v,CMPI_sint64);
00540    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00541 }
00542 
00543 void CmpiArrayIdx::operator=(const CMPIUint8 v) {
00544    CMPIStatus rc;
00545    if (ar.getEnc()->ft->getSimpleType(ar.getEnc(),&rc)!=CMPI_uint8)
00546       throw CMPI_RC_ERR_TYPE_MISMATCH;
00547    rc=ar.getEnc()->ft->setElementAt(ar.getEnc(),idx,(CMPIValue*)&v,CMPI_uint8);
00548    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00549 }
00550 
00551 void CmpiArrayIdx::operator=(const CMPIUint16 v) {
00552    CMPIStatus rc;
00553    if (ar.getEnc()->ft->getSimpleType(ar.getEnc(),&rc)!=CMPI_uint16)
00554       throw CMPI_RC_ERR_TYPE_MISMATCH;
00555    rc=ar.getEnc()->ft->setElementAt(ar.getEnc(),idx,(CMPIValue*)&v,CMPI_uint16);
00556    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00557 }
00558 
00559 void CmpiArrayIdx::operator=(const CMPIUint32 v) {
00560    CMPIStatus rc;
00561    if (ar.getEnc()->ft->getSimpleType(ar.getEnc(),&rc)!=CMPI_uint32)
00562       throw CMPI_RC_ERR_TYPE_MISMATCH;
00563    rc=ar.getEnc()->ft->setElementAt(ar.getEnc(),idx,(CMPIValue*)&v,CMPI_uint32);
00564    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00565 }
00566 
00567 void CmpiArrayIdx::operator=(const unsigned int v) {
00568    CMPIStatus rc;
00569    if (ar.getEnc()->ft->getSimpleType(ar.getEnc(),&rc)!=CMPI_uint32)
00570       throw CMPI_RC_ERR_TYPE_MISMATCH;
00571    rc=ar.getEnc()->ft->setElementAt(ar.getEnc(),idx,(CMPIValue*)&v,CMPI_uint32);
00572    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00573 }
00574 
00575 void CmpiArrayIdx::operator=(const CMPIUint64 v) {
00576    CMPIStatus rc;
00577    if (ar.getEnc()->ft->getSimpleType(ar.getEnc(),&rc)!=CMPI_uint64)
00578       throw CMPI_RC_ERR_TYPE_MISMATCH;
00579    rc=ar.getEnc()->ft->setElementAt(ar.getEnc(),idx,(CMPIValue*)&v,CMPI_uint64);
00580    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00581 }
00582 
00583 
00584 void CmpiArrayIdx::operator>>(CmpiString& v) {
00585    CMPIStatus rc;
00586    CMPIData d;
00587    if (ar.getEnc()->ft->getSimpleType(ar.getEnc(),&rc)!=CMPI_string)
00588       throw CMPI_RC_ERR_TYPE_MISMATCH;
00589    d=ar.getEnc()->ft->getElementAt(ar.getEnc(),idx,&rc);
00590    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00591    v=CmpiString(d.value.string);
00592 }
00593 
00594 void CmpiArrayIdx::operator>>(CMPISint8& v) {
00595    CMPIStatus rc;
00596    CMPIData d;
00597    if (ar.getEnc()->ft->getSimpleType(ar.getEnc(),&rc)!=CMPI_sint8)
00598       throw CMPI_RC_ERR_TYPE_MISMATCH;
00599    d=ar.getEnc()->ft->getElementAt(ar.getEnc(),idx,&rc);
00600    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00601    v=d.value.sint8;
00602 }
00603 
00604 void CmpiArrayIdx::operator>>(CMPISint16& v) {
00605    CMPIStatus rc;
00606    CMPIData d;
00607    if (ar.getEnc()->ft->getSimpleType(ar.getEnc(),&rc)!=CMPI_sint16)
00608       throw CMPI_RC_ERR_TYPE_MISMATCH;
00609    d=ar.getEnc()->ft->getElementAt(ar.getEnc(),idx,&rc);
00610    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00611    v=d.value.sint16;
00612 }
00613 
00614 void CmpiArrayIdx::operator>>(CMPISint32& v) {
00615    CMPIStatus rc;
00616    CMPIData d;
00617    if (ar.getEnc()->ft->getSimpleType(ar.getEnc(),&rc)!=CMPI_sint32)
00618       throw CMPI_RC_ERR_TYPE_MISMATCH;
00619    d=ar.getEnc()->ft->getElementAt(ar.getEnc(),idx,&rc);
00620    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00621    v=d.value.sint32;
00622 }
00623 
00624 void CmpiArrayIdx::operator>>(int& v) {
00625    CMPIStatus rc;
00626    CMPIData d;
00627    if (ar.getEnc()->ft->getSimpleType(ar.getEnc(),&rc)!=CMPI_sint32)
00628       throw CMPI_RC_ERR_TYPE_MISMATCH;
00629    d=ar.getEnc()->ft->getElementAt(ar.getEnc(),idx,&rc);
00630    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00631    v=(int)d.value.sint32;
00632 }
00633 
00634 void CmpiArrayIdx::operator>>(CMPISint64& v) {
00635    CMPIStatus rc;
00636    CMPIData d;
00637    if (ar.getEnc()->ft->getSimpleType(ar.getEnc(),&rc)!=CMPI_sint64)
00638       throw CMPI_RC_ERR_TYPE_MISMATCH;
00639    d=ar.getEnc()->ft->getElementAt(ar.getEnc(),idx,&rc);
00640    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00641    v=(int)d.value.sint64;
00642 }
00643 
00644 void CmpiArrayIdx::operator>>(CMPIUint8& v) {
00645    CMPIStatus rc;
00646    CMPIData d;
00647    if (ar.getEnc()->ft->getSimpleType(ar.getEnc(),&rc)!=CMPI_uint8)
00648       throw CMPI_RC_ERR_TYPE_MISMATCH;
00649    d=ar.getEnc()->ft->getElementAt(ar.getEnc(),idx,&rc);
00650    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00651    v=d.value.uint8;
00652 }
00653 
00654 void CmpiArrayIdx::operator>>(CMPIUint16& v) {
00655    CMPIStatus rc;
00656    CMPIData d;
00657    if (ar.getEnc()->ft->getSimpleType(ar.getEnc(),&rc)!=CMPI_uint16)
00658       throw CMPI_RC_ERR_TYPE_MISMATCH;
00659    d=ar.getEnc()->ft->getElementAt(ar.getEnc(),idx,&rc);
00660    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00661    v=d.value.uint16;
00662 }
00663 
00664 void CmpiArrayIdx::operator>>(CMPIUint32& v) {
00665    CMPIStatus rc;
00666    CMPIData d;
00667    if (ar.getEnc()->ft->getSimpleType(ar.getEnc(),&rc)!=CMPI_uint32)
00668       throw CMPI_RC_ERR_TYPE_MISMATCH;
00669    d=ar.getEnc()->ft->getElementAt(ar.getEnc(),idx,&rc);
00670    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00671    v=d.value.uint32;
00672 }
00673 
00674 void CmpiArrayIdx::operator>>(unsigned int& v) {
00675    CMPIStatus rc;
00676    CMPIData d;
00677    if (ar.getEnc()->ft->getSimpleType(ar.getEnc(),&rc)!=CMPI_uint32)
00678       throw CMPI_RC_ERR_TYPE_MISMATCH;
00679    d=ar.getEnc()->ft->getElementAt(ar.getEnc(),idx,&rc);
00680    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00681    v=(unsigned int)d.value.uint32;
00682 }
00683 
00684 void CmpiArrayIdx::operator>>(CMPIUint64& v) {
00685    CMPIStatus rc;
00686    CMPIData d;
00687    if (ar.getEnc()->ft->getSimpleType(ar.getEnc(),&rc)!=CMPI_uint64)
00688       throw CMPI_RC_ERR_TYPE_MISMATCH;
00689    d=ar.getEnc()->ft->getElementAt(ar.getEnc(),idx,&rc);
00690    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00691    v=(int)d.value.uint64;
00692 }
00693 
00694 
00695 
00696 //---------------------------------------------------
00697 //--
00698 // CmpiData member functions
00699 //--
00700 //---------------------------------------------------
00701 
00702 
00703 void CmpiData::operator>>(CmpiInstance& v){
00704    if (data.type!=CMPI_instance)
00705       throw CMPI_RC_ERR_TYPE_MISMATCH;
00706    else v=CmpiInstance(data.value.inst);
00707 }
00708 
00709 void CmpiData::operator>>(CmpiObjectPath& v) {
00710    if (data.type!=CMPI_ref)
00711       throw CMPI_RC_ERR_TYPE_MISMATCH;
00712    else v=CmpiObjectPath(data.value.ref);
00713 }
00714 
00715 
00716 //---------------------------------------------------
00717 //--
00718 // CmpiInstance member functions
00719 //--
00720 //---------------------------------------------------
00721 
00722 
00723 void *CmpiInstance::makeInstance(CMPIBroker *mb, const CmpiObjectPath& cop) {
00724    CMPIStatus rc;
00725    void *inst=mb->eft->newInstance(mb,((CmpiObjectPath&)cop).getEnc(),&rc);
00726    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00727    return inst;
00728 }
00729 
00730 CmpiBoolean CmpiInstance::doInstanceIsA(CMPIBroker *mb, const char *className) {
00731    CmpiObjectPath cop=getObjectPath();
00732    return cop.doClassPathIsA(mb,(char*)className);
00733 }
00734 
00735 CmpiData CmpiInstance::getProperty(const char* name) {
00736    CmpiData d;
00737    CMPIStatus rc;
00738    d.data=getEnc()->ft->getProperty(getEnc(),(char*)name,&rc);
00739    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00740    return d;
00741 }
00742 
00743 CmpiData CmpiInstance::getProperty(const int pos, CmpiString *name) {
00744    CmpiData d;
00745    CMPIStatus rc;
00746    CMPIString *s;
00747    d.data=getEnc()->ft->getPropertyAt(getEnc(),pos,&s,&rc);
00748    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00749    if (name) *name=CmpiString(s);
00750    return d;
00751 };
00752 
00753 unsigned int CmpiInstance::getPropertyCount() {
00754    CMPIStatus rc;
00755    unsigned int c=getEnc()->ft->getPropertyCount(getEnc(),&rc);
00756    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00757    return c;
00758 }
00759 
00760 void CmpiInstance::setProperty(const char* name, CmpiData data) {
00761    CMPIStatus rc=getEnc()->ft->setProperty(getEnc(),(char*)name,
00762       data.data.type!=CMPI_chars ? &data.data.value : (CMPIValue*)data.data.value.chars,
00763       data.data.type);
00764    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00765 }
00766 
00767 CmpiObjectPath CmpiInstance::getObjectPath() {
00768    CMPIStatus rc;
00769    CmpiObjectPath cop(getEnc()->ft->getObjectPath(getEnc(),&rc));
00770    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00771    return cop;
00772 }
00773 
00774 
00775 //---------------------------------------------------
00776 //--
00777 // CmpiStatus member functions
00778 //--
00779 //---------------------------------------------------
00780 
00781 
00782 CmpiStatus::CmpiStatus() {
00783    st.rc=CMPI_RC_OK;
00784    st.msg=NULL;
00785 }
00786 
00787 CmpiStatus::CmpiStatus(CMPIrc rcp) {
00788    st.rc=rcp;
00789    st.msg=NULL;
00790 }
00791 
00792 //---------------------------------------------------
00793 //--
00794 // CmpiObjectPath member functions
00795 //--
00796 //---------------------------------------------------
00797 
00798 
00799 
00800 void *CmpiObjectPath::makeObjectPath(CMPIBroker *mb, const char *ns, const char *cls) {
00801    CMPIStatus rc;
00802    void *op=mb->eft->newObjectPath(mb,(char*)ns,(char*)cls,&rc);
00803    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00804    return op;
00805 }
00806 
00807 void *CmpiObjectPath::makeObjectPath(CMPIBroker *mb, const CmpiString& ns, const char *cls) {
00808    CMPIStatus rc;
00809    void *op=mb->eft->newObjectPath(mb,CMGetCharPtr(ns.getEnc()),(char*)cls,&rc);
00810    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00811    return op;
00812 }
00813 
00814 CmpiBoolean CmpiObjectPath::doClassPathIsA(CMPIBroker *mb, const char *className) {
00815    CMPIStatus rc;
00816    CmpiBoolean bv=mb->eft->classPathIsA(mb,getEnc(),(char*)className,&rc);
00817    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00818    return bv;
00819 }
00820 
00821 CmpiString CmpiObjectPath::getNameSpace() const{
00822    CMPIStatus rc;
00823    CMPIString *s=getEnc()->ft->getNameSpace(getEnc(),&rc);
00824    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00825    return CmpiString(s);
00826 }
00827 
00828 void CmpiObjectPath::setNameSpace(const char* ns) {
00829    CMPIStatus rc=getEnc()->ft->setNameSpace(getEnc(),(char*)ns);
00830    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00831 }
00832 
00833 CmpiString CmpiObjectPath::getHostname() const {
00834    CMPIStatus rc;
00835    CMPIString *s=getEnc()->ft->getHostname(getEnc(),&rc);
00836    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00837    return CmpiString(s);
00838 }
00839 
00840 void CmpiObjectPath::setHostname(const char* hn) {
00841    CMPIStatus rc=getEnc()->ft->setHostname(getEnc(),(char*)hn);
00842    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00843 }
00844 
00845 CmpiString CmpiObjectPath::getClassName() const {
00846    CMPIStatus rc;
00847    CMPIString *s=getEnc()->ft->getClassName(getEnc(),&rc);
00848    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00849    return CmpiString(s);
00850 }
00851 
00852 void CmpiObjectPath::setClassName(const char* cn) {
00853    CMPIStatus rc=getEnc()->ft->setClassName(getEnc(),(char*)cn);
00854    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00855 }
00856 
00857 CmpiData CmpiObjectPath::getKey(const char* name) const {
00858    CmpiData d;
00859    CMPIStatus rc;
00860    d.data=getEnc()->ft->getKey(getEnc(),(char*)name,&rc);
00861    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00862    return d;
00863 }
00864 
00865 unsigned int CmpiObjectPath::getKeyCount() const {
00866    CMPIStatus rc;
00867    unsigned int c=getEnc()->ft->getKeyCount(getEnc(),&rc);
00868    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00869    return c;
00870 }
00871 
00872 CmpiData CmpiObjectPath::getKey(const int pos, CmpiString *name) const {
00873    CmpiData d;
00874    CMPIStatus rc;
00875    CMPIString *s;
00876    d.data=getEnc()->ft->getKeyAt(getEnc(),(int)pos,&s,&rc);
00877    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00878    if (name) *name=CmpiString(s);
00879    return d;
00880 }
00881 
00882 void CmpiObjectPath::setKey(const char* name, CmpiData data) {
00883    CMPIStatus rc=getEnc()->ft->addKey(getEnc(),(char*)name,
00884       data.data.type!=CMPI_chars ? &data.data.value : (CMPIValue*)data.data.value.chars,
00885       data.data.type);
00886    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00887 }
00888 
00889 
00890 //---------------------------------------------------
00891 //--
00892 // CmpiResult member functions
00893 //--
00894 //---------------------------------------------------
00895 
00896 
00897 
00898 void CmpiResult::returnData(const CmpiData& d)
00899 {
00900    CMPIStatus rc=getEnc()->ft->returnData(getEnc(),
00901       &(const_cast<CmpiData&>(d).data.value),d.data.type);
00902       if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00903 }
00904 
00905 void CmpiResult::returnData(const CmpiInstance& d)
00906 {
00907    CMPIStatus rc=getEnc()->ft->returnInstance(getEnc(),d.getEnc());
00908    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00909 }
00910 
00911 void CmpiResult::returnData(const CmpiObjectPath& d)
00912 {
00913    CMPIStatus rc = getEnc()->ft->returnObjectPath(getEnc(),d.getEnc());
00914    if (rc.rc != CMPI_RC_OK)
00915    {
00916       throw rc.rc;
00917    }
00918 }
00919 
00920 void CmpiResult::returnDone() {
00921    CMPIStatus rc=getEnc()->ft->returnDone(getEnc());
00922    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00923 }
00924 
00925 
00926 
00927 //---------------------------------------------------
00928 //--
00929 // CmpiBroker member functions
00930 //--
00931 //---------------------------------------------------
00932 
00933 
00934 void CmpiBroker::deliverIndication(const CmpiContext& ctx, const char*,
00935                                    const CmpiInstance& inst)
00936 {
00937    throw CmpiStatus(CMPI_RC_ERR_NOT_SUPPORTED);
00938 }
00939 
00940      // class 1 services
00941 CmpiEnumeration CmpiBroker::enumInstanceNames(const CmpiContext& ctx,
00942                                               const CmpiObjectPath& cop)
00943 {
00944    CMPIStatus rc;
00945    CMPIEnumeration* en=getEnc()->bft->enumInstanceNames
00946       (getEnc(),ctx.getEnc(),cop.getEnc(),&rc);
00947    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00948    return CmpiEnumeration(en);
00949 }
00950 
00951 CmpiInstance CmpiBroker::getInstance(const CmpiContext& ctx,
00952                          const CmpiObjectPath& cop,
00953                          const char** properties)
00954 {
00955    CMPIStatus rc;
00956    CMPIInstance* en=getEnc()->bft->getInstance
00957       (getEnc(),ctx.getEnc(),cop.getEnc(),properties,&rc);
00958    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00959    return CmpiInstance(en);
00960 }
00961 
00962 
00963      // class 2 services
00964 CmpiObjectPath CmpiBroker::createInstance(const CmpiContext& ctx,
00965                               const CmpiObjectPath& cop,
00966                               const CmpiInstance& inst)
00967 {
00968    throw CmpiStatus(CMPI_RC_ERR_NOT_SUPPORTED);
00969 }
00970 
00971 void CmpiBroker::setInstance(const CmpiContext& ctx, const CmpiObjectPath& cop,
00972                              const CmpiInstance& inst)
00973 {
00974    throw CmpiStatus(CMPI_RC_ERR_NOT_SUPPORTED);
00975 }
00976 
00977 void CmpiBroker::deleteInstance(const CmpiContext& ctx, const CmpiObjectPath& cop)
00978 {
00979    throw CmpiStatus(CMPI_RC_ERR_NOT_SUPPORTED);
00980 }
00981 
00982 CmpiEnumeration CmpiBroker::execQuery(const CmpiContext& ctx,
00983                           const  CmpiObjectPath& cop,
00984                           const char* query, const char* language)
00985 {
00986    throw CmpiStatus(CMPI_RC_ERR_NOT_SUPPORTED);
00987 }
00988 
00989 
00990 CmpiEnumeration CmpiBroker::enumInstances(const CmpiContext& ctx,
00991                               const CmpiObjectPath& cop,
00992                               const char** properties)
00993 {
00994    CMPIStatus rc;
00995    CMPIEnumeration* en=getEnc()->bft->enumInstances
00996       (getEnc(),ctx.getEnc(),cop.getEnc(),properties,&rc);
00997    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
00998    return CmpiEnumeration(en);
00999 }
01000 
01001 CmpiEnumeration CmpiBroker::associators(const CmpiContext& ctx,
01002                             const CmpiObjectPath& cop,
01003                             const char* assocClass, const char* resultClass,
01004                   const char* role, const char* resultRole,
01005              const char** properties)
01006 {
01007    throw CmpiStatus(CMPI_RC_ERR_NOT_SUPPORTED);
01008 }
01009 
01010 CmpiEnumeration CmpiBroker::associatorNames(const CmpiContext& ctx,
01011                                 const CmpiObjectPath& cop,
01012                                 const char* assocClass, const char* resultClass,
01013                       const char* role, const char* resultRole)
01014 {
01015    throw CmpiStatus(CMPI_RC_ERR_NOT_SUPPORTED);
01016 }
01017 
01018 CmpiEnumeration CmpiBroker::references(const CmpiContext& ctx,
01019                            const CmpiObjectPath& cop,
01020                            const char* resultClass, const char* role,
01021             const char** properties)
01022 {
01023    throw CmpiStatus(CMPI_RC_ERR_NOT_SUPPORTED);
01024 }
01025 
01026 CmpiEnumeration CmpiBroker::referenceNames(const CmpiContext& ctx,
01027                                const CmpiObjectPath& cop,
01028                                const char* resultClass, const char* role)
01029 {
01030    throw CmpiStatus(CMPI_RC_ERR_NOT_SUPPORTED);
01031 }
01032 
01033 CmpiData CmpiBroker::invokeMethod(const CmpiContext& ctx, const CmpiObjectPath& cop,
01034                  const char* methName, const CmpiArgs& in, CmpiArgs& out)
01035 {
01036    throw CmpiStatus(CMPI_RC_ERR_NOT_SUPPORTED);
01037 }
01038 
01039 void CmpiBroker::setProperty(const CmpiContext& ctx, const CmpiObjectPath& cop,
01040                  const char* name, const CmpiData& data)
01041 {
01042    throw CmpiStatus(CMPI_RC_ERR_NOT_SUPPORTED);
01043 }
01044 
01045 CmpiData CmpiBroker::getProperty(const CmpiContext& ctx, const CmpiObjectPath& cop,
01046                   const char* name)
01047 {
01048    throw CmpiStatus(CMPI_RC_ERR_NOT_SUPPORTED);
01049 }
01050 
01051 
01052 
01053 
01054 //---------------------------------------------------
01055 //--
01056 // CmpiString member functions
01057 //--
01058 //---------------------------------------------------
01059 
01060 
01061 
01062 
01063 CmpiString::CmpiString(const CmpiString& s) {
01064    CmpiString *ss=(CmpiString*)&s;
01065    enc=ss->getEnc()->ft->clone(ss->getEnc(),NULL);
01066 }
01067 
01068 
01069 
01070 //---------------------------------------------------
01071 //--
01072 // CmpiArgs member functions
01073 //--
01074 //---------------------------------------------------
01075 
01076 
01077 
01078 
01079 void *CmpiArgs::makeArgs(CMPIBroker *mb) {
01080    CMPIStatus rc;
01081    void *args=mb->eft->newArgs(mb,&rc);
01082    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
01083    return args;
01084 }
01085 
01086 void CmpiArgs::setArg(const char* name, CmpiData& data) {
01087    CMPIStatus rc=getEnc()->ft->addArg(getEnc(),(char*)name,
01088          data.data.type!=CMPI_chars ? &data.data.value
01089                                : (CMPIValue*)data.data.value.chars,
01090          data.data.type);
01091    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
01092 }
01093 
01094 CmpiData CmpiArgs::getArg(const int pos, CmpiString *name) {
01095    CmpiData d;
01096    CMPIStatus rc;
01097    CMPIString *s;
01098    d.data=getEnc()->ft->getArgAt(getEnc(),(int)pos,&s,&rc);
01099    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
01100    if (name) *name=CmpiString(s);
01101    return d;
01102 }
01103 
01104 CmpiData CmpiArgs::getArg(const char* name) {
01105    CmpiData d;
01106    CMPIStatus rc;
01107    d.data=getEnc()->ft->getArg(getEnc(),(char*)name,&rc);
01108    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
01109    return d;
01110 }
01111 
01112 unsigned int CmpiArgs::getArgCount() {
01113    CMPIStatus rc;
01114    unsigned int c=getEnc()->ft->getArgCount(getEnc(),&rc);
01115    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
01116    return c;
01117 }
01118 
01119 
01120 
01121 //---------------------------------------------------
01122 //--
01123 // CmpiObject member functions
01124 //--
01125 //---------------------------------------------------
01126 
01127 
01128 
01129 
01130 CmpiString CmpiObject::doToString(CMPIBroker *mb) {
01131    CMPIStatus rc;
01132    CMPIString *str=mb->eft->toString(mb,enc,&rc);
01133    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
01134    return CmpiString(str);
01135 }
01136 
01137 CmpiBoolean CmpiObject::doIsA(CMPIBroker *mb, const char *typeName) {
01138    CMPIStatus rc;
01139    CmpiBoolean bv=mb->eft->isOfType(mb,enc,(char*)typeName,&rc);
01140    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
01141    return bv;
01142 }
01143 
01144 
01145 
01146 //---------------------------------------------------
01147 //--
01148 // CmpiContext member functions
01149 //--
01150 //---------------------------------------------------
01151 
01152 
01153 
01154 const char *CmpiContext::invocationFlags=CMPIInvocationFlags;
01155 
01156 CmpiData CmpiContext::getEntry(const char* name) {
01157    CmpiData d;
01158    CMPIStatus rc;
01159    d.data=getEnc()->ft->getEntry(getEnc(),(char*)name,&rc);
01160    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
01161    return d;
01162 }
01163 
01164 
01165 
01166 //---------------------------------------------------
01167 //--
01168 // CmpiDateTime member functions
01169 //--
01170 //---------------------------------------------------
01171 
01172 
01173 void *CmpiDateTime::makeDateTime(CMPIBroker *mb) {
01174    CMPIStatus rc;
01175    void *dt=mb->eft->newDateTime(mb,&rc);
01176    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
01177    return dt;
01178 }
01179 
01180 void *CmpiDateTime::makeDateTime(CMPIBroker *mb, const char* utcTime) {
01181    CMPIStatus rc;
01182    void *dt=mb->eft->newDateTimeFromChars(mb,(char*)utcTime,&rc);
01183    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
01184    return dt;
01185 }
01186 
01187 void *CmpiDateTime::makeDateTime(CMPIBroker *mb, const CMPIUint64 binTime,
01188                                  const CmpiBoolean interval) {
01189    CMPIStatus rc;
01190    void *dt=mb->eft->newDateTimeFromBinary(mb,binTime,interval,&rc);
01191    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
01192    return dt;
01193 }
01194 
01195 CmpiBoolean CmpiDateTime::isInterval() {
01196    CMPIStatus rc;
01197    CmpiBoolean bv=getEnc()->ft->isInterval(getEnc(),&rc);
01198    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
01199    return bv;
01200 }
01201 
01202 CMPIUint64 CmpiDateTime::getDateTime() {
01203    CMPIStatus rc;
01204    CMPIUint64 rv=getEnc()->ft->getBinaryFormat(getEnc(),&rc);
01205    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
01206    return rv;
01207 };
01208 
01209 //---------------------------------------------------
01210 //--
01211 // CmpiEnumeration member functions
01212 //--
01213 //---------------------------------------------------
01214 /*
01215 CmpiEnumeration::CmpiEnumeration(CMPIEnumeration* enc) {
01216    this->enc=enc;
01217 }
01218 
01219 CMPIEnumeration *CmpiEnumeration::getEnc() const {
01220    return (CMPIEnumeration*)enc;
01221 }
01222 
01223 CmpiEnumeration::CmpiEnumeration() {
01224 }
01225 */
01226 CmpiBoolean CmpiEnumeration::hasNext()
01227 {
01228    CMPIStatus rc={CMPI_RC_OK,NULL};
01229    CmpiBoolean bv=getEnc()->ft->hasNext(getEnc(),&rc);
01230    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
01231    return bv;
01232 }
01233 
01234 CmpiData CmpiEnumeration::getNext()
01235 {
01236    CMPIStatus rc={CMPI_RC_OK,NULL};
01237    CMPIData d=getEnc()->ft->getNext(getEnc(),&rc);
01238    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
01239    return CmpiData(d);
01240 }
01241 // drop cursor to 0
01242 void CmpiEnumeration::toFirst()
01243 {
01244    CMPIStatus rc={CMPI_RC_OK,NULL};
01245    if ((void*)getEnc()->ft == (void*)CMPI_ObjEnumeration_Ftab)
01246    {
01247       CMPI_ObjEnumeration* ie=(CMPI_ObjEnumeration*)getEnc();
01248       ie->cursor = 0;
01249    }
01250    else if ((void*)getEnc()->ft == (void*)CMPI_InstEnumeration_Ftab)
01251    {
01252       CMPI_InstEnumeration* ie=(CMPI_InstEnumeration*)getEnc();
01253       ie->cursor = 0;
01254    }
01255    else
01256    {
01257       CMPI_OpEnumeration* ie=(CMPI_OpEnumeration*)getEnc();
01258       ie->cursor = 0;
01259    }
01260 }
01261 
01262 /*
01263 CmpiData CmpiEnumeration::toArray()
01264 {
01265    CMPIStatus rc={CMPI_RC_OK,NULL};
01266    CMPIArray* a=getEnc()->ft->toArray(getEnc(),&rc);
01267    if (rc.rc!=CMPI_RC_OK) throw rc.rc;
01268    return CmpiData(CmpiArray(a));
01269 }
01270 */
01271 
01272 // compare CmpiData
01273 bool CmpiData::operator == (const CmpiData& d)
01274 {
01275    if (data.type == d.data.type)
01276    {
01277       // compare simplest types
01278       switch (data.type)
01279       {
01280          case CMPI_string:
01281             return strcmp(CmpiString(data.value.string).charPtr(),CmpiString(d.data.value.string).charPtr()) == 0;
01282          case CMPI_chars: 
01283             return strcmp(data.value.chars,d.data.value.chars) == 0;
01284          case CMPI_sint8 : return data.value.sint8 ==d.data.value.sint8;
01285          case CMPI_sint16: return data.value.sint16==d.data.value.sint16;
01286          case CMPI_sint32: return data.value.sint32==d.data.value.sint32;
01287          case CMPI_sint64: return data.value.sint64==d.data.value.sint64;
01288          case CMPI_uint8 : return data.value.uint8 ==d.data.value.uint8;
01289          case CMPI_uint16: return data.value.uint16==d.data.value.uint16;
01290          case CMPI_uint32: return data.value.uint32==d.data.value.uint32;
01291          case CMPI_uint64: return data.value.uint64==d.data.value.uint64;
01292          default:
01293             throw CMPI_RC_ERR_NOT_SUPPORTED;
01294       }
01295    }
01296    return false;
01297 } 
01298 
01299 

Generated on Thu Feb 9 08:47:48 2006 for openwbem by  doxygen 1.4.6