/*
 * SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 * SPDX-License-Identifier: MIT
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 */

 #ifndef __TENSORRT_HPP__
 #define __TENSORRT_HPP__
 
 #include <memory>
 #include <string>
 #include <vector>
 #include <unordered_map>
 
 namespace TensorRT10 {
 
 enum class DType : int { FLOAT = 0, HALF = 1, INT8 = 2, INT32 = 3, BOOL = 4, UINT8 = 5, FP8 = 6, BF16 = 7, INT64 = 8, INT4 = 9, NONE=-1 };
 
 class Engine {
  public:
   virtual ~Engine() = default;
   virtual bool forward(const std::unordered_map<std::string, const void *> &bindings, void *stream = nullptr, void *input_consum_event = nullptr) = 0;
   virtual int index(const std::string &name) = 0;
   virtual std::vector<int> run_dims(const std::string &name) = 0;
   virtual std::vector<int> run_dims(int ibinding) = 0;
   virtual std::vector<int> static_dims(const std::string &name) = 0;
   virtual std::vector<int> static_dims(int ibinding) = 0;
   virtual int numel(const std::string &name) = 0;
   virtual int numel(int ibinding) = 0;
   virtual int num_bindings() = 0;
   virtual bool is_input(int ibinding) = 0;
   virtual bool is_input(const std::string &name) = 0;
   virtual bool set_run_dims(const std::string &name, const std::vector<int> &dims) = 0;
   virtual bool set_run_dims(int ibinding, const std::vector<int> &dims) = 0;
   virtual DType dtype(const std::string &name) = 0;
   virtual DType dtype(int ibinding) = 0;
   virtual bool has_dynamic_dim() = 0;
   virtual void print(const char *name = "TensorRT-Engine") = 0;
 };
 
 std::shared_ptr<Engine> load(const std::string &file);
 };  // namespace TensorRT
 
 #endif  // __TENSORRT_HPP__