Action:
|
Writes a list of entities to disk as text or binary.
|
|
Prototype:
|
outcome api_save_entity_list_with_history (
|
|
|
FILE* file_ptr,
|
|
// open file
|
|
|
|
|
|
// descriptor
|
|
|
logical text_mode,
|
|
// TRUE if file is
|
|
|
|
|
|
// text, FALSE if
|
|
|
|
|
|
// binary
|
|
|
ENTITY_LIST const&
|
|
// entities to
|
|
|
|
entity_list,
|
|
// save
|
|
|
HISTORY_STREAM_LIST& hslist,
|
// history streams to
|
|
|
|
|
|
// save
|
|
|
DELTA_STATE_LIST& dslist,
|
|
// returns delta
|
|
|
|
|
|
// states saved
|
|
|
AcisOptions* ao = NULL
|
// acis options
|
|
|
);
|
|
Includes:
|
#include "kernel/acis.hxx"
|
|
#include "kernel/kernapi/api/api.hxx"
|
|
#include "kernel/kernapi/api/kernapi.hxx"
|
|
#include "kernel/kerndata/bulletin/bulletin.hxx"
|
|
#include "kernel/kerndata/lists/lists.hxx"
|
|
#include "baseutil/logical.h"
|
|
#include "kernel/kernapi/api/acis_options.hxx"
|
|
Description:
|
The file pointer argument should be an open file positioned at the point where this API begins the entity save. When the save is complete, the file will be correctly positioned at the end of the entity save; therefore, an application can save multiple bodies intermixed with other application specific data in a single save file.
|
|
|
The entities are written to disk as a sequence of records, one per model entity. Writing records in binary is roughly twice as fast as writing in text and the files are some 20 per cent shorter however, use binary save files only for short-term storage. Write and read binary files only by the same version running on the same type of hardware.
|
|
|
Each entity record begins with a string identifier denoting its type. When a file is restored, records of unrecognized derived classes will be ignored.
|
|
|
The floating point precision for real numbers in text files is six digits for single precision and 15 digits for double precision.
|
|
|
History data is saved after active entities in a form allowing
api_restore_entity_list to restore without history if desired.
|
|
|
The returned
dslist can be used by the application to map
DELTA_STATE pointers to unique integers and back again during save and restore to maintain an association between
DELTA_STATEs and application data. For example, one might use the following pseudo code
|
|
|
class app_data {
|
|
|
DELTA_STATE* ds;
|
|
|
void save(DELTA_STATE_LIST& dslist) {
|
|
|
|
write_int(dslist.lookup(ds));
|
|
|
}
|
|
|
void restore(DELTA_STATE_LIST& dslist) {
|
|
|
|
ds = read_int();
|
|
|
}
|
|
|
void fix_pointers(DELTA_STATE_LIST& dslist) {
|
|
|
|
if( (int) < 0 ) {
|
|
|
|
|
ds = NULL;
|
|
|
|
} else {
|
|
|
|
|
ds = dslist[i];
|
|
|
|
}
|
|
|
}
|
|
};
|
|
|
DELTA_STATE_LIST dslist;
|
|
HISTORY_STREAM_LIST hslist;
|
|
ENTITY_LIST elist;
|
|
elist.add(entity_to_save);
|
|
api_save_entity_list_with_history
|
|
|
(file, TRUE, elist, hslist,dslist);
|
|
|
foreach(app_data* ap) {
|
|
|
ap->save(dslist);
|
|
}
|
|
|
See
api_restore_entity_list_with_history for an example of how to restore the above
app_data
|
|
|
Some entities may have
HISTORY_STREAMs attached via an
ATTRIB_HISTORY. In this case the
hslist would be larger on return than on entry. The returned list can be used as with the
dslist when saving application data.
|
|
|
Beginning with
ACIS release 6.3, it is
required that the product ID and units be populated for the file header (using class
FileInfo) before you can save a SAT file. Refer to the reference templates for the class
FileInfo and function
api_set_file_info for more information.
|
|
Errors:
|
Failed to save entities; e.g., unable to write disk file.
|
|
Library:
|
kernel
|
|
Filename:
|
kern/kernel/kernapi/api/kernapi.hxx
|
|
Effect:
|
Read-only
|