11 #ifndef __BINARYSTREAM_H__
12 #define __BINARYSTREAM_H__
86 fd = fopen(fname, flag);
91 if (stat(fname, &sb) == -1)
169 if (fseek(
fd, ((
long)
sizeof(T))*((
long) index), SEEK_SET) != 0)
170 SG_ERROR(
"Error seeking to %ld (file '%s')\n",
sizeof(T)*((int64_t) index),
m_fname)
172 if ( fread(buffer,
sizeof(T), num,
fd) != num)
183 if ( fread(&ptr,
sizeof(T), 1,
fd) != 1)
185 fprintf(stderr,
"Error calling fread (file '%s')\n",
m_fname);
199 if (fseek(
fd, ((
long)
sizeof(T))*((
long) index), SEEK_SET) != 0)
200 SG_ERROR(
"Error seeking to %ld (file '%s')\n",
sizeof(T)*((int64_t) index),
m_fname)
204 if ( fread(&ptr,
sizeof(T), 1,
fd) != 1)
211 virtual const char*
get_name()
const {
return "BinaryStream"; }
224 #endif // BINARY_STREAM
CBinaryStream(const char *fname, const char *flag="r")
char * get_line(uint64_t &len, uint64_t &offs)
#define SG_NOTIMPLEMENTED
void open_stream(const char *fname, const char *flag="r")
Class SGObject is the base class of all shogun objects.
T operator[](int32_t index) const
memory mapped emulation via binary streams (files)
all of classes and functions are contained in the shogun namespace
CBinaryStream(const CBinaryStream &bs)
void pre_buffer(T *buffer, long index, long num) const
virtual const char * get_name() const