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

📄 cmpi_selectexp.cpp

📁 Pegasus is an open-source implementationof the DMTF CIM and WBEM standards. It is designed to be por
💻 CPP
📖 第 1 页 / 共 2 页
字号:
  }  PEGASUS_STATIC CMPIBoolean selxEvaluateUsingAccessor (const CMPISelectExp * eSx,                                                CMPIAccessor * accessor,                                                void *parm, CMPIStatus * rc)  {    CMPI_SelectExp *sx = (CMPI_SelectExp *) eSx;    if (!accessor)      {        if (rc)          CMSetStatus (rc, CMPI_RC_ERR_INVALID_PARAMETER);        return false;      }    if (strncmp (sx->lang.getCString (), CALL_SIGN_WQL, CALL_SIGN_WQL_SIZE) ==        0)      {        if (_check_WQL (sx, rc))          {            CMPI_SelectExpAccessor_WQL ips (accessor, parm);            try            {              if (rc)                CMSetStatus (rc, CMPI_RC_OK);              return sx->wql_stmt->evaluateWhereClause (&ips);            }	    catch (const Exception &e)             {	        DDD(cout<<"### exception: selxEvaluateUsingAccessor - msg: "<<e.getMessage()<<endl);                if (rc) CMSetStatusWithString(rc,CMPI_RC_ERR_FAILED,            		(CMPIString*)string2CMPIString(e.getMessage()));		return false;            }            catch (...)            {	      DDD(cout<<"### exception: selxEvaluateUsingAccessor - ..." << endl);              if (rc)                CMSetStatus (rc, CMPI_RC_ERR_FAILED);              return false;            }          }        else          return false;      }#ifndef PEGASUS_DISABLE_CQL    if ((strncmp (sx->lang.getCString(),                  CALL_SIGN_CQL, CALL_SIGN_CQL_SIZE) == 0) ||        (strncmp (sx->lang.getCString(),                  "CIM:CQL", 7) == 0))      {        if (_check_CQL (sx, rc))          {            CMPI_SelectExpAccessor_CQL ips (accessor, parm, sx->cql_stmt,                                            sx->classNames[0]);            try            {              if (rc)                CMSetStatus (rc, CMPI_RC_OK);              return sx->cql_stmt->evaluate (ips.getInstance ());            }            catch (const Exception &e)            {	        DDD(cout<<"### exception: selxEvaluateUsingAccessor - msg: "<<e.getMessage()<<endl);                if (rc) CMSetStatusWithString(rc,CMPI_RC_ERR_FAILED,            		(CMPIString*)string2CMPIString(e.getMessage()));		return false;	    }            catch (...)            {	      DDD(cout<<"### exception: selxEvaluateUsingAccessor - ..." << endl);              if (rc)                CMSetStatus (rc, CMPI_RC_ERR_FAILED);              return false;            }          }        else          return false;      }#endif    return false;  }  PEGASUS_STATIC CMPIString *selxGetString (const CMPISelectExp * eSx, CMPIStatus * rc)  {    CMPI_SelectExp *sx = (CMPI_SelectExp *) eSx;    if (rc)      CMSetStatus (rc, CMPI_RC_OK);    return string2CMPIString (sx->cond);  }  PEGASUS_STATIC CMPISelectCond *selxGetDOC (const CMPISelectExp * eSx, CMPIStatus * rc)  {    CMPI_SelectExp *sx = (CMPI_SelectExp *) eSx;    CMPISelectCond *sc = NULL;    if (strncmp (sx->lang.getCString (), CALL_SIGN_WQL, CALL_SIGN_WQL_SIZE) ==        0)      {        if (sx->wql_dnf == NULL)          {	   CMPI_Wql2Dnf *dnf = NULL;	   try 	   {            dnf = new CMPI_Wql2Dnf (String (sx->cond), String::EMPTY);            }            catch (const Exception &e)            {		 DDD(cout<<"### exception: selxGetDOC - msg: "<<e.getMessage()<<endl);         	if (rc) CMSetStatusWithString(rc,CMPI_RC_ERR_FAILED,            		(CMPIString*)string2CMPIString(e.getMessage()));                if (dnf)                  delete dnf;	       return NULL;	    }	    sx->wql_dnf = dnf;            sx->tableau = sx->wql_dnf->getTableau ();          }        sc = (CMPISelectCond *) new CMPI_SelectCond (sx->tableau, 0);      }#ifndef PEGASUS_DISABLE_CQL    if ((strncmp (sx->lang.getCString(),                  CALL_SIGN_CQL, CALL_SIGN_CQL_SIZE) == 0) ||        (strncmp (sx->lang.getCString(),                  "CIM:CQL", 7) == 0))      {        if (sx->cql_dnf == NULL)          {            /* The constructor should set this to a valid pointer. */            if (sx->_context == NULL)              {                CMSetStatus (rc, CMPI_RC_ERROR_SYSTEM);                return NULL;              }            CQLSelectStatement selectStatement (sx->lang, sx->cond,                                                *sx->_context);            CMPI_Cql2Dnf *dnf = NULL;            try            {              CQLParser::parse (sx->cond, selectStatement);              dnf = new CMPI_Cql2Dnf (selectStatement);            }            catch (const Exception &e)            {		 DDD(cout<<"### exception: selxGetDOC - msg: "<<e.getMessage()<<endl);         	if (rc) CMSetStatusWithString(rc,CMPI_RC_ERR_FAILED,            		(CMPIString*)string2CMPIString(e.getMessage()));                if (dnf)                  delete dnf;	       return NULL;            }            sx->cql_dnf = dnf;            sx->tableau = sx->cql_dnf->getTableau ();          }        sc = (CMPISelectCond *) new CMPI_SelectCond (sx->tableau, 0);      }#endif    if (sc)      {        if (rc)          CMSetStatus (rc, CMPI_RC_OK);        CMPI_Object *obj = new CMPI_Object (sc);        obj->priv = ((CMPI_SelectCond *) sc)->priv;        return reinterpret_cast < CMPISelectCond * >(obj);      }    /* If the sc was null, we just exit */    if (rc)      CMSetStatus (rc, CMPI_RC_ERR_FAILED);    return NULL;  }  PEGASUS_STATIC CMPISelectCond *selxGetCOD (const CMPISelectExp * eSx, CMPIStatus * rc)  {    if (rc)      CMSetStatus (rc, CMPI_RC_ERR_NOT_SUPPORTED);    return NULL;  }}static CMPISelectExpFT selx_FT = {  CMPICurrentVersion,  selxRelease,  selxClone,  selxEvaluate,  selxGetString,  selxGetDOC,  selxGetCOD,  selxEvaluateUsingAccessor};CMPISelectExpFT *CMPI_SelectExp_Ftab = &selx_FT;CMPI_SelectExp::~CMPI_SelectExp(){  delete wql_stmt;  delete wql_dnf;#ifndef PEGASUS_DISABLE_CQL  delete cql_dnf;  delete cql_stmt;#endif}CMPI_SelectExp::CMPI_SelectExp (const OperationContext & ct,                                QueryContext * context, String cond_,                                String lang_):ctx (ct),cond (cond_),lang (lang_),_context (context),persistent(true){  // We do NOT add ourselves to the CMPI_Object as this is a persitent object.  // Look at the other construtors.  props = NULL;  ft = CMPI_SelectExp_Ftab;  wql_dnf = NULL;  wql_stmt = NULL;#ifndef PEGASUS_DISABLE_CQL  cql_stmt = NULL;  cql_dnf = NULL;#endif  tableau = NULL;}CMPI_SelectExp::CMPI_SelectExp (WQLSelectStatement * st, Boolean persistent_)   :ctx (OperationContext ()), wql_stmt (st), persistent (persistent_){  // Adding the object to the garbage collector.  if (!persistent_)  {  CMPI_ThreadContext::addObject (reinterpret_cast<CMPI_Object *>(this));  }  hdl = NULL;  ft = CMPI_SelectExp_Ftab;  props = NULL;  wql_dnf = NULL;#ifndef PEGASUS_DISABLE_CQL  cql_dnf = NULL;  cql_stmt = NULL;#endif  tableau = NULL;  _context = NULL;  cond = st->getQuery ();  lang = CALL_SIGN_WQL;}#ifndef PEGASUS_DISABLE_CQLCMPI_SelectExp::CMPI_SelectExp (CQLSelectStatement * st, Boolean persistent_)          :ctx (OperationContext ()),cql_stmt (st), persistent (persistent_){  // Adding the object to the garbage collector.  if (!persistent_)  {  CMPI_ThreadContext::addObject (reinterpret_cast<CMPI_Object *>(this));  }  hdl = NULL;  ft = CMPI_SelectExp_Ftab;  props = NULL;  wql_dnf = NULL;  cql_dnf = NULL;  wql_stmt = NULL;  tableau = NULL;  _context = NULL;  cond = st->getQuery ();  lang = CALL_SIGN_CQL;  classNames = st->getClassPathList ();}#endifPEGASUS_NAMESPACE_END

⌨️ 快捷键说明

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