Add interface GetTypeIdName() and GetTypeIdHashCode() for Device Op (#533)

This commit is contained in:
Qianfeng
2022-12-15 08:34:02 +08:00
committed by GitHub
parent 9a1f2475e3
commit 10c72aced8
3 changed files with 220 additions and 0 deletions

View File

@@ -5,6 +5,7 @@
#include <cmath>
#include <string>
#include <sstream>
#include "ck/stream_config.hpp"
@@ -46,6 +47,17 @@ struct BaseOperator
virtual bool IsSupportedArgument(const BaseArgument*) { return false; }
virtual std::string GetTypeString() const { return ""; }
virtual std::string GetTypeIdName() const { return typeid(*this).name(); }
virtual std::string GetTypeIdHashCode() const
{
std::ostringstream oss;
oss << std::hex << typeid(*this).hash_code();
return oss.str();
};
virtual size_t GetWorkSpaceSize(const BaseArgument*) const { return 0; }
virtual void SetWorkSpacePointer(BaseArgument* p_arg, void* p_workspace) const