软件过程管理里面有个sloc是什么?
软件过程管理里面有个sloc是什么:
SLOC(single line of code),代码行LOC的基本单位之一。
附:代码行相关知识
代码行(line of code)指所有的可执行的源代码行数,包括可交付的工作控制语言(JCL:job control language)语句、数据定义、数据类型声明、等价声明、输入/输出格式声明等。一代码行(1LOC)的价值和人月均代码行数可以体现一个软件组织的生产能力。组织可以根据对历史项目的审计来核算组织的单行代码价值。代码行LOC常用于源代码的规模估算,常使用的单位有:SLOC(single line of code)、KLOC(thousand lines of code)、LLOC(logical line of code)、PLOC(physical line of code)、NCLOC (non-commented line of code)、DSI(delivered source instruction)
#include "StdAfx.h"
#include ".\puiddisk.h"
#define _WIN32_DCOM
#include
using namespace std;
#include
#include # pragma comment(lib, "wbemuuid.lib")
CpuIDDisk::CpuIDDisk(void)
{
GetInfomation();
}CpuIDDisk::~CpuIDDisk(void)
{
}
int CpuIDDisk::GetInfomation(void)
{
HRESULT hres;
//步骤1:不是必须的,COM只须也只能初始化一次
hres = CoInitializeEx(0, COINIT_MULTITHREADED );
if (FAILED(hres))
{
return 1; //初始化COM异常:注意,COM只须也只能初始化一次
}
//步骤2:不是必须的,COM只须也只能设置一次
//Set general COM security levels
hres = CoInitializeSecurity(
NULL,
-1, // COM authentication
NULL, // Authentication services
NULL, // Reserved
RPC_C_AUTHN_LEVEL_DEFAULT, // Default authentication
RPC_C_IMP_LEVEL_IMPERSONATE, // Default Impersonation
NULL, // Authentication info
EOAC_NONE, // Additional capabilities
NULL // Reserved
);
if (FAILED(hres))
{
CoUninitialize();
return 1; // Program has failed.
}
//以上不是必须的,若已有“::COMInit();”,则要跳过
//步骤3: Obtain the initial locator to WMI
IWbemLocator *pLoc = NULL;
hres = CoCreateInstance(
CLSID_WbemLocator,
0,
CLSCTX_INPROC_SERVER,
IID_IWbemLocator, (LPVOID *) &pLoc);
if (FAILED(hres))
{
CoUninitialize();
return 1;//Failed to create IWbemLocator object
} //步骤4:Connect to WMI through the IWbemLocator::ConnectServer method
IWbemServices *pSvc = NULL;
hres = pLoc->ConnectServer(
_bstr_t(L"ROOT\\CIMV2"), // Object path of WMI namespace
NULL, // User name. NULL = current user
NULL, // User password. NULL = current
0, // Locale. NULL indicates current
NULL, // Security flags.
0, // Authority (e.g. Kerberos)
0, // Context object
&pSvc // pointer to IWbemServices proxy
);
if (FAILED(hres))
{
pLoc->Release();
CoUninitialize();
return 1; // Program has failed.
}
// 步骤5: Set security levels on the proxy
hres = CoSetProxyBlanket(
pSvc, // Indicates the proxy to set
RPC_C_AUTHN_WINNT, // RPC_C_AUTHN_xxx
RPC_C_AUTHZ_NONE, // RPC_C_AUTHZ_xxx
NULL, // Server principal name
RPC_C_AUTHN_LEVEL_CALL, // RPC_C_AUTHN_LEVEL_xxx
RPC_C_IMP_LEVEL_IMPERSONATE, // RPC_C_IMP_LEVEL_xxx
NULL, // client identity
EOAC_NONE // proxy capabilities
); if (FAILED(hres))
{
pSvc->Release();
pLoc->Release();
CoUninitialize();
return 1;
} // 步骤6:Use the IWbemServices pointer to make requests of WMI ----
IEnumWbemClassObject* pEnumerator = NULL;
//计算CPUID
hres = pSvc->ExecQuery(
bstr_t("WQL"),
bstr_t("SELECT * FROM Win32_Processor"),//Win32_OperatingSystem
WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,
NULL,
&pEnumerator);
if (FAILED(hres))
{
pSvc->Release();
pLoc->Release();
CoUninitialize();
return 1;
}
// 步骤7:Get the data from the query
IWbemClassObject *pclsObj;
ULONG uReturn = 0;
while (pEnumerator)
{
HRESULT hr = pEnumerator->Next(WBEM_INFINITE, 1,
&pclsObj, &uReturn); if(0 == uReturn)
{
break;
}
VARIANT vtProp;
VariantInit(&vtProp);
hr = pclsObj->Get(L"ProcessorId", 0, &vtProp, 0, 0);
strProcessID=_com_util::ConvertBSTRToString(vtProp.bstrVal);//strProcessID:类级变量
} //计算硬盘系列号
hres = pSvc->ExecQuery(
bstr_t("WQL"),
bstr_t("SELECT * FROM Win32_DiskDrive"),
WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,
NULL,
&pEnumerator); if (FAILED(hres))
{
pSvc->Release();
pLoc->Release();
CoUninitialize();
return 1;
}
while (pEnumerator)
{
HRESULT hr = pEnumerator->Next(WBEM_INFINITE, 1,
&pclsObj, &uReturn); if(0 == uReturn)
{
break;
} VARIANT vtProp;
VariantInit(&vtProp);
hr = pclsObj->Get(L"PNPDeviceID", 0, &vtProp, 0, 0);
strDisk=_com_util::ConvertBSTRToString(vtProp.bstrVal);
} pSvc->Release();
pLoc->Release();
pEnumerator->Release();
pclsObj->Release();
CoUninitialize(); return 0;
鹏仔微信 15129739599 鹏仔QQ344225443 鹏仔前端 pjxi.com 共享博客 sharedbk.com
图片声明:本站部分配图来自网络。本站只作为美观性配图使用,无任何非法侵犯第三方意图,一切解释权归图片著作权方,本站不承担任何责任。如有恶意碰瓷者,必当奉陪到底严惩不贷!