15a16,17
> 
> //#include "FileException.h"
28c30
< #ifdef _TSB_SERIALIZER_DEBUG
---
> #ifdef _TSB_DEBUG
56c58
< void Serializer::open()
---
> void Serializer::open() throw (IOException)
58c60
< #ifdef _TSB_SERIALIZER_DEBUG
---
> #ifdef _TSB_DEBUG
108c110
<         //delete m_pArchive;
---
> 
110d111
<         //m_pArchive = 0;
112a114
> 
119d120
<     //m_pArchive->write(data, size);
125d125
<     //m_pArchive->read(data, size);
128,561d127
< 
< /*string Serializer::readLabel()
< {
< 	size_t labelLength = 0;
< 	//ifs.read( &labelLength, sizeof( labelLength ) );
<     m_fileStream >> labelLength;
< 	char* tempLabel = new char[ labelLength + 1 ];
< 	memset( tempLabel, '\0', labelLength+1 );
< 	m_fileStream.read( tempLabel, labelLength );
< 	tempLabel[ labelLength ] = '\0';
< 
< 	return tempLabel;
< }*/
< 
< /*
< // write element data to file in binary format
< static void write_element_binary( char* m_dataPath )
< {
< 
< 	// construct filename; SLASH is o/s dependent
< 	char fname[255];
< 	sprintf( fname, "%s%sclass.bin", m_dataPath, SLASH );
< 
< 	// open file for writing
< 	ofstream data_file( fname );
< 
< 	// check for bad file
< 	if ( data_file.bad( ) )
< {
< 		sprintf( fss_io.msgstr, "\n\nERROR: Could not open %s\n\n", fname );
< 		fss_io._exit( fss_io.msgstr, -2 );
< 		return;
< 	}
< 
< 	// write elements data to binary file
< 	sprintf( fss_io.msgstr, "\nWriting %d elements to binary file...", ElementVector.size( ) );
< 	fss_io._print( fss_io.msgstr );
< 	// write number of stands to file
< 	int n = ElementVector.size( );
< 	data_file.write( &n, sizeof( n ) );
< 	for( vector< Element >::iterator evi = ElementVector.begin( ); evi != ElementVector.end( ); ++evi )
< {
< 		(*evi).write_to_binary_file( data_file );
< 	}
< 	sprintf( fss_io.msgstr, "Done" );
< 	fss_io._print( fss_io.msgstr );
< 
< 	// close file
< 	data_file.close( );
< }
< 
< // read binary element data
< static void read_element_binary( char* m_dataPath )
< {
< 
< 	// construct filename; SLASH is o/s dependent
< 	char fname[255];
< 	sprintf( fname, "%s%sclass.bin", m_dataPath, SLASH );
< 
< 	// open file for reading
< 	ifstream data_file( fname );
< 
< 	// check for bad file
< 	if ( data_file.bad( ) )
< {
< 		sprintf( fss_io.msgstr, "\n\nERROR: Could not find/open %s\n\n", fname );
< 		fss_io._exit( fss_io.msgstr, -2 );
< 		return;
< 	}
< 
< 	// read number of elements to be read
< 	int n;
< 	data_file.read( &n, sizeof( n ) );
< 	sprintf( fss_io.msgstr, "\nReading %ld elements from binary file...", n );
< 	fss_io._print( fss_io.msgstr );
< 	for( int i = 0; i < n; ++i )
< {
< 
< 		// read data from binary file
< 		Element SE;
< 		data_file.read( &SE, sizeof( Element ) );
< 		ElementVector.push_back( SE );
< 
< 	}
< 	sprintf( fss_io.msgstr, "Done" );
< 	fss_io._print( fss_io.msgstr );
< 
< 	// close file
< 	data_file.close( );
< 
< }
< */
< 
< /*
< // write zone data to file in binary format
< static void write_zone_binary( char* m_dataPath )
< {
< 
< 	// construct filename; SLASH is o/s dependent
< 	char fname[255];
< 	sprintf( fname, "%s%szone.bin", m_dataPath, SLASH );
< 
< 	// open file for writing
< 	ofstream data_file( fname );
< 
< 	// check for bad file
< 	if ( data_file.bad( ) )
< {
< 		sprintf( fss_io.msgstr, "\n\nERROR: Could not open %s\n\n", fname );
< 		fss_io._exit( fss_io.msgstr, -2 );
< 		return;
< 	}
< 
< 	// write zone data to binary file
< 	sprintf( fss_io.msgstr, "\nWriting %ld zones to binary file...", NumZones );
< 	fss_io._print( fss_io.msgstr );
< 	// write the number of elements
< 	data_file.write( &NumZones, sizeof( NumZones ) );
< 	for( ZoneMapIterator zmi = ZoneMap.begin( ); zmi != ZoneMap.end( ); ++zmi )
< {
< 		zmi->second->write_to_binary_file( data_file );
< 	}
< 	sprintf( fss_io.msgstr, "Done" );
< 	fss_io._print( fss_io.msgstr );
< 
< 	// close file
< 	data_file.close( );
< }
< 
< // read zone data from file in binary format
< static void read_zone_binary( char* m_dataPath )
< {
< 
< 	// construct filename; SLASH is o/s dependent
< 	char fname[255];
< 	sprintf( fname, "%s%szone.bin", m_dataPath, SLASH );
< 
< 	// open file for reading
< 	ifstream data_file( fname );
< 
< 	// check for bad file
< 	if ( data_file.bad( ) )
< {
< 		sprintf( fss_io.msgstr, "\n\nERROR: Could not find/open %s\n\n", fname );
< 		fss_io._exit( fss_io.msgstr, -2 );
< 		return;
< 	}
< 
< 	// initialize data structure in preparation for new elements
< 	delete[] ZoneArray;
< 
< 	// read the number of elements
< 	data_file.read( &NumZones, sizeof( NumZones ) );
< 	// allocate an array of the appropriate size
< 	ZoneArray = new Zone[ NumZones ];
< 	sprintf( fss_io.msgstr, "\nReading %ld zones from binary file...", NumZones );
< 	fss_io._print( fss_io.msgstr );
< 	int ArrayIndex = 0;
< 	while ( !data_file.eof( ) )
< {
< 
< 		data_file.read( &ArrayIndex, sizeof( ArrayIndex ) );
< 
< 		// read binary data into array
< 		if ( !data_file.eof( ) )
< {
< 			ZoneArray[ArrayIndex].index = ArrayIndex;
< 			ZoneArray[ArrayIndex].read_from_binary_file( data_file );
< 		}
< 
< 	}
< 	sprintf( fss_io.msgstr, "Done" );
< 	fss_io._print( fss_io.msgstr );
< 
< 	// close file
< 	data_file.close( );
< 
< }
< 
< // write static group data to file in binary format
< static void write_sgroup_binary( char* m_dataPath )
< {
< 
< 	// construct filename; SLASH is o/s dependent
< 	char fname[255];
< 	sprintf( fname, "%s%ssgroup.bin", m_dataPath, SLASH );
< 
< 	// open file for writing
< 	ofstream data_file( fname );
< 
< 	// check for bad file
< 	if ( data_file.bad( ) )
< {
< 		sprintf( fss_io.msgstr, "\n\nERROR: Could not open %s\n\n", fname );
< 		fss_io._exit( fss_io.msgstr, -2 );
< 		return;
< 	}
< 
< 	// write group data to binary file
< 	sprintf( fss_io.msgstr, "\nWriting %ld static groups to binary file...", NumSGroups );
< 	fss_io._print( fss_io.msgstr );
< 	// write the number of elements
< 	data_file.write( &NumSGroups, sizeof( NumSGroups ) );
< 	for( GroupMapIterator gmi = SGroupMap.begin( ); gmi != SGroupMap.end( ); ++gmi )
< {
< 		gmi->second->write_to_binary_file( data_file );
< 	}
< 	sprintf( fss_io.msgstr, "Done" );
< 	fss_io._print( fss_io.msgstr );
< 
< 	// close file
< 	data_file.close( );
< }
< 
< // write float group data to file in binary format
< static void write_fgroup_binary( char* m_dataPath )
< {
< 
< 	// construct filename; SLASH is o/s dependent
< 	char fname[255];
< 	sprintf( fname, "%s%sfgroup.bin", m_dataPath, SLASH );
< 
< 	// open file for writing
< 	ofstream data_file( fname );
< 
< 	// check for bad file
< 	if ( data_file.bad( ) )
< {
< 		sprintf( fss_io.msgstr, "\n\nERROR: Could not open %s\n\n", fname );
< 		fss_io._exit( fss_io.msgstr, -2 );
< 		return;
< 	}
< 
< 	// write group data to binary file
< 	sprintf( fss_io.msgstr, "\nWriting %ld float groups to binary file...", NumFGroups );
< 	fss_io._print( fss_io.msgstr );
< 	// write the number of elements
< 	data_file.write( &NumFGroups, sizeof( NumFGroups ) );
< 	for( GroupMapIterator gmi = FGroupMap.begin( ); gmi != FGroupMap.end( ); ++gmi )
< {
< 		gmi->second->write_to_binary_file( data_file );
< 	}
< 	sprintf( fss_io.msgstr, "Done" );
< 	fss_io._print( fss_io.msgstr );
< 
< 	// close file
< 	data_file.close( );
< }
< 
< // read float group data from file in binary format
< static void read_fgroup_binary( char* m_dataPath )
< {
< 
< 	// construct filename; SLASH is o/s dependent
< 	char fname[255];
< 	sprintf( fname, "%s%sfgroup.bin", m_dataPath, SLASH );
< 
< 	// open file for reading
< 	ifstream data_file( fname );
< 
< 	// check for bad file
< 	if ( data_file.bad( ) )
< {
< 		sprintf( fss_io.msgstr, "\n\nERROR: Could not find/open %s\n\n", fname );
< 		fss_io._exit( fss_io.msgstr, -2 );
< 		return;
< 	}
< 
< 	// initialize data structure in preparation for new elements
< 	delete[] FGroupArray;
< 
< 	// read the number of elements
< 	data_file.read( &NumFGroups, sizeof( NumFGroups ) );
< 	// allocate an array of the appropriate size
< 	FGroupArray = new Group[ NumFGroups ];
< 	sprintf( fss_io.msgstr, "\nReading %ld float groups from binary file...", NumFGroups );
< 	fss_io._print( fss_io.msgstr );
< 	int ArrayIndex = 0;
< 	while ( !data_file.eof( ) )
< {
< 
< 		data_file.read( &ArrayIndex, sizeof( ArrayIndex ) );
< 
< 		// read binary data into array
< 		if ( !data_file.eof( ) )
< {
< 			FGroupArray[ArrayIndex].index = ArrayIndex;
< 			FGroupArray[ArrayIndex].read_from_binary_file( data_file );
< 		}
< 
< 	}
< 	sprintf( fss_io.msgstr, "Done" );
< 	fss_io._print( fss_io.msgstr );
< 
< 	// close file
< 	data_file.close( );
< 
< }
< 
< // read static group data from file in binary format
< static void read_sgroup_binary( char* m_dataPath )
< {
< 
< 	// construct filename; SLASH is o/s dependent
< 	char fname[255];
< 	sprintf( fname, "%s%ssgroup.bin", m_dataPath, SLASH );
< 
< 	// open file for reading
< 	ifstream data_file( fname );
< 
< 	// check for bad file
< 	if ( data_file.bad( ) )
< {
< 		sprintf( fss_io.msgstr, "\n\nERROR: Could not find/open %s\n\n", fname );
< 		fss_io._exit( fss_io.msgstr, -2 );
< 		return;
< 	}
< 
< 	// initialize data structure in preparation for new elements
< 	delete[] SGroupArray;
< 
< 	// read the number of elements
< 	data_file.read( &NumSGroups, sizeof( NumSGroups ) );
< 	// allocate an array of the appropriate size
< 	SGroupArray = new Group[ NumSGroups ];
< 	sprintf( fss_io.msgstr, "\nReading %ld static groups from binary file...", NumSGroups );
< 	fss_io._print( fss_io.msgstr );
< 	int ArrayIndex = 0;
< 	while ( !data_file.eof( ) )
< {
< 
< 		data_file.read( &ArrayIndex, sizeof( ArrayIndex ) );
< 
< 		// read binary data into array
< 		if ( !data_file.eof( ) )
< {
< 			SGroupArray[ArrayIndex].index = ArrayIndex;
< 			SGroupArray[ArrayIndex].read_from_binary_file( data_file );
< 		}
< 
< 	}
< 	sprintf( fss_io.msgstr, "Done" );
< 	fss_io._print( fss_io.msgstr );
< 
< 	// close file
< 	data_file.close( );
< 
< }
< 
< // write table data to file in binary format
< static void write_table_binary( char* m_dataPath )
< {
< 
< 	// construct filename; SLASH is o/s dependent
< 	char fname[255];
< 	sprintf( fname, "%s%stable.bin", m_dataPath, SLASH );
< 
< 	// open file for writing
< 	ofstream data_file( fname );
< 
< 	// check for bad file
< 	if ( data_file.bad( ) )
< {
< 		sprintf( fss_io.msgstr, "\n\nERROR: Could not open %s\n\n", fname );
< 		fss_io._exit( fss_io.msgstr, -2 );
< 		return;
< 	}
< 
< 	// write table data to binary file
< 	sprintf( fss_io.msgstr, "\nWriting %ld tables to binary file...", NumTables );
< 	fss_io._print( fss_io.msgstr );
< 	// write the number of elements
< 	data_file.write( &NumTables, sizeof( NumTables ) );
< 	for( TableMapIterator tmi = TableMap.begin( ); tmi != TableMap.end( ); ++tmi )
< {
< 		tmi->second->write_to_binary_file( data_file );
< 	}
< 	sprintf( fss_io.msgstr, "Done" );
< 	fss_io._print( fss_io.msgstr );
< 
< 	// close file
< 	data_file.close( );
< }
< 
< // read table data from file in binary format
< static void read_table_binary( char* m_dataPath )
< {
< 
< 	// construct filename; SLASH is o/s dependent
< 	char fname[255];
< 	sprintf( fname, "%s%stable.bin", m_dataPath, SLASH );
< 
< 	// open file for reading
< 	ifstream data_file( fname );
< 
< 	// check for bad file
< 	if ( data_file.bad( ) )
< {
< 		sprintf( fss_io.msgstr, "\n\nERROR: Could not find/open %s\n\n", fname );
< 		fss_io._exit( fss_io.msgstr, -2 );
< 		return;
< 	}
< 
< 	// initialize data structure in preparation for new elements
< 	delete[] TableArray;
< 
< 	// read the number of elements
< 	data_file.read( &NumTables, sizeof( NumTables ) );
< 	// allocate an array of the appropriate size
< 	TableArray = new Table[ NumTables ];
< 	sprintf( fss_io.msgstr, "\nReading %ld tables from binary file...", NumTables );
< 	fss_io._print( fss_io.msgstr );
< 	int ArrayIndex = 0;
< 	while ( !data_file.eof( ) )
< {
< 
< 		data_file.read( &ArrayIndex, sizeof( ArrayIndex ) );
< 
< 		// read binary data into array
< 		if ( !data_file.eof( ) )
< {
< 			TableArray[ArrayIndex].index = ArrayIndex;
< 			TableArray[ArrayIndex].read_from_binary_file( data_file );
< 		}
< 
< 	}
< 	sprintf( fss_io.msgstr, "Done" );
< 	fss_io._print( fss_io.msgstr );
< 
< 	// close file
< 	data_file.close( );
< 
< }
< */
