Purpose:
|
Defines the abstract base class.
|
|
Derivation:
|
FileInterface : ACIS_OBJECT : -
|
|
Filename:
|
kern/kernel/kernutil/fileio/fileif.hxx
|
|
Description:
|
Defines the abstract base class that defines the interface that
ACIS uses to save and restore
ENTITY data.
|
|
|
All
ACIS save and restore operations use an object of this class to control the reading or writing of the data. There are two main reasons for having this class:
|
|
|
The first reason is to allow saving and restoring
ENTITY data to targets other than a standard C stream file; i.e., a
FILE*. To do this derive a new subclass from this one, which implements reading and writing for the new target.
|
|
|
The second reason is to allow saving and restoring unknown
ENTITY data in binary format. This is the reason that this class has so many virtual methods. To support unknown
ENTITY data, the data is tagged with its type when it is written to a file. This allows manipulation of the data when it is loaded back in even if the data is unknown.
|
|
|
When deriving a new class to support a different kind of storage target,derive it from the
BinaryFile class, which is derived from this one and is declared in
binfile.hxx. The
BinaryFile class has a standard implementation for most of the virtual methods of this class that already take care of the details for saving and restoring the unknown
ENTITY data. Implementation of the actual read and write methods are all that is necessary.
|
|
Constructor:
|
public: FileInterface::FileInterface
();
|
|
|
C++ constructor, creating a
FileInterface.
|
|
|
|
|
Destructor:
|
public: virtual FileInterface::~FileInterface
();
|
|
|
C++ destructor, deleting a
FileInterface.
|
|
|
|
Methods:
|
public: virtual FilePosition
|
|
|
FileInterface::goto_mark (
|
|
|
FilePosition
|
// file position.
|
|
|
) = 0;
|
|
|
Goes to the mark.
|
|
|
|
|
|
|
public: virtual char FileInterface::read_char
() = 0;
|
|
|
Reads a character. Written with C printf format "%c".
|
|
|
|
|
|
|
public: virtual TaggedData*
|
|
|
FileInterface::read_data ();
|
|
|
Reads the data.
|
|
|
|
|
|
|
public: virtual double
|
|
|
FileInterface::read_double () = 0;
|
|
|
Reads a double. Written with C printf format "%g ".
|
|
|
|
|
|
|
public: virtual int FileInterface::read_enum
(
|
|
|
enum_table const&
|
// enumeration table
|
|
|
) = 0;
|
|
|
Read an enumeration table. The <identifier> specifies which enumeration is active and its valid values. The <identifier> is not written to the file. A valid value only is written to the file. This is a character string or a long value from the enumeration <identifier> written with C printf format "%s".
|
|
|
|
|
|
|
public: virtual float
|
|
|
FileInterface::read_float () = 0;
|
|
|
Reads a float. Written with C printf format "%g ".
|
|
|
|
|
|
|
public: virtual logical FileInterface::read_header
(
|
|
|
int&,
|
// first integer
|
|
|
int&,
|
// second integer
|
|
|
int&,
|
// third integer
|
|
|
int&
|
// fourth integer
|
|
|
);
|
|
|
Reads a header. The first record of the
ACIS save file is a header, such as:
200 0 1 0
|
|
|
First Integer: An encoded version number. In the example, this is "200". This value is 100 times the major version plus the minor version (e.g., 107 for
ACIS version 1.7). For point releases, the final value is truncated. Part save data for the
.sat files is not affected by a point release (e.g., 105 for
ACIS version 1.5.2).
|
|
|
Second Integer: The total number of saved data records, or zero. If zero, then there needs to be an end mark.
|
|
|
Third Integer: A count of the number of entities in the original entity list saved to the part file.
|
|
|
Fourth Integer: The least significant bit of this number is used to indicate whether or not
history has been saved in this save file.
|
|
|
|
|
|
|
public: virtual int FileInterface::read_id
(
|
|
|
char*,
|
// ID string buffer
|
|
|
int
|
|
// buffer length
|
|
|
|
= 0
|
|
|
) = 0;
|
|
|
Reads an identifier. The save identifier written with C printf format "%s ".
|
|
|
|
|
|
|
public: virtual logical FileInterface::read_logical
(
|
|
|
const char* f
|
// FALSE keyword
|
|
|
|
= "F",
|
|
|
const char* t
|
// TRUE keyword
|
|
|
|
= "T"
|
|
|
) = 0;
|
|
|
Reads a logical.
(false_string, true_string, {or any_valid_string}): Appropriate string written with C printf format "%s ".
|
|
|
|
|
|
|
public: virtual long FileInterface::read_long
() = 0;
|
|
|
Reads a long. Written with C printf format "%ld".
|
|
|
|
|
|
|
public: virtual void*
|
|
|
FileInterface::read_pointer () = 0;
|
|
|
Reads a pointer. Pointer reference to a save file record index. Written as "$" followed by index number written as a long.
|
|
|
|
|
|
|
public: virtual SPAposition
|
|
|
FileInterface::read_position ();
|
|
|
Reads the position.
x, y, z coordinates written as real numbers.
|
|
|
|
|
|
|
public: virtual int FileInterface::read_sequence
();
|
|
|
Reads a sequence. Written as "-" followed by the entity index written as long.
|
|
|
|
|
|
|
public: virtual short
|
|
|
FileInterface::read_short () = 0;
|
|
|
Reads a short. Written with C printf format "%d".
|
|
|
|
|
|
|
public: virtual char* FileInterface::read_string
(
|
|
|
int& len
|
// length
|
|
|
) = 0;
|
|
|
Reads a string, allocates memory for it, and the argument returns the length of the string. Length written as long followed by string written with C printf format "%s".
|
|
|
|
|
|
|
public: virtual size_t FileInterface::read_string
(
|
|
|
char* buf,
|
// buffer
|
|
|
size_t maxlen
|
// maximum length
|
|
|
|
= 0
|
|
|
) = 0;
|
|
|
Reads a string, allocates memory for it, and the argument returns the length of the string. Length written as long followed by string written with C printf format "%s".
|
|
|
|
|
|
|
public: virtual logical
|
|
|
FileInterface::read_subtype_end () = 0;
|
|
|
Reads subtype end. Braces around the subtypes, written as "} " in the SAT file.
|
|
|
|
|
|
|
public: virtual logical
|
|
|
FileInterface::read_subtype_start () = 0;
|
|
|
Reads subtype start. Braces around the subtypes, written as "{ " in the SAT file.
|
|
|
|
|
|
|
public: virtual SPAvector FileInterface::read_vector
();
|
|
|
Reads the vector.
x, y, z components written as real numbers.
|
|
|
|
|
|
|
public: virtual FilePosition
|
|
|
FileInterface::set_mark () = 0;
|
|
|
Sets the mark.
|
|
|
|
|
|
|
public: virtual logical
|
|
|
FileInterface::unknown_types_ok ();
|
|
|
Determines if unknown
ENTITY types are OK. This returns
TRUE for everything except old style binary files, so it has a default implementation.
|
|
|
|
|
|
|
public: virtual void FileInterface::write_char
(
|
|
|
char
|
// character
|
|
|
) = 0;
|
|
|
Writes a character. Written with C printf format "%c".
|
|
|
|
|
|
|
public: virtual void FileInterface::write_data
(
|
|
|
const TaggedData&
|
// tagged data
|
|
|
);
|
|
|
Writes the data.
|
|
|
|
|
|
|
public: virtual void FileInterface::write_double
(
|
|
|
double
|
// real
|
|
|
) = 0;
|
|
|
Writes a real. Written with C printf format "%g ".
|
|
|
|
|
|
|
public: virtual void FileInterface::write_enum
(
|
|
|
int,
|
// value
|
|
|
enum_table const&
|
// enumeration table
|
|
|
) = 0;
|
|
|
Writes enumeration table. The <identifier> specifies which enumeration is active and its valid values. The <identifier> is not written to the file. A valid value only is written to the file. This is a character string or a long value from the enumeration <identifier> written with C printf format "%s".
|
|
|
|
|
|
|
public: virtual void FileInterface::write_float
(
|
|
|
float
|
// float
|
|
|
) = 0;
|
|
|
Writes a float. Written with C printf format "%g ".
|
|
|
|
|
|
|
public: virtual void FileInterface::write_header
(
|
|
|
int,
|
// first integer
|
|
|
int,
|
// second integer
|
|
|
int,
|
// third integer
|
|
|
int
|
|
// fourth integer
|
|
|
);
|
|
|
Writes a header. The first record of the
ACIS save file is a header, such as:
200 0 1 0
|
|
|
First Integer: An encoded version number. In the example, this is "200". This value is 100 times the major version plus the minor version (e.g., 107 for
ACIS version 1.7). For point releases, the final value is truncated. Part save data for the
.sat files is not affected by a point release (e.g., 105 for
ACIS version 1.5.2).
|
|
|
Second Integer: The total number of saved data records, or zero. If zero, then there needs to be an end mark.
|
|
|
Third Integer: A count of the number of entities in the original entity list saved to the part file.
|
|
|
Fourth Integer: The least significant bit of this number is used to indicate whether or not
history has been saved in this save file.
|
|
|
|
|
|
|
public: virtual void FileInterface::write_id
(
|
|
|
const char*,
|
// ID string
|
|
|
int
|
|
// ID level (1 or 2)
|
|
|
) = 0;
|
|
|
Writes an identifier. The save identifier written with C printf format "%s ".
|
|
|
|
|
|
|
public: virtual void
|
|
|
FileInterface::write_literal_string (
|
|
|
const char*,
|
// string
|
|
|
size_t len
|
// length
|
|
|
|
= 0
|
|
|
);
|
|
|
Writes a literal string.
|
|
|
|
|
|
|
public: virtual void FileInterface::write_logical
(
|
|
|
logical,
|
// logical value
|
|
|
const char* f
|
// FALSE keyword
|
|
|
|
= "F",
|
|
|
const char* t
|
// TRUE keyword
|
|
|
|
= "T"
|
|
|
) = 0;
|
|
|
Writes a logical.
(false_string, true_string, {or any_valid_string}): Appropriate string written with C printf format "%s ".
|
|
|
|
|
|
|
public: virtual void FileInterface::write_long
(
|
|
|
long
|
// long
|
|
|
) = 0;
|
|
|
Writes a long. Written with C printf format "%ld".
|
|
|
|
|
|
|
public: virtual void FileInterface::write_newline
(
|
|
|
int
|
|
// number of new lines
|
|
|
|
= 1
|
|
|
);
|
|
|
Writes a new line character.
|
|
|
|
|
|
|
public: virtual void FileInterface::write_pointer
(
|
|
|
void*
|
// pointer
|
|
|
) = 0;
|
|
|
Writes a pointer. Pointer reference to a save file record index. Written as "$" followed by index number written as a long.
|
|
|
|
|
|
|
public: virtual void FileInterface::write_position
(
|
|
|
const SPAposition&
|
// position
|
|
|
);
|
|
|
Writes a position.
x, y, z coordinates written as real numbers.
|
|
|
|
|
|
|
public: virtual void FileInterface::write_sequence
(
|
|
|
int
|
|
// integer
|
|
|
);
|
|
|
Writes a sequence. Written as "-" followed by the entity index written as long.
|
|
|
|
|
|
|
public: virtual void FileInterface::write_short
(
|
|
|
short
|
// short
|
|
|
) = 0;
|
|
|
Writes a short. Written with C printf format "%d".
|
|
|
|
|
|
|
public: virtual void FileInterface::write_string
(
|
|
|
const char*,
|
// string
|
|
|
size_t len
|
// length
|
|
|
|
= 0
|
|
|
) = 0;
|
|
|
Writes a string. Length written as long followed by string written with C printf format "%s".
|
|
|
|
|
|
|
public: virtual void
|
|
|
FileInterface::write_subtype_end () = 0;
|
|
|
Writes a subtype end. Braces around the subtypes, written as "} " in the SAT file.
|
|
|
|
|
|
|
public: virtual void
|
|
|
FileInterface::write_subtype_start () = 0;
|
|
|
Writes a subtype start. Braces around the subtypes, written as "{ " in the SAT file.
|
|
|
|
|
|
|
public: virtual void
|
|
|
FileInterface::write_terminator () = 0;
|
|
|
Writes a terminator. Written as "#" in the SAT file.
|
|
|
|
|
|
|
public: virtual void FileInterface::write_vector
(
|
|
|
const SPAvector&
|
// vector name
|
|
|
);
|
|
|
Writes a vector.
x, y, z components written as real numbers.
|