• Main Page
  • Related Pages
  • Classes
  • Files
  • File List
  • File Members

ocsReadWriteTools.hh

Go to the documentation of this file.
00001 // $Id: ocsReadWriteTools.hh,v 1.2 2005/07/06 16:45:54 zweck Exp $
00002 
00003 //###################################################################
00004 //
00005 //           Optical Communication Systems Simulator
00006 //
00007 //       Copyright (2000):
00008 //       Optical Fiber Communications Laboratory (OFCL)
00009 //       Computer Science & Electrical Engineering Department (CSEE)
00010 //       University of Maryland Baltimore County (UMBC)
00011 //
00012 //###################################################################
00013 
00014 #ifndef _OCS_READ_WRITE_TOOLS_HH_
00015 #define _OCS_READ_WRITE_TOOLS_HH_
00016 
00017 #ifndef _OCS_READ_WRITE_ENUMERATORS_
00018 #define _OCS_READ_WRITE_ENUMERATORS_
00019 
00020 enum BoundsFlagEnumerator { LOWER_ONLY = 1, UPPER_ONLY = 2, 
00021                             LOWER_AND_UPPER = 3, NO_BOUNDS = 4};
00022 
00023 
00024 enum InputParameterOptionsEnumerator { MANDATORY = 1, OPTIONAL_WARNING = 2,
00025                                        OPTIONAL_NO_WARNING = 3};
00026 
00027 
00028 #endif /* _OCS_READ_WRITE_ENUMERATORS_ */
00029 
00030 #ifndef _OCS_TYPE_SIMULATION_
00031 #define _OCS_TYPE_SIMULATION_
00032 
00033 enum typeSimulation { SCALAR = 1, VECTOR = 2 };
00034 
00035 #endif /*_OCS_TYPE_SIMULATION_ */
00036 
00037 #ifndef _OCS_SYSTEM_HDRS_
00038 #define _OCS_SYSTEM_HDRS_
00039 
00040 #include <iostream.h>
00041 #include <string.h>
00042 #include <math.h> 
00043 #include <fstream.h>
00044 #include <complex.h>
00045 #include <stdlib.h>
00046 #include <stdio.h>
00047 #include <strstream>
00048 
00049 #include <string>
00050   using namespace std;
00051 
00052 
00053 
00054 #endif /* _OCS_SYSTEM_HDRS_ */
00055 
00056 #include "ocsConst.hh"
00057 #include "ocsReducedModelTools.hh"
00058 
00059 
00060 
00061 
00062 // The first two functions added by JZ May 4th 2001.
00063 // They improve on the functions discussed below in that 
00064 // they allow a default value to be specified.
00065 
00066 
00067 // ## The next five functions were added on March 1st, 2001 by JZ.
00068 // ## They allow the user to specify whether the parameter being read
00069 // ## is mandatory or optional.
00070 
00071 // ## The reason for doing this is to allow new parameters to be added
00072 // ## to the class and only add them to the input files if the user
00073 // ## will be using these parameters in his/her application.
00074  
00075 // ## If InputParameterOption ==  MANDATORY
00076 // ##  and the parameter is not
00077 // ## present in the .in file then the code will abort.
00078 
00079 // ## If InputParameterOption == OPTIONAL_WARNING then the if the 
00080 // ## parameter is not present the code will not abort but will
00081 // ## output a warning message. 
00082 
00083 // ## If InputParameterOption == OPTIONAL_NO_WARNING then 
00084 // ## the code will not abort but will not
00085 // ## output a warning message. It is recommended that this option
00086 // ## be only  used when reading in an array of parameters.
00087 
00088 // ## Over time the other versions of these functions (see below) 
00089 // ## will be phased out.
00090 
00091 
00092 int ReadInt(string ParameterName, string UnitsString,
00093             int LowerBound,int UpperBound,
00094             BoundsFlagEnumerator BoundsFlag, 
00095             InputParameterOptionsEnumerator InputParameterOption,
00096             int DefaultValue,
00097             ifstream * InFile, bool DebugLevel); 
00098 
00099 long ReadLongInt(string ParameterName, string UnitsString,
00100             int LowerBound,int UpperBound,
00101             BoundsFlagEnumerator BoundsFlag, 
00102             InputParameterOptionsEnumerator InputParameterOption,
00103             int DefaultValue,
00104             ifstream * InFile, bool DebugLevel); 
00105 
00106 double ReadDouble(string ParameterName, string UnitsString,
00107             double LowerBound, double UpperBound,
00108             BoundsFlagEnumerator BoundsFlag, 
00109             InputParameterOptionsEnumerator InputParameterOption,
00110             double DefaultValue,
00111             ifstream * InFile, bool DebugLevel); 
00112 
00113 string ReadString(string ParameterName, 
00114                   InputParameterOptionsEnumerator InputParameterOption,
00115                   string DefaultValue,
00116                   ifstream * InFile, bool DebugLevel);
00117 
00118 
00119 //#######
00120 
00121 int ReadInt(string ParameterName, string UnitsString,
00122             int LowerBound,int UpperBound,
00123             BoundsFlagEnumerator BoundsFlag, 
00124             InputParameterOptionsEnumerator InputParameterOption,
00125             int DefaultValue,
00126             ifstream * InFile); 
00127 
00128 long ReadLongInt(string ParameterName, string UnitsString,
00129             int LowerBound,int UpperBound,
00130             BoundsFlagEnumerator BoundsFlag, 
00131             InputParameterOptionsEnumerator InputParameterOption,
00132             int DefaultValue,
00133             ifstream * InFile); 
00134 
00135 double ReadDouble(string ParameterName, string UnitsString,
00136             double LowerBound, double UpperBound,
00137             BoundsFlagEnumerator BoundsFlag, 
00138             InputParameterOptionsEnumerator InputParameterOption,
00139             double DefaultValue,
00140             ifstream * InFile); 
00141 
00142 string ReadString(string ParameterName, 
00143                   InputParameterOptionsEnumerator InputParameterOption,
00144                   string DefaultValue,
00145                   ifstream * InFile);
00146 
00147 
00148 //#######
00149 
00150 int ReadInt(string ParameterName, string UnitsString,
00151             int LowerBound,int UpperBound,
00152             BoundsFlagEnumerator BoundsFlag, 
00153             InputParameterOptionsEnumerator InputParameterOption,
00154             ifstream * InFile, bool DebugLevel); 
00155 
00156 long ReadLongInt(string ParameterName, string UnitsString,
00157             int LowerBound,int UpperBound,
00158             BoundsFlagEnumerator BoundsFlag, 
00159             InputParameterOptionsEnumerator InputParameterOption,
00160             ifstream * InFile, bool DebugLevel); 
00161 
00162 double ReadDouble(string ParameterName, string UnitsString,
00163             double LowerBound, double UpperBound,
00164             BoundsFlagEnumerator BoundsFlag, 
00165             InputParameterOptionsEnumerator InputParameterOption,
00166             ifstream * InFile, bool DebugLevel); 
00167 
00168 string ReadString(string ParameterName, 
00169                   InputParameterOptionsEnumerator InputParameterOption,
00170                   ifstream * InFile, bool DebugLevel);
00171 
00172 
00173 void MissingParameter(string ParameterName,
00174                       InputParameterOptionsEnumerator InputParameterOption, 
00175                       bool DebugLevel);
00176 
00177 int ReadInt(string ParameterName, string UnitsString,
00178             int LowerBound,int UpperBound,
00179             BoundsFlagEnumerator BoundsFlag, 
00180             InputParameterOptionsEnumerator InputParameterOption,
00181             ifstream * InFile); 
00182 
00183 long ReadLongInt(string ParameterName, string UnitsString,
00184             int LowerBound,int UpperBound,
00185             BoundsFlagEnumerator BoundsFlag, 
00186             InputParameterOptionsEnumerator InputParameterOption,
00187             ifstream * InFile); 
00188 
00189 double ReadDouble(string ParameterName, string UnitsString,
00190             double LowerBound, double UpperBound,
00191             BoundsFlagEnumerator BoundsFlag, 
00192             InputParameterOptionsEnumerator InputParameterOption,
00193             ifstream * InFile); 
00194 
00195 string ReadString(string ParameterName, 
00196                   InputParameterOptionsEnumerator InputParameterOption,
00197                   ifstream * InFile);
00198 
00199 
00200 void MissingParameter(string ParameterName,
00201                       InputParameterOptionsEnumerator InputParameterOption);
00202 
00203 // ########## Older versions of Read parameter functions, still very
00204 // ########## much in use in the code 
00205 
00206 int ReadInt(string ParameterName, string UnitsString,
00207             int LowerBound,int UpperBound,
00208             BoundsFlagEnumerator BoundsFlag, ifstream * InFile, 
00209             bool DebugLevel); 
00210 
00211 long ReadLongInt(string ParameterName, string UnitsString,
00212             long LowerBound, long UpperBound,
00213                  BoundsFlagEnumerator BoundsFlag, ifstream * InFile,
00214                  bool DebugLevel); 
00215 
00216 
00217 
00218 double ReadDouble(string ParameterName, string UnitsString,
00219             double LowerBound, double UpperBound,
00220             BoundsFlagEnumerator BoundsFlag, ifstream * InFile,
00221                   bool DebugLevel); 
00222 
00223 string ReadString(string ParameterName, ifstream * InFile, 
00224                   bool DebugLevel);
00225 
00226 int ReadInt(string ParameterName, string UnitsString,
00227             int LowerBound,int UpperBound,
00228             BoundsFlagEnumerator BoundsFlag, ifstream * InFile); 
00229 
00230 long ReadLongInt(string ParameterName, string UnitsString,
00231             long LowerBound, long UpperBound,
00232                  BoundsFlagEnumerator BoundsFlag, ifstream * InFile); 
00233 
00234 
00235 
00236 double ReadDouble(string ParameterName, string UnitsString,
00237             double LowerBound, double UpperBound,
00238             BoundsFlagEnumerator BoundsFlag, ifstream * InFile); 
00239 
00240 string ReadString(string ParameterName, ifstream * InFile);
00241 
00242 void cerror(char * msg);
00243 void LogFileSeparator();
00244 void LogFileStars();
00245 void LogFileAbortWithErrorMsg(string ErrorMsg);
00246 
00247 string WriteTypeSimulation(typeSimulation TypeSimulation);
00248 
00249 // added by walter
00250 double* ReadVectorOfDoubles(string ParameterName, string UnitsString,
00251             double LowerBound, double UpperBound,
00252             BoundsFlagEnumerator BoundsFlag, 
00253             InputParameterOptionsEnumerator InputParameterOption,
00254             double DefaultValue,unsigned NumbersOfElements,
00255             ifstream * InFile);
00256 
00257 double* ReadVectorOfDoubles(string ParameterName, string UnitsString,
00258             double LowerBound, double UpperBound,
00259             BoundsFlagEnumerator BoundsFlag, 
00260             InputParameterOptionsEnumerator InputParameterOption,
00261             double DefaultValue, unsigned NumberOfElements,
00262             ifstream * InFile, bool DebugLevel);
00263 void WrongTypeParameter(string ParameterName);
00264 void WrongTypeParameter(string ParameterName, bool DebugLevel);
00265 
00266 unsigned ReadUnsignedInt(string ParameterName, string UnitsString,
00267             unsigned LowerBound,unsigned UpperBound,
00268             BoundsFlagEnumerator BoundsFlag, 
00269             InputParameterOptionsEnumerator InputParameterOption,
00270             unsigned DefaultValue,
00271             ifstream * InFile, bool DebugLevel); 
00272 
00273 unsigned ReadUnsignedInt(string ParameterName, string UnitsString,
00274             unsigned LowerBound,unsigned UpperBound,
00275             BoundsFlagEnumerator BoundsFlag, 
00276             InputParameterOptionsEnumerator InputParameterOption,
00277             unsigned DefaultValue,
00278             ifstream * InFile); 
00279 
00280 
00281 //end added by walter
00282             
00283             
00284 
00285 #endif /* OCS_READ_WRITE_TOOLS_HH_ */

Generated on Fri Jul 2 2010 12:57:47 for OCS by  doxygen 1.7.1