00001
00025 #ifndef __FILEFORMAT_H__
00026 #define __FILEFORMAT_H__
00027
00028 #include "annetwork.h"
00029
00030 class ANNFileFormat;
00031
00032 EXCEPTIONCLASS (invalid_filename);
00033
00034
00035
00037
00038
00039
00040
00041
00043
00049 class ANNFileFormatLib {
00050 public:
00051
00056 static ANNetwork* load (const String& filename) throw (file_not_found, invalid_format, assertion_failed);
00057
00062 static void load (const String& filename, ANNetwork& net) throw (file_not_found, invalid_format, assertion_failed, open_failure);
00063
00072 static void load (TextIStream& in, ANNetwork& net, const String& filetype) throw (invalid_format, assertion_failed);
00073
00079 static void save (const String& filename, const ANNetwork& net, const char* fileformat=NULL) throw (invalid_filename, invalid_format, assertion_failed, stream_failure, open_failure);
00080
00086 static void save (TextOStream& out, const ANNetwork& net, const String& filetype) throw (assertion_failed, invalid_filename, stream_failure);
00087
00088 protected:
00093 static ANNFileFormat* create (const String& fileformat) throw (invalid_format);
00094 };
00095
00096
00097
00099
00100
00101
00102
00103
00105
00112 class ANNFileFormat {
00113 public:
00114
00119 virtual void load (TextIStream& in, ANNetwork& net) const=0;
00120 virtual void save (TextOStream& out, const ANNetwork& net) const throw (stream_failure) {MUST_OVERLOAD}
00121
00122 protected:
00123 };
00124
00125 class SNNS_ANNFormat : public ANNFileFormat {
00126 public:
00127 virtual void load (TextIStream& in, ANNetwork& set) const;
00128 virtual void save (TextOStream& out, const ANNetwork& set) const throw (stream_failure);
00129 };
00130
00131
00132 #endif
00133