本文整理汇总了C++中scxcorelib::SCXHandle::GetName方法的典型用法代码示例。如果您正苦于以下问题:C++ SCXHandle::GetName方法的具体用法?C++ SCXHandle::GetName怎么用?C++ SCXHandle::GetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scxcorelib::SCXHandle
的用法示例。
在下文中一共展示了SCXHandle::GetName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EnumerateOneInstance
MI_BEGIN_NAMESPACE
static void EnumerateOneInstance(Context& context,
SCX_LANEndpoint_Class& inst, bool keysOnly,
SCXCoreLib::SCXHandle<SCXSystemLib::NetworkInterfaceInstance> intf)
{
// Add the key properperties first.
inst.CreationClassName_value("SCX_LANEndpoint");
inst.Name_value(StrToMultibyte(intf->GetName()).c_str());
// Add the scoping systems keys.
inst.SystemCreationClassName_value("SCX_ComputerSystem");
SCXCoreLib::NameResolver mi;
inst.SystemName_value(StrToMultibyte(mi.GetHostDomainname()).c_str());
if (!keysOnly)
{
inst.InstanceID_value(StrToMultibyte(intf->GetName()).c_str());
inst.Caption_value("LAN endpoint caption information");
inst.Description_value("LAN Endpoint description information");
inst.ElementName_value(StrToMultibyte(intf->GetName()).c_str());
std::wstring text;
if(intf->GetMACAddressRAW(text))
{
inst.MACAddress_value(StrToMultibyte(text).c_str());
intf->GetMACAddress(text, '-', true);
inst.FormattedMACAddress_value(StrToMultibyte(text).c_str());
}
}
context.Post(inst);
}
示例2: AddKeys
/**
Add a SCXInstance with the name property set frmo the ProcessInstance to the collection
\param[in] processinst Process instance to get data from
\param[out] inst Instance to add keys to
\param[in] cimtype Type of CIM Class to return
\throws SCXInvalidArgumentException - The instance can not be converted to a ProcessInstance
This method contains knowledge on which are the key fields for the class.
The key properties are defined in the MOF file.
*/
void ProcessProvider::AddKeys(SCXCoreLib::SCXHandle<SCXSystemLib::ProcessInstance> processinst, SCXInstance &inst, SupportedCimClasses cimtype) // private
{
SCX_LOGTRACE(m_log, L"ProcessProvider AddKeys()");
if (processinst == NULL)
{
throw SCXInvalidArgumentException(L"einst", L"Not a ProcessInstance", SCXSRCLOCATION);
}
scxulong pid;
if (processinst->GetPID(pid))
{
SCXProperty pid_prop(L"Handle", StrFrom(pid));
inst.AddKey(pid_prop);
}
AddScopingOperatingSystemKeys(inst);
if (eSCX_UnixProcessStatisticalInformation == cimtype)
{
std::string name;
if (processinst->GetName(name))
{
SCXProperty name_prop(L"Name", StrFromMultibyte(name));
inst.AddKey(name_prop);
SCXProperty creationClass_prop(L"ProcessCreationClassName", L"SCX_UnixProcessStatisticalInformation");
inst.AddKey(creationClass_prop);
}
}
else if (eSCX_UnixProcess == cimtype)
{
SCXProperty creationClass_prop(L"CreationClassName", L"SCX_UnixProcess");
inst.AddKey(creationClass_prop);
}
}
示例3: EnumerateOneInstance
MI_BEGIN_NAMESPACE
static void EnumerateOneInstance(Context& context,
SCX_EthernetPortStatistics_Class& inst, bool keysOnly,
SCXCoreLib::SCXHandle<SCXSystemLib::NetworkInterfaceInstance> intf)
{
// Add the key properperties first.
inst.InstanceID_value(StrToMultibyte(intf->GetName()).c_str());
if (!keysOnly)
{
inst.Caption_value("Ethernet port information");
inst.Description_value("Statistics on transfer performance for a port");
scxulong ulong = 0;
scxulong bytesReceived = intf->GetBytesReceived(ulong) ? ulong : 0;
inst.BytesReceived_value(bytesReceived);
scxulong bytesTransmitted = intf->GetBytesSent(ulong) ? ulong : 0;
inst.BytesTransmitted_value(bytesTransmitted);
inst.BytesTotal_value(bytesReceived + bytesTransmitted);
inst.PacketsReceived_value(intf->GetPacketsReceived(ulong) ? ulong : 0);
inst.PacketsTransmitted_value(intf->GetPacketsSent(ulong) ? ulong : 0);
inst.TotalTxErrors_value(intf->GetErrorsSending(ulong) ? ulong : 0);
inst.TotalRxErrors_value(intf->GetErrorsReceiving(ulong) ? ulong : 0);
inst.TotalCollisions_value(intf->GetCollisions(ulong) ? ulong : 0);
}
context.Post(inst);
}
示例4: EnumerateOneInstance
MI_BEGIN_NAMESPACE
static void EnumerateOneInstance(Context& context,
SCX_IPProtocolEndpoint_Class& inst, bool keysOnly,
SCXCoreLib::SCXHandle<SCXSystemLib::NetworkInterfaceInstance> intf)
{
// Add the key properperties first.
inst.CreationClassName_value("SCX_IPProtocolEndpoint");
inst.Name_value(StrToMultibyte(intf->GetName()).c_str());
// Add the scoping systems keys.
inst.SystemCreationClassName_value("SCX_ComputerSystem");
SCXCoreLib::NameResolver mi;
inst.SystemName_value(StrToMultibyte(mi.GetHostDomainname()).c_str());
if (!keysOnly)
{
inst.Caption_value("IP protocol endpoint information");
inst.Description_value("Properties of an IP protocol connection endpoint");
inst.ElementName_value(StrToMultibyte(intf->GetName()).c_str());
wstring text;
if (intf->GetIPAddress(text))
{
inst.IPv4Address_value(StrToMultibyte(text).c_str());
}
if (intf->GetBroadcastAddress(text))
{
inst.IPv4BroadcastAddress_value(StrToMultibyte(text).c_str());
}
if (intf->GetNetmask(text))
{
inst.SubnetMask_value(StrToMultibyte(text).c_str());
}
inst.EnabledState_value(GetEnabledState(intf));
}
context.Post(inst);
}
示例5: AddProperties
//.........这里部分代码省略.........
if (processinst->GetWorkingSetSize(ulong))
{
SCXProperty prop(L"WorkingSetSize", ulong);
inst.AddProperty(prop);
}
if (processinst->GetProcessSessionID(ulong))
{
SCXProperty prop(L"ProcessSessionID", ulong);
inst.AddProperty(prop);
}
if (processinst->GetProcessTTY(name))
{
SCXProperty prop(L"ProcessTTY", StrFromMultibyte(name));
inst.AddProperty(prop);
}
if (processinst->GetModulePath(name))
{
SCXProperty prop(L"ModulePath", StrFromMultibyte(name));
inst.AddProperty(prop);
}
if (processinst->GetParameters(params))
{
std::vector<SCXProperty> props;
for (std::vector<std::string>::const_iterator iter = params.begin();
iter != params.end(); ++iter)
{
SCXProperty item(L"", StrFromMultibyte(*iter));
props.push_back(item);
}
SCXProperty prop(L"Parameters", props);
inst.AddProperty(prop);
}
if (processinst->GetProcessWaitingForEvent(name))
{
SCXProperty prop(L"ProcessWaitingForEvent", StrFromMultibyte(name));
inst.AddProperty(prop);
}
if (processinst->GetName(name))
{
SCXProperty name_prop(L"Name", StrFromMultibyte(name));
inst.AddProperty(name_prop);
}
if (processinst->GetPriority(uint))
{
SCXProperty prio_prop(L"Priority", uint);
inst.AddProperty(prio_prop);
}
if (processinst->GetExecutionState(ushort))
{
SCXProperty state_prop(L"ExecutionState", ushort);
inst.AddProperty(state_prop);
}
if (processinst->GetCreationDate(ctime))
{
SCXProperty cdate_prop(L"CreationDate", ctime);
inst.AddProperty(cdate_prop);
}
if (processinst->GetTerminationDate(ctime))
{
SCXProperty edate_prop(L"TerminationDate", ctime);
inst.AddProperty(edate_prop);
}
if (processinst->GetParentProcessID(pid))
{
SCXProperty ppid_prop(L"ParentProcessID", StrFrom(pid));
inst.AddProperty(ppid_prop);
}
if (processinst->GetRealUserID(ulong))
{
SCXProperty user_prop(L"RealUserID", ulong);
inst.AddProperty(user_prop);
}
if (processinst->GetProcessGroupID(ulong))
{
SCXProperty group_prop(L"ProcessGroupID", ulong);
inst.AddProperty(group_prop);
}
if (processinst->GetProcessNiceValue(uint))
{
SCXProperty nice_prop(L"ProcessNiceValue", uint);
inst.AddProperty(nice_prop);
}
}
}
示例6: EnumerateOneInstance
MI_BEGIN_NAMESPACE
static void EnumerateOneInstance(Context& context,
SCX_UnixProcessStatisticalInformation_Class& inst, bool keysOnly,
SCXCoreLib::SCXHandle<SCXSystemLib::ProcessInstance> processinst)
{
SCXLogHandle& log = SCXCore::g_ProcessProvider.GetLogHandle();
// Add the key properties first.
scxulong pid;
if (processinst->GetPID(pid))
{
inst.Handle_value(StrToUTF8(StrFrom(pid)).c_str());
}
// Add keys of scoping operating system
try {
SCXCoreLib::NameResolver mi;
inst.CSName_value(StrToMultibyte(mi.GetHostDomainname()).c_str());
} catch (SCXException& e){
SCX_LOGWARNING(log, StrAppend(
StrAppend(L"Can't read host/domainname because ", e.What()),
e.Where()));
}
try {
SCXSystemLib::SCXOSTypeInfo osinfo;
inst.OSName_value(StrToMultibyte(osinfo.GetOSName(true)).c_str());
} catch (SCXException& e){
SCX_LOGWARNING(log, StrAppend(
StrAppend(L"Can't read OS name because ", e.What()),
e.Where()));
}
inst.CSCreationClassName_value("SCX_ComputerSystem");
inst.OSCreationClassName_value("SCX_OperatingSystem");
inst.ProcessCreationClassName_value("SCX_UnixProcessStatisticalInformation");
std::string name;
if (processinst->GetName(name))
{
inst.Name_value(name.c_str());
}
if (!keysOnly)
{
unsigned int uint = 0;
scxulong ulong = 0;
inst.Description_value("A snapshot of a current process");
inst.Caption_value("Unix process information");
if (processinst->GetRealData(ulong))
{
inst.RealData_value(ulong);
}
if (processinst->GetRealStack(ulong))
{
inst.RealStack_value(ulong);
}
if (processinst->GetVirtualText(ulong))
{
inst.VirtualText_value(ulong);
}
if (processinst->GetVirtualData(ulong))
{
inst.VirtualData_value(ulong);
}
if (processinst->GetVirtualStack(ulong))
{
inst.VirtualStack_value(ulong);
}
if (processinst->GetVirtualMemoryMappedFileSize(ulong))
{
inst.VirtualMemoryMappedFileSize_value(ulong);
}
if (processinst->GetVirtualSharedMemory(ulong))
{
inst.VirtualSharedMemory_value(ulong);
}
if (processinst->GetCpuTimeDeadChildren(ulong))
{
inst.CpuTimeDeadChildren_value(ulong);
}
if (processinst->GetSystemTimeDeadChildren(ulong))
{
inst.SystemTimeDeadChildren_value(ulong);
}
if (processinst->GetRealText(ulong))
{
inst.RealText_value(ulong);
//.........这里部分代码省略.........