class cogs::io::DataBlockImporter — HIRO 0.7.0 documentation

# class cogs::io::DataBlockImporter

## Overview

Enables reading of cogs structures into files. More…

    #include <DataBlockImporter.h>

    class DataBlockImporter {
    public:
        // structs

        struct DataBlockInfo;

        // construction

        DataBlockImporter();
        DataBlockImporter(const std::shared_ptr<DataBlockManager>& datablock_manager);
        DataBlockImporter(const DataBlockImporter&);
        DataBlockImporter(const DataBlockImporter&&);

        // methods

        DataBlockImporter& operator=(const DataBlockImporter&);
        DataBlockImporter& operator=(const DataBlockImporter&&);
        bool OpenFile(const std::string& filename);
        void CloseFile();
        bool IsFileOpen() const;
        size_t GetPointCloudCount() const;
        bool ReadPointCloud(cogs::PointCloud& out_cloud, DataBlockIndex id = 0);
        size_t GetScanCount() const;
        bool ReadScan(cogs::Scan& out_scan, DataBlockIndex id = 0);
        size_t GetMeshCount() const;
        bool ReadMesh(cogs::Mesh& out_mesh, DataBlockIndex id = 0);
    };

## Detailed Documentation

Enables reading of cogs structures into files.

When file is open, only header is fetched, containing information about data available in file and it counts. When user gets specific object, it is imported directly from file. When file is closed, no data can be obtained.

By default, exporter supports only predefined data blocks, but can be altered to support also custom data blocks, when user-defined DataBlockManager is provided during class construction.

For more information about cogs file io system, see page cogs-file-format.

### Construction

    DataBlockImporter()

Creates importer with default DataBlockManager object.

    DataBlockImporter(const std::shared_ptr<DataBlockManager>& datablock_manager)

Creates importer with custom DataBlockManager object.

### Methods

    bool OpenFile(const std::string& filename)

Opens file for reading and fetches file header information.

    void CloseFile()

Closes currently opened file, disabling getters.

    bool IsFileOpen() const

Checks if a file is currently open.

    size_t GetPointCloudCount() const

Returns number of available all point cloud objects.

    bool ReadPointCloud(cogs::PointCloud& out_cloud, DataBlockIndex id = 0)

Loads object with specified index from file. Returns success.

    size_t GetScanCount() const

Returns number of available point cloud objects with scan information.

    bool ReadScan(cogs::Scan& out_scan, DataBlockIndex id = 0)

Loads object with specified index from file. Returns success.

    size_t GetMeshCount() const

Returns number of available mesh objects.

    bool ReadMesh(cogs::Mesh& out_mesh, DataBlockIndex id = 0)

Loads object with specified index from file. Returns success.