RCSB PDB Protein Data Bank A Member of the wwPDB
An Information Portal to Biological Macromolecular Structures
PDB Home | Contact Us
next up previous contents
Next: GetObject Up: Persistence Methods Previous: Persistence Methods

WriteObject

NAME WriteObject

PROTOTYPE

#include "ISTable.h"
#include "FileNavigator.h"

int ISTable::WriteObject(FileNavigator * fnav);

EXAMPLE

#include "ISTable.h"
#include "FileNavigator.h"

const int MAX_TABLES = 50;
const char * NAV_FILE = "table.odb";

ISTable * pTable = new ISTable[MAX_TABLES];
int * table_loc = new int[MAX_TABLES];
FileNavigator * f = new FileNavigator();
f->OpenFile(NAV_FILE, WRITE_MODE);
f->ReadFileHeader();

... // do table construction/maniputation

// Write out all the tables...
Word list_loc = 0, place = 0;
f->WriteWord(0, list_loc);

for (int i = 0; i < MAX_TABLES; i++) {
  table_loc[i] = pTable[i].WriteObject(f);
}

f->WriteWords((Word *) table_locs, MAX_TABLES, place);
f->UpdateWord(place, list_loc, list_loc);
f->CloseFile();
PURPOSE

WriteObject dumps out the object to a persistent storage file.

RECEIVES

fnav A pointer to the FileNavigator object responsible for writing the persistent storage file.

RETURN VALUE

A negative value indicates an error or warning.
A non-negative value indicates the index of the object, needed for reconstruction.

REMARKS

See also: GetObject



Olivera Tosic
6/12/2002

 

© RCSB PDB