00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _FileStream
00026 #define _FileStream
00027
00028 #include <OPS_Stream.h>
00029
00030 #include <fstream>
00031 using std::ofstream;
00032
00033 class FileStream : public OPS_Stream
00034 {
00035 public:
00036 FileStream(int indentSize=2);
00037 FileStream(const char *fileName, openMode mode = OVERWRITE, int indent=2);
00038 ~FileStream();
00039
00040 int setFile(const char *fileName, openMode mode = OVERWRITE);
00041 int open(void);
00042 int close(void);
00043
00044 int setPrecision(int precision);
00045 int setFloatField(floatField);
00046 int precision(int precision) {return 0;};
00047 int width(int width) {return 0;};
00048 const char *getFileName(void) {return fileName;}
00049
00050
00051 int tag(const char *);
00052 int tag(const char *, const char *);
00053 int endTag();
00054 int attr(const char *name, int value);
00055 int attr(const char *name, double value);
00056 int attr(const char *name, const char *value);
00057 int write(Vector &data);
00058
00059
00060 OPS_Stream& write(const char *s, int n);
00061 OPS_Stream& write(const unsigned char *s, int n);
00062 OPS_Stream& write(const signed char *s, int n);
00063 OPS_Stream& write(const void *s, int n);
00064 OPS_Stream& operator<<(char c);
00065 OPS_Stream& operator<<(unsigned char c);
00066 OPS_Stream& operator<<(signed char c);
00067 OPS_Stream& operator<<(const char *s);
00068 OPS_Stream& operator<<(const unsigned char *s);
00069 OPS_Stream& operator<<(const signed char *s);
00070 OPS_Stream& operator<<(const void *p);
00071 OPS_Stream& operator<<(int n);
00072 OPS_Stream& operator<<(unsigned int n);
00073 OPS_Stream& operator<<(long n);
00074 OPS_Stream& operator<<(unsigned long n);
00075 OPS_Stream& operator<<(short n);
00076 OPS_Stream& operator<<(unsigned short n);
00077 OPS_Stream& operator<<(bool b);
00078 OPS_Stream& operator<<(double n);
00079 OPS_Stream& operator<<(float n);
00080
00081 int sendSelf(int commitTag, Channel &theChannel);
00082 int recvSelf(int commitTag, Channel &theChannel,
00083 FEM_ObjectBroker &theBroker);
00084
00085 private:
00086 ofstream theFile;
00087 int fileOpen;
00088 openMode theOpenMode;
00089 char *fileName;
00090
00091 void indent(void);
00092 int indentSize;
00093 int numIndent;
00094 char *indentString;
00095 };
00096
00097 #endif