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

# class cogs::io::DataBlockManager

## Overview

Container class for specific data block factory objects. More…

    #include <DataBlockManager.h>

    class DataBlockManager {
    public:
        // fields

        static const DataBlockType POINTCLOUD_DTB_TYPE;
        static const DataBlockType SCAN_DTB_TYPE;
        static const DataBlockType MESH_DTB_TYPE;
        static const DataBlockType TRIANGULATION_DTB_TYPE;

        // construction

        DataBlockManager();
        DataBlockManager(const DataBlockManager&);
        DataBlockManager(DataBlockManager&&);
        ~DataBlockManager();

        // methods

        DataBlockManager& operator=(const DataBlockManager&);
        DataBlockManager& operator=(DataBlockManager&&);
        bool HasFactoryFor(const DataBlockType& datablock_type);
        std::unique_ptr<DataBlock> Create(const DataBlockType& datablock_type, DataBlockIndex index);

        template <typename T>
        void AddFactoryFor(const DataBlockType& datablock_type);
    };

## Detailed Documentation

Container class for specific data block factory objects.

Used for registering new data block factories and creation of data blocks.

By default class contains predefined factories for data blocks, but can be extended to support custom, user defined ones.

### Fields

    static const DataBlockType POINTCLOUD_DTB_TYPE

Identifier of predefined point cloud data block class.

    static const DataBlockType SCAN_DTB_TYPE

Identifier of predefined scan data block class.

    static const DataBlockType MESH_DTB_TYPE

Identifier of predefined mesh data block class.

    static const DataBlockType TRIANGULATION_DTB_TYPE

Identifier of predefined triangulation data block class.

### Construction

    DataBlockManager()

Creates manager with predefined data block factories.

### Methods

    bool HasFactoryFor(const DataBlockType& datablock_type)

Checks if current instance has a factory for defined datablock_type already.

    std::unique_ptr<DataBlock> Create(const DataBlockType& datablock_type, DataBlockIndex index)

Creates new instance of data block using corresponding factory.

    template <typename T>
    void AddFactoryFor(const DataBlockType& datablock_type)

Registers new factory type T for the defined datablock_type.

When the factory of specified type does not exist, method logs message and does nothing.