cdev-1.7.2n
This commit is contained in:
192
include/cdevDefCollectionRequest.h
Normal file
192
include/cdevDefCollectionRequest.h
Normal file
@@ -0,0 +1,192 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Copyright (c) 1994,1995 Southeastern Universities Research Association,
|
||||
* Continuous Electron Beam Accelerator Facility
|
||||
*
|
||||
* This software was developed under a United States Government license
|
||||
* described in the NOTICE file included as part of this distribution.
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
*
|
||||
* cdevDefCollectionRequest.h : This is the default class that will be used
|
||||
* to support collection operations for services.
|
||||
*
|
||||
* Author: Walt Akers
|
||||
*
|
||||
* Revision History:
|
||||
* cdevDefCollectionRequest.h,v
|
||||
* Revision 1.2 1998/10/22 17:57:41 chen
|
||||
* fix a bug on setting collection values
|
||||
*
|
||||
* Revision 1.1 1996/11/12 20:32:25 akers
|
||||
* New collection device source code
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef _CDEV_DEF_COLLECTION_REQUEST_H
|
||||
#define _CDEV_DEF_COLLECTION_REQUEST_H
|
||||
|
||||
#include <cdevCollectionRequest.h>
|
||||
|
||||
class CDEV_CLASS_SPEC cdevDefCollectionRequest: public cdevCollectionRequest
|
||||
{
|
||||
friend class cdevCollectionRequest;
|
||||
friend class cdevService;
|
||||
|
||||
public:
|
||||
// *********************************************************************
|
||||
// * This structure is provided as the void * argument to the default
|
||||
// * callback whenever the synchronous send is used. The checkSum is
|
||||
// * used to detect if the result returned after the send method stopped
|
||||
// * waiting for it.
|
||||
// *********************************************************************
|
||||
typedef struct
|
||||
{
|
||||
int completionCode;
|
||||
int finished;
|
||||
cdevData *data;
|
||||
} SendStatus;
|
||||
|
||||
// *********************************************************************
|
||||
// * These methods get state and access information for the underlying
|
||||
// * cdevRequestObjects.
|
||||
// *********************************************************************
|
||||
virtual int getState (void);
|
||||
virtual int getAccess (void);
|
||||
|
||||
// *********************************************************************
|
||||
// * This method sets the context of each of the underlying
|
||||
// * cdevRequestObjects.
|
||||
// *********************************************************************
|
||||
virtual int setContext (cdevData &ctx);
|
||||
|
||||
// *********************************************************************
|
||||
// * cdevClientRequestObject::send :
|
||||
// * The send interface is used to provide synchronous I/O with the
|
||||
// * service.
|
||||
// *
|
||||
// * Returns CDEV_SUCCESS on success or CDEV_ERROR on error.
|
||||
// *********************************************************************
|
||||
virtual int send ( cdevData & in, cdevData & out )
|
||||
{ return send(&in, &out); }
|
||||
virtual int send ( cdevData * in, cdevData & out )
|
||||
{ return send(in, &out); }
|
||||
virtual int send ( cdevData & in, cdevData * out )
|
||||
{ return send(&in, out); }
|
||||
virtual int send ( cdevData * in, cdevData * out );
|
||||
|
||||
// *********************************************************************
|
||||
// * sendNoBlock :
|
||||
// * The sendNoBlock interface is used in conjunction with cdevGroup
|
||||
// * or cdevSystem to execute a series of operations.
|
||||
// *
|
||||
// * Returns CDEV_SUCCESS on success or CDEV_ERROR on error.
|
||||
// *********************************************************************
|
||||
virtual int sendNoBlock (cdevData & in, cdevData & out)
|
||||
{ return sendNoBlock(&in, &out); }
|
||||
virtual int sendNoBlock (cdevData * in, cdevData & out)
|
||||
{ return sendNoBlock(in, &out); }
|
||||
virtual int sendNoBlock (cdevData & in, cdevData * out)
|
||||
{ return sendNoBlock(&in, out); }
|
||||
virtual int sendNoBlock (cdevData * in, cdevData * out);
|
||||
|
||||
// *********************************************************************
|
||||
// * sendCallback :
|
||||
// * The sendCallback interface provides asynchronous communications
|
||||
// * with the service.
|
||||
// *
|
||||
// * Returns CDEV_SUCCESS on success or CDEV_ERROR on error.
|
||||
// *********************************************************************
|
||||
virtual int sendCallback (cdevData & in, cdevCallback & callback)
|
||||
{ return sendCallback(&in, callback); }
|
||||
virtual int sendCallback (cdevData * in, cdevCallback & callback);
|
||||
|
||||
// *********************************************************************
|
||||
// * This method returns the name of the class.
|
||||
// *********************************************************************
|
||||
const char *className (void) const {return "cdevDefCollectionRequest";}
|
||||
|
||||
protected:
|
||||
// *********************************************************************
|
||||
// * These are the protected constructor and destructor for this object.
|
||||
// *********************************************************************
|
||||
cdevDefCollectionRequest (char **devices, int nDevices, char *msg, cdevSystem& sys);
|
||||
virtual ~cdevDefCollectionRequest (void);
|
||||
|
||||
// *********************************************************************
|
||||
// * This is the syncCallback method. It will be used by the send
|
||||
// * method in order to detect the completion of the operation.
|
||||
// *********************************************************************
|
||||
static void syncCallback (int status, void * user, cdevRequestObject &, cdevData &data);
|
||||
|
||||
// *********************************************************************
|
||||
// * This callback function is used to receive the individual callbacks
|
||||
// * from the underlying cdevRequestObjects and is used by sendCallback.
|
||||
// *********************************************************************
|
||||
static void asyncCallback (int, void *, cdevRequestObject &, cdevData &);
|
||||
|
||||
// *********************************************************************
|
||||
// * This is the asyncNoBlockCallback method. It will be used by the
|
||||
// * sendNoBlock method in order to detect the completion of the
|
||||
// * operation.
|
||||
// *********************************************************************
|
||||
static void asyncNoBlockCallback (int status, void * user, cdevRequestObject &, cdevData &data);
|
||||
|
||||
|
||||
// *********************************************************************
|
||||
// * This is routine set scaler value to array of cdevData with a
|
||||
// * specified tag
|
||||
// *********************************************************************
|
||||
static int setScalerDataValue (cdevData& data, int tag,
|
||||
cdevData* res, int num);
|
||||
|
||||
// *********************************************************************
|
||||
// * This is routine set vector value to array of cdevData with a
|
||||
// * specified tag
|
||||
// *********************************************************************
|
||||
static int setVectorDataValue (cdevData& data, int tag, size_t dim,
|
||||
cdevData* res, int num);
|
||||
|
||||
// *********************************************************************
|
||||
// * This is routine split a input cdevData into an array of cdevData.
|
||||
// * The input data is either a scaler value which will be duplicated
|
||||
// * to all splited data values, or a array of data whose bound[0].length
|
||||
// * must be the same as the 'num'. This works for a single tag
|
||||
// *********************************************************************
|
||||
static int splitDataItem (cdevData& data, int tag,
|
||||
cdevData* res, int num);
|
||||
|
||||
|
||||
// *********************************************************************
|
||||
// * This is routine split a input cdevData into an array of cdevData.
|
||||
// * The input data is either a scaler value which will be duplicated
|
||||
// * to all splited data values, or a array of data whose bound[0].length
|
||||
// * must be the same as the 'num'
|
||||
// * caller must free return cdevData array if it is not zero.
|
||||
// *********************************************************************
|
||||
static cdevData *splitData (cdevData& data, int splitnum);
|
||||
|
||||
private:
|
||||
static SendStatus sendStatus;
|
||||
static int sendCheckSum;
|
||||
|
||||
// *********************************************************************
|
||||
// * These are the cdevRequestObjects that are addressed by each call
|
||||
// * to this cdevDefCollectionRequest. The nRequests variable contains
|
||||
// * the number of cdevRequestObjects that are represented.
|
||||
// *********************************************************************
|
||||
cdevRequestObject **requests;
|
||||
int nRequests;
|
||||
|
||||
// *********************************************************************
|
||||
// * This is the master data structure. It contains no actual data,
|
||||
// * however, it identifies the data structure that should exist when
|
||||
// * the request has been executed.
|
||||
// *
|
||||
// * This structure is inspected and updated at the completion of each
|
||||
// * callback, and is used to initially create the cdevData objects that
|
||||
// * are used for interim data storage.
|
||||
// *********************************************************************
|
||||
cdevData format;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user