DRAMA C++ Intro   Class Hierarchy   Alphabetical List of types   List of Classes   File List   Class Member Index   File Members Index   Related Pages  

dcppmonitor.h

Go to the documentation of this file.
00001 /*
00002  * Name: filter.m4
00003  *
00004  * Description:
00005  *     DOXYGEN Input file filter for DRAMA source files.
00006  *
00007  *     This file must be complatible with both Solaris and GNU m4.  All
00008  *     unused macros are deleted and this comment must end up as a C/C++
00009  *     compatible comment which is not picked up by DOXYGEN.
00010  * 
00011  * Synopsis:
00012  *    DCF(func)  => Produces a link to a DRAMA C source file func.html 
00013  *                   in ../routines.
00014  *     DDL(link,text) => Produce a link to ../link.html, specified link text.
00015  *
00016  * Language: m4 macro. 
00017  *
00018  * Author: Tony Farrell, AAO.
00019  *
00020  * "@(#) $Id: ACMM:DramaHtml/filter.m4,v 3.24 03-Nov-2009 09:07:29+11 tjf $"
00021  *
00022  * History:
00023  *     10-Nov-2004 - TJF - Original Version.
00024  */
00025 
00026 
00027 
00028 #ifndef dcppmonitor_h
00029 #define dcppmonitor_h
00030 /*                            d c p p m o n i t o r
00031   
00032  * Module name:
00033       dcppmonitor.h
00034   
00035  * Function:
00036         A class that which used DcppTask to support parameter monitoring.
00037   
00038  * Description:
00039         This class provides a wrap around to parameter monitoring operations.
00040         It uses a DcppTask object previously constructed by the user and 
00041         on which a GetPath operation  must have been completed.
00042         
00043         This file now uses DOXYGEN comments to generate the C++ web pages.
00044         m4 macros of the form @htmlonly <a href="../routines/function.html">function()</a>@endhtmlonly are used in the comments
00045         to refer to DRAMA C function documention (see DramaHtml/Makefile,
00046         DramaHtml/doxygen.config and DramaHtml/filter.m4 for detials)
00047   
00048  * Language:
00049       C++
00050   
00051  * Support: Tony Farrell, AAO
00052   
00053  * Copyright (c) Anglo-Australian Telescope Board, 1995.
00054    Not to be used for commercial purposes without AATB permission.
00055   
00056  *     @(#) $Id: ACMM:DramaDul/dcppmonitor.h,v 3.43 17-Sep-2009 14:07:33+10 tjf $
00057   
00058  * History:
00059       12-Oct-1995 - TJF - Original version. Extracted from dcpp.h.
00060       10-Sep-1997 - TJF - Add IsInitial(), IsStarting() and IsActive().
00061       09-Dec-1997 - TJF - Declare class with DPUBLICCLASS to allow
00062                           export from WIN32 DLL.
00063       16-Mar-2006 - TJF - monId should be INT32 - to avoid compiler warnings
00064                           with the new SDS Arg calls.
00065   
00066  */
00067 #include "dcpptask.h"
00068 /*
00069  * This file now uses DOXYGEN comments - the following is placed into the
00070  * index page.  note that the @file block says to include the typedefs,
00071  * functions etc from this file into the documentation.
00072  */
00073 
00082 typedef void (*DcppMonChangedRoutine)
00083                 (const char *name, SdsCodeType type, DcppVoidPnt value,  
00084                  DcppVoidPnt ClientData, StatusType * status);
00085 
00105 DPUBLICCLASS DcppMonitor {
00106      private:
00107         DcppTask *task;
00108         DcppMonChangedRoutine changedHandler;
00109         DcppHandlerRoutine    completedHandler;
00110         DcppHandlerRoutine    startHandler;
00111         DcppVoidPnt           clientData;
00112         enum StateEnum { INIT, WAIT_ID, ACTIVE } state;
00113         INT32 monId;
00114 
00115 
00116         const char *StateString(StateEnum state) const;
00117         static DcppHandlerRet CompHandler(DcppVoidPnt ClientData,
00118                                      StatusType * status);
00119         static DcppHandlerRet StartedHandler(DcppVoidPnt ClientData,
00120                                      StatusType *status);
00121         static DcppHandlerRet TrigHandler(DcppVoidPnt ClientData,
00122                                      StatusType * status);
00123 
00124 
00125         /* kept for link time compatiblity only - should not be invoked
00126            any more.  Use DcppVarArgsToSds() for all code.
00127         */
00128         void FormatArg(int count, 
00129                             Arg& ArgId,
00130                             StatusType * status,
00131                             va_list args);
00132 
00133 
00134 
00135 /*
00136  *      Prevent Assignment and copying of this type by redefining the
00137  *      assignment and copy operators to be private.
00138  *      This ensures we can't get multiple threads controlling the one
00139  *      task unless done intentionally by the caller.
00140  *
00141  *      Also disallow the default constructor.
00142  */
00143         DcppMonitor& operator=(const DcppMonitor&);
00144         DcppMonitor(const DcppMonitor&);
00145         DcppMonitor();
00146 
00147 
00148 
00149 
00150     public:
00155         DcppMonitor(DcppTask * Task) { task = Task; state = INIT; };
00156         
00161         DcppTask * Task() const { return task; };
00162 
00190         void Monitor(
00191                 const DcppMonChangedRoutine ChangedHandler,
00192                 const DcppHandlerRoutine    CompletedHandler,
00193                 const DcppVoidPnt             ClientData,
00194                 const bool SendCurrent,
00195                 const int count, StatusType * const status, ...);
00223         void MonitorForget(
00224                 const DcppMonChangedRoutine ChangedHandler,
00225                 const DcppHandlerRoutine    CompletedHandler,
00226                 const DcppVoidPnt             ClientData,
00227                 const bool SendCurrent,
00228                 const int count, StatusType * const status, ...);
00257         void Forward(
00258                 const char * const MTask, 
00259                 const char * const Action,
00260                 const DcppHandlerRoutine    CompletedHandler,
00261                 const DcppVoidPnt             ClientData,
00262                 const bool SendCurrent,
00263                 const int count, StatusType * const status, ...);
00294         void Forward(
00295                 const char * const MTask, 
00296                 const char * const Action,
00297                 const DcppHandlerRoutine    StartedHandler,
00298                 const DcppHandlerRoutine    CompletedHandler,
00299                 const DcppVoidPnt             ClientData,
00300                 const bool SendCurrent,
00301                 const int count, StatusType * const status, ...);
00329         void ForwardForget(
00330                 const char * const MTask, 
00331                 const char * const Action,
00332                 const DcppHandlerRoutine    CompletedHandler,
00333                 const DcppVoidPnt             ClientData,
00334                 const bool SendCurrent,
00335                 const int count, StatusType * const status, ...);
00366         void ForwardStartForget(
00367                 const char * const MTask, 
00368                 const char * const Action,
00369                 const DcppHandlerRoutine    StartHandler,
00370                 const DcppHandlerRoutine    CompletedHandler,
00371                 const DcppVoidPnt             ClientData,
00372                 const bool SendCurrent,
00373                 const int count, StatusType * const status, ...);
00374 
00405         void Add (
00406                   const char * const name, 
00407                   StatusType * const status,
00408                   const DcppHandlerRoutine   SuccessHandler = 0,
00409                   const DcppHandlerRoutine   ErrorHandler   = 0,
00410                   const DcppVoidPnt ClientData = 0) const ;
00441         void Delete (
00442                   const char * const name, 
00443                   StatusType * const status,
00444                   const DcppHandlerRoutine   SuccessHandler = 0,
00445                   const DcppHandlerRoutine   ErrorHandler   = 0,
00446                   const DcppVoidPnt ClientData = 0) const ;
00447         
00477         void Cancel (
00478                   StatusType * const status,
00479                   const DcppHandlerRoutine   SuccessHandler = 0,
00480                   const DcppHandlerRoutine   ErrorHandler   = 0,
00481                   const DcppVoidPnt ClientData = 0) const ;
00482 
00487         bool IsInitial() {
00488                return (state == INIT);
00489         }
00495         bool IsStarting() {
00496                return (state == WAIT_ID);
00497         }
00502         bool IsActive() {
00503                return (state == ACTIVE);
00504         }
00508         void Reset() {
00509             state = INIT;
00510         }
00511 };
00512 
00513 #endif
00514 

Click here for the DRAMA home page and here for the AAO home page.

For more information, contact tjf@aaoepp.aao.gov.au 

Generated on Tue Nov 3 09:09:56 2009 for AAO DRAMA C++ Interfaces by doxygen 1.2.18