⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cmpi_result.cpp

📁 Pegasus is an open-source implementationof the DMTF CIM and WBEM standards. It is designed to be por
💻 CPP
📖 第 1 页 / 共 2 页
字号:
      res->deliver(inst);	} catch (const CIMException &e)	{    	DDD(cout<<"### exception: resultReturnObject - msg: "<<e.getMessage()<<endl);	    CMReturnWithString(CMPI_RC_ERR_FAILED, (CMPIString*)string2CMPIString(e.getMessage()));	}      CMReturn(CMPI_RC_OK);   }   PEGASUS_STATIC CMPIStatus resultReturnExecQuery(const CMPIResult* eRes, const CMPIInstance* eInst) {      ExecQueryResponseHandler* res=(ExecQueryResponseHandler*)eRes->hdl;      if ((res == NULL) || (eInst == NULL))		CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);	  if (!eInst->hdl)		CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);	try {       if ((((CMPI_Result*)eRes)->flags & RESULT_set)==0) {         res->processing();         ((CMPI_Result*)eRes)->flags|=RESULT_set;      }      CIMInstance& inst=*(CIMInstance*)(eInst->hdl);      CMPI_Result *xRes=(CMPI_Result*)eRes;      // Check if a property filter has been set. If yes throw out      // all properties which are not found in the filter list.      char **listroot=(char**)(reinterpret_cast<const CMPI_Object*>(eInst))->priv;      if (listroot && *listroot)      {         int propertyCount = inst.getPropertyCount()-1;         for (int idx=propertyCount; idx >=0 ; idx--)         {            CIMConstProperty prop = inst.getProperty(idx);            String sName = prop.getName().getString();            char * name = strdup(sName.getCString());            char **list = listroot;            int found = false;            while (*list)            {               if (System::strcasecmp(name,*list)==0)               {                  found = true;                  break;               }               list++;            }            free(name);            if (!found)            {               inst.removeProperty(idx);            }         }      }      res->deliver(inst);	} catch (const CIMException &e)	{    	DDD(cout<<"### exception: resultReturnExecQuery - msg: "<<e.getMessage()<<endl);	    CMReturnWithString(CMPI_RC_ERR_FAILED, (CMPIString*)string2CMPIString(e.getMessage()));	}      CMReturn(CMPI_RC_OK);   }   PEGASUS_STATIC CMPIStatus resultReturnObjectPath(const CMPIResult* eRes, const CMPIObjectPath* eRef) {      ObjectPathResponseHandler* res=(ObjectPathResponseHandler*)eRes->hdl;      if ((res == NULL) || (eRef == NULL))		CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);	  if (!eRef->hdl)		CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);	try {       if ((((CMPI_Result*)eRes)->flags & RESULT_set)==0) {         res->processing();         ((CMPI_Result*)eRes)->flags|=RESULT_set;      }      CIMObjectPath& ref=*(CIMObjectPath*)(eRef->hdl);      res->deliver(ref);	} catch (const CIMException &e)	{    	DDD(cout<<"### exception: resultReturnObjectPath - msg: "<<e.getMessage()<<endl);	    CMReturnWithString(CMPI_RC_ERR_FAILED, (CMPIString*)string2CMPIString(e.getMessage()));	}      CMReturn(CMPI_RC_OK);   }   PEGASUS_STATIC CMPIStatus resultReturnInstDone(const CMPIResult* eRes) {      InstanceResponseHandler* res=(InstanceResponseHandler*)eRes->hdl;	  if (!res)		CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);	try {       if ((((CMPI_Result*)eRes)->flags & RESULT_set)==0) res->processing();      res->complete();      ((CMPI_Result*)eRes)->flags|=(RESULT_done | RESULT_set);	} catch (const CIMException &e)	{    	DDD(cout<<"### exception: resultReturnInstDone - msg: "<<e.getMessage()<<endl);	    CMReturnWithString(CMPI_RC_ERR_FAILED, (CMPIString*)string2CMPIString(e.getMessage()));	}	      CMReturn(CMPI_RC_OK)	}   PEGASUS_STATIC CMPIStatus resultReturnRefDone(const CMPIResult* eRes) {      ObjectPathResponseHandler* res=(ObjectPathResponseHandler*)eRes->hdl;	  if (!res)		CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);	try {      if ((((CMPI_Result*)eRes)->flags & RESULT_set)==0) res->processing();      res->complete();      ((CMPI_Result*)eRes)->flags|=(RESULT_done | RESULT_set);	} catch (const CIMException &e)	{    	DDD(cout<<"### exception: resultReturnRefDone - msg: "<<e.getMessage()<<endl);	    CMReturnWithString(CMPI_RC_ERR_FAILED, (CMPIString*)string2CMPIString(e.getMessage()));	}      CMReturn(CMPI_RC_OK);   }   PEGASUS_STATIC CMPIStatus resultReturnDataDone(const CMPIResult* eRes) {      ResponseHandler* res=(ResponseHandler*)eRes->hdl;	  if (!res)		CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);	 try {      if ((((CMPI_Result*)eRes)->flags & RESULT_set)==0) res->processing();      res->complete();      ((CMPI_Result*)eRes)->flags|=(RESULT_done | RESULT_set);	} catch (const CIMException &e)	{    	DDD(cout<<"### exception: resultReturnDataDone - msg: "<<e.getMessage()<<endl);	    CMReturnWithString(CMPI_RC_ERR_FAILED, (CMPIString*)string2CMPIString(e.getMessage()));	}      CMReturn(CMPI_RC_OK);   }   PEGASUS_STATIC CMPIStatus resultReturnMethDone(const CMPIResult* eRes) {      MethodResultResponseHandler* res=(MethodResultResponseHandler*)eRes->hdl;	  if (!res)		CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);	try {      if ((((CMPI_Result*)eRes)->flags & RESULT_set)==0) res->processing();   //   res->complete();    // Do not close the handle      ((CMPI_Result*)eRes)->flags|=(RESULT_done | RESULT_set);	} catch (const CIMException &e)	{    	DDD(cout<<"### exception: resultReturnMethDone - msg: "<<e.getMessage()<<endl);	    CMReturnWithString(CMPI_RC_ERR_FAILED, (CMPIString*)string2CMPIString(e.getMessage()));	}      CMReturn(CMPI_RC_OK);   }   PEGASUS_STATIC CMPIStatus resultReturnObjDone(const CMPIResult* eRes) {      ObjectResponseHandler* res=(ObjectResponseHandler*)eRes->hdl;	  if (!res)		CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);	try {      if ((((CMPI_Result*)eRes)->flags & RESULT_set)==0) res->processing();      res->complete();      ((CMPI_Result*)eRes)->flags|=(RESULT_done | RESULT_set);	} catch (const CIMException &e)	{    	DDD(cout<<"### exception: resultReturnObjDone - msg: "<<e.getMessage()<<endl);	    CMReturnWithString(CMPI_RC_ERR_FAILED, (CMPIString*)string2CMPIString(e.getMessage()));	}      CMReturn(CMPI_RC_OK);   }   PEGASUS_STATIC CMPIStatus resultReturnExecQueryDone(const CMPIResult* eRes) {      ExecQueryResponseHandler* res=(ExecQueryResponseHandler*)eRes->hdl;	  if (!res)		CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);	try {      if ((((CMPI_Result*)eRes)->flags & RESULT_set)==0) res->processing();      res->complete();      ((CMPI_Result*)eRes)->flags|=(RESULT_done | RESULT_set);	} catch (const CIMException &e)	{    	DDD(cout<<"### exception: resultReturnExecQueryDone - msg: "<<e.getMessage()<<endl);	    CMReturnWithString(CMPI_RC_ERR_FAILED, (CMPIString*)string2CMPIString(e.getMessage()));	}      CMReturn(CMPI_RC_OK);   }   PEGASUS_STATIC CMPIStatus resultReturnError(const CMPIResult* eRes, const CMPIError* er) {       CMPIStatus rrc={CMPI_RC_OK,NULL};       if (eRes->hdl == NULL)          CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);       if (er == NULL)          CMReturn(CMPI_RC_ERR_INVALID_HANDLE);       CMPIError *clonedError = er->ft->clone(er,&rrc);       if(rrc.rc != CMPI_RC_OK)       {           return rrc;       }       AutoMutex mtx(errorChainMutex);       ((CMPI_Error*)clonedError)->nextError = ((CMPI_Result*)eRes)->resError;       ((CMPI_Result*)eRes)->resError = (CMPI_Error*)clonedError;      CMReturn(CMPI_RC_OK);   }   PEGASUS_STATIC CMPIStatus resultBadReturnData(const CMPIResult* eRes, const CMPIValue* data,  const CMPIType type) {      CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);   }   PEGASUS_STATIC CMPIStatus resultBadReturnInstance(const CMPIResult* eRes, const CMPIInstance* eInst) {      CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);   }   PEGASUS_STATIC CMPIStatus resultBadReturnObjectPath(const CMPIResult* eRes, const CMPIObjectPath* eRef) {      CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);   }}static CMPIResultFT resultMethOnStack_FT={     CMPICurrentVersion,     NULL,     NULL,     resultReturnData,     resultBadReturnInstance,     resultBadReturnObjectPath,     resultReturnMethDone,     resultReturnError};static CMPIResultFT resultObjOnStack_FT={     CMPICurrentVersion,     NULL,     NULL,     resultBadReturnData,     resultReturnObject,     resultBadReturnObjectPath,     resultReturnObjDone,     resultReturnError};static CMPIResultFT resultExecQueryOnStack_FT={     CMPICurrentVersion,     NULL,     NULL,     resultBadReturnData,     resultReturnExecQuery,     resultBadReturnObjectPath,     resultReturnExecQueryDone,     resultReturnError};static CMPIResultFT resultData_FT={     CMPICurrentVersion,     NULL,     NULL,     resultReturnData,     resultBadReturnInstance,     resultBadReturnObjectPath,     resultReturnDataDone,     resultReturnError};static CMPIResultFT resultInstOnStack_FT={     CMPICurrentVersion,     NULL,     NULL,     resultBadReturnData,     resultReturnInstance,     resultBadReturnObjectPath,     resultReturnInstDone,     resultReturnError};static CMPIResultFT resultRefOnStack_FT={     CMPICurrentVersion,     NULL,     NULL,     resultBadReturnData,     resultBadReturnInstance,     resultReturnObjectPath,     resultReturnRefDone,     resultReturnError};static CMPIResultFT resultResponseOnStack_FT={     CMPICurrentVersion,     NULL,     NULL,     resultBadReturnData,     resultBadReturnInstance,     resultBadReturnObjectPath,     resultReturnDataDone,     resultReturnError};CMPIResultFT *CMPI_ResultMeth_Ftab=&resultMethOnStack_FT;CMPIResultFT *CMPI_ResultData_Ftab=&resultData_FT;CMPIResultFT *CMPI_ResultMethOnStack_Ftab=&resultMethOnStack_FT;CMPIResultFT *CMPI_ResultInstOnStack_Ftab=&resultInstOnStack_FT;CMPIResultFT *CMPI_ResultObjOnStack_Ftab=&resultObjOnStack_FT;CMPIResultFT *CMPI_ResultRefOnStack_Ftab=&resultRefOnStack_FT;CMPIResultFT *CMPI_ResultResponseOnStack_Ftab=&resultResponseOnStack_FT;CMPIResultFT *CMPI_ResultExecQueryOnStack_Ftab=&resultExecQueryOnStack_FT;CMPI_ResultOnStack::CMPI_ResultOnStack(const ObjectPathResponseHandler & handler,         CMPI_Broker *xMb) {      hdl=(void*)&handler;      xBroker=xMb;      ft=CMPI_ResultRefOnStack_Ftab;      flags=RESULT_ObjectPath;      resError=NULL;   }CMPI_ResultOnStack::CMPI_ResultOnStack(const InstanceResponseHandler& handler,         CMPI_Broker *xMb) {      hdl=(void*)&handler;      xBroker=xMb;      ft=CMPI_ResultInstOnStack_Ftab;      flags=RESULT_Instance;      resError=NULL;   }CMPI_ResultOnStack::CMPI_ResultOnStack(const ObjectResponseHandler& handler,         CMPI_Broker *xMb) {      hdl=(void*)&handler;      xBroker=xMb;      ft=CMPI_ResultObjOnStack_Ftab;      flags=RESULT_Object;      resError=NULL;   }CMPI_ResultOnStack::CMPI_ResultOnStack(const MethodResultResponseHandler& handler,         CMPI_Broker *xMb) {      hdl=(void*)&handler;      xBroker=xMb;      ft=CMPI_ResultMethOnStack_Ftab;      flags=RESULT_Method;      resError=NULL;   }CMPI_ResultOnStack::CMPI_ResultOnStack(const ResponseHandler& handler,         CMPI_Broker *xMb) {      hdl=(void*)&handler;      xBroker=xMb;      ft=CMPI_ResultResponseOnStack_Ftab;      flags=RESULT_Response;      resError=NULL;   }CMPI_ResultOnStack::CMPI_ResultOnStack(const ExecQueryResponseHandler& handler,         CMPI_Broker *xMb) {      hdl=(void*)&handler;      xBroker=xMb;      ft=CMPI_ResultExecQueryOnStack_Ftab;      flags=RESULT_Object;      resError=NULL;   }CMPI_ResultOnStack::~CMPI_ResultOnStack() {	try {      if ((flags & RESULT_set)==0)  {         if (ft==CMPI_ResultRefOnStack_Ftab) ((ObjectPathResponseHandler*)hdl)->processing();         else if (ft==CMPI_ResultInstOnStack_Ftab) ((InstanceResponseHandler*)hdl)->processing();         else if (ft==CMPI_ResultObjOnStack_Ftab) ((ObjectResponseHandler*)hdl)->processing();         else if (ft==CMPI_ResultMethOnStack_Ftab) ((MethodResultResponseHandler*)hdl)->processing();         else if (ft==CMPI_ResultResponseOnStack_Ftab) ((ResponseHandler*)hdl)->processing();         else if (ft==CMPI_ResultExecQueryOnStack_Ftab) ((ExecQueryResponseHandler*)hdl)->processing();         else ((ResponseHandler*)hdl)->processing();  // shoul not get here      }      if ((flags & RESULT_done)==0) {         if (ft==CMPI_ResultRefOnStack_Ftab) ((ObjectPathResponseHandler*)hdl)->complete();         else if (ft==CMPI_ResultInstOnStack_Ftab) ((InstanceResponseHandler*)hdl)->complete();         else if (ft==CMPI_ResultObjOnStack_Ftab) ((ObjectResponseHandler*)hdl)->complete();         else if (ft==CMPI_ResultMethOnStack_Ftab) ((MethodResultResponseHandler*)hdl)->complete();         else if (ft==CMPI_ResultResponseOnStack_Ftab) ((ResponseHandler*)hdl)->complete();         else if (ft==CMPI_ResultExecQueryOnStack_Ftab) ((ExecQueryResponseHandler*)hdl)->complete();         else ((ResponseHandler*)hdl)->complete();  // shoul not get here      }	} catch (const CIMException &)	{		// Ignore the exception	}  }PEGASUS_NAMESPACE_END

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -