34#include <NDEVR/SoftwareService.h>
35#include <NDEVR/FactoryOptions.h>
36#include <NDEVR/Model.h>
37#include <NDEVR/Scene.h>
38#include <NDEVR/File.h>
39#include <NDEVR/FileFormat.h>
250 friend class ModelFactory;
The equivelent of std::vector but with a bit more control.
Used with InfoPipe to signal that the process can be cancelled.
A core class where all Design Objects including models, materials, and geometries are stored.
A hash-based key-value store, useful for quick associative lookups.
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
Allows IOFactories to report what features they support to make the import/export dialogs easier to s...
User-defined options that define preferences for importing and exporting using IOFactory objects.
Logic for reading or writing to a file as well as navigating filesystems or other common file operati...
virtual void getSupportedFormats(Buffer< FileFormat > &formats, const File &file)
Populates the given buffer with formats supported for the specified file.
virtual void getSupportedFormats(Buffer< FileFormat > &formats, bool is_read)=0
Populates the given buffer with supported file formats for reading or writing.
void throwIfNotEnabled(bool is_read)
Throws an exception if the factory is not enabled for the given operation direction.
virtual void getSupportedFormatsForExtension(Buffer< FileFormat > &formats, bool is_read, const StringView &extension)
Populates the given buffer with formats matching a specific file extension.
virtual FactoryOptions defaultWriteOptions(const FactoryParameters &file) const
Returns the default write options for the given factory parameters.
virtual bool isAutoEnabled() const
Checks whether this factory is automatically enabled without requiring a password.
Buffer< Scene > readScenesFromFile(const File &file)
Reads scenes from a file and returns them as a buffer of Scene objects.
virtual void getSupportedFormats(Buffer< FileFormat > &formats, DesignObjectLookup *lookup, const Buffer< UUID > &models)
Populates the given buffer with formats supported for writing the specified models.
virtual bool canRead(const File &file)
Checks whether this factory can read the given file.
virtual bool updateFromFile(const FactoryParameters &file, const FactoryOptions &old_options)
Updates the factory parameters from a file, comparing against old options.
static void EnableExtension(const StringView &extension, const StringView &read_password, const StringView &write_password)
Enables a specific file extension with the given read and write passwords.
bool writeScenesToFile(const File &file, const Buffer< Scene > &scene)
Writes a buffer of scenes to a file.
IOFactory(const StringView &factory_name)
Constructs an IOFactory with the given factory name.
virtual bool canWrite(const File &file)
Checks whether this factory can write the given file.
virtual String getIcon(const File &file)
Returns the icon name associated with the given file type.
virtual bool readFile(FactoryParameters &file)=0
Reads data from a file into the design object hierarchy.
virtual ~IOFactory()
Virtual destructor.
virtual void getSupportedFormatsByModelType(Buffer< FileFormat > &formats, bool is_read, const StringView &model_type)
Populates the given buffer with formats matching a specific model type.
static void EnableFactory(const StringView &factory, const StringView &read_password, const StringView &write_password)
Enables a factory by name with the given read and write passwords.
void getSupportedFormats(Buffer< FileFormat > &formats)
Populates the given buffer with all supported file formats (both read and write).
virtual bool determineExtension(const File &file, String &extension)
Attempts to determine the file extension for the given file.
const String & name() const
Returns the name of this factory.
virtual Buffer< UUID > filterModelsToExport(Buffer< UUID > models_to_check, const DesignObjectLookup *lookup, const FileFormat &export_format) const
Filters a list of model UUIDs to only those that can be exported in the given format.
Buffer< UUID > readFileWithDefaultSettings(const File &file, DesignObjectLookup *lookup)
Reads a file using default settings and returns the UUIDs of the created models.
virtual bool writeFile(FactoryParameters &file)=0
Writes data from the design object hierarchy to a file.
virtual bool canWrite(const FileFormat &file)
Checks whether this factory can write the given file format.
virtual bool isFactoryEnabled(bool is_read) const
Checks whether this factory is enabled for reading or writing.
static void EnableFactory(IOFactory *factory, const StringView &read_password, const StringView &write_password)
Registers an IOFactory instance with the system, enabling it for read and/or write.
virtual bool canRead(const FactoryParameters &file)
Checks whether this factory can read using the given FactoryParameters.
virtual bool canWrite(const FactoryParameters &file)
Checks whether this factory can write using the given FactoryParameters.
String factoryWriteAppFeature() const
Returns the application feature string required for write operations.
virtual FactoryFeatures factoryFeatures(const FactoryParameters &file, bool is_import) const =0
Returns the features and configurable options for this factory given the parameters.
String factoryReadAppFeature() const
Returns the application feature string required for read operations.
virtual FactoryOptions defaultReadOptions(const FactoryParameters &file) const
Returns the default read options for the given factory parameters.
virtual bool canRead(const FileFormat &file)
Checks whether this factory can read the given file format.
A light-weight base class for Log that allows processes to update, without the need for additional in...
Serves as the primary program interface for processes to report issues and allows any number of LogSt...
A core class that represents a node on model hierarchy.
Used with InfoPipe to signal that the system will be using progress.
Base interface for services that extend or modify software behavior through modules.
The core String View class for the NDEVR API.
The core String class for the NDEVR API.
Manages temporary file paths during an IOFactory write operation, ensuring safe writes by writing to ...
TemporaryIOFileLocker(FactoryParameters ¶ms)
Constructs the locker, replacing file paths in params with temporary paths.
Buffer< std::pair< File, File > > writeToActual()
Moves all temporary files to their actual (final) destinations.
FactoryParameters & m_params
Reference to the FactoryParameters being managed.
Dictionary< String, FileRequest > m_original_requests
The original file requests before temporary path substitution.
~TemporaryIOFileLocker()
Destructor.
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
The primary namespace for the NDEVR SDK.
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
A container of input information that is to be filled with output information by an IOFactory.
const FileFormat & format(const StringView &name="default") const
The format to read/write.
Buffer< FileFactoryWarning > warnings
Any warnings to show to the user after the operation.
FactoryOptions options
All read/write options including special parameters.
CancelInfo cancel
Provides cancellation support for the operation.
void setInfoPipe(InfoPipe *pipe)
Sets the info pipe for streaming log messages or cancelling the operation.
Buffer< UUID > cameras
UUIDs of cameras created or targeted by the operation.
FactoryParameters & operator=(const FactoryParameters ¶ms)
Copy assignment operator.
bool shouldWriteModel(const Model &model) const
Checks whether a given model is in the list of models to be written.
ProgressInfo progress
Tracks progress of the read/write operation.
Buffer< DynamicPointer< FindFileFunction > > missing_files
Files that could not be found and require user input.
void addWarning(const FileFactoryWarning &warning)
Adds a warning that will be shown to the user when the IOFactory operation is completed.
FactoryParameters(const FactoryParameters ¶ms)
Copy constructor.
Buffer< UUID > models
UUIDs of models created or targeted by the operation.
TranslatedString custom_message
An optional custom message to display during the operation.
FactoryParameters(const FileRequest &request, const StringView &name="default")
Constructs FactoryParameters from a FileRequest and optional name.
void addMissingFile(const DynamicPointer< FindFileFunction > &file)
Registers a missing file that the user needs to locate before the operation can complete.
String custom_message_icon
An optional icon name for the custom message.
Dictionary< String, FileRequest > requests
Maps name keys to FileRequest objects for multi-file formats.
const File & file(const StringView &name="default") const
The address for reading/writing.
FileFormat & format(const StringView &name="default")
The format to read/write.
std::function< bool(UUID library_id, Model &model)> assign_to_library
Callback to assign a model to a specific library by UUID.
FactoryParameters(const File &file, const FileFormat &format, const StringView &name="default")
Constructs FactoryParameters from a file, format, and optional name.
DesignObjectLookup * lookup
The design object lookup used to resolve models and objects.
Allows the software to display a warning to the end user about a problem encountered during an IOFact...
FileFactoryWarning(const TranslatedString &title, const TranslatedString &message)
Constructs a warning with a title and descriptive message.
FileFactoryWarning(const TranslatedString &title, const File &file, uint04 line_number=Constant< uint04 >::Invalid)
Constructs a warning referencing a specific file and optional line number.
TranslatedString message
The descriptive message body of the warning.
TranslatedString title
The title or heading of the warning.
A FileRequest bundles format data as well as a particular file.
TranslatedString message
The descriptive message explaining which file is needed.
File default_file
The default file path suggestion for the user.
TranslatedString title
The title shown to the user when requesting the file.
Buffer< FileFormat > formats
The acceptable file formats for the missing file.
FindFileFunction(const TranslatedString &title, const TranslatedString &message, const std::function< void(const File &f)> &file)
Constructs a FindFileFunction with a title, message, and callback for when the file is found.
std::function< void(const File &f)> callback
The callback invoked when the user provides the file.