mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-26 00:00:02 +02:00
removing more using namespace std
This commit is contained in:
parent
d71008bd10
commit
a67d9e60da
@ -7,7 +7,7 @@
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
using namespace std;
|
||||
//using namespace std;
|
||||
|
||||
int dummyCallback(detectorData* d, int p,void*) {
|
||||
cout << "got data " << p << endl;
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include "slsDetector.h"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "slsDetectorCommand.h"
|
||||
using namespace std;
|
||||
//using namespace std;
|
||||
|
||||
|
||||
/** @short This class handles the command line I/Os, help etc. of the text clients */
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "fileIO.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
/* I/O */
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include <math.h>
|
||||
#include <semaphore.h>
|
||||
|
||||
using namespace std;
|
||||
// using namespace std;
|
||||
/**
|
||||
@short class handling the data file I/O flags
|
||||
*/
|
||||
@ -50,14 +50,14 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
|
||||
using fileIOStatic::writeDataFile;
|
||||
using fileIOStatic::createFileName;
|
||||
|
||||
int getFileIndexFromFileName(string fname){
|
||||
int getFileIndexFromFileName(std::string fname){
|
||||
int ret;
|
||||
pthread_mutex_lock(&mf);
|
||||
ret=fileIOStatic::getFileIndexFromFileName(fname);
|
||||
pthread_mutex_unlock(&mf);
|
||||
return ret;
|
||||
};
|
||||
int getIndicesFromFileName(string fname, int &index){
|
||||
int getIndicesFromFileName(std::string fname, int &index){
|
||||
int ret;
|
||||
pthread_mutex_lock(&mf);
|
||||
ret=fileIOStatic::getIndicesFromFileName(fname,index);
|
||||
@ -67,7 +67,7 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
|
||||
|
||||
|
||||
|
||||
int getVariablesFromFileName(string fname, int &index, int &p_index, double &sv0, double &sv1){
|
||||
int getVariablesFromFileName(std::string fname, int &index, int &p_index, double &sv0, double &sv1){
|
||||
|
||||
int ret;
|
||||
pthread_mutex_lock(&mf);
|
||||
@ -76,7 +76,7 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
|
||||
return ret;
|
||||
};
|
||||
|
||||
int getVariablesFromFileName(string fname, int &index, int &f_index, int &p_index, double &sv0, double &sv1, int &detindex){
|
||||
int getVariablesFromFileName(std::string fname, int &index, int &f_index, int &p_index, double &sv0, double &sv1, int &detindex){
|
||||
|
||||
|
||||
int ret;
|
||||
@ -91,11 +91,11 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
|
||||
\param s file path
|
||||
\return actual file path
|
||||
*/
|
||||
virtual string setFilePath(string s) {
|
||||
virtual std::string setFilePath(std::string s) {
|
||||
pthread_mutex_lock(&mf);
|
||||
sprintf(filePath, s.c_str());
|
||||
pthread_mutex_unlock(&mf);
|
||||
return string(filePath);
|
||||
return std::string(filePath);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -103,11 +103,11 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
|
||||
\param s file name to be set
|
||||
\returns actual file name
|
||||
*/
|
||||
virtual string setFileName(string s) {
|
||||
virtual std::string setFileName(std::string s) {
|
||||
pthread_mutex_lock(&mf);
|
||||
sprintf(fileName, s.c_str());
|
||||
pthread_mutex_unlock(&mf);
|
||||
return string(fileName);};
|
||||
return std::string(fileName);};
|
||||
|
||||
/**
|
||||
sets the default output file index
|
||||
@ -175,11 +175,11 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
|
||||
\returns the output files path
|
||||
|
||||
*/
|
||||
virtual string getFilePath() {return string(filePath);};
|
||||
virtual std::string getFilePath() {return std::string(filePath);};
|
||||
/**
|
||||
\returns the output files root name
|
||||
*/
|
||||
virtual string getFileName() {return string(fileName);};
|
||||
virtual std::string getFileName() {return std::string(fileName);};
|
||||
|
||||
/**
|
||||
\returns the output file index
|
||||
@ -212,9 +212,9 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
|
||||
virtual fileFormat getFileFormat() {return *fileFormatType;};
|
||||
|
||||
|
||||
string createFileName();
|
||||
std::string createFileName();
|
||||
|
||||
string createReceiverFilePrefix();
|
||||
std::string createReceiverFilePrefix();
|
||||
|
||||
|
||||
/**
|
||||
@ -227,7 +227,7 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
|
||||
\param nch number of channels to be written to file. if -1 defaults to the number of installed channels of the detector
|
||||
\returns OK or FAIL if it could not write the file or data=NULL
|
||||
*/
|
||||
virtual int writeDataFile(string fname, double *data, double *err=NULL, double *ang=NULL, char dataformat='f', int nch=-1);
|
||||
virtual int writeDataFile(std::string fname, double *data, double *err=NULL, double *ang=NULL, char dataformat='f', int nch=-1);
|
||||
|
||||
|
||||
/**
|
||||
@ -253,7 +253,7 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
|
||||
\param data array of data values
|
||||
\returns OK or FAIL if it could not write the file or data=NULL
|
||||
*/
|
||||
virtual int writeDataFile(string fname, int *data);
|
||||
virtual int writeDataFile(std::string fname, int *data);
|
||||
|
||||
|
||||
virtual int writeDataFile(void *data, int iframe=-1);
|
||||
@ -276,7 +276,7 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
|
||||
\param data array of data values
|
||||
\returns OK or FAIL if it could not write the file or data=NULL
|
||||
*/
|
||||
virtual int writeDataFile(string fname, short int *data);
|
||||
virtual int writeDataFile(std::string fname, short int *data);
|
||||
|
||||
|
||||
|
||||
@ -304,7 +304,7 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
|
||||
\param dataformat format of the data: can be 'i' integer or 'f' double (default)
|
||||
\returns OK or FAIL if it could not read the file or data=NULL
|
||||
*/
|
||||
virtual int readDataFile(string fname, double *data, double *err=NULL, double *ang=NULL, char dataformat='f');
|
||||
virtual int readDataFile(std::string fname, double *data, double *err=NULL, double *ang=NULL, char dataformat='f');
|
||||
|
||||
/**
|
||||
reads a data file
|
||||
@ -324,7 +324,7 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
|
||||
\param data array of data values
|
||||
\returns OK or FAIL if it could not read the file or data=NULL
|
||||
yes */
|
||||
virtual int readDataFile(string fname, int *data);
|
||||
virtual int readDataFile(std::string fname, int *data);
|
||||
|
||||
/**
|
||||
reads a raw data file
|
||||
@ -342,7 +342,7 @@ yes */
|
||||
\param data array of data values
|
||||
\returns OK or FAIL if it could not read the file or data=NULL
|
||||
*/
|
||||
virtual int readDataFile(string fname, short int *data);
|
||||
virtual int readDataFile(std::string fname, short int *data);
|
||||
/**
|
||||
reads a short int raw data file
|
||||
\param infile input file stream
|
||||
@ -355,7 +355,7 @@ yes */
|
||||
virtual int getDataBytes ( )=0;
|
||||
friend class slsDetector;
|
||||
|
||||
string getCurrentFileName(){return currentFileName;};
|
||||
std::string getCurrentFileName(){return currentFileName;};
|
||||
protected:
|
||||
|
||||
|
||||
@ -368,12 +368,12 @@ yes */
|
||||
void incrementDetectorIndex() { (detIndex)++; };
|
||||
|
||||
|
||||
string getCurrentReceiverFilePrefix(){return currentReceiverFilePrefix;};
|
||||
std::string getCurrentReceiverFilePrefix(){return currentReceiverFilePrefix;};
|
||||
|
||||
|
||||
string currentFileName;
|
||||
std::string currentFileName;
|
||||
|
||||
string currentReceiverFilePrefix;
|
||||
std::string currentReceiverFilePrefix;
|
||||
|
||||
|
||||
/** output directory */
|
||||
|
@ -15,7 +15,7 @@
|
||||
#endif
|
||||
|
||||
#include "sls_detector_defs.h"
|
||||
using namespace std;
|
||||
// using namespace std;
|
||||
/**
|
||||
@short class handling the data file I/O flags
|
||||
*/
|
||||
@ -56,8 +56,8 @@ class fileIOStatic {
|
||||
\param detindex detector id
|
||||
\returns file name without extension
|
||||
*/
|
||||
static string createFileName(char *filepath, char *filename, int aMask, double sv0, int prec0, double sv1, int prec1, int pindex, int npos, int findex, int frameindex=-1, int detindex=-1){ \
|
||||
ostringstream osfn; \
|
||||
static std::string createFileName(char *filepath, char *filename, int aMask, double sv0, int prec0, double sv1, int prec1, int pindex, int npos, int findex, int frameindex=-1, int detindex=-1){ \
|
||||
std::ostringstream osfn; \
|
||||
osfn << filepath << "/" << filename; \
|
||||
if ( aMask& (1 << (slsDetectorDefs::MAX_ACTIONS))) osfn << "_S" << fixed << setprecision(prec0) << sv0; \
|
||||
if (aMask & (1 << (slsDetectorDefs::MAX_ACTIONS+1))) osfn << "_s" << fixed << setprecision(prec1) << sv1; \
|
||||
@ -86,8 +86,8 @@ class fileIOStatic {
|
||||
\param detindex detector id
|
||||
\returns file name without extension
|
||||
*/
|
||||
static string createReceiverFilePrefix(char *filename, int aMask, double sv0, int prec0, double sv1, int prec1, int pindex, int npos,int detindex=-1){ \
|
||||
ostringstream osfn; \
|
||||
static std::string createReceiverFilePrefix(char *filename, int aMask, double sv0, int prec0, double sv1, int prec1, int pindex, int npos,int detindex=-1){ \
|
||||
std::ostringstream osfn; \
|
||||
osfn << filename; \
|
||||
if ( aMask& (1 << (slsDetectorDefs::MAX_ACTIONS))) osfn << "_S" << fixed << setprecision(prec0) << sv0; \
|
||||
if (aMask & (1 << (slsDetectorDefs::MAX_ACTIONS+1))) osfn << "_s" << fixed << setprecision(prec1) << sv1; \
|
||||
@ -101,13 +101,13 @@ class fileIOStatic {
|
||||
\param fname file name
|
||||
\returns file index
|
||||
*/
|
||||
static int getFileIndexFromFileName(string fname){ \
|
||||
static int getFileIndexFromFileName(std::string fname){ \
|
||||
int i; \
|
||||
size_t dot=fname.rfind("."); \
|
||||
if (dot==string::npos) \
|
||||
if (dot==std::string::npos) \
|
||||
return -1; \
|
||||
size_t uscore=fname.rfind("_"); \
|
||||
if (uscore==string::npos) return -1; \
|
||||
if (uscore==std::string::npos) return -1; \
|
||||
if (sscanf( fname.substr(uscore+1,dot-uscore-1).c_str(),"%d",&i)) return i; \
|
||||
cout << "******************************** cannot parse file index" << endl; \
|
||||
return 0; \
|
||||
@ -118,11 +118,11 @@ class fileIOStatic {
|
||||
\param index reference to index
|
||||
\returns frame index
|
||||
*/
|
||||
static int getIndicesFromFileName(string fname,int &index){ \
|
||||
static int getIndicesFromFileName(std::string fname,int &index){ \
|
||||
int i; \
|
||||
string s; \
|
||||
std::string s; \
|
||||
size_t uscore=fname.rfind("_"); \
|
||||
if (uscore==string::npos) return -1; \
|
||||
if (uscore==std::string::npos) return -1; \
|
||||
s=fname; \
|
||||
if (sscanf(s.substr(uscore+1,s.size()-uscore-1).c_str(),"%d",&i)){ \
|
||||
index=i; \
|
||||
@ -146,16 +146,16 @@ class fileIOStatic {
|
||||
\param sv1 reference to scan variable 1
|
||||
\returns file index
|
||||
*/
|
||||
static int getVariablesFromFileName(string fname, int &index, int &p_index, double &sv0, double &sv1) { \
|
||||
static int getVariablesFromFileName(std::string fname, int &index, int &p_index, double &sv0, double &sv1) { \
|
||||
int i; \
|
||||
double f; \
|
||||
string s; \
|
||||
std::string s; \
|
||||
index=-1; \
|
||||
p_index=-1; \
|
||||
sv0=-1; \
|
||||
sv1=-1; \
|
||||
size_t uscore=fname.rfind("_"); \
|
||||
if (uscore==string::npos) return -1; \
|
||||
if (uscore==std::string::npos) return -1; \
|
||||
s=fname; \
|
||||
if (sscanf(s.substr(uscore+1,s.size()-uscore-1).c_str(),"%d",&i)) { \
|
||||
index=i; \
|
||||
@ -201,16 +201,16 @@ class fileIOStatic {
|
||||
\param detindex reference to detector id
|
||||
\returns file index
|
||||
*/
|
||||
static int getVariablesFromFileName(string fname, int &index, int &f_index, int &p_index, double &sv0, double &sv1, int &detindex) { \
|
||||
static int getVariablesFromFileName(std::string fname, int &index, int &f_index, int &p_index, double &sv0, double &sv1, int &detindex) { \
|
||||
int i; \
|
||||
double f; \
|
||||
string s; \
|
||||
std::string s; \
|
||||
index=-1; \
|
||||
p_index=-1; \
|
||||
sv0=-1; \
|
||||
sv1=-1; \
|
||||
size_t uscore=fname.rfind("_"); \
|
||||
if (uscore==string::npos) return -1; \
|
||||
if (uscore==std::string::npos) return -1; \
|
||||
s=fname; \
|
||||
if (sscanf(s.substr(uscore+1,s.size()-uscore-1).c_str(),"%d",&i)) { \
|
||||
index=i; \
|
||||
@ -262,7 +262,7 @@ class fileIOStatic {
|
||||
\param detindex reference to detector id
|
||||
\returns file name
|
||||
*/
|
||||
static int verifySameFrame(string fname, int index, int f_index, int p_index, double sv0, double sv1, int detindex) { \
|
||||
static int verifySameFrame(std::string fname, int index, int f_index, int p_index, double sv0, double sv1, int detindex) { \
|
||||
int new_index=-1;
|
||||
int new_f_index=-1;
|
||||
int new_p_index=-1;
|
||||
@ -283,10 +283,10 @@ class fileIOStatic {
|
||||
\param fname complete file name prefix
|
||||
\returns file name
|
||||
*/
|
||||
static string getNameFromReceiverFilePrefix(string fname) { \
|
||||
static std::string getNameFromReceiverFilePrefix(std::string fname) { \
|
||||
int i; \
|
||||
double f; \
|
||||
string s; \
|
||||
std::string s; \
|
||||
s=fname; \
|
||||
size_t uscore=s.rfind("_"); \
|
||||
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"d%d",&i)) \
|
||||
@ -313,14 +313,14 @@ class fileIOStatic {
|
||||
\param fname complete file name
|
||||
\returns file name without file name prefix, detector index or extension
|
||||
*/
|
||||
static string getReceiverFileNameToConcatenate(string fname) { \
|
||||
static std::string getReceiverFileNameToConcatenate(std::string fname) { \
|
||||
int i;double f; \
|
||||
string s=fname; \
|
||||
std::string s=fname; \
|
||||
if(fname.empty()) return fname; \
|
||||
size_t dot=s.find(".");
|
||||
size_t uscore=s.rfind("_"); \
|
||||
|
||||
if (uscore==string::npos) return "??"; \
|
||||
if (uscore==std::string::npos) return "??"; \
|
||||
if (sscanf(s.substr(uscore+1,s.size()-uscore-1).c_str(),"%d",&i)) \
|
||||
s=fname.substr(0,uscore); \
|
||||
uscore=s.rfind("_"); \
|
||||
@ -358,7 +358,7 @@ class fileIOStatic {
|
||||
|
||||
*/
|
||||
|
||||
static int writeDataFile(string fname, int nch, double *data, double *err=NULL, double *ang=NULL, char dataformat='f'){ \
|
||||
static int writeDataFile(std::string fname, int nch, double *data, double *err=NULL, double *ang=NULL, char dataformat='f'){ \
|
||||
ofstream outfile; \
|
||||
if (data==NULL) { \
|
||||
cout << "No data to write!" << endl; \
|
||||
@ -426,7 +426,7 @@ class fileIOStatic {
|
||||
\param data array of data values
|
||||
\returns OK or FAIL if it could not write the file or data=NULL
|
||||
*/
|
||||
static int writeDataFile(string fname,int nch, int *data){ \
|
||||
static int writeDataFile(std::string fname,int nch, int *data){ \
|
||||
ofstream outfile; \
|
||||
if (data==NULL) return slsDetectorDefs::FAIL; \
|
||||
outfile.open (fname.c_str(),ios_base::out); \
|
||||
@ -447,7 +447,7 @@ class fileIOStatic {
|
||||
\param data array of data values
|
||||
\returns OK or FAIL if it could not write the file or data=NULL
|
||||
*/
|
||||
static int writeBinaryDataFile(string fname, size_t nbytes, void *data){ \
|
||||
static int writeBinaryDataFile(std::string fname, size_t nbytes, void *data){ \
|
||||
FILE *sfilefd; \
|
||||
if (data==NULL) return slsDetectorDefs::FAIL; \
|
||||
sfilefd = fopen(fname.c_str(), "w"); \
|
||||
@ -490,7 +490,7 @@ class fileIOStatic {
|
||||
\param data array of data values
|
||||
\returns OK or FAIL if it could not write the file or data=NULL
|
||||
*/
|
||||
static int writeDataFile(string fname,int nch, short int *data) { \
|
||||
static int writeDataFile(std::string fname,int nch, short int *data) { \
|
||||
ofstream outfile; \
|
||||
if (data==NULL) return slsDetectorDefs::FAIL; \
|
||||
outfile.open (fname.c_str(),ios_base::out); \
|
||||
@ -531,10 +531,10 @@ class fileIOStatic {
|
||||
\returns number of channels read or -1 if it could not read the file or data=NULL
|
||||
|
||||
*/
|
||||
static int readDataFile(int nch, string fname, double *data, double *err=NULL, double *ang=NULL, char dataformat='f') { \
|
||||
static int readDataFile(int nch, std::string fname, double *data, double *err=NULL, double *ang=NULL, char dataformat='f') { \
|
||||
ifstream infile; \
|
||||
int iline=0; \
|
||||
string str; \
|
||||
std::string str; \
|
||||
infile.open(fname.c_str(), ios_base::in); \
|
||||
if (infile.is_open()) { \
|
||||
iline=readDataFile(nch, infile, data, err, ang, dataformat, 0); \
|
||||
@ -564,11 +564,11 @@ class fileIOStatic {
|
||||
double fdata, ferr, fang; \
|
||||
int maxchans; \
|
||||
int ich; \
|
||||
string str; \
|
||||
std::string str; \
|
||||
maxchans=nch; \
|
||||
while (infile.good() and interrupt==0) { \
|
||||
getline(infile,str); \
|
||||
istringstream ssstr(str); \
|
||||
std::istringstream ssstr(str); \
|
||||
if (ang==NULL) { \
|
||||
ssstr >> ichan >> fdata; \
|
||||
if (ssstr.fail() || ssstr.bad()) { \
|
||||
@ -617,10 +617,10 @@ class fileIOStatic {
|
||||
\param nch number of channels
|
||||
\returns OK or FAIL if it could not read the file or data=NULL
|
||||
*/
|
||||
static int readDataFile(string fname, int *data, int nch) { \
|
||||
static int readDataFile(std::string fname, int *data, int nch) { \
|
||||
ifstream infile; \
|
||||
int iline=0; \
|
||||
string str; \
|
||||
std::string str; \
|
||||
infile.open(fname.c_str(), ios_base::in); \
|
||||
if (infile.is_open()) { \
|
||||
iline=readDataFile(infile, data, nch, 0); \
|
||||
@ -644,10 +644,10 @@ class fileIOStatic {
|
||||
static int readDataFile(ifstream &infile, int *data, int nch, int offset) { \
|
||||
int ichan, idata, iline=0; \
|
||||
int interrupt=0; \
|
||||
string str; \
|
||||
std::string str; \
|
||||
while (infile.good() and interrupt==0) { \
|
||||
getline(infile,str); \
|
||||
istringstream ssstr(str); \
|
||||
std::istringstream ssstr(str); \
|
||||
ssstr >> ichan >> idata; \
|
||||
if (ssstr.fail() || ssstr.bad()) { \
|
||||
interrupt=1; \
|
||||
@ -673,10 +673,10 @@ class fileIOStatic {
|
||||
\param nch number of channels
|
||||
\returns OK or FAIL if it could not read the file or data=NULL
|
||||
*/
|
||||
static int readDataFile(string fname, short int *data, int nch){ \
|
||||
static int readDataFile(std::string fname, short int *data, int nch){ \
|
||||
ifstream infile; \
|
||||
int iline=0; \
|
||||
string str; \
|
||||
std::string str; \
|
||||
infile.open(fname.c_str(), ios_base::in); \
|
||||
if (infile.is_open()) { \
|
||||
iline=readDataFile(infile, data, nch, 0); \
|
||||
@ -700,10 +700,10 @@ class fileIOStatic {
|
||||
int ichan, iline=0; \
|
||||
short int idata; \
|
||||
int interrupt=0; \
|
||||
string str; \
|
||||
std::string str; \
|
||||
while (infile.good() and interrupt==0) { \
|
||||
getline(infile,str); \
|
||||
istringstream ssstr(str); \
|
||||
std::istringstream ssstr(str); \
|
||||
ssstr >> ichan >> idata; \
|
||||
if (ssstr.fail() || ssstr.bad()) { \
|
||||
interrupt=1; \
|
||||
|
@ -23,7 +23,7 @@ class postProcessingFuncs;
|
||||
|
||||
|
||||
|
||||
using namespace std;
|
||||
// using namespace std;
|
||||
|
||||
#define MAX_BADCHANS 20000
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user