44 std :: vector< char >str;
45 if ( !this->
read(& n, 1) ) {
50 if ( !this->
read(str.data(), n) ) {
54 data = std::string(str.data(), str.size());
60 int n = ( int ) data.size();
62 return this->
write(data.data(), n);
67 filename(
std::move(filename))
70 this->
stream = fopen(this->filename.c_str(), write ?
"wb" :
"rb" );
83 return ( (
int)fread(data,
sizeof(
int ), count,
stream) == count );
90 return ( (
int)fread(data,
sizeof(
unsigned long ), count,
stream) == count );
95 return ( (
int)fread(data,
sizeof(
long ), count,
stream) == count );
100 return ( (
int)fread(data,
sizeof(
double ), count,
stream) == count );
105 return ( (
int)fread(data,
sizeof(
char ), count,
stream) == count );
110 return ( (
int)fread(& data,
sizeof(
bool ), 1,
stream) == 1 );
115 return ( (
int)fwrite(data,
sizeof(
int ), count,
stream) == count );
120 return ( (
int)fwrite(data,
sizeof(
unsigned long ), count,
stream) == count );
125 return ( (
int)fwrite(data,
sizeof(
long ), count,
stream) == count );
130 return ( (
int)fwrite(data,
sizeof(
double ), count,
stream) == count );
135 return ( (
int)fwrite(data,
sizeof(
char ), count,
stream) == count );
140 return ( (
int)fwrite(& data,
sizeof(
bool ), 1,
stream) == 1 );
145 return sizeof(int)*count;
150 return sizeof(double)*count;
155 return sizeof(char)*count;
160 return sizeof(bool)*count;
165 return sizeof(int)*count;
virtual int read(int *data, int count)
Reads count integer values into array pointed by data.
virtual int write(const int *data, int count)
Writes count integer values from array pointed by data.
virtual ~FileDataStream()
Destructor (will not close stream!)
virtual int givePackSizeOfInt(int count)
virtual int read(int *data, int count)=0
Reads count integer values into array pointed by data.
virtual int givePackSizeOfLong(int count)
virtual int write(const int *data, int count)=0
Writes count integer values from array pointed by data.
FileDataStream(std::string filename, bool write)
Constructor, takes associated stream pointer as parameter.
virtual int givePackSizeOfBool(int count)
virtual int givePackSizeOfDouble(int count)
virtual int givePackSizeOfChar(int count)
the oofem namespace is to define a context or scope in which all oofem names are defined.
FILE * stream
FILE pointer of associated stream.