Main Page   Namespace List   Compound List   File List   Compound Members   File Members  

copyOf-ocsReadWriteTools.hh

Go to the documentation of this file.
00001 // $Id: ocsReadWriteTools.hh,v 1.9 2002/04/29 20:18:33 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 
00015 #ifndef _OCS_READ_WRITE_TOOLS_HH_ 
00016 #define _OCS_READ_WRITE_TOOLS_HH_
00017 
00018 #ifndef _OCS_READ_WRITE_ENUMERATORS_ //garding the file from being 
00019 #define _OCS_READ_WRITE_ENUMERATORS_ //redefined
00020 
00021 enum BoundsFlagEnumerator { LOWER_ONLY = 1, UPPER_ONLY = 2, 
00022                             LOWER_AND_UPPER = 3, NO_BOUNDS = 4};
00023 
00024 
00025 enum InputParameterOptionsEnumerator { MANDATORY = 1, OPTIONAL_WARNING = 2,
00026                                        OPTIONAL_NO_WARNING = 3};
00027 
00028 
00029 #endif // _OCS_READ_WRITE_ENUMERATORS_
00030 
00031 #ifndef _OCS_TYPE_SIMULATION_ //garding the file from being redefined
00032 #define _OCS_TYPE_SIMULATION_
00033 
00034 enum typeSimulation { SCALAR = 1, VECTOR = 2 };
00035 
00036 #endif //_OCS_TYPE_SIMULATION_
00037 
00038 #ifndef _OCS_SYSTEM_HDRS_ //garding the file from being redefined
00039 #define _OCS_SYSTEM_HDRS_
00040 
00041 #include <iostream.h>
00042 #include <string.h>
00043 #include <math.h> 
00044 #include <fstream.h>
00045 #include <complex.h>
00046 #include <stdlib.h>
00047 #include <stdio.h>
00048 #include <strstream>
00049 
00050 #include <string>
00051   using namespace std;
00052 
00053 
00054 
00055 #endif // _OCS_SYSTEM_HDRS_
00056 
00057 #include "ocsConst.hh"
00058 #include "ocsReducedModelTools.hh"
00059 
00060 
00061 
00062 
00063 // The first two functions added by JZ May 4th 2001.
00064 // They improve on the functions discussed below in that 
00065 // they allow a default value to be specified.
00066 
00067 
00068 // ## The next five functions were added on March 1st, 2001 by JZ.
00069 // ## They allow the user to specify whether the parameter being read
00070 // ## is mandatory or optional.
00071 
00072 // ## The reason for doing this is to allow new parameters to be added
00073 // ## to the class and only add them to the input files if the user
00074 // ## will be using these parameters in his/her application.
00075  
00076 // ## If InputParameterOption ==  MANDATORY
00077 // ##  and the parameter is not
00078 // ## present in the .in file then the code will abort.
00079 
00080 // ## If InputParameterOption == OPTIONAL_WARNING then the if the 
00081 // ## parameter is not present the code will not abort but will
00082 // ## output a warning message. 
00083 
00084 // ## If InputParameterOption == OPTIONAL_NO_WARNING then 
00085 // ## the code will not abort but will not
00086 // ## output a warning message. It is recommended that this option
00087 // ## be only  used when reading in an array of parameters.
00088 
00089 // ## Over time the other versions of these functions (see below) 
00090 // ## will be phased out.
00091 
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 
00129 long ReadLongInt(string ParameterName, string UnitsString,
00130             int LowerBound,int UpperBound,
00131             BoundsFlagEnumerator BoundsFlag, 
00132             InputParameterOptionsEnumerator InputParameterOption,
00133             long DefaultValue,
00134             ifstream * InFile); 
00135 
00136 
00172 double ReadDouble(string ParameterName, string UnitsString,
00173             double LowerBound, double UpperBound,
00174             BoundsFlagEnumerator BoundsFlag, 
00175             InputParameterOptionsEnumerator InputParameterOption,
00176             double DefaultValue,
00177             ifstream * InFile); 
00178 
00179 
00180 string ReadString(string ParameterName, 
00181                   InputParameterOptionsEnumerator InputParameterOption,
00182                   string DefaultValue,
00183                   ifstream * InFile);
00184 
00185 
00186 //#######
00187 
00188 int ReadInt(string ParameterName, string UnitsString,
00189             int LowerBound,int UpperBound,
00190             BoundsFlagEnumerator BoundsFlag, 
00191             InputParameterOptionsEnumerator InputParameterOption,
00192             ifstream * InFile); 
00193 
00194 long ReadLongInt(string ParameterName, string UnitsString,
00195             int LowerBound,int UpperBound,
00196             BoundsFlagEnumerator BoundsFlag, 
00197             InputParameterOptionsEnumerator InputParameterOption,
00198             ifstream * InFile); 
00199 
00200 
00201 
00202 double ReadDouble(string ParameterName, string UnitsString,
00203             double LowerBound, double UpperBound,
00204             BoundsFlagEnumerator BoundsFlag, 
00205             InputParameterOptionsEnumerator InputParameterOption,
00206             ifstream * InFile); 
00207 
00208 string ReadString(string ParameterName, 
00209                   InputParameterOptionsEnumerator InputParameterOption,
00210                   ifstream * InFile);
00211 
00212 
00213 
00214 
00215 void MissingParameter(string ParameterName,
00216                       InputParameterOptionsEnumerator InputParameterOption);
00217 
00218 
00219 // ########## Older versions of Read parameter functions, still very
00220 // ########## much in use in the code 
00221 
00222 
00223 
00224 
00225 int ReadInt(string ParameterName, string UnitsString,
00226             int LowerBound,int UpperBound,
00227             BoundsFlagEnumerator BoundsFlag, ifstream * InFile); 
00228 
00229 long ReadLongInt(string ParameterName, string UnitsString,
00230             long LowerBound, long UpperBound,
00231             BoundsFlagEnumerator BoundsFlag, ifstream * InFile); 
00232 
00233 
00234 
00235 double ReadDouble(string ParameterName, string UnitsString,
00236             double LowerBound, double UpperBound,
00237             BoundsFlagEnumerator BoundsFlag, ifstream * InFile); 
00238 
00239 string ReadString(string ParameterName, ifstream * InFile);
00240 
00241 
00242 
00243 void cerror(char * msg);
00244 
00245 
00246 void LogFileSeparator();
00247 
00248 
00249 void LogFileStars();
00250 
00251 
00252 void LogFileAbortWithErrorMsg(string ErrorMsg);
00253 
00254 
00255 
00256 string WriteTypeSimulation(typeSimulation TypeSimulation);
00257 
00258 #endif // OCS_READ_WRITE_TOOLS_HH_

Generated at Mon Jun 9 20:08:10 2003 for OCS by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000