Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

chopws.h

Go to the documentation of this file.
00001 #ifndef CHOPWS_H
00002 #define CHOPWS_H
00003 /****************************************************************************
00004 * E.S.O. - VLT project
00005 *
00006 * "@(#) $Id: chopws.h,v 1.63 2003/11/12 09:04:00 vltsccm Exp $"
00007 *
00008 * who       when      what
00009 * --------  --------  -----------------------------------------------------
00010 * rkarban   14/05/97  created
00011 */
00012 
00013 /****************************************************************************
00014  * Common service routines.
00015  *---------------------------------------------------------------------------
00016  */
00017 
00018 #ifndef __cplusplus
00019 #error This is a C++ include file and cannot be used from plain C
00020 #endif
00021 
00022 #include <ECCS.h>
00023 #include <eccsTestTools.h>
00024 #include <fndOBJECT.h>
00025 #include <fndSTRING.h>
00026 #include <evhCALLBACK.h>
00027 #include <evhTASK.h>
00028 #include <eccsDB_ATTR.h>
00029 
00030 #include "chopwsDefines.h"
00031 #include "chopwsErrors.h"
00032 
00033 /*
00034  * Macro to free an object and invalidate its pointer
00035  */
00036 #define DELETE_OBJECT(object) do                        \
00037                                   {                     \
00038                                   if (object != NULL)   \
00039                                       {                 \
00040                                       delete object;    \
00041                                       object = NULL;    \
00042                                       }                 \
00043                                   } while (0)
00044 
00045 /*
00046  * Macros to read from and write to the database
00047  */
00048 #define DB_READ(var,type,attrName)                                   \
00049     do                                                               \
00050   {                                                            \
00051         eccsDB_##type attrName##Attr(dbPoint, attrName);             \
00052   var = attrName##Attr;                                        \
00053   if (attrName##Attr.ErrStatus() == FAILURE)                   \
00054             {                                                        \
00055             ErrAdd(chopwsMOD, chopwsERR_DB_READ, __FILE_LINE__,        \
00056                    "configuration parameter", dbPoint, attrName);    \
00057             return FAILURE;                                          \
00058             }                                                        \
00059       } while (0)
00060 
00061 #define DB_READ_STRING(var,attrName)                                 \
00062     do                                                               \
00063   {                                                            \
00064         eccsDB_STRING attrName##Attr(dbPoint, attrName);             \
00065   strcpy(var, (const char *)attrName##Attr);                   \
00066   if (attrName##Attr.ErrStatus() == FAILURE)                   \
00067             {                                                        \
00068             ErrAdd(chopwsMOD, chopwsERR_DB_READ, __FILE_LINE__,        \
00069                    "configuration parameter", dbPoint, attrName);    \
00070             return FAILURE;                                          \
00071             }                                                        \
00072       } while (0)
00073 
00074 #define DB_WRITE(value,type,attrName)                                \
00075     do                                                               \
00076   {                                                            \
00077         eccsDB_##type attrName##Attr(dbPoint, attrName);             \
00078   attrName##Attr = value;                                      \
00079   if (attrName##Attr.ErrStatus() == FAILURE)                   \
00080             {                                                        \
00081             ErrAdd(chopwsMOD, chopwsERR_DB_WRITE, __FILE_LINE__,       \
00082                    "status parameter", dbPoint, attrName);           \
00083             return FAILURE;                                          \
00084             }                                                        \
00085       } while (0)
00086 
00087 
00088 /* 
00089  * Prototypes
00090  */
00091 vltLOGICAL objectOk(eccsERROR_CLASS *object, const char *name);
00092 ccsCOMPL_STAT freq2Interval (vltDOUBLE freq, ccsTIMEVAL *interval);
00093 
00094 #endif // !CHOPWS_H

Generated on Wed Dec 3 14:52:12 2003 for ATCS API by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001