NDEVR
API Documentation

Writes and reads points of data to and from a plain-text file based on FactoryOptions. More...

Inheritance diagram for AsciiFactory:
[legend]
Collaboration diagram for AsciiFactory:
[legend]

Public Member Functions

 AsciiFactory ()
 Constructs a default AsciiFactory with standard settings.
 AsciiFactory (const StringView &name)
 Constructs an AsciiFactory with a specific name identifier.
bool canRead (const FactoryParameters &file) override
 Checks whether this factory can read the specified file.
FactoryOptions defaultReadOptions (const FactoryParameters &file) const override
 Returns the default read options for the given file.
FactoryOptions defaultWriteOptions (const FactoryParameters &file) const override
 Returns the default write options for the given file.
FactoryFeatures factoryFeatures (const FactoryParameters &file, bool is_import) const override
 Returns the feature set supported by this factory for the given file and direction.
Buffer< UUIDfilterModelsToExport (Buffer< UUID > models_to_check, const DesignObjectLookup *lookup, const FileFormat &export_format) const override
 Filters a set of model UUIDs to only those that can be exported in the given format.
virtual String getIcon (const File &file) override
 Returns the icon name associated with a given file.
virtual void getSupportedFormats (Buffer< FileFormat > &formats, bool is_read) override
 Populates the given buffer with file formats supported by this factory.
virtual void getSupportedFormats (Buffer< FileFormat > &formats, DesignObjectLookup *lookup, const Buffer< UUID > &models) override
 Populates the given buffer with file formats supported for specific models.
virtual void getSupportedFormatsByModelType (Buffer< FileFormat > &formats, bool is_read, const StringView &model_type) override
 Populates the given buffer with file formats supported for a specific model type.
virtual bool isRecursiveWrite (const FactoryParameters &params) const
 Checks whether writing should recurse into child models.
virtual bool readFile (FactoryParameters &parameters) override
 Reads an ASCII file and populates design objects from the parsed data.
virtual bool writeFile (FactoryParameters &parameters) override
 Writes design objects to an ASCII file.
virtual bool writeToString (String &output, const FactoryParameters &parameters, uint04 max_line_count)
 Writes design data to a string instead of a file, up to a maximum number of lines.
Public Member Functions inherited from IOFactory
 IOFactory (const StringView &factory_name)
 Constructs an IOFactory with the given factory name.
virtual ~IOFactory ()
 Virtual destructor.
virtual bool canRead (const File &file)
 Checks whether this factory can read the given file.
virtual bool canRead (const FileFormat &file)
 Checks whether this factory can read the given file format.
virtual bool canWrite (const FactoryParameters &file)
 Checks whether this factory can write using the given FactoryParameters.
virtual bool canWrite (const File &file)
 Checks whether this factory can write the given file.
virtual bool canWrite (const FileFormat &file)
 Checks whether this factory can write the given file format.
virtual bool determineExtension (const File &file, String &extension)
 Attempts to determine the file extension for the given file.
String factoryReadAppFeature () const
 Returns the application feature string required for read operations.
String factoryWriteAppFeature () const
 Returns the application feature string required for write operations.
void getSupportedFormats (Buffer< FileFormat > &formats)
 Populates the given buffer with all supported file formats (both read and write).
virtual void getSupportedFormats (Buffer< FileFormat > &formats, const File &file)
 Populates the given buffer with formats supported for the specified file.
virtual void getSupportedFormatsForExtension (Buffer< FileFormat > &formats, bool is_read, const StringView &extension)
 Populates the given buffer with formats matching a specific file extension.
virtual bool isAutoEnabled () const
 Checks whether this factory is automatically enabled without requiring a password.
virtual bool isFactoryEnabled (bool is_read) const
 Checks whether this factory is enabled for reading or writing.
const Stringname () const
 Returns the name of this factory.
Buffer< UUIDreadFileWithDefaultSettings (const File &file, DesignObjectLookup *lookup)
 Reads a file using default settings and returns the UUIDs of the created models.
Buffer< ScenereadScenesFromFile (const File &file)
 Reads scenes from a file and returns them as a buffer of Scene objects.
void throwIfNotEnabled (bool is_read)
 Throws an exception if the factory is not enabled for the given operation direction.
virtual bool updateFromFile (const FactoryParameters &file, const FactoryOptions &old_options)
 Updates the factory parameters from a file, comparing against old options.
bool writeScenesToFile (const File &file, const Buffer< Scene > &scene)
 Writes a buffer of scenes to a file.

Static Public Member Functions

static DesignParameter NoneParameter ()
 Returns a DesignParameter representing a "none" or empty column mapping.
static FileFormat PointFormat ()
 Returns the FileFormat descriptor for ASCII point files.
static ASCIIPointOptions ReadPoints (FactoryParameters &parameters, Model &root, Buffer< DesignParameter > &params)
 Reads point data from an ASCII file into a model and populates parameter mappings.
static void WriteHeaders (const AsciiOptions &options, String &string, bool add_new_line=true)
 Writes column header names to a string based on the given ASCII options.
Static Public Member Functions inherited from IOFactory
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.
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.
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.

Detailed Description

Writes and reads points of data to and from a plain-text file based on FactoryOptions.


AsciiFactory allows for defining multiple columns of data to be streamed out to a text file. It supports configurable column mappings, delimiters, and header rows, making it suitable for generic CSV, TXT, and other delimited point-cloud or tabular data formats.

See also
IOFactory, AsciiOptions, AsciiDeploymentFactory, AsciiMeasurementFactory

Definition at line 54 of file AsciiFactory.h.

Constructor & Destructor Documentation

◆ AsciiFactory() [1/2]

AsciiFactory::AsciiFactory ( )

Constructs a default AsciiFactory with standard settings.


◆ AsciiFactory() [2/2]

AsciiFactory::AsciiFactory ( const StringView & name)

Constructs an AsciiFactory with a specific name identifier.


Parameters
[in]nameThe name to assign to this factory instance.

References IOFactory::name().

Member Function Documentation

◆ canRead()

bool AsciiFactory::canRead ( const FactoryParameters & file)
overridevirtual

Checks whether this factory can read the specified file.


Parameters
[in]fileThe factory parameters describing the file to check.
Returns
True if the file can be read by this factory, false otherwise.

Reimplemented from IOFactory.

◆ defaultReadOptions()

FactoryOptions AsciiFactory::defaultReadOptions ( const FactoryParameters & file) const
overridevirtual

Returns the default read options for the given file.


Parameters
[in]fileThe factory parameters describing the file.
Returns
A FactoryOptions populated with default read settings.

Reimplemented from IOFactory.

◆ defaultWriteOptions()

FactoryOptions AsciiFactory::defaultWriteOptions ( const FactoryParameters & file) const
overridevirtual

Returns the default write options for the given file.


Parameters
[in]fileThe factory parameters describing the file.
Returns
A FactoryOptions populated with default write settings.

Reimplemented from IOFactory.

◆ factoryFeatures()

FactoryFeatures AsciiFactory::factoryFeatures ( const FactoryParameters & file,
bool is_import ) const
overridevirtual

Returns the feature set supported by this factory for the given file and direction.


Parameters
[in]fileThe factory parameters describing the file.
[in]is_importWhether the query is for import (true) or export (false).
Returns
A FactoryFeatures describing the capabilities for this file.

Implements IOFactory.

◆ filterModelsToExport()

Buffer< UUID > AsciiFactory::filterModelsToExport ( Buffer< UUID > models_to_check,
const DesignObjectLookup * lookup,
const FileFormat & export_format ) const
overridevirtual

Filters a set of model UUIDs to only those that can be exported in the given format.


Parameters
[in]models_to_checkThe UUIDs of the models to check.
[in]lookupThe design object lookup for querying model information.
[in]export_formatThe target export format to filter against.
Returns
A buffer containing only the UUIDs of models that are exportable in the given format.

Reimplemented from IOFactory.

◆ getIcon()

virtual String AsciiFactory::getIcon ( const File & file)
overridevirtual

Returns the icon name associated with a given file.


Parameters
[in]fileThe file to retrieve the icon for.
Returns
A String containing the icon resource name.

Reimplemented from IOFactory.

◆ getSupportedFormats() [1/2]

virtual void AsciiFactory::getSupportedFormats ( Buffer< FileFormat > & formats,
bool is_read )
overridevirtual

Populates the given buffer with file formats supported by this factory.


Parameters
[in]formatsThe buffer to populate with supported FileFormat entries.
[in]is_readWhether to return formats for reading (true) or writing (false).

Implements IOFactory.

◆ getSupportedFormats() [2/2]

virtual void AsciiFactory::getSupportedFormats ( Buffer< FileFormat > & formats,
DesignObjectLookup * lookup,
const Buffer< UUID > & models )
overridevirtual

Populates the given buffer with file formats supported for specific models.


Parameters
[in]formatsThe buffer to populate with supported FileFormat entries.
[in]lookupThe design object lookup used to query model information.
[in]modelsThe UUIDs of the models to check for supported export formats.

Reimplemented from IOFactory.

◆ getSupportedFormatsByModelType()

virtual void AsciiFactory::getSupportedFormatsByModelType ( Buffer< FileFormat > & formats,
bool is_read,
const StringView & model_type )
overridevirtual

Populates the given buffer with file formats supported for a specific model type.


Parameters
[in]formatsThe buffer to populate with supported FileFormat entries.
[in]is_readWhether to return formats for reading (true) or writing (false).
[in]model_typeThe model type string to filter supported formats by.

Reimplemented from IOFactory.

◆ isRecursiveWrite()

virtual bool AsciiFactory::isRecursiveWrite ( const FactoryParameters & params) const
virtual

Checks whether writing should recurse into child models.


Parameters
[in]paramsThe factory parameters describing the current write operation.
Returns
True if writing should recurse into child models, false otherwise.

◆ NoneParameter()

DesignParameter AsciiFactory::NoneParameter ( )
static

Returns a DesignParameter representing a "none" or empty column mapping.


Returns
A DesignParameter that indicates no data mapping.

◆ PointFormat()

FileFormat AsciiFactory::PointFormat ( )
static

Returns the FileFormat descriptor for ASCII point files.


Returns
A FileFormat representing the ASCII point file type.

◆ readFile()

virtual bool AsciiFactory::readFile ( FactoryParameters & parameters)
overridevirtual

Reads an ASCII file and populates design objects from the parsed data.


Parameters
[in]parametersThe factory parameters describing the file and read options.
Returns
True if the file was read successfully, false otherwise.

Implements IOFactory.

◆ ReadPoints()

ASCIIPointOptions AsciiFactory::ReadPoints ( FactoryParameters & parameters,
Model & root,
Buffer< DesignParameter > & params )
static

Reads point data from an ASCII file into a model and populates parameter mappings.


Parameters
[in]parametersThe factory parameters describing the file and read options.
[in]rootThe root model to populate with the read point data.
[in]paramsThe buffer of DesignParameter column mappings to populate.
Returns
An ASCIIPointOptions struct describing what data fields were found.

◆ writeFile()

virtual bool AsciiFactory::writeFile ( FactoryParameters & parameters)
overridevirtual

Writes design objects to an ASCII file.


Parameters
[in]parametersThe factory parameters describing the file and write options.
Returns
True if the file was written successfully, false otherwise.

Implements IOFactory.

◆ WriteHeaders()

void AsciiFactory::WriteHeaders ( const AsciiOptions & options,
String & string,
bool add_new_line = true )
static

Writes column header names to a string based on the given ASCII options.


Parameters
[in]optionsThe ASCII formatting options containing column definitions.
[in]stringThe string to append the header row to.
[in]add_new_lineWhether to append a newline character after the headers.

◆ writeToString()

virtual bool AsciiFactory::writeToString ( String & output,
const FactoryParameters & parameters,
uint04 max_line_count )
virtual

Writes design data to a string instead of a file, up to a maximum number of lines.


Parameters
[in]outputThe string to write the ASCII output into.
[in]parametersThe factory parameters describing the data and write options.
[in]max_line_countThe maximum number of lines to write.
Returns
True if the data was written successfully, false otherwise.

The documentation for this class was generated from the following file: