📄 cliclientlib.cpp
字号:
opts.elapsedTime.stop(); opts.saveElapsedTime = opts.elapsedTime.getElapsed(); } if (opts.summary) { if (opts.time) { cout << opts.saveElapsedTime << endl; } } else { outputFormatClass(opts.outputType, cimClass); } return(0);}int getProperty(CIMClient& client, Options& opts){ if (opts.verboseTest) { cout << "getProperty " << "Namespace= " << opts.nameSpace << ", Instance= " << opts.instanceName.toString() << ", propertyName= " << opts.propertyName << endl; } CIMValue cimValue; if (opts.time) { opts.elapsedTime.reset(); opts.elapsedTime.start(); } cimValue = client.getProperty( opts.nameSpace, opts.instanceName, opts.propertyName); if (opts.time) { opts.elapsedTime.stop(); opts.saveElapsedTime = opts.elapsedTime.getElapsed(); } // ATTN: TODO: display returned property return(0);}int setProperty(CIMClient& client, Options& opts){ if (opts.verboseTest) { cout << "setProperty " << "Namespace= " << opts.nameSpace << ", Instance= " << opts.instanceName.toString() << ", propertyName= " << opts.propertyName << ", newValue= " << opts.newValue.toString() << endl; } if (opts.time) { opts.elapsedTime.reset(); opts.elapsedTime.start(); } client.setProperty( opts.nameSpace, opts.instanceName, opts.propertyName, opts.newValue); if (opts.time) { opts.elapsedTime.stop(); opts.saveElapsedTime = opts.elapsedTime.getElapsed(); } return(0);}int getQualifier(CIMClient& client, Options& opts){ cout << "entering getQualifier " << endl; //if (opts.verboseTest) { cout << "getQualifier " << "Namespace= " << opts.nameSpace << ", Qualifier= " << opts.qualifierName << endl; } CIMQualifierDecl cimQualifierDecl; if (opts.time) { opts.elapsedTime.reset(); opts.elapsedTime.start(); } cimQualifierDecl = client.getQualifier( opts.nameSpace, opts.qualifierName); if (opts.time) { opts.elapsedTime.stop(); opts.saveElapsedTime = opts.elapsedTime.getElapsed(); } // display new qualifier outputFormatQualifierDecl(opts.outputType, cimQualifierDecl); return(0);}int setQualifier(CIMClient& client, Options& opts){ if (opts.verboseTest) { cout << "setQualifiers " << "Namespace= " << opts.nameSpace // KS add the qualifier decl here. << endl; } if (opts.time) { opts.elapsedTime.reset(); opts.elapsedTime.start(); } client.setQualifier( opts.nameSpace, opts.qualifierDeclaration); if (opts.time) { opts.elapsedTime.stop(); opts.saveElapsedTime = opts.elapsedTime.getElapsed(); } return(0);}int deleteQualifier(CIMClient& client, Options& opts){ if (opts.verboseTest) { cout << "deleteQualifiers " << "Namespace= " << opts.nameSpace << " Qualifier= " << opts.qualifierName << endl; } if (opts.time) { opts.elapsedTime.reset(); opts.elapsedTime.start(); } client.deleteQualifier( opts.nameSpace, opts.qualifierName); if (opts.time) { opts.elapsedTime.stop(); opts.saveElapsedTime = opts.elapsedTime.getElapsed(); } return(0);}int enumerateQualifiers(CIMClient& client, Options& opts){ if (opts.verboseTest) { cout << "enumerateQualifiers " << "Namespace= " << opts.nameSpace << endl; } Array<CIMQualifierDecl> qualifierDecls; if (opts.time) { opts.elapsedTime.reset(); opts.elapsedTime.start(); } qualifierDecls = client.enumerateQualifiers( opts.nameSpace); if (opts.time) { opts.elapsedTime.stop(); opts.saveElapsedTime = opts.elapsedTime.getElapsed(); } if (opts.summary) cout << qualifierDecls.size() << " returned." << endl; else { // Output the returned instances for (Uint32 i = 0; i < qualifierDecls.size(); i++) { CIMQualifierDecl myQualifierDecl = qualifierDecls[i]; outputFormatQualifierDecl(opts.outputType, myQualifierDecl); } } return(0);}/*Array<CIMObjectPath> referenceNames( const CIMNamespaceName& nameSpace, const CIMObjectPath& objectName, const CIMName& resultClass = CIMName(), const String& role = String::EMPTY*/int referenceNames(CIMClient& client, Options& opts){ if (opts.verboseTest) { cout << "ReferenceNames " << "Namespace= " << opts.nameSpace << ", ObjectPath= " << opts.objectName << ", resultClass= " << opts.resultClass << ", role= " << opts.role << endl; } // do conditional select of instance if params properly set. CIMObjectPath thisObjectPath(opts.objectName); if (!_conditionalSelectInstance(client, opts, thisObjectPath)) return(0); if (opts.time) { opts.elapsedTime.reset(); opts.elapsedTime.start(); } Array<CIMObjectPath> referenceNames = client.referenceNames( opts.nameSpace, thisObjectPath, opts.resultClass, opts.role); if (opts.time) { opts.elapsedTime.stop(); opts.saveElapsedTime = opts.elapsedTime.getElapsed(); } /* const CIMNamespaceName& nameSpace, const CIMObjectPath& objectName, const CIMName& resultClass = CIMName(), const String& role = String::EMPTY */ if (opts.summary) { String s = "referenceNames"; _displaySummary(referenceNames.size(),s, opts.objectName,opts); } else { //simply output the list one per line for the moment. for (Uint32 i = 0; i < referenceNames.size(); i++) cout << referenceNames[i].toString() << endl; } return(0);}/**** Array<CIMObject> references( const CIMNamespaceName& nameSpace, const CIMObjectPath& objectName, const CIMName& resultClass = CIMName(), const String& role = String::EMPTY, Boolean includeQualifiers = false, Boolean includeClassOrigin = false, const CIMPropertyList& propertyList = CIMPropertyList() ); */int references(CIMClient& client, Options& opts){ if (opts.verboseTest) { cout << "References " << "Namespace= " << opts.nameSpace << ", Object= " << opts.objectName << ", resultClass= " << opts.resultClass << ", role= " << opts.role << ", includeQualifiers= " << _toString(opts.includeQualifiers) << ", includeClassOrigin= " << _toString(opts.includeClassOrigin) << ", CIMPropertyList= " << buildPropertyListString(opts.propertyList) << endl; } // do conditional select of instance if params properly set. CIMObjectPath thisObjectPath(opts.objectName); if (!_conditionalSelectInstance(client, opts, thisObjectPath)) return(0); if (opts.time) { opts.elapsedTime.reset(); opts.elapsedTime.start(); } Array<CIMObject> objects = client.references( opts.nameSpace, thisObjectPath, opts.resultClass, opts.role, opts.includeQualifiers, opts.includeClassOrigin, opts.propertyList); if (opts.time) { opts.elapsedTime.stop(); opts.saveElapsedTime = opts.elapsedTime.getElapsed(); } if (opts.summary) { String s = "references"; _displaySummary(objects.size(), s, opts.objectName,opts); } else { // Output the returned instances for (Uint32 i = 0; i < objects.size(); i++) outputFormatObject(opts.outputType, objects[i]); } return(0);}/* Array<CIMObjectPath> associatorNames( const CIMNamespaceName& nameSpace, const CIMObjectPath& objectName, const CIMName& assocClass = CIMName(), const CIMName& resultClass = CIMName(), const String& role = String::EMPTY, const String& resultRole = String::EMPTY );*/int associatorNames(CIMClient& client, Options& opts){ if (opts.verboseTest) { cout << "associatorNames " << "Namespace= " << opts.nameSpace << ", Object= " << opts.objectName << ", assocClass= " << opts.assocClass << ", resultClass= " << opts.resultClass << ", role= " << opts.role << ", resultRole= " << opts.resultRole << endl; } // do conditional select of instance if params properly set. CIMObjectPath thisObjectPath(opts.objectName); if(!_conditionalSelectInstance(client, opts, thisObjectPath)) return(0); if (opts.time) { opts.elapsedTime.reset(); opts.elapsedTime.start(); } Array<CIMObjectPath> associatorNames = client.associatorNames( opts.nameSpace, thisObjectPath, opts.assocClass, opts.resultClass, opts.role, opts.resultRole); if (opts.time) { opts.elapsedTime.stop(); opts.saveElapsedTime = opts.elapsedTime.getElapsed(); } /* const CIMNamespaceName& nameSpace, const CIMObjectPath& objectName, const CIMName& resultClass = CIMName(), const String& role = String::EMPTY */ if (opts.summary) { String s = "associator names"; _displaySummary(associatorNames.size(), s, opts.objectName,opts); } else { // Output the list one per line for the moment. for (Uint32 i = 0; i < associatorNames.size(); i++) cout << associatorNames[i].toString() << endl; } return(0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -