#pragma once #include "IComplexCommandCreator.h" #include "ComplexCommandCreateData.h" #include namespace Incart::Usb { template class ComplexDataCommandCreator final : public IComplexCommandCreator { protected: std::tuple m_args; public: ComplexDataCommandCreator(TArgs... args) : m_args(std::forward(args)...) { } std::shared_ptr create(std::shared_ptr inputData) override { std::shared_ptr> data = std::dynamic_pointer_cast>(inputData); return createCommand(data->data, std::make_index_sequence{}); } private: template std::shared_ptr createCommand(TData data, std::index_sequence) { return std::make_shared(data, std::get(m_args)...); } }; } // namespace Incart::Usb