diff --git a/cpp/core/utils/Print.h b/cpp/core/utils/Print.h index 33e75ac4357f8..cf55c42ce1332 100644 --- a/cpp/core/utils/Print.h +++ b/cpp/core/utils/Print.h @@ -26,186 +26,6 @@ namespace gluten { // the token `ToString` means the method of `ToString()` // the token `2String` means the method of `toString()` -template -static inline void print(const T& t) { - std::cout << t; -} - -template -static inline void printLf(const T& t) { - std::cout << t << std::endl; -} - -template -static inline void print(const A& a, const B& b) { - std::cout << a << b; -} - -template -static inline void printLf(const A& a, const B& b) { - std::cout << a << b << std::endl; -} - -template -static inline void printSplit(const A& a, const B& b, const std::string split = ": ") { - std::cout << a << split << b; -} - -template -static inline void printSplitLf(const A& a, const B& b, const std::string split = ": ") { - std::cout << a << split << b << std::endl; -} - -template -static inline void printEq(const A& a, const B& b) { - std::cout << a << " = " << b; -} - -template -static inline void printEqlf(const A& a, const B& b) { - std::cout << a << " = " << b << std::endl; -} - -template -static inline void printVs(const A& a, const B& b) { - std::cout << a << " vs " << b; -} - -template -static inline void printVslf(const A& a, const B& b) { - std::cout << a << " vs " << b << std::endl; -} - -template -static inline void printElement(const E& e, bool first = false) { - if (!first) { - std::cout << ", "; - } - std::cout << e; -} - -template -static inline void printRange(ITERATOR begin, ITERATOR end) { - std::cout << "{ "; - for (; begin != end; ++begin) { - std::cout << *begin << " "; - } - std::cout << "}" << std::endl; -} - -template -static inline void printContainer(const C& c, const std::string& containerName = "") { - if (!containerName.empty()) { - std::cout << containerName << " "; - } - std::cout << "size = " << c.size() << " "; - PrintRange(c.begin(), c.end()); -} - -template -static inline void printAB2String(const A& a, const B& b) { - std::cout << a << " = " << b.toString() << std::endl; -} - -template -static inline void print2String(const T& t, const std::string& prefix = "") { - if (!prefix.empty()) { - std::cout << prefix << ": "; - } - std::cout << t.toString() << std::endl; -} - -template -static inline void printRangeToString(ITERATOR begin, ITERATOR end) { - std::cout << "{ "; - for (; begin != end; ++begin) { - std::cout << begin->ToString() << " "; - } - std::cout << "}"; -} - -template -static inline void printRange2String(ITERATOR begin, ITERATOR end) { - std::cout << "{ "; - for (; begin != end; ++begin) { - std::cout << begin->toString() << " "; - } - std::cout << "}"; -} - -template -static inline void printContainerToString(const C& c, const std::string& containerName = "") { - if (!containerName.empty()) { - std::cout << containerName << " "; - } - std::cout << "size = " << c.size() << std::endl; - PrintRangeToString(c.begin(), c.end()); -} - -template -static inline void printContainer2String(const C& c, const std::string& containerName = "") { - if (!containerName.empty()) { - std::cout << containerName << " "; - } - std::cout << "size = " << c.size() << std::endl; - PrintRange2String(c.begin(), c.end()); -} - -template -static inline void printVectorToString(const C& c, const std::string& containerName = "") { - std::cout << containerName << " = {"; - for (auto& x : c) { - std::cout << " " << x->ToString(); - } - std::cout << " }" << std::endl; -} - -template -static inline void printVector2String(const C& c, const std::string& containerName = "") { - std::cout << containerName << " = {"; - for (auto& x : c) { - std::cout << " " << x->toString(); - } - std::cout << " }" << std::endl; -} - -template -static inline void printVectorMapping(const V& v, const std::string& vectorName = "") { - std::cout << vectorName << "\n{\n"; - for (size_t i = 0; i < v.size(); ++i) { - print("\t"); - PrintSplitLF(i, v[i], " -> "); - } - std::cout << "}" << std::endl; -} - -template -static inline void printVectorRange(const V& v, unsigned int begin, unsigned int end) { - std::cout << "{"; - auto index = begin; - for (; index != end; ++index) { - PrintElement(v[index], index == begin); - } - - std::cout << "}" << std::endl; -} - -#define PRINT(a) PrintSplit(#a, a) -#define PRINTLF(a) PrintSplitLF(#a, a) - -#define PRINT_FUNCTION_NAME() std::cout << __func__ << std::endl; -#define PRINT_FUNCTION_SPLIT_LINE() std::cout << "===== " << __func__ << " ======" << std::endl; - -#define PRINT_CONTAINER(c) PrintContainer(c, #c) - -#define PRINT_CONTAINER_TO_STRING(v) PrintContainerToString(v, #v) -#define PRINT_CONTAINER_2_STRING(v) PrintContainer2String(v, #v) - -#define PRINT_VECTOR_TO_STRING(v) PrintVectorToString(v, #v) -#define PRINT_VECTOR_2_STRING(v) PrintVector2String(v, #v) - -#define PRINT_VECTOR_MAPPING(v) PrintVectorMapping(v, #v) - template static inline void Print(const T& t) {}