Back to Aurora Vision Library website

You are here: Start » Function Reference » Serialization » SaveObject

SaveObject


Header: STD.h
Namespace: avs
Module: FoundationLite

Saves an AVL object to a file.

Syntax

void avs::SaveObject
(
	const T& inObject,
	const atl::String& inTypeName,
	const atl::String& inFile,
	avl::StreamMode::Type inStreamMode,
	bool inIgnoreErrors,
	int inCompressionLevel
)

Parameters

Name Type Default Description
Input value inObject const T& Object to save.
Input value inTypeName const String& Type of object to save.
Input value inFile const String& Destination file path.
Input value inStreamMode StreamMode::Type
Input value inIgnoreErrors bool
Input value inCompressionLevel int

Remarks

Stream Modes
It is recommended to use the Binary stream mode for saving an object to a file as it is more efficient and works with all data types. The Text mode is more human-friendly, so it should be chosen if humans are expected to read or modify the file.
File Naming Conventions
It is recommended to name the files with the following double file extension: .<typeName>.avdata, where <typeName> is the instance type.
Working with Saved Objects
There are three ways to load the saved objects in Aurora Vision Studio:
  • using the LoadObject filter with the same instance type,
  • using the command Load from File... from a filter input's context menu in the Program Editor (only binary files),
  • using the command Link to a File... from a filter input's context menu in the Program Editor (only binary files).
Possible Errors
  • [Io Error] Unable to open file for writing in SaveObject.
    You may have no write permission for the current working directory. If the project has not been saved yet, the working directory is typically in C:\Program Files and this message appears. Save the project to solve the problem.

See Also