COMP: use kwsys_stl and not std::

This commit is contained in:
Bill Hoffman 2008-01-30 21:40:43 -05:00
parent 0ac845b7da
commit 2a6e918c1f
2 changed files with 36 additions and 36 deletions

View File

@ -1671,7 +1671,7 @@ bool SystemInformation::RetrieveClassicalCPUIdentity()
} }
/** Extract a value from the CPUInfo file */ /** Extract a value from the CPUInfo file */
std::string SystemInformation::ExtractValueFromCpuInfoFile(std::string buffer,const char* word,int init) kwsys_stl::string SystemInformation::ExtractValueFromCpuInfoFile(kwsys_stl::string buffer,const char* word,int init)
{ {
long int pos = buffer.find(word,init); long int pos = buffer.find(word,init);
if(pos != -1) if(pos != -1)
@ -1693,12 +1693,12 @@ int SystemInformation::RetreiveInformationFromCpuInfoFile()
{ {
this->NumberOfLogicalCPU = 0; this->NumberOfLogicalCPU = 0;
this->NumberOfPhysicalCPU = 0; this->NumberOfPhysicalCPU = 0;
std::string buffer; kwsys_stl::string buffer;
FILE *fd = fopen("/proc/cpuinfo", "r" ); FILE *fd = fopen("/proc/cpuinfo", "r" );
if ( !fd ) if ( !fd )
{ {
kwsys_ios::cout << "Problem opening /proc/cpuinfo" << std::endl; kwsys_ios::cout << "Problem opening /proc/cpuinfo" << kwsys_stl::endl;
return 0; return 0;
} }
@ -1723,7 +1723,7 @@ int SystemInformation::RetreiveInformationFromCpuInfoFile()
// Count the number of physical ids that are the same // Count the number of physical ids that are the same
int currentId = -1; int currentId = -1;
std::string idc = this->ExtractValueFromCpuInfoFile(buffer,"physical id"); kwsys_stl::string idc = this->ExtractValueFromCpuInfoFile(buffer,"physical id");
while(this->CurrentPositionInFile>0) while(this->CurrentPositionInFile>0)
{ {
@ -1742,7 +1742,7 @@ int SystemInformation::RetreiveInformationFromCpuInfoFile()
} }
// CPU speed (checking only the first proc // CPU speed (checking only the first proc
std::string CPUSpeed = this->ExtractValueFromCpuInfoFile(buffer,"cpu MHz"); kwsys_stl::string CPUSpeed = this->ExtractValueFromCpuInfoFile(buffer,"cpu MHz");
this->CPUSpeedInMHz = (float)atof(CPUSpeed.c_str()); this->CPUSpeedInMHz = (float)atof(CPUSpeed.c_str());
// Chip family // Chip family
@ -1757,7 +1757,7 @@ int SystemInformation::RetreiveInformationFromCpuInfoFile()
this->RetrieveClassicalCPUIdentity(); this->RetrieveClassicalCPUIdentity();
// L1 Cache size // L1 Cache size
std::string cacheSize = this->ExtractValueFromCpuInfoFile(buffer,"cache size"); kwsys_stl::string cacheSize = this->ExtractValueFromCpuInfoFile(buffer,"cache size");
pos = cacheSize.find(" KB"); pos = cacheSize.find(" KB");
if(pos!=-1) if(pos!=-1)
{ {
@ -1807,7 +1807,7 @@ int SystemInformation::QueryMemory()
int errorFlag = uname(&unameInfo); int errorFlag = uname(&unameInfo);
if( errorFlag!=0 ) if( errorFlag!=0 )
{ {
std::cout << "Problem calling uname(): " << strerror(errno) << std::endl; kwsys_stl::cout << "Problem calling uname(): " << strerror(errno) << kwsys_stl::endl;
return 0; return 0;
} }
@ -1831,7 +1831,7 @@ int SystemInformation::QueryMemory()
FILE *fd = fopen("/proc/meminfo", "r" ); FILE *fd = fopen("/proc/meminfo", "r" );
if ( !fd ) if ( !fd )
{ {
std::cout << "Problem opening /proc/meminfo" << std::endl; kwsys_stl::cout << "Problem opening /proc/meminfo" << kwsys_stl::endl;
return 0; return 0;
} }
@ -2228,7 +2228,7 @@ unsigned int SystemInformation::GetNumberOfPhysicalCPU()
bool SystemInformation::ParseSysCtl() bool SystemInformation::ParseSysCtl()
{ {
// Extract the arguments from the command line // Extract the arguments from the command line
std::vector<const char*> args; kwsys_stl::vector<const char*> args;
args.push_back("sysctl"); args.push_back("sysctl");
args.push_back("-a"); args.push_back("-a");
args.push_back(0); args.push_back(0);
@ -2271,7 +2271,7 @@ bool SystemInformation::ParseSysCtl()
} }
/** Extract a value from sysctl command */ /** Extract a value from sysctl command */
std::string SystemInformation::ExtractValueFromSysCtl(const char* word) kwsys_stl::string SystemInformation::ExtractValueFromSysCtl(const char* word)
{ {
long int pos = this->SysCtlBuffer.find(word); long int pos = this->SysCtlBuffer.find(word);
if(pos != -1) if(pos != -1)
@ -2287,9 +2287,9 @@ std::string SystemInformation::ExtractValueFromSysCtl(const char* word)
} }
/** Run a given process */ /** Run a given process */
std::string SystemInformation::RunProcess(std::vector<const char*> args) kwsys_stl::string SystemInformation::RunProcess(kwsys_stl::vector<const char*> args)
{ {
std::string buffer = ""; kwsys_stl::string buffer = "";
// Run the application // Run the application
kwsysProcess* gp = kwsysProcess_New(); kwsysProcess* gp = kwsysProcess_New();
@ -2320,12 +2320,12 @@ std::string SystemInformation::RunProcess(std::vector<const char*> args)
} break; } break;
case kwsysProcess_State_Error: case kwsysProcess_State_Error:
{ {
std::cerr << "Error: Could not run " << args[0] << ":\n"; kwsys_stl::cerr << "Error: Could not run " << args[0] << ":\n";
std::cerr << kwsysProcess_GetErrorString(gp) << "\n"; kwsys_stl::cerr << kwsysProcess_GetErrorString(gp) << "\n";
} break; } break;
case kwsysProcess_State_Exception: case kwsysProcess_State_Exception:
{ {
std::cerr << "Error: " << args[0] kwsys_stl::cerr << "Error: " << args[0]
<< " terminated with an exception: " << " terminated with an exception: "
<< kwsysProcess_GetExceptionString(gp) << "\n"; << kwsysProcess_GetExceptionString(gp) << "\n";
} break; } break;
@ -2335,8 +2335,8 @@ std::string SystemInformation::RunProcess(std::vector<const char*> args)
case kwsysProcess_State_Killed: case kwsysProcess_State_Killed:
{ {
// Should not get here. // Should not get here.
std::cerr << "Unexpected ending state after running " << args[0] kwsys_stl::cerr << "Unexpected ending state after running " << args[0]
<< std::endl; << kwsys_stl::endl;
} break; } break;
} }
kwsysProcess_Delete(gp); kwsysProcess_Delete(gp);
@ -2345,14 +2345,14 @@ std::string SystemInformation::RunProcess(std::vector<const char*> args)
} }
std::string SystemInformation::ParseValueFromKStat(const char* arguments) kwsys_stl::string SystemInformation::ParseValueFromKStat(const char* arguments)
{ {
std::vector<const char*> args; kwsys_stl::vector<const char*> args;
args.clear(); args.clear();
args.push_back("kstat"); args.push_back("kstat");
args.push_back("-p"); args.push_back("-p");
std::string command = arguments; kwsys_stl::string command = arguments;
long int start = -1; long int start = -1;
long int pos = command.find(' ',0); long int pos = command.find(' ',0);
while(pos!=-1) while(pos!=-1)
@ -2374,7 +2374,7 @@ std::string SystemInformation::ParseValueFromKStat(const char* arguments)
if(!inQuotes) if(!inQuotes)
{ {
std::string arg = command.substr(start+1,pos-start-1); kwsys_stl::string arg = command.substr(start+1,pos-start-1);
// Remove the quotes if any // Remove the quotes if any
long int quotes = arg.find('"'); long int quotes = arg.find('"');
@ -2388,14 +2388,14 @@ std::string SystemInformation::ParseValueFromKStat(const char* arguments)
} }
pos = command.find(' ',pos+1); pos = command.find(' ',pos+1);
} }
std::string lastArg = command.substr(start+1,command.size()-start-1); kwsys_stl::string lastArg = command.substr(start+1,command.size()-start-1);
args.push_back(lastArg.c_str()); args.push_back(lastArg.c_str());
args.push_back(0); args.push_back(0);
std::string buffer = this->RunProcess(args); kwsys_stl::string buffer = this->RunProcess(args);
std::string value = ""; kwsys_stl::string value = "";
for(unsigned int i=buffer.size()-1;i>0;i--) for(unsigned int i=buffer.size()-1;i>0;i--)
{ {
if(buffer[i] == ' ' || buffer[i] == '\t') if(buffer[i] == ' ' || buffer[i] == '\t')
@ -2404,7 +2404,7 @@ std::string SystemInformation::ParseValueFromKStat(const char* arguments)
} }
if(buffer[i] != '\n' && buffer[i] != '\r') if(buffer[i] != '\n' && buffer[i] != '\r')
{ {
std::string val = value; kwsys_stl::string val = value;
value = buffer[i]; value = buffer[i];
value += val; value += val;
} }

View File

@ -172,7 +172,6 @@ public:
void RunMemoryCheck(); void RunMemoryCheck();
protected:
typedef struct tagID typedef struct tagID
{ {
@ -233,6 +232,7 @@ protected:
{ {
AMD, Intel, NSC, UMC, Cyrix, NexGen, IDT, Rise, Transmeta, Sun, UnknownManufacturer AMD, Intel, NSC, UMC, Cyrix, NexGen, IDT, Rise, Transmeta, Sun, UnknownManufacturer
}; };
protected:
// Functions. // Functions.
bool RetrieveCPUFeatures(); bool RetrieveCPUFeatures();
@ -263,7 +263,7 @@ protected:
// For Linux // For Linux
int RetreiveInformationFromCpuInfoFile(); int RetreiveInformationFromCpuInfoFile();
std::string ExtractValueFromCpuInfoFile(std::string buffer, kwsys_stl::string ExtractValueFromCpuInfoFile(kwsys_stl::string buffer,
const char* word, int init=0); const char* word, int init=0);
static void Delay (unsigned int); static void Delay (unsigned int);
@ -273,13 +273,13 @@ protected:
// For Mac // For Mac
bool ParseSysCtl(); bool ParseSysCtl();
std::string ExtractValueFromSysCtl(const char* word); kwsys_stl::string ExtractValueFromSysCtl(const char* word);
std::string SysCtlBuffer; kwsys_stl::string SysCtlBuffer;
// For Solaris // For Solaris
bool QuerySolarisInfo(); bool QuerySolarisInfo();
std::string ParseValueFromKStat(const char* arguments); kwsys_stl::string ParseValueFromKStat(const char* arguments);
std::string RunProcess(std::vector<const char*> args); kwsys_stl::string RunProcess(kwsys_stl::vector<const char*> args);
// Evaluate the memory information. // Evaluate the memory information.
int QueryMemory(); int QueryMemory();
@ -292,11 +292,11 @@ protected:
// Operating System information // Operating System information
bool QueryOSInformation(); bool QueryOSInformation();
std::string OSName; kwsys_stl::string OSName;
std::string Hostname; kwsys_stl::string Hostname;
std::string OSRelease ; kwsys_stl::string OSRelease ;
std::string OSVersion; kwsys_stl::string OSVersion;
std::string OSPlatform; kwsys_stl::string OSPlatform;
}; };
} // namespace @KWSYS_NAMESPACE@ } // namespace @KWSYS_NAMESPACE@