api_restore_history
List of: Functions
Subjects: History and Roll
Contents: Kernel

Action: Restores a history stream and associated entities and entity id information from a file.

Prototype: outcome api_restore_history (


FILE* file_ptr, // open file descriptor


logical text_mode, // text mode


HISTORY_STREAM_LIST& hlist,// restored history




// streams


logical create_new_hs // flag for creating



= FALSE, // new history stream


AcisOptions* ao = NULL // acis options


);

Includes: #include "kernel/acis.hxx"

#include "baseutil/logical.h"

#include "kernel/kernapi/api/api.hxx"

#include "kernel/kernapi/api/kernapi.hxx"

#include "kernel/kerndata/bulletin/bulletin.hxx"

#include "kernel/kernapi/api/acis_options.hxx"

Description: This routine restores entities and any associated history information from a file. If the file has no history (i.e. it was created using api_save_entity_list) then the create_new_hs flag is examined. If the flag is TRUE, a new history stream is instantiated to hold the created entities. If the flag is FALSE, the entities in the file are created in the default stream. All created history streams are added to the history stream list hlist; no change in the history stream list indicates the file had no history and the entities were placed in the default stream. api_get_active_entities can be called on the streams in hlist to find the entities read in.


The file pointer is an open file positioned at the point where this API begins the restore entity. When the restore is complete, the file will be correctly positioned at the end of the save entity. This allows an application to restore multiple entities intermixed with other application-specific data in a single save file.


Establish in the calling routine whether the file is text or binary and set text_mode correctly: TRUE if the file is text, FALSE if binary. Restoring a binary file is about twice as fast as restoring a text file. However, use binary files only when the file is created and read on the same version of the system running on the same type of machine.


When an entity is restored from a file, any unrecognized main entity types (BODY, CURVE, etc.) are skipped and any references to those entities are set to NULL. Unrecognized descendent entities of ATTRIB, SURFACE, or CURVE generate a new record for their immediate owner class, and references to them become references to the new record. If a record for a derived class of ATTRIB is not recognized, an ATTRIB record results so that the chain of attributes for the entity owning the unrecognized attribute remains connected.


It is possible to restore entities made by versions having different sets of attribute classes. Attribute types common to the two versions are restored, but attributes of types unknown to the receiving version are ignored.


A warning is given if the version of the product receiving the model differs from the version that made the save file. It is an error if the current product is older than that recorded in the file.

Errors: Warning: Version number of this system differs from version that made the save file being read.



Warning: Record for unrecognized entity is being skipped. Unable to read file. Malformed save file.

Library: kernel

Filename: kern/kernel/kernapi/api/kernapi.hxx

Effect: Changes model
PDF/KERN/16FNA.PDF
HTM/DATA/KERN/KERN/16FNA/0136.HTM