fors_paf.h

00001 /* $Id: fors_paf.h,v 1.2 2010/09/14 07:49:30 cizzo Exp $
00002  *
00003  * This file is part of the FORS Library
00004  * Copyright (C) 2002-2010 European Southern Observatory
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00019  */
00020 
00021 /*
00022  * $Author: cizzo $
00023  * $Date: 2010/09/14 07:49:30 $
00024  * $Revision: 1.2 $
00025  * $Name: fors-4_8_6 $
00026  */
00027  
00028 #ifndef FORS_PAF_H
00029 #define FORS_PAF_H
00030 
00031 #include <sys/types.h>
00032 
00033 #include <cpl.h>
00034 
00035 
00036 CPL_BEGIN_DECLS
00037 
00038 /*
00039  * Maximum length of a parameter file record, i.e. maximum number of
00040  * characters per line of a parameter file on disk. This does not include
00041  * a trailing 0.
00042  */
00043 
00044 #define PAF_RECORD_MAX  (256)
00045 
00046 
00047 /*
00048  * PAF value types
00049  */
00050 
00051 enum _FORS_PAF_TYPE_ {
00052     PAF_TYPE_NONE,
00053     PAF_TYPE_BOOL,
00054     PAF_TYPE_INT,
00055     PAF_TYPE_DOUBLE,
00056     PAF_TYPE_STRING
00057 };
00058 
00059 typedef enum _FORS_PAF_TYPE_ ForsPAFType;
00060 
00061 /*
00062  * PAF object
00063  */
00064 
00065 typedef struct _FORS_PAF_ ForsPAF;
00066 
00067 /*
00068  * Create, copy and destroy operations
00069  */
00070 
00071 ForsPAF *newForsPAF(const char *, const char *, const char *,
00072                           const char *);
00073 void deleteForsPAF(ForsPAF *);
00074 
00075 /*
00076  * Nonmodifying operations
00077  */
00078 
00079 int forsPAFIsEmpty(const ForsPAF *);
00080 size_t forsPAFGetSize(const ForsPAF *);
00081 int forsPAFContains(const ForsPAF *, const char *);
00082 size_t forsPAFCount(const ForsPAF *, const char *);
00083 
00084 /*
00085  * Header operations
00086  */
00087 
00088 ForsPAFType forsPAFType(const ForsPAF *, const char *);
00089 
00090 const char *forsPAFGetName(const ForsPAF *);
00091 const char *forsPAFGetTag(const ForsPAF *);
00092 const char *forsPAFGetId(const ForsPAF *);
00093 const char *forsPAFGetDescription(const ForsPAF *);
00094 
00095 int forsPAFSetName(ForsPAF *, const char *);
00096 int forsPAFSetTag(ForsPAF *, const char *);
00097 int forsPAFSetId(ForsPAF *, const char *);
00098 int forsPAFSetDescription(ForsPAF *, const char *);
00099 
00100 int forsPAFSetHeader(ForsPAF *, const char *, const char *, const char *,
00101                     const char *);
00102 
00103 /*
00104  * Element access
00105  */
00106 
00107 int forsPAFGetValueBool(const ForsPAF *, const char *);
00108 int forsPAFGetValueInt(const ForsPAF *, const char *);
00109 double forsPAFGetValueDouble(const ForsPAF *, const char *);
00110 const char *forsPAFGetValueString(const ForsPAF *, const char *);
00111 const char *forsPAFGetComment(const ForsPAF *, const char *);
00112 
00113 int forsPAFSetValueBool(ForsPAF *, const char *, int);
00114 int forsPAFSetValueInt(ForsPAF *, const char *, int);
00115 int forsPAFSetValueDouble(ForsPAF *, const char *, double);
00116 int forsPAFSetValueString(ForsPAF *, const char *, const char *);
00117 int forsPAFSetComment(ForsPAF *, const char *, const char *);
00118 
00119 /*
00120  * Inserting and removing elements
00121  */
00122 
00123 int forsPAFInsertBool(ForsPAF *, const char *, const char *, int, const char *);
00124 int forsPAFInsertInt(ForsPAF *, const char *, const char *, int, const char *);
00125 int forsPAFInsertDouble(ForsPAF *, const char *, const char *, double,
00126                        const char *);
00127 int forsPAFInsertString(ForsPAF *, const char *, const char *, const char *,
00128                        const char *);
00129 
00130 int forsPAFInsertAfterBool(ForsPAF *, const char *, const char *, int,
00131                           const char *);
00132 int forsPAFInsertAfterInt(ForsPAF *, const char *, const char *, int,
00133                          const char *);
00134 int forsPAFInsertAfterDouble(ForsPAF *, const char *, const char *, double,
00135                             const char *);
00136 int forsPAFInsertAfterString(ForsPAF *, const char *, const char *,
00137                             const char *, const char *);
00138 
00139 int forsPAFPrependBool(ForsPAF *, const char *, int, const char *);
00140 int forsPAFPrependInt(ForsPAF *, const char *, int, const char *);
00141 int forsPAFPrependDouble(ForsPAF *, const char *, double, const char *);
00142 int forsPAFPrependString(ForsPAF *, const char *, const char *, const char *);
00143 
00144 int forsPAFAppendBool(ForsPAF *, const char *, int, const char *);
00145 int forsPAFAppendInt(ForsPAF *, const char *, int, const char *);
00146 int forsPAFAppendDouble(ForsPAF *, const char *, double, const char *);
00147 int forsPAFAppendString(ForsPAF *, const char *, const char *, const char *);
00148 
00149 void forsPAFErase(ForsPAF *, const char *);
00150 void forsPAFClear(ForsPAF *);
00151 
00152 /*
00153  * Read and write operations
00154  */
00155 
00156 int forsPAFWrite(ForsPAF *);
00157 
00158 /*
00159  * Miscellaneous utilities
00160  */
00161 
00162 int forsPAFIsValidName(const char *);
00163 
00164 CPL_END_DECLS
00165 
00166 #endif /* FORS_PAF_H */

Generated on Fri Mar 4 09:46:00 2011 for FORS Pipeline Reference Manual by  doxygen 1.4.7