Skip to content

Dynamic Device Reference#

aes70::dynamic_device::device#

Class declaration#

The following describes the basic API of the device class. There are additional methods for advanced usage which are not documented here. Consult the source code for those.

namespace aes70::dynamic_device
{
    class device
    {
    public:
        device();

        /**
         * Reserve storage space for `n` objects.
         */
        void reserve(size_t n);

        /**
         * Returns the number of objects in this device.
         */
        size_t count_objects() const;

        /**
         * Returns the number of objects in this device.
         */
        size_t count_connections() const;

        /**
         * Return the root block.
         */
        std::shared_ptr<block> &get_root();

        /**
         * Create a child object in the root block. This calls
         * `aes70::dynamic_device::block::create_child` on the root block
         * object.
         */
        template <typename Type, typename... TN>
        std::shared_ptr<Type> create_child(TN &&...args);

        /**
         * Create a block object in the root block. This calls
         * `aes70::dynamic_device::block::create_block` on the root block
         * object.
         */
        std::shared_ptr<RootBlockType> create_block(const std::string &role);

        /**
         * Removes a child from the root block.
         */
        std::shared_ptr<aes70::device::object> remove(
            std::shared_ptr<aes70::device::object> child);

        /**
          * Create a manager object.
          */
        template <typename Type, typename... TN>
        observer_ptr<Type> create_manager(TN &&...args);

        /**
         * Cork all connections.
         */
        void cork();

        /**
         * Uncork all connections.
         */
        void uncork() override;

        /**
         * Returns a cork handle.
         */
        auto cork_handle();

        /**
         * Close all AES70 connections to this device.
         */
        void close() override
    }
}

aes70::dynamic_device::block#

The following describes the basic API of the block class. There are additional methods for advanced usage which are not documented here. Consult the source code for those.

namespace aes70::dynamic_device
{
    class block
    {
    public:
        block(const std::string &role);

        /**
         * Returns the children of this block.
         */
        const std::vector<std::shared_ptr<aes70::device::object>>
            &get_members() const;

        /**
         * Increases the capacity of the internal vector which holds the children
         * of this block.
         */
        void reserve(size_t n);

        /**
         * Replace the member in this block.
         */
        std::vector<std::shared_ptr<aes70::device::object>> set_members(
            std::vector<std::shared_ptr<aes70::device::object>> &&_members);

        /**
         * Remove all object in this block.
         */
        void clear();

        /**
         * Create a new child block.
         */
        std::shared_ptr<block> create_block(
            const std::string &role);


        /**
         * Create a new child object.
         * @param args - The constructor arguments passed to Type
         * @tparam Type - The type of object to construct. Needs to be a subclass
         *        of aes70::device::object.
         */
        template <typename Type, typename... TN>
        observer_ptr<Type> create_child(TN &&...args);
    };
}

aes70::dynamic_device::linear_device#

linear_device has the same methods as device. The difference is that linear_device stores objects for lookup in a vector.