mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 10:07:59 +02:00
void pointers added to callback functions
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@199 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
@ -1,4 +1,3 @@
|
||||
|
||||
#ifndef SLS_DETECTOR_USERS_H
|
||||
#define SLS_DETECTOR_USERS_H
|
||||
|
||||
@ -354,32 +353,32 @@ class slsDetectorUsers
|
||||
\param func function for reading the detector position
|
||||
*/
|
||||
|
||||
virtual void registerGetPositionCallback( float (*func)(void))=0;
|
||||
virtual void registerGetPositionCallback( float (*func)(void*),void *arg)=0;
|
||||
/**
|
||||
@short register callback for connecting to the epics channels
|
||||
\param func function for connecting to the epics channels
|
||||
*/
|
||||
virtual void registerConnectChannelsCallback( int (*func)(void))=0;
|
||||
virtual void registerConnectChannelsCallback( int (*func)(void*),void *arg)=0;
|
||||
/**
|
||||
@short register callback to disconnect the epics channels
|
||||
\param func function to disconnect the epics channels
|
||||
*/
|
||||
virtual void registerDisconnectChannelsCallback( int (*func)(void))=0;
|
||||
virtual void registerDisconnectChannelsCallback( int (*func)(void*),void *arg)=0;
|
||||
/**
|
||||
@short register callback for moving the detector
|
||||
\param func function for moving the detector
|
||||
*/
|
||||
virtual void registerGoToPositionCallback( int (*func)(float))=0;
|
||||
virtual void registerGoToPositionCallback( int (*func)(float,void*),void *arg)=0;
|
||||
/**
|
||||
@short register callback for moving the detector without waiting
|
||||
\param func function for moving the detector
|
||||
*/
|
||||
virtual void registerGoToPositionNoWaitCallback( int (*func)(float))=0;
|
||||
virtual void registerGoToPositionNoWaitCallback( int (*func)(float,void*),void *arg)=0;
|
||||
/**
|
||||
@short register calbback reading to I0
|
||||
\param func function for reading the I0 (called with parameter 0 before the acquisition, 1 after and the return value used as I0)
|
||||
*/
|
||||
virtual void registerGetI0Callback( float (*func)(int))=0;
|
||||
virtual void registerGetI0Callback( float (*func)(int,void*),void *arg)=0;
|
||||
|
||||
/************************************************************************
|
||||
|
||||
|
@ -11,18 +11,18 @@ slsDetectorUtils::slsDetectorUtils() {
|
||||
#ifdef VERBOSE
|
||||
cout << "setting callbacks" << endl;
|
||||
#endif
|
||||
registerGetPositionCallback(&defaultGetPosition);
|
||||
registerConnectChannelsCallback(&defaultConnectChannels);
|
||||
registerDisconnectChannelsCallback(&defaultDisconnectChannels);
|
||||
registerGoToPositionCallback(&defaultGoToPosition);
|
||||
registerGoToPositionNoWaitCallback(&defaultGoToPositionNoWait);
|
||||
registerGetI0Callback(&defaultGetI0);
|
||||
registerGetPositionCallback(&defaultGetPosition, NULL);
|
||||
registerConnectChannelsCallback(&defaultConnectChannels,NULL);
|
||||
registerDisconnectChannelsCallback(&defaultDisconnectChannels,NULL);
|
||||
registerGoToPositionCallback(&defaultGoToPosition,NULL);
|
||||
registerGoToPositionNoWaitCallback(&defaultGoToPositionNoWait,NULL);
|
||||
registerGetI0Callback(&defaultGetI0,NULL);
|
||||
#ifdef VERBOSE
|
||||
cout << "done " << endl;
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -45,8 +45,7 @@ void slsDetectorUtils::acquire(int delflag){
|
||||
|
||||
|
||||
if ((*correctionMask&(1<< ANGULAR_CONVERSION)) || (*correctionMask&(1<< I0_NORMALIZATION))) {
|
||||
if (connect_channels())
|
||||
connect_channels();
|
||||
connect_channels(NULL);
|
||||
}
|
||||
|
||||
|
||||
@ -132,7 +131,7 @@ void slsDetectorUtils::acquire(int delflag){
|
||||
if (*stoppedFlag==0) {
|
||||
if (*numberOfPositions>0) {
|
||||
if (go_to_position)
|
||||
go_to_position (detPositions[ip]);
|
||||
go_to_position (detPositions[ip],NULL);
|
||||
currentPositionIndex=ip+1;
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "moving to position" << std::endl;
|
||||
@ -159,21 +158,21 @@ void slsDetectorUtils::acquire(int delflag){
|
||||
if (*correctionMask&(1<< ANGULAR_CONVERSION)) {
|
||||
pthread_mutex_lock(&mp);
|
||||
if (get_position)
|
||||
currentPosition=get_position();
|
||||
currentPosition=get_position(NULL);
|
||||
posfinished=0;
|
||||
pthread_mutex_unlock(&mp);
|
||||
}
|
||||
|
||||
if (*correctionMask&(1<< I0_NORMALIZATION)) {
|
||||
/* if (*correctionMask&(1<< I0_NORMALIZATION)) {
|
||||
if (get_i0)
|
||||
get_i0(0);
|
||||
}
|
||||
}*/
|
||||
|
||||
startAndReadAll();
|
||||
|
||||
if (*correctionMask&(1<< I0_NORMALIZATION)) {
|
||||
if (get_i0)
|
||||
currentI0=get_i0(1); // this is the correct i0!!!!!
|
||||
currentI0=get_i0(1,NULL); // this is the correct i0!!!!!
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&mp);
|
||||
@ -271,7 +270,7 @@ void slsDetectorUtils::acquire(int delflag){
|
||||
|
||||
if ((*correctionMask&(1<< ANGULAR_CONVERSION)) || (*correctionMask&(1<< I0_NORMALIZATION))) {
|
||||
if (disconnect_channels)
|
||||
disconnect_channels();
|
||||
disconnect_channels(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -520,13 +520,13 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
||||
|
||||
|
||||
|
||||
void registerGetPositionCallback( float (*func)(void)){get_position=func;};
|
||||
void registerConnectChannelsCallback( int (*func)(void)){connect_channels=func;};
|
||||
void registerDisconnectChannelsCallback( int (*func)(void)){disconnect_channels=func;};
|
||||
void registerGetPositionCallback( float (*func)(void*),void *arg){get_position=func; POarg=arg;};
|
||||
void registerConnectChannelsCallback( int (*func)(void*),void *arg){connect_channels=func; CCarg=arg;};
|
||||
void registerDisconnectChannelsCallback(int (*func)(void*),void*arg){disconnect_channels=func;DCarg=arg;};
|
||||
|
||||
void registerGoToPositionCallback( int (*func)(float)){go_to_position=func;};
|
||||
void registerGoToPositionNoWaitCallback( int (*func)(float)){go_to_position_no_wait=func;};
|
||||
void registerGetI0Callback( float (*func)(int)){get_i0=func;};
|
||||
void registerGoToPositionCallback( int (*func)(float, void*),void *arg){go_to_position=func;GTarg=arg;};
|
||||
void registerGoToPositionNoWaitCallback(int (*func)(float, void*),void*arg){go_to_position_no_wait=func;GTNarg=arg;};
|
||||
void registerGetI0Callback( float (*func)(int, void*),void *arg){get_i0=func;IOarg=arg;};
|
||||
|
||||
/**
|
||||
Saves the detector setup to file
|
||||
@ -565,12 +565,13 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
||||
|
||||
int progressIndex;
|
||||
|
||||
float (*get_position)(void);
|
||||
int (*go_to_position)(float);
|
||||
int (*go_to_position_no_wait)(float);
|
||||
int (*connect_channels)(void);
|
||||
int (*disconnect_channels)(void);
|
||||
float (*get_i0)(int);
|
||||
float (*get_position)(void*);
|
||||
int (*go_to_position)(float, void*);
|
||||
int (*go_to_position_no_wait)(float, void*);
|
||||
int (*connect_channels)(void*);
|
||||
int (*disconnect_channels)(void*);
|
||||
float (*get_i0)(int, void*);
|
||||
void *POarg,*CCarg,*DCarg,*GTarg,*GTNarg,*IOarg;
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user