junrushao commented on code in PR #36:
URL: https://github.com/apache/tvm-ffi/pull/36#discussion_r2401047963
##########
include/tvm/ffi/reflection/registry.h:
##########
@@ -25,23 +25,74 @@
#include <tvm/ffi/any.h>
#include <tvm/ffi/c_api.h>
+#include <tvm/ffi/container/map.h>
+#include <tvm/ffi/container/variant.h>
#include <tvm/ffi/function.h>
+#include <tvm/ffi/optional.h>
+#include <tvm/ffi/string.h>
#include <tvm/ffi/type_traits.h>
+#include <optional>
+#include <sstream>
#include <string>
#include <utility>
+#include <vector>
namespace tvm {
namespace ffi {
/*! \brief Reflection namespace */
namespace reflection {
-
/*!
* \brief Trait that can be used to set field info
* \sa DefaultValue, AttachFieldFlag
*/
struct FieldInfoTrait {};
+/*! \brief User-supplied metadata attached to a field or a method */
+class Metadata : public FieldInfoTrait {
+ public:
+ /*!
+ * \brief Constructor
+ * \param dict The initial dictionary
+ */
+ explicit Metadata(std::initializer_list<std::pair<String, Any>> dict) :
dict_(dict) {}
+ /*!
+ * \brief Merge this Metadata into the given metadata dictionary
+ * \param info The field info
+ * \param data The metadata to be merged into
+ */
+ TVM_FFI_INLINE void Apply(TVMFFIFieldInfo* info, Metadata* data) {
Review Comment:
It means we will need to define two builders:
- FieldInfoBuilder
- MethodInfoIBuilder
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]