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 GITINC 00029 #define GITINC 00030 /* 00031 * Copyright (c) Anglo-Australian Telescope Board, 1995. 00032 * Not to be used for commercial purposes without AATB permission. 00033 * 00034 * @(#) $Id: ACMM:DramaGit/Git.h,v 3.49 17-Sep-2009 14:08:18+10 tjf $ 00035 * 00036 * This file now uses DOXYGEN comments to generate the C++ web pages. 00037 * m4 macros of the form @htmlonly <a href="../routines/function.html">function()</a>@endhtmlonly are used in the comments 00038 * to refer to DRAMA C function documention (see DramaHtml/Makefile, 00039 * DramaHtml/doxygen.config and DramaHtml/filter.m4 for detials) 00040 * 00041 00042 00043 */ 00044 #ifdef GIT_MODULE 00045 #define DNOCONST 0 00046 #endif 00047 /* 00048 * Include file for Git module 00049 */ 00050 00051 #include "DitsTypes.h" /* For DitsActionHandlerType and drama.h */ 00052 #include "sds.h" /* For SdsIdType */ 00053 #include "DitsSys.h" 00054 #include "dul.h" /* */ 00055 #ifdef __cplusplus 00056 extern "C" { 00057 #endif 00058 /* 00059 * Simulation levels, taken from GIT_SPEC. Note GIT_SIM_NONE should be zero. 00060 */ 00061 typedef enum { GIT_SIM_NONE=0, GIT_SIM_BASIC, GIT_SIM_COMMANDS, 00062 GIT_SIM_STATUS, GIT_SIM_FULL } GitSimulationType; 00063 00064 typedef enum { GIT_MON_START, GIT_MON_FORWARD, GIT_MON_ADD, 00065 GIT_MON_DELETE, GIT_MON_CANCEL } GitMonitorMsgType; 00066 00069 typedef struct { 00070 const char * GitTrue; 00071 const char * GitFalse; 00072 } GitLogStrType; 00073 00074 00075 #define GIT_M_SIM_BASIC 1 00076 #define GIT_M_SIM_COMMANDS 2 00077 #define GIT_M_SIM_STATUS 4 00078 00079 #define GIT_M_ARG_UPPER 1 00080 #define GIT_M_ARG_LOWER 2 00081 #define GIT_M_ARG_KEEPERR 4 00082 #define GIT_M_ARG_ABBREV 8 00083 #define GIT_M_ARG_LASTBIT 0x10 00084 00085 #define GIT_ARG_LMAX 10 00086 00087 #ifdef DPROTOTYPES_OK 00088 DPUBLIC DVOID GitActivate ( 00089 DCONSTV SdsIdType parsysid, 00090 StatusType *status); 00091 DPUBLIC int GitSimulation ( 00092 DCONSTV char * DCONSTR exName, 00093 DCONSTV int levels, 00094 GitSimulationType * DCONSTR simulation, 00095 float * DCONSTR timebase, 00096 StatusType * DCONSTR status); 00097 00098 DPUBLIC DVOID GitParEnvGetS( 00099 DCONSTV char * DCONSTR pName, 00100 DCONSTV char * DCONSTR eName, 00101 DCONSTV char * DCONSTR badVal, 00102 DCONSTV char * DCONSTR defVal, 00103 DCONSTV int actValLen, 00104 char * DCONSTR actVal, 00105 StatusType * DCONSTR status); 00106 DPUBLIC int GitEnvGetS( 00107 DCONSTV char * name, 00108 DCONSTV int valLen, 00109 char *val, 00110 StatusType *status); 00111 DPUBLIC DVOID GitArgGetS ( 00112 DCONSTV SdsIdType id, 00113 DCONSTV char * name, 00114 DCONSTV int position, 00115 DCONSTV char *values[], 00116 DCONSTV char *defVal, 00117 DCONSTV int flags, 00118 DCONSTV int actValLen , 00119 char * actValue, 00120 int *index, 00121 StatusType * status); 00122 DPUBLIC DVOID GitArgGetI ( 00123 DCONSTV SdsIdType id, 00124 DCONSTV char *name, 00125 DCONSTV int position, 00126 DCONSTV long int range[], 00127 DCONSTV long int defVal, 00128 DCONSTV int flags, 00129 long int * actValue, 00130 StatusType *status); 00131 00132 DPUBLIC DVOID GitArgGetD ( 00133 DCONSTV SdsIdType id, 00134 DCONSTV char *name, 00135 DCONSTV int position, 00136 DCONSTV double range[], 00137 DCONSTV double defVal, 00138 DCONSTV int flags, 00139 double * actValue, 00140 StatusType *status); 00141 00142 DPUBLIC DVOID GitArgGetL ( 00143 DCONSTV SdsIdType id, 00144 DCONSTV char *name, 00145 DCONSTV int position, 00146 DCONSTV GitLogStrType strings[], 00147 DCONSTV long int defVal, 00148 DCONSTV int flags, 00149 long int * actValue, 00150 StatusType *status); 00151 00152 DPUBLIC DVOID GitArgNamePos ( 00153 DCONSTV SdsIdType id, 00154 DCONSTV char *name, 00155 DCONSTV int position, 00156 SdsIdType *argid, 00157 StatusType *status); 00158 DPUBLIC DVOID GitPathGetInit( 00159 DCONSTV char * DCONSTV name, 00160 int MessageBytes, 00161 int MaxMessages, 00162 int ReplyBytes, 00163 int MaxReplies, 00164 int timeout, 00165 DitsActionRoutineType handler, 00166 DVOIDP client_data, 00167 StatusType *status); 00168 DPUBLIC DVOID GitPathGetComp( 00169 DitsPathType *path, 00170 DVOIDP * client_data, 00171 StatusType *status); 00172 00173 00174 DPUBLIC DVOID GitTpiInit (StatusType *status); 00175 DPUBLIC DVOID GitTpiPut ( 00176 DCONSTV int key, 00177 DVOIDP item, 00178 StatusType *status); 00179 DPUBLIC DVOID GitTpiGet ( 00180 DCONSTV int key, 00181 DVOIDP * item, 00182 StatusType *status); 00183 DPUBLIC DVOID GitTpiDelete ( 00184 DCONSTV int key, 00185 StatusType *status); 00186 00187 DPUBLIC DVOID GitArgGetStruct ( 00188 DCONSTV SdsIdType id, 00189 DCONSTV char *name, 00190 DCONSTV int position, 00191 DCONSTV char *defVal, 00192 int actNameLen, 00193 char * actName, 00194 SdsIdType * actValue, 00195 StatusType *status); 00196 00197 DPUBLIC DVOID GitPutDelay( 00198 double delay, 00199 StatusType *status); 00200 DPUBLIC DVOID GitPutDelayPar( 00201 DCONSTV char * parameter, 00202 StatusType *status); 00203 00204 00205 DPUBLIC DVOID GitTimer(StatusType *status); 00206 DPUBLIC DVOID GitTimerArgExtract(DVOIDP ClientData, const SdsIdType InArg, 00207 SdsIdType * DCONSTR OutArg, 00208 StatusType * DCONSTR status); 00209 00210 00211 typedef DVOID (*GitMonitorStartedType)(int id, 00212 DVOIDP client_data, 00213 StatusType *status); 00214 typedef DVOID (*GitMonitorChangedType)( 00215 char * name, 00216 SdsCodeType type, 00217 DVOIDP value, 00218 DVOIDP client_data, 00219 StatusType *status); 00220 typedef DVOID (*GitMonitorResponseType)( 00221 DVOIDP client_data, 00222 StatusType *status); 00223 00224 typedef DVOID (*GitTimerArgRoutineType)( 00225 DVOIDP ClientData, 00226 SdsIdType InArg, SdsIdType *OutArg, 00227 StatusType *status); 00228 00229 #else 00230 DPUBLIC DVOID GitActivate (); 00231 DPUBLIC int GitSimulation (); 00232 DPUBLIC DVOID GitParEnvGetS(); 00233 DPUBLIC int GitEnvGetS(); 00234 DPUBLIC DVOID GitArgGetS (); 00235 DPUBLIC DVOID GitArgGetI (); 00236 DPUBLIC DVOID GitArgGetD (); 00237 DPUBLIC DVOID GitArgGetD (); 00238 DPUBLIC DVOID GitArgGetL (); 00239 DPUBLIC DVOID GitArgNamePos (); 00240 DPUBLIC DVOID GitPathGetInit(); 00241 DPUBLIC DVOID GitPathGetComp(); 00242 DPUBLIC DVOID GitTpiInit (); 00243 DPUBLIC DVOID GitTpiAdd (); 00244 DPUBLIC DVOID GitTpiGet (); 00245 DPUBLIC DVOID GitTpiPut (); 00246 DPUBLIC DVOID GitTpiDelete (); 00247 DPUBLIC DVOID GitArgGetStruct(); 00248 DPUBLIC DVOID GitPutDelay(); 00249 DPUBLIC DVOID GitPutDelayPar(); 00250 DPUBLIC DVOID GitTimer(StatusType *status); 00251 DPUBLIC DVOID GitTimerArgExtract(); 00252 00253 typedef DVOID (*GitMonitorStartedType)(); 00254 typedef DVOID (*GitMonitorChangedType)(); 00255 typedef DVOID (*GitMonitorResponseType)(); 00256 typedef DVOID (*GitTimerArgRoutineType)(); 00257 00258 #endif 00259 00260 /* 00261 * Can only define these prototypes in gitmonitor.c if stdarg.h is available. 00262 */ 00263 00264 #if (!defined(GITMONITORC) || defined(DSTDARG_OK)) && defined(DPROTOTYPES_OK) 00265 DPUBLIC DVOID GitMonitorStart( 00266 DitsPathType path, 00267 GitMonitorStartedType Started, 00268 GitMonitorChangedType Changed, 00269 GitMonitorResponseType Completed, 00270 GitMonitorResponseType Unexpected, 00271 DVOIDP client_data, 00272 int count, 00273 StatusType *status, ...); 00274 DPUBLIC DVOID GitMonitorStartF( 00275 DitsPathType path, 00276 int Flags, 00277 GitMonitorStartedType Started, 00278 GitMonitorChangedType Changed, 00279 GitMonitorResponseType Completed, 00280 GitMonitorResponseType Unexpected, 00281 DVOIDP client_data, 00282 int count, 00283 StatusType *status, ...); 00284 DPUBLIC DVOID GitMonitorForward( 00285 DitsPathType path, 00286 DCONSTV char * task, 00287 DCONSTV char * action, 00288 GitMonitorStartedType Started, 00289 GitMonitorResponseType Completed, 00290 GitMonitorResponseType Unexpected, 00291 DVOIDP client_data, 00292 int count, 00293 StatusType *status, ...); 00294 00295 DPUBLIC DVOID GitMonitorMessage( 00296 int id, 00297 DitsPathType path, 00298 GitMonitorMsgType type, 00299 int count, 00300 DitsTransIdType * transid, 00301 StatusType *status,...); 00302 00303 #elif !defined(GITMONITORC) 00304 DPUBLIC DVOID GitMonitorStart(); 00305 DPUBLIC DVOID GitMonitorStartF(); 00306 DPUBLIC DVOID GitMonitorForward(); 00307 DPUBLIC DVOID GitMonitorChange(); 00308 #endif 00309 00310 00311 /* 00312 * Structures used by GitTimer. 00313 */ 00314 typedef struct { 00315 char ActionName[DITS_C_NAMELEN]; 00316 GitTimerArgRoutineType ArgCreateRoutine; 00317 DVOIDP ClientData; 00318 SdsIdType Arg; /* Argument for this action */ 00319 00320 /* Info private to GitTimer follows */ 00321 DitsGsokMessageType _Message; /* Message to send */ 00322 } GitTimerDetailsType; 00323 00324 typedef struct { 00325 char TaskName[DITS_C_NAMELEN]; /* Task involved */ 00326 int SeqCount; /* Number of elements in Sequence */ 00327 GitTimerDetailsType *SequenceDetails; /* Sequence definitons */ 00328 DitsPathInfoType Buffers; /* Message buffer sizes */ 00329 /* Info private to GitTimer follows */ 00330 int _Current; /* Current in sequence */ 00331 long _Count; /* Number of repeats to do */ 00332 int _Done; /* Number of repeats done; */ 00333 DitsPathType _Path; /* Path to task involved */ 00334 IMP_AbsTime _StartTime; /* Start time */ 00335 } GitTimerType; 00336 00337 00338 #ifdef __cplusplus 00339 } /* extern "C" */ 00340 /* 00341 * C++ only section 00342 * 00343 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00344 * 00345 * Here is a C++ interface to Git. 00346 * 00347 * First, A Class which defines flags used in the rest of this module. 00348 */ 00349 #include "arg.h" 00350 00359 DPUBLICCLASS Git { 00360 public: 00361 enum { 00362 Upper=GIT_M_ARG_UPPER, 00363 Lower=GIT_M_ARG_UPPER, 00364 KeepErr=GIT_M_ARG_KEEPERR, 00365 Abbrev = GIT_M_ARG_ABBREV, 00366 LastBit=GIT_M_ARG_LASTBIT 00371 }; 00372 }; 00373 00387 DPUBLICCLASS GitEnum : public Git { 00388 protected: 00397 virtual void SetValue(const unsigned int) = 0; 00409 virtual const char * const * Lookup() = 0; 00410 public: 00413 virtual ~GitEnum() {}; 00428 void Get(const SdsId& Id, 00429 const char * const Name, 00430 const int Position, 00431 StatusType *status, 00432 const char *Default=0, 00433 const int Flags = Git::Upper|Git::Abbrev) 00434 { 00435 char string[100]; 00436 int index; 00437 GitArgGetS((SdsIdType)Id,Name,Position,(const char **)Lookup(), 00438 Default, 00439 Flags,sizeof(string),string,&index,status); 00440 SetValue(index); 00441 }; 00442 00443 }; 00462 DPUBLICCLASS GitBool : public Git { 00463 private: 00464 bool value; 00465 static const GitLogStrType lookupTable[]; 00466 protected: 00478 virtual const GitLogStrType * Lookup() { 00479 return lookupTable; 00480 } 00481 public: 00485 GitBool() { 00486 value = false; 00487 } 00498 GitBool ( /*Constructor with automatic Get */ 00499 const SdsId& Id, 00500 const char * const Name, 00501 const int Position, 00502 StatusType * const status, 00503 const bool Default = false, 00504 const int Flags = (Git::Upper|Git::Abbrev)) 00505 { 00506 value = false; 00507 Get(Id,Name,Position,status,Default,Flags); 00508 } 00511 virtual ~GitBool() {}; /* Destructor for inheritors */ 00526 virtual void Get( /* Get value from Sds structure */ 00527 const SdsId& Id, 00528 const char * const Name, 00529 const int Position, 00530 StatusType * const status, 00531 const bool Default = false, 00532 const int Flags = (Git::Upper|Git::Abbrev)) 00533 { 00534 long int actValue; 00535 GitArgGetL((SdsIdType)Id,Name,Position,Lookup(),Default, 00536 Flags,&actValue,status); 00537 value = actValue ? true : false; 00538 }; 00541 operator int() const { 00542 return ((int)(value)); 00543 }; 00546 operator bool() const { 00547 return value; 00548 }; 00549 00550 }; 00564 DPUBLICCLASS GitReal : public Git { 00565 private: 00566 double value; 00567 00568 protected: 00577 virtual const double * Range() { return 0; }; 00578 public: 00583 GitReal(const double def = 0.0) { /* Basic constructor */ 00584 value = def; 00585 } 00596 GitReal ( /*Constructor with automatic Get */ 00597 const SdsId& Id, 00598 const char * const Name, 00599 const int Position, 00600 StatusType * const status, 00601 const double Default = 0.0, 00602 const int Flags = 0) 00603 { 00604 value = 0.0; 00605 Get(Id,Name,Position,status,Default,Flags); 00606 } 00609 virtual ~GitReal() {}; /* Destructor for inheritors */ 00624 virtual void Get( /* Get value from Sds structure */ 00625 const SdsId& Id, 00626 const char * const Name, 00627 const int Position, 00628 StatusType * const status, 00629 const double Default = 0.0, 00630 const int Flags = 0) 00631 { 00632 GitArgGetD((SdsIdType)Id,Name,Position,Range(),Default, 00633 Flags,&value,status); 00634 }; 00637 operator double() const { 00638 return (value); 00639 }; 00642 operator float() const { 00643 return (value); 00644 }; 00645 00646 }; 00647 00660 DPUBLICCLASS GitInt : public Git { 00661 private: 00662 long int value; 00663 00664 protected: 00673 virtual const long int * Range() { return 0; }; 00674 public: 00679 GitInt(const long int def = 0) { /* Basic constructor */ 00680 value = def; 00681 } 00692 GitInt ( /*Constructor with automatic Get */ 00693 const SdsId& Id, 00694 const char * const Name, 00695 const int Position, 00696 StatusType * const status, 00697 const long int Default = 0, 00698 const int Flags = 0) 00699 { 00700 value = 0; 00701 Get(Id,Name,Position,status,Default,Flags); 00702 } 00705 virtual ~GitInt() {}; /* Destructor for inheritors */ 00720 virtual void Get( /* Get value from Sds structure */ 00721 const SdsId& Id, 00722 const char * const Name, 00723 const int Position, 00724 StatusType * const status, 00725 const long int Default = 0, 00726 const int Flags = 0) 00727 { 00728 GitArgGetI((SdsIdType)Id,Name,Position,Range(),Default, 00729 Flags,&value,status); 00730 }; 00732 operator long int() const { 00733 return (value); 00734 }; 00735 00736 }; 00737 00738 #endif 00739 #endif 00740
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
1.2.18