diff --git a/src/shogun/features/RealFileFeatures.cpp b/src/shogun/features/RealFileFeatures.cpp index e798ef6a150..c03e5efdbfd 100644 --- a/src/shogun/features/RealFileFeatures.cpp +++ b/src/shogun/features/RealFileFeatures.cpp @@ -20,44 +20,42 @@ using namespace shogun; CRealFileFeatures::CRealFileFeatures() { SG_UNSTABLE("CRealFileFeatures::CRealFileFeatures()", "\n") - - working_file=NULL; - working_filename=strdup(""); - intlen=0; - doublelen=0; - endian=0; - fourcc=0; - preprocd=0; - labels=NULL; - status=false; + init(); } CRealFileFeatures::CRealFileFeatures(int32_t size, char* fname) : CDenseFeatures(size) { + init(); + working_file=fopen(fname, "r"); working_filename=strdup(fname); ASSERT(working_file) - intlen=0; - doublelen=0; - endian=0; - fourcc=0; - preprocd=0; - labels=NULL; status=load_base_data(); } CRealFileFeatures::CRealFileFeatures(int32_t size, FILE* file) -: CDenseFeatures(size), working_file(file), working_filename(NULL) +: CDenseFeatures(size) { + init(); + ASSERT(working_file) + status=load_base_data(); +} + +void CRealFileFeatures::init() +{ + working_file=NULL; + working_filename=strdup(""); intlen=0; doublelen=0; endian=0; fourcc=0; preprocd=0; labels=NULL; - status=load_base_data(); + status=false; + + unset_generic(); } CRealFileFeatures::~CRealFileFeatures() diff --git a/src/shogun/features/RealFileFeatures.h b/src/shogun/features/RealFileFeatures.h index 88a3c34cf81..b46599d917c 100644 --- a/src/shogun/features/RealFileFeatures.h +++ b/src/shogun/features/RealFileFeatures.h @@ -80,6 +80,10 @@ class CRealFileFeatures: public CDenseFeatures */ bool load_base_data(); + private: + /** initialises members */ + void init(); + protected: /** working file */ FILE* working_file;