#include <ImFusion/Base/ImFusionFile.h>
Loading and saving of the ImFusion file format.
More...
Loading and saving of the ImFusion file format.
- See also
- ImFusionFileIoAlgorithm
|
std::optional< OwningDataList > | load (int blockId=-1) |
| Load the file and add content to provided data list, returns true on success If the given blockId is < 0, all data stored in the file will be loaded.
|
|
bool | loadMetaInfo () |
| Load only the meta-info block in the file, returns true on success.
|
|
bool | save (DataList data) |
| Save data to a file, returns true on success.
|
|
bool | save (const SharedImageSet *img) |
| Convenience method to save an image data set, returns true on success.
|
|
void | setProperties (Properties *p) |
| Set global properties.
|
|
const Properties * | properties () const |
| Get global properties.
|
|
void | addGroup (ImFusionFileGroup &g) |
| Add group.
|
|
const std::map< Data *, unsigned int > & | dataBlockIds () const |
| Returns the map of the written/loaded data to their corresponding block IDs.
|
|
void | setLoadAllSharedImageSetProperties (bool val) |
| Defines whether properties should be copied to all contained SharedImageSets.
|
|
void | setEnsureTopLeftOriginOnLoad (bool val) |
| Defines whether legacy data with origin in botton-left corner should be flipped when loading.
|
|
bool | isEnsuringTopLeftOriginOnLoad () const |
| Returns whether legacy data with origin in botton-left corner should be flipped when loading.
|
|
bool | fileSizeFitsBlockData (size_t *sizeOfContent=nullptr) const |
|
std::streampos | getReadPosition () |
| Read position of the reading-head in the current input stream (i.e.
|
|
bool | load (DataList &data, int blockId=-1) |
|
|
bool | open (int mode) |
| Open the file and retrieve block information, return true on success and at least one block present.
|
|
bool | beginBlockWrite (ImFusionFilePlugin *p, Data *d=0) |
| Initialize plugin The file will open a new block and initialize the plugin with the file pointer.
|
|
unsigned long long | endBlockWrite () |
| Close block and disable plugin access.
|
|
bool | beginBlockRead (int block, ImFusionFilePlugin *p) |
| Initialize plugin The file will read the block header and point the plugin to the position after the header.
|
|
unsigned long long | endBlockRead () |
| Close block and disable plugin access.
|
|
int | listBlocks (std::vector< unsigned int > &blockTypeOut, std::vector< unsigned long long > &blockSizeOut) |
| Return block information, available after having called open()
|
|
bool | close () |
| Close the file manually if selective read methods above have been used.
|
|
◆ addPlugin()
- Deprecated
- "Use addPlugin(std::unique_ptr<ImFusionFilePlugin>) for correct ownership semantics."
◆ canSave()
static bool canSave |
( |
const DataList & | data | ) |
|
|
static |
Determines if all Data items in the given data list can be saved into an ImFusion file
◆ setIgnoredDataComponentIds()
Sets the list of DataComponentIDs that should not be written/read.
- Note
- If this set consists of the single value "<ALL>", all DataComponents will be ignored.
◆ setSaveUnrestoredDataComponents()
void setSaveUnrestoredDataComponents |
( |
bool | enable | ) |
|
Sets whether DataComponents should be saved which couldn't be restored when the input dataset was loaded.
An ImFusionFile might contain DataComponents of plugins that are currently not loaded. In this case, the particular DataComponent cannot be restored and are instead saved inside the UnrestoredDataComponents component. If this component is present and this option enabled, the configuration of those components is written back to the resulting ImFusionFile.
This option is important for e.g. scripts that load a ImFusionFile, modify the data and save it again.
Unrestored component ids that are in ignoredDataComponentIds will not be saved, regardless of this option.
Enabled by default.
◆ open()
Open the file and retrieve block information, return true on success and at least one block present.
- Parameters
-
mode | Access mode 0 = read, 1 = write |
◆ beginBlockWrite()
Initialize plugin The file will open a new block and initialize the plugin with the file pointer.
The plugin can then write freely to the block.
- Parameters
-
p | plugin for writing to block |
d | data for determining save type |
- Returns
- true if successful, false otherwise
◆ endBlockWrite()
unsigned long long endBlockWrite |
( |
| ) |
|
Close block and disable plugin access.
- Returns
- number of bytes written to block, -1 on error
◆ beginBlockRead()
Initialize plugin The file will read the block header and point the plugin to the position after the header.
The plugin can then access the data in the block.
- Parameters
-
block | block number |
p | plugin for writing to block |
- Returns
- true if successful, false otherwise
◆ endBlockRead()
unsigned long long endBlockRead |
( |
| ) |
|
Close block and disable plugin access.
- Returns
- number of bytes written to block, -1 on error
◆ listBlocks()
int listBlocks |
( |
std::vector< unsigned int > & | blockTypeOut, |
|
|
std::vector< unsigned long long > & | blockSizeOut ) |
Return block information, available after having called open()
- Parameters
-
[out] | blockTypeOut | list of block types |
[out] | blockSizeOut | list of block sizes in bytes |
- Returns
- number of blocks or -1 on error
◆ load() [1/2]
Load the file and add content to provided data list, returns true on success If the given blockId is < 0, all data stored in the file will be loaded.
If the given blockId is >= 0, only the data in the given block will be loaded.
◆ getReadPosition()
Read position of the reading-head in the current input stream (i.e.
number of bytes that were read) Basically returns the tellg() of the underlying stream, and returns -1 if no valid stream is present. Only valid when using the buffer constructor This function is not supported on older MacOS systems
◆ load() [2/2]
bool load |
( |
DataList & | data, |
|
|
int | blockId = -1 ) |
- Deprecated
- "Use the std::optional<OwningDataList> load(int) overload instead for correct ownership semantics."
The documentation for this class was generated from the following file:
- ImFusion/Base/ImFusionFile.h