make all get*() member functions const member functions - looks natural, get*() methods shouldn't change state.

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@788 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
billich 2014-03-17 18:44:43 +00:00
parent d29660cad8
commit 540c3b1971
2 changed files with 16 additions and 16 deletions

View File

@ -11,7 +11,7 @@
/* uncomment next line to enable debug output */ /* uncomment next line to enable debug output */
// #define EIGER_DEBUG #define EIGER_DEBUG
/* macro for debug output */ /* macro for debug output */
#ifdef EIGER_DEBUG #ifdef EIGER_DEBUG
@ -27,7 +27,7 @@ public:
DEBUG("initialize() with: detectorHostName= " << detectorHostName << "."); DEBUG("initialize() with: detectorHostName= " << detectorHostName << ".");
} }
char *getDetectorHostname() { char *getDetectorHostname() const {
const std::string name = "some_host_name"; const std::string name = "some_host_name";
char *c = new char[name.length()]; char *c = new char[name.length()];
name.copy(c, name.length()); name.copy(c, name.length());
@ -36,7 +36,7 @@ public:
return(c); return(c);
} }
char *getFileName() { char *getFileName() const {
const std::string name = "some_file_name"; const std::string name = "some_file_name";
char *c = new char[name.length()]; char *c = new char[name.length()];
name.copy(c, name.length()); name.copy(c, name.length());
@ -45,7 +45,7 @@ public:
return(c); return(c);
} }
char *getFilePath() { char *getFilePath() const {
std::string name = "some_path"; std::string name = "some_path";
char *c = new char[name.length()]; char *c = new char[name.length()];
name.copy(c, name.length()); name.copy(c, name.length());
@ -54,17 +54,17 @@ public:
return(c); return(c);
} }
int getDynamicRange() { int getDynamicRange() const {
DEBUG("getDynamicRange(): Return 16."); DEBUG("getDynamicRange(): Return 16.");
return(16); return(16);
} }
int getScanTag() { int getScanTag() const {
DEBUG("getScanTag(): return 4711."); DEBUG("getScanTag(): return 4711.");
return(4711); return(4711);
} }
int getNumberOfFrames() { int getNumberOfFrames() const {
DEBUG("getNumberOfFrames(): return 42."); DEBUG("getNumberOfFrames(): return 42.");
return(42); return(42);
} }
@ -79,7 +79,7 @@ public:
return(this->getFilePath()); return(this->getFilePath());
} }
int getEnableFileWrite() { int getEnableFileWrite() const {
DEBUG("getEnableFileWrite() returns 1."); DEBUG("getEnableFileWrite() returns 1.");
return(1); return(1);
} }

View File

@ -1,4 +1,4 @@
//#define EIGER_RECEIVER
#ifdef EIGER_RECEIVER #ifdef EIGER_RECEIVER
#ifndef EIGERRECEIVER_H #ifndef EIGERRECEIVER_H
@ -71,7 +71,7 @@ public:
* caller needs to deallocate the returned char array. * caller needs to deallocate the returned char array.
* if uninitialized, it must return NULL * if uninitialized, it must return NULL
*/ */
virtual char *getDetectorHostname() = 0; virtual char *getDetectorHostname() const = 0;
/** /**
* Returns status of receiver: idle, running or error * Returns status of receiver: idle, running or error
@ -84,38 +84,38 @@ public:
* Returns File Name * Returns File Name
* caller is responsible to deallocate the returned char array. * caller is responsible to deallocate the returned char array.
*/ */
virtual char *getFileName() = 0; virtual char *getFileName() const = 0;
/** /**
* Returns File Path * Returns File Path
* caller is responsible to deallocate the returned char array * caller is responsible to deallocate the returned char array
*/ */
virtual char *getFilePath() = 0; //FIXME: Does the caller need to free() the returned pointer? virtual char *getFilePath() const = 0; //FIXME: Does the caller need to free() the returned pointer?
/** /**
* Returns the number of bits per pixel * Returns the number of bits per pixel
*/ */
virtual int getDynamicRange() = 0; virtual int getDynamicRange() const = 0;
/** /**
* Returns scan tag * Returns scan tag
*/ */
virtual int getScanTag() = 0; virtual int getScanTag() const = 0;
/* /*
* Returns number of frames to receive * Returns number of frames to receive
* This is the number of frames to expect to receiver from the detector. * This is the number of frames to expect to receiver from the detector.
* The data receiver will change from running to idle when it got this number of frames * The data receiver will change from running to idle when it got this number of frames
*/ */
virtual int getNumberOfFrames() = 0; virtual int getNumberOfFrames() const = 0;
/** /**
* Returns file write enable * Returns file write enable
* 1: YES 0: NO * 1: YES 0: NO
*/ */
virtual int getEnableFileWrite() = 0; virtual int getEnableFileWrite() const = 0;
/** /**
* Set File Name (without frame index, file index and extension) * Set File Name (without frame index, file index and extension)