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

Git.h
1 /*
2  * Name: filter.m4
3  *
4  * Description:
5  * DOXYGEN Input file filter for DRAMA source files.
6  *
7  * This file must be complatible with both Solaris and GNU m4. All
8  * unused macros are deleted and this comment must end up as a C/C++
9  * compatible comment which is not picked up by DOXYGEN.
10  *
11  * Synopsis:
12  * DCF(func) => Produces a link to a DRAMA C source file func.html
13  * in ../routines.
14  * DDL(link,text) => Produce a link to ../link.html, specified link text.
15  *
16  * Language: m4 macro.
17  *
18  * Author: Tony Farrell, AAO.
19  *
20  * "@(#) $Id: ACMM:DramaHtml/filter.m4,v 3.29+ 02-May-2014 10:40:01+10 tjf $"
21  *
22  * History:
23  * 10-Nov-2004 - TJF - Original Version.
24  */
25 
26 
27 
28 #ifndef GITINC
29 #define GITINC
30 /*
31  * Copyright (c) Anglo-Australian Telescope Board, 1995.
32  * Not to be used for commercial purposes without AATB permission.
33  *
34  * @(#) $Id: ACMM:DramaGit/Git.h,v 3.71 24-Mar-2015 09:39:09+11 tjf $
35  *
36  * This file now uses DOXYGEN comments to generate the C++ web pages.
37  * m4 macros of the form @htmlonly <a href="../routines/function.html">function()</a>@endhtmlonly are used in the comments
38  * to refer to DRAMA C function documention (see DramaHtml/Makefile,
39  * DramaHtml/doxygen.config and DramaHtml/filter.m4 for detials)
40  *
41 
42 
43  */
44 #ifdef GIT_MODULE
45 #define DNOCONST 0
46 #endif
47 /*
48  * Include file for Git module
49  */
50 
51 #include "DitsTypes.h" /* For DitsActionHandlerType and drama.h */
52 #include "sds.h" /* For SdsIdType */
53 #include "DitsSys.h"
54 #include "dul.h" /* */
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 /*
59  * Simulation levels, taken from GIT_SPEC. Note GIT_SIM_NONE should be zero.
60  */
61 typedef enum { GIT_SIM_NONE=0, GIT_SIM_BASIC, GIT_SIM_COMMANDS,
62  GIT_SIM_STATUS, GIT_SIM_FULL } GitSimulationType;
63 
64 typedef enum { GIT_MON_START, GIT_MON_FORWARD, GIT_MON_ADD,
65  GIT_MON_DELETE, GIT_MON_CANCEL } GitMonitorMsgType;
66 
69 typedef struct {
70  const char * GitTrue;
71  const char * GitFalse;
73 
74 
75 #define GIT_M_SIM_BASIC 1
76 #define GIT_M_SIM_COMMANDS 2
77 #define GIT_M_SIM_STATUS 4
78 
79 #define GIT_M_SIM_ALLLEVELS -1 /* The way this was traditionally done */
80 
81 #define GIT_M_ARG_UPPER 1
82 #define GIT_M_ARG_LOWER 2
83 #define GIT_M_ARG_KEEPERR 4
84 #define GIT_M_ARG_ABBREV 8
85 #define GIT_M_ARG_LASTBIT 0x10
86 
87 #define GIT_ARG_LMAX 10
88 
89 #ifdef DPROTOTYPES_OK
90  DPUBLIC DVOID GitActivate (
91  DCONSTV SdsIdType parsysid,
92  StatusType *status);
93  DPUBLIC int GitSimulation (
94  DCONSTV char * DCONSTR exName,
95  DCONSTV int levels,
96  GitSimulationType * DCONSTR simulation,
97  float * DCONSTR timebase,
98  StatusType * DCONSTR status);
99 
100  DPUBLIC DVOID GitParEnvGetS(
101  DCONSTV char * DCONSTR pName,
102  DCONSTV char * DCONSTR eName,
103  DCONSTV char * DCONSTR badVal,
104  DCONSTV char * DCONSTR defVal,
105  DCONSTV int actValLen,
106  char * DCONSTR actVal,
107  StatusType * DCONSTR status);
108  DPUBLIC int GitEnvGetS(
109  DCONSTV char * name,
110  DCONSTV int valLen,
111  char *val,
112  StatusType *status);
113  DPUBLIC DVOID GitArgGetS (
114  DCONSTV SdsIdType id,
115  DCONSTV char * name,
116  DCONSTV int position,
117  DCONSTV char *values[],
118  DCONSTV char *defVal,
119  DCONSTV int flags,
120  DCONSTV int actValLen ,
121  char * actValue,
122  int *index,
123  StatusType * status);
124  DPUBLIC DVOID GitArgGetI (
125  DCONSTV SdsIdType id,
126  DCONSTV char *name,
127  DCONSTV int position,
128  DCONSTV long int range[],
129  DCONSTV long int defVal,
130  DCONSTV int flags,
131  long int * actValue,
132  StatusType *status);
133 
134  DPUBLIC DVOID GitArgGetD (
135  DCONSTV SdsIdType id,
136  DCONSTV char *name,
137  DCONSTV int position,
138  DCONSTV double range[],
139  DCONSTV double defVal,
140  DCONSTV int flags,
141  double * actValue,
142  StatusType *status);
143 
144  DPUBLIC DVOID GitArgGetL (
145  DCONSTV SdsIdType id,
146  DCONSTV char *name,
147  DCONSTV int position,
148  DCONSTV GitLogStrType strings[],
149  DCONSTV long int defVal,
150  DCONSTV int flags,
151  long int * actValue,
152  StatusType *status);
153 
154  DPUBLIC DVOID GitArgNamePos (
155  DCONSTV SdsIdType id,
156  DCONSTV char *name,
157  DCONSTV int position,
158  SdsIdType *argid,
159  StatusType *status);
160  DPUBLIC DVOID GitPathGetInit(
161  DCONSTV char * DCONSTV name,
162  int MessageBytes,
163  int MaxMessages,
164  int ReplyBytes,
165  int MaxReplies,
166  int timeout,
167  DitsActionRoutineType handler,
168  DVOIDP client_data,
169  StatusType *status);
170  DPUBLIC DVOID GitPathGetComp(
171  DitsPathType *path,
172  DVOIDP * client_data,
173  StatusType *status);
174 
175 
176  DPUBLIC DVOID GitTpiInit (StatusType *status);
177  DPUBLIC DVOID GitTpiPut (
178  DCONSTV int key,
179  DVOIDP item,
180  StatusType *status);
181  DPUBLIC DVOID GitTpiGet (
182  DCONSTV int key,
183  DVOIDP * item,
184  StatusType *status);
185  DPUBLIC DVOID GitTpiDelete (
186  DCONSTV int key,
187  StatusType *status);
188 
189  DPUBLIC DVOID GitArgGetStruct (
190  DCONSTV SdsIdType id,
191  DCONSTV char *name,
192  DCONSTV int position,
193  DCONSTV char *defVal,
194  int actNameLen,
195  char * actName,
196  SdsIdType * actValue,
197  StatusType *status);
198 
199  DPUBLIC DVOID GitPutDelay(
200  double delay,
201  StatusType *status);
202  DPUBLIC DVOID GitPutDelayPar(
203  DCONSTV char * parameter,
204  StatusType *status);
205 
206 
207  DPUBLIC DVOID GitTimer(StatusType *status);
208  DPUBLIC DVOID GitTimerArgExtract(DVOIDP ClientData, const SdsIdType InArg,
209  SdsIdType * DCONSTR OutArg,
210  StatusType * DCONSTR status);
211 
212 
213  typedef DVOID (*GitMonitorStartedType)(int id,
214  DVOIDP client_data,
215  StatusType *status);
216  typedef DVOID (*GitMonitorChangedType)(
217  char * name,
218  SdsCodeType type,
219  DVOIDP value,
220  DVOIDP client_data,
221  StatusType *status);
222  typedef DVOID (*GitMonitorResponseType)(
223  DVOIDP client_data,
224  StatusType *status);
225 
226  typedef DVOID (*GitTimerArgRoutineType)(
227  DVOIDP ClientData,
228  SdsIdType InArg, SdsIdType *OutArg,
229  StatusType *status);
230 
231 #else
232  DPUBLIC DVOID GitActivate ();
233  DPUBLIC int GitSimulation ();
234  DPUBLIC DVOID GitParEnvGetS();
235  DPUBLIC int GitEnvGetS();
236  DPUBLIC DVOID GitArgGetS ();
237  DPUBLIC DVOID GitArgGetI ();
238  DPUBLIC DVOID GitArgGetD ();
239  DPUBLIC DVOID GitArgGetD ();
240  DPUBLIC DVOID GitArgGetL ();
241  DPUBLIC DVOID GitArgNamePos ();
242  DPUBLIC DVOID GitPathGetInit();
243  DPUBLIC DVOID GitPathGetComp();
244  DPUBLIC DVOID GitTpiInit ();
245  DPUBLIC DVOID GitTpiAdd ();
246  DPUBLIC DVOID GitTpiGet ();
247  DPUBLIC DVOID GitTpiPut ();
248  DPUBLIC DVOID GitTpiDelete ();
249  DPUBLIC DVOID GitArgGetStruct();
250  DPUBLIC DVOID GitPutDelay();
251  DPUBLIC DVOID GitPutDelayPar();
252  DPUBLIC DVOID GitTimer(StatusType *status);
253  DPUBLIC DVOID GitTimerArgExtract();
254 
255  typedef DVOID (*GitMonitorStartedType)();
256  typedef DVOID (*GitMonitorChangedType)();
257  typedef DVOID (*GitMonitorResponseType)();
258  typedef DVOID (*GitTimerArgRoutineType)();
259 
260 #endif
261 
262 /*
263  * Can only define these prototypes in gitmonitor.c if stdarg.h is available.
264  */
265 
266 #if (!defined(GITMONITORC) || defined(DSTDARG_OK)) && defined(DPROTOTYPES_OK)
267  DPUBLIC DVOID GitMonitorStart(
268  DitsPathType path,
269  GitMonitorStartedType Started,
270  GitMonitorChangedType Changed,
271  GitMonitorResponseType Completed,
272  GitMonitorResponseType Unexpected,
273  DVOIDP client_data,
274  int count,
275  StatusType *status, ...);
276  DPUBLIC DVOID GitMonitorStartF(
277  DitsPathType path,
278  int Flags,
279  GitMonitorStartedType Started,
280  GitMonitorChangedType Changed,
281  GitMonitorResponseType Completed,
282  GitMonitorResponseType Unexpected,
283  DVOIDP client_data,
284  int count,
285  StatusType *status, ...);
286  DPUBLIC DVOID GitMonitorForward(
287  DitsPathType path,
288  DCONSTV char * task,
289  DCONSTV char * action,
290  GitMonitorStartedType Started,
291  GitMonitorResponseType Completed,
292  GitMonitorResponseType Unexpected,
293  DVOIDP client_data,
294  int count,
295  StatusType *status, ...);
296 
297  DPUBLIC DVOID GitMonitorMessage(
298  int id,
299  DitsPathType path,
300  GitMonitorMsgType type,
301  int count,
302  DitsTransIdType * transid,
303  StatusType *status,...);
304 
305 #elif !defined(GITMONITORC)
306  DPUBLIC DVOID GitMonitorStart();
307  DPUBLIC DVOID GitMonitorStartF();
308  DPUBLIC DVOID GitMonitorForward();
309  DPUBLIC DVOID GitMonitorChange();
310 #endif
311 
312 
313 /*
314  * Structures used by GitTimer.
315  */
316 typedef struct {
317  char ActionName[DITS_C_NAMELEN];
318  GitTimerArgRoutineType ArgCreateRoutine;
319  DVOIDP ClientData;
320  SdsIdType Arg; /* Argument for this action */
321 
322  /* Info private to GitTimer follows */
323  DitsGsokMessageType _Message; /* Message to send */
325 
326 typedef struct {
327  char TaskName[DITS_C_NAMELEN]; /* Task involved */
328  int SeqCount; /* Number of elements in Sequence */
329  GitTimerDetailsType *SequenceDetails; /* Sequence definitons */
330  DitsPathInfoType Buffers; /* Message buffer sizes */
331  /* Info private to GitTimer follows */
332  int _Current; /* Current in sequence */
333  long _Count; /* Number of repeats to do */
334  int _Done; /* Number of repeats done; */
335  DitsPathType _Path; /* Path to task involved */
336  IMP_AbsTime _StartTime; /* Start time */
337  } GitTimerType;
338 
339 
340 #ifdef __cplusplus
341 } /* extern "C" */
342 /*
343  * C++ only section
344  *
345  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
346  *
347  * Here is a C++ interface to Git.
348  *
349  * First, A Class which defines flags used in the rest of this module.
350  */
351 #include "arg.h"
352 
361 DPUBLICCLASS Git {
362  public:
363  enum {
364  Upper=GIT_M_ARG_UPPER,
365  Lower=GIT_M_ARG_UPPER,
366  KeepErr=GIT_M_ARG_KEEPERR,
367  Abbrev = GIT_M_ARG_ABBREV,
368  LastBit=GIT_M_ARG_LASTBIT
373  };
374 };
375 
389 DPUBLICCLASS GitEnum : public Git {
390  protected:
399  virtual void SetValue(const unsigned int) = 0;
411  virtual const char * const * Lookup() = 0;
412  public:
415  virtual ~GitEnum() {};
430  void Get(const SdsId& Id,
431  const char * const Name,
432  const int Position,
433  StatusType *status,
434  const char *Default=0,
435  const int Flags = Git::Upper|Git::Abbrev)
436  {
437  char string[100];
438  int index;
439  GitArgGetS((SdsIdType)Id,Name,Position,(const char **)Lookup(),
440  Default,
441  Flags,sizeof(string),string,&index,status);
442  SetValue(index);
443  };
444 
445 };
464 DPUBLICCLASS GitBool : public Git {
465  private:
466  bool value;
467  static const GitLogStrType lookupTable[];
468  protected:
480  virtual const GitLogStrType * Lookup() {
481  return lookupTable;
482  }
483  public:
488  value = false;
489  }
500  GitBool ( /*Constructor with automatic Get */
501  const SdsId& Id,
502  const char * const Name,
503  const int Position,
504  StatusType * const status,
505  const bool Default = false,
506  const int Flags = (Git::Upper|Git::Abbrev))
507  {
508  value = false;
509  Get(Id,Name,Position,status,Default,Flags);
510  }
513  virtual ~GitBool() {}; /* Destructor for inheritors */
528  virtual void Get( /* Get value from Sds structure */
529  const SdsId& Id,
530  const char * const Name,
531  const int Position,
532  StatusType * const status,
533  const bool Default = false,
534  const int Flags = (Git::Upper|Git::Abbrev))
535  {
536  long int actValue;
537  GitArgGetL((SdsIdType)Id,Name,Position,Lookup(),Default,
538  Flags,&actValue,status);
539  value = actValue ? true : false;
540  };
543  operator int() const {
544  return ((int)(value));
545  };
548  operator bool() const {
549  return value;
550  };
551 
552 };
566 DPUBLICCLASS GitReal : public Git {
567  private:
568  double value;
569 
570  protected:
579  virtual const double * Range() { return 0; };
580  public:
585  GitReal(const double def = 0.0) { /* Basic constructor */
586  value = def;
587  }
598  GitReal ( /*Constructor with automatic Get */
599  const SdsId& Id,
600  const char * const Name,
601  const int Position,
602  StatusType * const status,
603  const double Default = 0.0,
604  const int Flags = 0)
605  {
606  value = 0.0;
607  Get(Id,Name,Position,status,Default,Flags);
608  }
611  virtual ~GitReal() {}; /* Destructor for inheritors */
626  virtual void Get( /* Get value from Sds structure */
627  const SdsId& Id,
628  const char * const Name,
629  const int Position,
630  StatusType * const status,
631  const double Default = 0.0,
632  const int Flags = 0)
633  {
634  GitArgGetD((SdsIdType)Id,Name,Position,Range(),Default,
635  Flags,&value,status);
636  };
639  operator double() const {
640  return (value);
641  };
644  operator float() const {
645  return (value);
646  };
647 
648 };
649 
662 DPUBLICCLASS GitInt : public Git {
663  private:
664  long int value;
665 
666  protected:
675  virtual const long int * Range() { return 0; };
676  public:
681  GitInt(const long int def = 0) { /* Basic constructor */
682  value = def;
683  }
694  GitInt ( /*Constructor with automatic Get */
695  const SdsId& Id,
696  const char * const Name,
697  const int Position,
698  StatusType * const status,
699  const long int Default = 0,
700  const int Flags = 0)
701  {
702  value = 0;
703  Get(Id,Name,Position,status,Default,Flags);
704  }
707  virtual ~GitInt() {}; /* Destructor for inheritors */
722  virtual void Get( /* Get value from Sds structure */
723  const SdsId& Id,
724  const char * const Name,
725  const int Position,
726  StatusType * const status,
727  const long int Default = 0,
728  const int Flags = 0)
729  {
730  GitArgGetI((SdsIdType)Id,Name,Position,Range(),Default,
731  Flags,&value,status);
732  };
734  operator long int() const {
735  return (value);
736  };
737 
738 };
739 
740 #endif
741 #endif
A class which reads integer values from an SDS argument structure.
Definition: Git.h:662
GitBool(const SdsId &Id, const char *const Name, const int Position, StatusType *const status, const bool Default=false, const int Flags=(Git::Upper|Git::Abbrev))
Constructor with the initial value set from an SDS structure.
Definition: Git.h:500
virtual void Get(const SdsId &Id, const char *const Name, const int Position, StatusType *const status, const double Default=0.0, const int Flags=0)
Get the value of the object from an SDS struture.
Definition: Git.h:626
A class which reads logical values from SDS argument structures.
Definition: Git.h:464
virtual ~GitInt()
Destructor.
Definition: Git.h:707
virtual void Get(const SdsId &Id, const char *const Name, const int Position, StatusType *const status, const long int Default=0, const int Flags=0)
Get the value of the object from an SDS struture.
Definition: Git.h:722
virtual const long int * Range()
Function which returns sets the range.
Definition: Git.h:675
GitReal(const double def=0.0)
Simple constructor with a default value specified.
Definition: Git.h:585
virtual ~GitEnum()
Destructor.
Definition: Git.h:415
void Get(const SdsId &Id, const char *const Name, const int Position, StatusType *status, const char *Default=0, const int Flags=Git::Upper|Git::Abbrev)
Get the value of the object from an SDS struture.
Definition: Git.h:430
Definition: Git.h:316
Allow abbreviations.
Definition: Git.h:367
virtual const double * Range()
Function which returns sets the range.
Definition: Git.h:579
A C++ Interface to the SDS Arg library.
Definition: arg.h:267
A C++ Interface to the handling SDS structures.
Definition: sds.h:709
Definition: Git.h:326
The GitArgGet flags set up appropriately for C++.
Definition: Git.h:361
GitInt(const long int def=0)
Simple constructor with a default value specified.
Definition: Git.h:681
GitBool()
Simple constructor with a default value of false.
Definition: Git.h:487
virtual void Get(const SdsId &Id, const char *const Name, const int Position, StatusType *const status, const bool Default=false, const int Flags=(Git::Upper|Git::Abbrev))
Get the value of the object from an SDS struture.
Definition: Git.h:528
virtual ~GitReal()
Destructor.
Definition: Git.h:611
A class which reads Enumerated values from a SDS argument structures.
Definition: Git.h:389
const char * GitFalse
The string for FALSE.
Definition: Git.h:71
A class which reads real values from an SDS argument structure.
Definition: Git.h:566
Convert strings to upper case.
Definition: Git.h:364
A type used to store true and false string equivalent values.
Definition: Git.h:69
GitInt(const SdsId &Id, const char *const Name, const int Position, StatusType *const status, const long int Default=0, const int Flags=0)
Constructor with the initial value set from an SDS structure.
Definition: Git.h:694
virtual const GitLogStrType * Lookup()
Return a pointer to an array of enum strings equivalents.
Definition: Git.h:480
const char * GitTrue
The string for TRUE.
Definition: Git.h:70
GitReal(const SdsId &Id, const char *const Name, const int Position, StatusType *const status, const double Default=0.0, const int Flags=0)
Constructor with the initial value set from an SDS structure.
Definition: Git.h:598
virtual ~GitBool()
Destructor.
Definition: Git.h:513

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

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

Generated on Mon Feb 22 2016 13:58:31 for AAO DRAMA C++ Interfaces by doxygen 1.8.10