IOFormat IOF_v1.5.2_releaseENABLED_SECTIONS += INTERNAL
Loading...
Searching...
No Matches
ioformat Namespace Reference

Global namespace which contains all methods to encode/decode data from/into different resources (files, streams...) and some other helper classes and methods. More...

Classes

class  DecodingError
 
class  EncodingError
 
class  Logger
 
class  StackReader
 
class  UnsupportedFormat
 
class  UnsupportedOperation
 
class  Versioning
 

Functions

IOFORMAT_API bool init ()
 
IOFORMAT_API std::shared_ptr< iolink::View > openView (const std::string &pathFile)
 
IOFORMAT_API std::shared_ptr< iolink::View > openView (const std::string &path, const std::string &format)
 
IOFORMAT_API std::shared_ptr< iolink::View > openView (const iolink::Uri &uri)
 
IOFORMAT_API std::shared_ptr< iolink::View > openView (const iolink::Uri &uri, const std::string &format)
 
IOFORMAT_API std::shared_ptr< iolink::ImageView > readImage (const std::string &pathFile)
 
IOFORMAT_API std::shared_ptr< iolink::View > openView (std::shared_ptr< iolink::DataAccess > storage, const std::string &format)
 
IOFORMAT_API std::shared_ptr< iolink::Writer > openWriter (std::shared_ptr< iolink::View > view, const std::string &pathFile)
 
IOFORMAT_API std::shared_ptr< iolink::Writer > openWriter (std::shared_ptr< iolink::View > view, std::shared_ptr< iolink::DataAccess > dst, const std::string &format)
 
IOFORMAT_API std::shared_ptr< iolink::Writer > openWriter (std::shared_ptr< iolink::View > view, std::shared_ptr< iolink::DataAccess > dst, const std::string &format, const std::string &plugin)
 
IOFORMAT_API void writeView (std::shared_ptr< iolink::View > view, const std::string &pathFile)
 
IOFORMAT_API void writeView (std::shared_ptr< iolink::View > view, std::shared_ptr< iolink::DataAccess > dst, const std::string &format)
 
IOFORMAT_API std::string formatFromExtension (const std::string &extension)
 

Detailed Description

Global namespace which contains all methods to encode/decode data from/into different resources (files, streams...) and some other helper classes and methods.

Function Documentation

◆ formatFromExtension()

IOFORMAT_API std::string ioformat::formatFromExtension ( const std::string &  extension)

Helper to retrieve a format from an extension

Exetension are case insensitive, so for example "png" and "PNG" are the same for this function, and will return the same format.

Parameters
extensionstring which contains the extension to identify (without dot)
Returns
a string containing the format identifier corresponding to this extension

◆ init()

IOFORMAT_API bool ioformat::init ( )

Force IOFormat initialization. If not called, it will be initialized at the first call of any following methods. This method allows you to force the loading of all the IOFormat plugins. It may take some time, depending on the number of plugins to load.

Returns
true if at least one plugin was correctly loaded, false otherwise

◆ openView() [1/5]

IOFORMAT_API std::shared_ptr< iolink::View > ioformat::openView ( const iolink::Uri &  uri)

Access to data from Uniform Resource Identifier, using the extension of the path to determine format

Exceptions
iolink::Error

◆ openView() [2/5]

IOFORMAT_API std::shared_ptr< iolink::View > ioformat::openView ( const iolink::Uri &  uri,
const std::string &  format 
)

Access to data from Uniform Resource Identifier, using the given format to decode it

Exceptions
iolink::Error

◆ openView() [3/5]

IOFORMAT_API std::shared_ptr< iolink::View > ioformat::openView ( const std::string &  path,
const std::string &  format 
)

Open a View on the file at the given path, forcing to a specific format.

Parameters
pathThe path to the file
formatThe format to use to read the file
Exceptions
UnsupportedFormatWhen the extractor selected according to the format cannot read the file.

◆ openView() [4/5]

IOFORMAT_API std::shared_ptr< iolink::View > ioformat::openView ( const std::string &  pathFile)

Access to data from given file, using the extension of the file to determine format

Exceptions
iolink::Error
iolink::InvalidArgument
ioformat::UnsupportedFormat

◆ openView() [5/5]

IOFORMAT_API std::shared_ptr< iolink::View > ioformat::openView ( std::shared_ptr< iolink::DataAccess >  storage,
const std::string &  format 
)

Access to data from given storage, using the given format to decode it

Parameters
storageinput storage containing the data to decode with given format
formatfile format to apply on given stream to decode
Exceptions
iolink::Error
iolink::InvalidArgument
ioformat::UnsupportedFormat

◆ openWriter() [1/3]

IOFORMAT_API std::shared_ptr< iolink::Writer > ioformat::openWriter ( std::shared_ptr< iolink::View >  view,
const std::string &  pathFile 
)

Open a writer used to write an image view into a file.

Parameters
viewThe view that will be written
pathFilea path to the output file.
Returns
A writer ready to write the image into the file.

◆ openWriter() [2/3]

IOFORMAT_API std::shared_ptr< iolink::Writer > ioformat::openWriter ( std::shared_ptr< iolink::View >  view,
std::shared_ptr< iolink::DataAccess >  dst,
const std::string &  format 
)

Open a writer used to write an image view into an output stream.

Parameters
viewThe view that will be written
dstThe output stream where the encoded data will be written.
formatThe format to use to encode the image.
Returns
A writer ready to write the image into the output stream.

◆ openWriter() [3/3]

IOFORMAT_API std::shared_ptr< iolink::Writer > ioformat::openWriter ( std::shared_ptr< iolink::View >  view,
std::shared_ptr< iolink::DataAccess >  dst,
const std::string &  format,
const std::string &  plugin 
)

Open a writer used to write an image view into an output stream.

Parameters
viewThe view that will be written
dstThe output stream where the encoded data will be written.
formatThe format to use to encode the image.
pluginThe specific plugin to use.
Returns
A writer ready to write the image into the output stream.

◆ readImage()

IOFORMAT_API std::shared_ptr< iolink::ImageView > ioformat::readImage ( const std::string &  pathFile)

Access to data from given file, using the extension of the file to determine format. Image is fully loaded in memory. Limitation:

  • If file contains more than one image (like an image and its thumbnail), this method will only load first read frame.
  • If file contains a LOD image, resolution-0 image is read
  • If data is not an image or is not readable, an UnsupportedFormat exception is thrown
    Exceptions
    iolink::Error
    ioformat::UnsupportedFormat

◆ writeView() [1/2]

IOFORMAT_API void ioformat::writeView ( std::shared_ptr< iolink::View >  view,
const std::string &  pathFile 
)

Save a view into a file.

Parameters
viewThe view to save
pathFileThe path of the file where to save the image
Exceptions
iolink::ErrorWhen the image cannot be written

◆ writeView() [2/2]

IOFORMAT_API void ioformat::writeView ( std::shared_ptr< iolink::View >  view,
std::shared_ptr< iolink::DataAccess >  dst,
const std::string &  format 
)

Save a view into a storage.

Parameters
viewThe view to save
dstThe storage where to save the image
formatThe format in which the image will be encoded
Exceptions
iolink::ErrorWhen the image cannot be written