An instance of this class is written to the front of a Bam or Txo file to make the file a cached instance of some other loadable resource. More...
Public Member Functions | |
addDependentFile (Filename const pathname) | |
Adds the indicated file to the list of files that will be loaded to generate the data in this record. | |
clearData () | |
Removes the in-memory data object associated with this record, if any. | |
clearDependentFiles () | |
Empties the list of files that contribute to the data in this record. | |
bool | dependentsUnchanged () |
Returns true if all of the dependent files are still the same as when the cache was recorded, false otherwise. | |
Filename const | getCacheFilename () |
Returns the name of the cache file as hashed from the source_pathname. | |
TypedWritable | getData () |
Returns a pointer to the data stored in the record, or NULL if there is no data. | |
Filename const | getDependentPathname (int n) |
Returns the full pathname of the nth source files that contributes to the cache. | |
int | getNumDependentFiles () |
Returns the number of source files that contribute to the cache. | |
unsigned int | getRecordedTime () |
Returns the time at which this particular record was recorded or updated. | |
Filename const | getSourcePathname () |
Returns the full pathname to the source file that originally generated this cache request. | |
bool | hasData () |
Returns true if this cache record has an in-memory data object associated--that is, the object stored in the cache. | |
BamCacheRecord | makeCopy () |
Returns a duplicate of the BamCacheRecord. | |
bool | operator== (BamCacheRecord const other) |
Returns true if the record matches the other record in those attributes which get written to disk. | |
output (ostream out) | |
setData (TypedWritable ptr, ReferenceCount ref_ptr) | |
Stores a new data object on the record. | |
setData (TypedWritable ptr, int dummy) | |
This variant on set_data() is provided just to allow Python code to pass a 0 as the second parameter. | |
write (ostream out, int indent_level) | |
write (ostream out) | |
Static Public Member Functions | |
static TypeHandle | getClassType () |
An instance of this class is written to the front of a Bam or Txo file to make the file a cached instance of some other loadable resource.
This record contains information needed to test the validity of the cache.
addDependentFile | ( | Filename const | pathname | ) |
Adds the indicated file to the list of files that will be loaded to generate the data in this record.
This should be called once for the primary source file, and again for each secondary source file, if any.
clearData | ( | ) |
Removes the in-memory data object associated with this record, if any.
This does not affect the on-disk representation of the record.
Empties the list of files that contribute to the data in this record.
bool dependentsUnchanged | ( | ) |
Returns true if all of the dependent files are still the same as when the cache was recorded, false otherwise.
Filename const getCacheFilename | ( | ) |
Returns the name of the cache file as hashed from the source_pathname.
This will be relative to the root of the cache directory, and it will not include any suffixes that may be appended to resolve hash conflicts.
static TypeHandle getClassType | ( | ) | [static] |
Reimplemented from TypedWritableReferenceCount.
TypedWritable getData | ( | ) |
Returns a pointer to the data stored in the record, or NULL if there is no data.
The pointer is not removed from the record.
Filename const getDependentPathname | ( | int | n | ) |
Returns the full pathname of the nth source files that contributes to the cache.
Returns the number of source files that contribute to the cache.
unsigned int getRecordedTime | ( | ) |
Returns the time at which this particular record was recorded or updated.
Filename const getSourcePathname | ( | ) |
Returns the full pathname to the source file that originally generated this cache request.
In some cases, for instance in the case of a of a multipage texture like "cube_#.png", this may not not a true filename on disk.
bool hasData | ( | ) |
Returns true if this cache record has an in-memory data object associated--that is, the object stored in the cache.
Returns a duplicate of the BamCacheRecord.
The duplicate will not have a data pointer set, even though one may have been assigned to the original via set_data().
bool operator== | ( | BamCacheRecord const | other | ) |
Returns true if the record matches the other record in those attributes which get written to disk.
Does not compare the data pointer.
setData | ( | TypedWritable | ptr, |
ReferenceCount | ref_ptr | ||
) |
Stores a new data object on the record.
You should pass the same pointer twice, to both parameters; this allows the C++ typecasting to automatically convert the pointer into both a TypedWritable and a ReferenceCount pointer, so that the BamCacheRecord object can reliably manage the reference counts.
You may pass 0 or NULL as the second parameter. If you do this, the BamCacheRecord will not manage the object's reference count; it will be up to you to ensure the object is not deleted during the lifetime of the BamCacheRecord object.
setData | ( | TypedWritable | ptr, |
int | dummy | ||
) |
This variant on set_data() is provided just to allow Python code to pass a 0 as the second parameter.