Loading Unstructured_mesh/Unstructured_mesh.pro +1 −0 Original line number Original line Diff line number Diff line Loading @@ -14,6 +14,7 @@ HEADERS += \ ../src/Debug/HTMLLogger.h \ ../src/Debug/HTMLLogger.h \ ../src/Debug/VariableExport.h \ ../src/Debug/VariableExport.h \ ../src/NumericStaticArray/InlineArrayOperations.h \ ../src/NumericStaticArray/InlineArrayOperations.h \ ../src/Traits/CustomTypeTraits.h \ ../src/Traits/MemberApproach/MemberApproach.h \ ../src/Traits/MemberApproach/MemberApproach.h \ ../src/UnstructuredMesh/MeshDataContainer/MeshDataContainer.h \ ../src/UnstructuredMesh/MeshDataContainer/MeshDataContainer.h \ ../src/UnstructuredMesh/MeshDataContainer/MeshDataIO/VTKMeshDataReader.h \ ../src/UnstructuredMesh/MeshDataContainer/MeshDataIO/VTKMeshDataReader.h \ Loading src/Debug/CSVLogger.h +2 −2 Original line number Original line Diff line number Diff line Loading @@ -91,7 +91,7 @@ public: if (!logFile) create(logFileName.c_str()); if (!logFile) create(logFileName.c_str()); (*logFile) << groupIndex << ';' << line << ";\"" << cppFile << "\";\"" << name << "\";"; (*logFile) << groupIndex << ';' << line << ";\"" << cppFile << "\";\"" << name << "\";"; VariableExport::_writeWar(*logFile,value); VariableExport::exportVariable(*logFile,value); (*logFile) << "\n"; (*logFile) << "\n"; writeVar(line, cppFile, rest...); writeVar(line, cppFile, rest...); } } Loading @@ -104,7 +104,7 @@ public: if (!logFile) create(logFileName.c_str()); if (!logFile) create(logFileName.c_str()); (*logFile) << groupIndex << ';' << line << ";\"" << cppFile << "\";\"" << name << "\";"; (*logFile) << groupIndex << ';' << line << ";\"" << cppFile << "\";\"" << name << "\";"; VariableExport::_writeWar(*logFile,value); VariableExport::exportVariable(*logFile,value); (*logFile) << "\n"; (*logFile) << "\n"; groupIndex++; groupIndex++; Loading src/Debug/ConsoleLogger.h +2 −2 Original line number Original line Diff line number Diff line Loading @@ -44,7 +44,7 @@ public: std::cerr << "\033[0m\n"; std::cerr << "\033[0m\n"; #else #else std::cerr << "In file " << cppFile << " at line " << line << " variable " << name << " has value of "; std::cerr << "In file " << cppFile << " at line " << line << " variable " << name << " has value of "; VariableExport::_writeWar(std::cerr, value); VariableExport::exportVariable(std::cerr, value); std::cerr << "\n"; std::cerr << "\n"; #endif #endif } } Loading @@ -58,7 +58,7 @@ public: std::cerr << "\033[0m\n"; std::cerr << "\033[0m\n"; #else #else std::cerr << "In file " << cppFile << " at line " << line << " variable " << name << " has value of "; std::cerr << "In file " << cppFile << " at line " << line << " variable " << name << " has value of "; VariableExport::_writeWar(std::cerr, value); VariableExport::exportVariable(std::cerr, value); std::cerr << "\n"; std::cerr << "\n"; #endif #endif } } Loading src/Debug/HTMLLogger.h +2 −2 Original line number Original line Diff line number Diff line Loading @@ -93,7 +93,7 @@ public: if (!logFile) create(logFileName.c_str()); if (!logFile) create(logFileName.c_str()); (*logFile) << "[" << groupIndex << ", " << line << ", '" << cppFile << "', '" << name << "', "; (*logFile) << "[" << groupIndex << ", " << line << ", '" << cppFile << "', '" << name << "', "; VariableExport::_writeWar(*logFile,value); VariableExport::exportVariable(*logFile,value); (*logFile) << "],\n"; (*logFile) << "],\n"; writeVar(line, cppFile, rest...); writeVar(line, cppFile, rest...); } } Loading @@ -106,7 +106,7 @@ public: if (!logFile) create(logFileName.c_str()); if (!logFile) create(logFileName.c_str()); (*logFile) << "[" << groupIndex << ", " << line << ", '" << cppFile << "', '" << name << "', "; (*logFile) << "[" << groupIndex << ", " << line << ", '" << cppFile << "', '" << name << "', "; VariableExport::_writeWar(*logFile,value); VariableExport::exportVariable(*logFile,value); (*logFile) << "],\n"; (*logFile) << "],\n"; groupIndex++; groupIndex++; Loading src/Debug/VariableExport.h +31 −112 Original line number Original line Diff line number Diff line Loading @@ -4,100 +4,19 @@ #include <fstream> #include <fstream> #include <string> #include <string> #include "../Traits/Traits.h" #include "../Traits/Traits.h" #include "../Traits/CustomTypeTraits.h" namespace Detail { namespace VariableExport { void exportVariable(std::ostream& ost, ...) template <typename T1, typename T2 = void> struct __is_exportable : public std::integral_constant<bool, false> { }; template <typename T1> struct __is_exportable<T1, typename std::enable_if<std::is_class< typename std::remove_reference<decltype(std::cerr << std::declval<const T1&>())>::type >::value>::type> : public std::integral_constant<bool, true> { }; template <typename T1> struct is_exportable : public __is_exportable<T1> {}; template <typename T1, typename T2 = void> struct __is_iterable : public std::integral_constant<bool, false> { }; template <typename T1> struct __is_iterable<T1, typename std::enable_if<!std::is_same< decltype(std::declval<const T1&>().begin()), void >::value>::type> : public std::integral_constant<bool, true> { }; template <typename T1> struct is_iterable : public __is_iterable<T1> {}; template <typename T1, typename T2 = void> struct __is_indexable : public std::integral_constant<bool, false> { }; template <typename T1> struct __is_indexable<T1, typename std::enable_if< !std::is_same< decltype (std::declval<const T1&>()[0]), void >::value && !std::is_same< decltype (std::declval<const T1&>().size()), void >::value >::type> : public std::integral_constant<bool, true> { }; template <typename T1> struct is_indexable : public __is_indexable<T1> {}; template <typename T1, typename VOID = void> struct __has_default_traits : public std::integral_constant<bool, false> { }; template <typename T1> struct __has_default_traits< T1, typename std::enable_if< Traits<T1>::is_specialized >::type > : public std::integral_constant<bool, true> { }; template<typename T> struct has_default_traits : __has_default_traits<T> { }; } struct VariableExport { static void _writeWar(std::ostream& ost, ...) { { ost << "\"variable is not exportable\"" << std::endl; ost << "\"variable is not exportable\"" << std::endl; } } template<typename T> template<typename T> static auto _writeWar(std::ostream& ost, const T& b) auto exportVariable(std::ostream& ost, const T& b) -> typename std::enable_if<std::is_class< -> typename std::enable_if<std::is_class< typename std::remove_reference<decltype(ost << b)>::type>::value && typename std::remove_reference<decltype(ost << b)>::type>::value && !std::is_same<T, bool>::value && !std::is_same<T, bool>::value && Loading @@ -111,51 +30,51 @@ struct VariableExport { static void _writeWar(std::ostream& ost, const bool& b) void exportVariable(std::ostream& ost, const bool& b) { { ost << (b == true ? "true" : "false"); ost << (b == true ? "true" : "false"); } } static void _writeWar(std::ostream& ost, const std::string& str) void exportVariable(std::ostream& ost, const std::string& str) { { ost << '"' << str << '"'; ost << '"' << str << '"'; } } static void _writeWar(std::ostream& ost, const char* str) void exportVariable(std::ostream& ost, const char* str) { { ost << '"' << str << '"'; ost << '"' << str << '"'; } } static void _writeWar(std::ostream& ost, const char str) void exportVariable(std::ostream& ost, const char str) { { ost << '"' << str << '"'; ost << '"' << str << '"'; } } template<typename T1, typename T2> template<typename T1, typename T2> static auto _writeWar(std::ostream& ost, const std::pair<T1,T2>& b) -> void auto exportVariable(std::ostream& ost, const std::pair<T1,T2>& b) -> void { { ost << "{ "; ost << "{ "; _writeWar(ost, b.first); exportVariable(ost, b.first); ost << ": "; ost << ": "; _writeWar(ost, b.second); exportVariable(ost, b.second); ost << "}"; ost << "}"; } } template<typename T> template<typename T> static auto _writeWar(std::ostream& ost, const T &list) auto exportVariable(std::ostream& ost, const T &list) -> typename std::enable_if< -> typename std::enable_if< Detail::is_iterable<T>::value && is_iterable<T>::value && !Detail::is_exportable<T>::value && !is_exportable<T>::value && !Detail::has_default_traits<T>::value !has_default_traits<T>::value >::type >::type { { auto it = list.begin(); auto it = list.begin(); ost << "[ "; ost << "[ "; while (it != list.end()){ while (it != list.end()){ _writeWar(ost, *it); exportVariable(ost, *it); if (++it == list.end()){ if (++it == list.end()){ ost << " ]"; ost << " ]"; } else { } else { Loading @@ -167,17 +86,17 @@ struct VariableExport { template<typename T> template<typename T> static auto _writeWar(std::ostream& ost, const T &list) auto exportVariable(std::ostream& ost, const T &list) -> typename std::enable_if< -> typename std::enable_if< Detail::is_indexable<T>::value && is_indexable<T>::value && !Detail::is_iterable<T>::value && !is_iterable<T>::value && !Detail::is_exportable<T>::value && !is_exportable<T>::value && !Detail::has_default_traits<T>::value !has_default_traits<T>::value >::type >::type { { ost << "[ "; ost << "[ "; for (decltype (list.size())i = 0; i < list.size(); i++){ for (decltype (list.size())i = 0; i < list.size(); i++){ _writeWar(ost, list[i]); exportVariable(ost, list[i]); if (i == list.size() - 1){ if (i == list.size() - 1){ ost << " ]"; ost << " ]"; } else { } else { Loading @@ -192,12 +111,12 @@ struct VariableExport { template<typename T> template<typename T> static void _writeWar(std::ostream& ost, const std::initializer_list<T> &list) void exportVariable(std::ostream& ost, const std::initializer_list<T> &list) { { auto it = list.begin(); auto it = list.begin(); ost << "[ "; ost << "[ "; while (it != list.end()){ while (it != list.end()){ _writeWar(ost, *it); exportVariable(ost, *it); if (++it == list.end()){ if (++it == list.end()){ ost << " ]"; ost << " ]"; } else { } else { Loading @@ -211,7 +130,7 @@ struct VariableExport { struct PrintClass{ struct PrintClass{ static void print(std::ostream& ost, const T &traitedClass){ static void print(std::ostream& ost, const T &traitedClass){ ost << '"' << Traits<T>::ttype::template getName<Index>() << "\" : "; ost << '"' << Traits<T>::ttype::template getName<Index>() << "\" : "; VariableExport::_writeWar(ost, Traits<T>::ttype::template getReference<Index>()->getValue(traitedClass)); VariableExport::exportVariable(ost, Traits<T>::ttype::template getReference<Index>()->getValue(traitedClass)); ost << ", "; ost << ", "; PrintClass<T, Index + 1>::print(ost, traitedClass); PrintClass<T, Index + 1>::print(ost, traitedClass); Loading @@ -222,7 +141,7 @@ struct VariableExport { struct PrintClass <Traits<T, Types...>, Index, std::enable_if_t<Index < Traits<T, Types...>::size() - 1>>{ struct PrintClass <Traits<T, Types...>, Index, std::enable_if_t<Index < Traits<T, Types...>::size() - 1>>{ static void print(std::ostream& ost, const T &traitedClass){ static void print(std::ostream& ost, const T &traitedClass){ ost << '"' << Traits<T, Types...>::template getName<Index>() << "\" : "; ost << '"' << Traits<T, Types...>::template getName<Index>() << "\" : "; VariableExport::_writeWar(ost, Traits<T, Types...>::template getReference<Index>()->getValue(traitedClass)); VariableExport::exportVariable(ost, Traits<T, Types...>::template getReference<Index>()->getValue(traitedClass)); ost << ", "; ost << ", "; PrintClass<Traits<T, Types...>, Index + 1>::print(ost, traitedClass); PrintClass<Traits<T, Types...>, Index + 1>::print(ost, traitedClass); Loading @@ -233,7 +152,7 @@ struct VariableExport { struct PrintClass <Traits<T, Types...>, Index, std::enable_if_t<Index == Traits<T, Types...>::size() - 1>>{ struct PrintClass <Traits<T, Types...>, Index, std::enable_if_t<Index == Traits<T, Types...>::size() - 1>>{ static void print(std::ostream& ost, const T &traitedClass){ static void print(std::ostream& ost, const T &traitedClass){ ost << '"' << Traits<T, Types...>::template getName<Traits<T, Types...>::size() - 1>() << "\" : "; ost << '"' << Traits<T, Types...>::template getName<Traits<T, Types...>::size() - 1>() << "\" : "; VariableExport::_writeWar(ost, Traits<T, Types...>::template getReference<Traits<T, Types...>::size() - 1>()->getValue(traitedClass)); VariableExport::exportVariable(ost, Traits<T, Types...>::template getReference<Traits<T, Types...>::size() - 1>()->getValue(traitedClass)); } } }; }; Loading @@ -241,15 +160,15 @@ struct VariableExport { struct PrintClass<T, Index, std::enable_if_t<Index == Traits<T>::ttype::size() - 1>>{ struct PrintClass<T, Index, std::enable_if_t<Index == Traits<T>::ttype::size() - 1>>{ static void print(std::ostream& ost, const T &traitedClass){ static void print(std::ostream& ost, const T &traitedClass){ ost << '"' << Traits<T>::ttype::template getName<Traits<T>::ttype::size() - 1>() << "\" : "; ost << '"' << Traits<T>::ttype::template getName<Traits<T>::ttype::size() - 1>() << "\" : "; VariableExport::_writeWar(ost, Traits<T>::ttype::template getReference<Traits<T>::ttype::size() - 1>()->getValue(traitedClass)); VariableExport::exportVariable(ost, Traits<T>::ttype::template getReference<Traits<T>::ttype::size() - 1>()->getValue(traitedClass)); } } }; }; template<typename T> template<typename T> static auto _writeWar(std::ostream& ost, const T &traitedClass) auto exportVariable(std::ostream& ost, const T &traitedClass) -> typename std::enable_if< -> typename std::enable_if< Detail::has_default_traits<T>::value has_default_traits<T>::value >::type >::type { { ost << "{ "; ost << "{ "; Loading @@ -258,6 +177,6 @@ struct VariableExport { } } }; } #endif // VARIABLEEXPORT_H #endif // VARIABLEEXPORT_H Loading
Unstructured_mesh/Unstructured_mesh.pro +1 −0 Original line number Original line Diff line number Diff line Loading @@ -14,6 +14,7 @@ HEADERS += \ ../src/Debug/HTMLLogger.h \ ../src/Debug/HTMLLogger.h \ ../src/Debug/VariableExport.h \ ../src/Debug/VariableExport.h \ ../src/NumericStaticArray/InlineArrayOperations.h \ ../src/NumericStaticArray/InlineArrayOperations.h \ ../src/Traits/CustomTypeTraits.h \ ../src/Traits/MemberApproach/MemberApproach.h \ ../src/Traits/MemberApproach/MemberApproach.h \ ../src/UnstructuredMesh/MeshDataContainer/MeshDataContainer.h \ ../src/UnstructuredMesh/MeshDataContainer/MeshDataContainer.h \ ../src/UnstructuredMesh/MeshDataContainer/MeshDataIO/VTKMeshDataReader.h \ ../src/UnstructuredMesh/MeshDataContainer/MeshDataIO/VTKMeshDataReader.h \ Loading
src/Debug/CSVLogger.h +2 −2 Original line number Original line Diff line number Diff line Loading @@ -91,7 +91,7 @@ public: if (!logFile) create(logFileName.c_str()); if (!logFile) create(logFileName.c_str()); (*logFile) << groupIndex << ';' << line << ";\"" << cppFile << "\";\"" << name << "\";"; (*logFile) << groupIndex << ';' << line << ";\"" << cppFile << "\";\"" << name << "\";"; VariableExport::_writeWar(*logFile,value); VariableExport::exportVariable(*logFile,value); (*logFile) << "\n"; (*logFile) << "\n"; writeVar(line, cppFile, rest...); writeVar(line, cppFile, rest...); } } Loading @@ -104,7 +104,7 @@ public: if (!logFile) create(logFileName.c_str()); if (!logFile) create(logFileName.c_str()); (*logFile) << groupIndex << ';' << line << ";\"" << cppFile << "\";\"" << name << "\";"; (*logFile) << groupIndex << ';' << line << ";\"" << cppFile << "\";\"" << name << "\";"; VariableExport::_writeWar(*logFile,value); VariableExport::exportVariable(*logFile,value); (*logFile) << "\n"; (*logFile) << "\n"; groupIndex++; groupIndex++; Loading
src/Debug/ConsoleLogger.h +2 −2 Original line number Original line Diff line number Diff line Loading @@ -44,7 +44,7 @@ public: std::cerr << "\033[0m\n"; std::cerr << "\033[0m\n"; #else #else std::cerr << "In file " << cppFile << " at line " << line << " variable " << name << " has value of "; std::cerr << "In file " << cppFile << " at line " << line << " variable " << name << " has value of "; VariableExport::_writeWar(std::cerr, value); VariableExport::exportVariable(std::cerr, value); std::cerr << "\n"; std::cerr << "\n"; #endif #endif } } Loading @@ -58,7 +58,7 @@ public: std::cerr << "\033[0m\n"; std::cerr << "\033[0m\n"; #else #else std::cerr << "In file " << cppFile << " at line " << line << " variable " << name << " has value of "; std::cerr << "In file " << cppFile << " at line " << line << " variable " << name << " has value of "; VariableExport::_writeWar(std::cerr, value); VariableExport::exportVariable(std::cerr, value); std::cerr << "\n"; std::cerr << "\n"; #endif #endif } } Loading
src/Debug/HTMLLogger.h +2 −2 Original line number Original line Diff line number Diff line Loading @@ -93,7 +93,7 @@ public: if (!logFile) create(logFileName.c_str()); if (!logFile) create(logFileName.c_str()); (*logFile) << "[" << groupIndex << ", " << line << ", '" << cppFile << "', '" << name << "', "; (*logFile) << "[" << groupIndex << ", " << line << ", '" << cppFile << "', '" << name << "', "; VariableExport::_writeWar(*logFile,value); VariableExport::exportVariable(*logFile,value); (*logFile) << "],\n"; (*logFile) << "],\n"; writeVar(line, cppFile, rest...); writeVar(line, cppFile, rest...); } } Loading @@ -106,7 +106,7 @@ public: if (!logFile) create(logFileName.c_str()); if (!logFile) create(logFileName.c_str()); (*logFile) << "[" << groupIndex << ", " << line << ", '" << cppFile << "', '" << name << "', "; (*logFile) << "[" << groupIndex << ", " << line << ", '" << cppFile << "', '" << name << "', "; VariableExport::_writeWar(*logFile,value); VariableExport::exportVariable(*logFile,value); (*logFile) << "],\n"; (*logFile) << "],\n"; groupIndex++; groupIndex++; Loading
src/Debug/VariableExport.h +31 −112 Original line number Original line Diff line number Diff line Loading @@ -4,100 +4,19 @@ #include <fstream> #include <fstream> #include <string> #include <string> #include "../Traits/Traits.h" #include "../Traits/Traits.h" #include "../Traits/CustomTypeTraits.h" namespace Detail { namespace VariableExport { void exportVariable(std::ostream& ost, ...) template <typename T1, typename T2 = void> struct __is_exportable : public std::integral_constant<bool, false> { }; template <typename T1> struct __is_exportable<T1, typename std::enable_if<std::is_class< typename std::remove_reference<decltype(std::cerr << std::declval<const T1&>())>::type >::value>::type> : public std::integral_constant<bool, true> { }; template <typename T1> struct is_exportable : public __is_exportable<T1> {}; template <typename T1, typename T2 = void> struct __is_iterable : public std::integral_constant<bool, false> { }; template <typename T1> struct __is_iterable<T1, typename std::enable_if<!std::is_same< decltype(std::declval<const T1&>().begin()), void >::value>::type> : public std::integral_constant<bool, true> { }; template <typename T1> struct is_iterable : public __is_iterable<T1> {}; template <typename T1, typename T2 = void> struct __is_indexable : public std::integral_constant<bool, false> { }; template <typename T1> struct __is_indexable<T1, typename std::enable_if< !std::is_same< decltype (std::declval<const T1&>()[0]), void >::value && !std::is_same< decltype (std::declval<const T1&>().size()), void >::value >::type> : public std::integral_constant<bool, true> { }; template <typename T1> struct is_indexable : public __is_indexable<T1> {}; template <typename T1, typename VOID = void> struct __has_default_traits : public std::integral_constant<bool, false> { }; template <typename T1> struct __has_default_traits< T1, typename std::enable_if< Traits<T1>::is_specialized >::type > : public std::integral_constant<bool, true> { }; template<typename T> struct has_default_traits : __has_default_traits<T> { }; } struct VariableExport { static void _writeWar(std::ostream& ost, ...) { { ost << "\"variable is not exportable\"" << std::endl; ost << "\"variable is not exportable\"" << std::endl; } } template<typename T> template<typename T> static auto _writeWar(std::ostream& ost, const T& b) auto exportVariable(std::ostream& ost, const T& b) -> typename std::enable_if<std::is_class< -> typename std::enable_if<std::is_class< typename std::remove_reference<decltype(ost << b)>::type>::value && typename std::remove_reference<decltype(ost << b)>::type>::value && !std::is_same<T, bool>::value && !std::is_same<T, bool>::value && Loading @@ -111,51 +30,51 @@ struct VariableExport { static void _writeWar(std::ostream& ost, const bool& b) void exportVariable(std::ostream& ost, const bool& b) { { ost << (b == true ? "true" : "false"); ost << (b == true ? "true" : "false"); } } static void _writeWar(std::ostream& ost, const std::string& str) void exportVariable(std::ostream& ost, const std::string& str) { { ost << '"' << str << '"'; ost << '"' << str << '"'; } } static void _writeWar(std::ostream& ost, const char* str) void exportVariable(std::ostream& ost, const char* str) { { ost << '"' << str << '"'; ost << '"' << str << '"'; } } static void _writeWar(std::ostream& ost, const char str) void exportVariable(std::ostream& ost, const char str) { { ost << '"' << str << '"'; ost << '"' << str << '"'; } } template<typename T1, typename T2> template<typename T1, typename T2> static auto _writeWar(std::ostream& ost, const std::pair<T1,T2>& b) -> void auto exportVariable(std::ostream& ost, const std::pair<T1,T2>& b) -> void { { ost << "{ "; ost << "{ "; _writeWar(ost, b.first); exportVariable(ost, b.first); ost << ": "; ost << ": "; _writeWar(ost, b.second); exportVariable(ost, b.second); ost << "}"; ost << "}"; } } template<typename T> template<typename T> static auto _writeWar(std::ostream& ost, const T &list) auto exportVariable(std::ostream& ost, const T &list) -> typename std::enable_if< -> typename std::enable_if< Detail::is_iterable<T>::value && is_iterable<T>::value && !Detail::is_exportable<T>::value && !is_exportable<T>::value && !Detail::has_default_traits<T>::value !has_default_traits<T>::value >::type >::type { { auto it = list.begin(); auto it = list.begin(); ost << "[ "; ost << "[ "; while (it != list.end()){ while (it != list.end()){ _writeWar(ost, *it); exportVariable(ost, *it); if (++it == list.end()){ if (++it == list.end()){ ost << " ]"; ost << " ]"; } else { } else { Loading @@ -167,17 +86,17 @@ struct VariableExport { template<typename T> template<typename T> static auto _writeWar(std::ostream& ost, const T &list) auto exportVariable(std::ostream& ost, const T &list) -> typename std::enable_if< -> typename std::enable_if< Detail::is_indexable<T>::value && is_indexable<T>::value && !Detail::is_iterable<T>::value && !is_iterable<T>::value && !Detail::is_exportable<T>::value && !is_exportable<T>::value && !Detail::has_default_traits<T>::value !has_default_traits<T>::value >::type >::type { { ost << "[ "; ost << "[ "; for (decltype (list.size())i = 0; i < list.size(); i++){ for (decltype (list.size())i = 0; i < list.size(); i++){ _writeWar(ost, list[i]); exportVariable(ost, list[i]); if (i == list.size() - 1){ if (i == list.size() - 1){ ost << " ]"; ost << " ]"; } else { } else { Loading @@ -192,12 +111,12 @@ struct VariableExport { template<typename T> template<typename T> static void _writeWar(std::ostream& ost, const std::initializer_list<T> &list) void exportVariable(std::ostream& ost, const std::initializer_list<T> &list) { { auto it = list.begin(); auto it = list.begin(); ost << "[ "; ost << "[ "; while (it != list.end()){ while (it != list.end()){ _writeWar(ost, *it); exportVariable(ost, *it); if (++it == list.end()){ if (++it == list.end()){ ost << " ]"; ost << " ]"; } else { } else { Loading @@ -211,7 +130,7 @@ struct VariableExport { struct PrintClass{ struct PrintClass{ static void print(std::ostream& ost, const T &traitedClass){ static void print(std::ostream& ost, const T &traitedClass){ ost << '"' << Traits<T>::ttype::template getName<Index>() << "\" : "; ost << '"' << Traits<T>::ttype::template getName<Index>() << "\" : "; VariableExport::_writeWar(ost, Traits<T>::ttype::template getReference<Index>()->getValue(traitedClass)); VariableExport::exportVariable(ost, Traits<T>::ttype::template getReference<Index>()->getValue(traitedClass)); ost << ", "; ost << ", "; PrintClass<T, Index + 1>::print(ost, traitedClass); PrintClass<T, Index + 1>::print(ost, traitedClass); Loading @@ -222,7 +141,7 @@ struct VariableExport { struct PrintClass <Traits<T, Types...>, Index, std::enable_if_t<Index < Traits<T, Types...>::size() - 1>>{ struct PrintClass <Traits<T, Types...>, Index, std::enable_if_t<Index < Traits<T, Types...>::size() - 1>>{ static void print(std::ostream& ost, const T &traitedClass){ static void print(std::ostream& ost, const T &traitedClass){ ost << '"' << Traits<T, Types...>::template getName<Index>() << "\" : "; ost << '"' << Traits<T, Types...>::template getName<Index>() << "\" : "; VariableExport::_writeWar(ost, Traits<T, Types...>::template getReference<Index>()->getValue(traitedClass)); VariableExport::exportVariable(ost, Traits<T, Types...>::template getReference<Index>()->getValue(traitedClass)); ost << ", "; ost << ", "; PrintClass<Traits<T, Types...>, Index + 1>::print(ost, traitedClass); PrintClass<Traits<T, Types...>, Index + 1>::print(ost, traitedClass); Loading @@ -233,7 +152,7 @@ struct VariableExport { struct PrintClass <Traits<T, Types...>, Index, std::enable_if_t<Index == Traits<T, Types...>::size() - 1>>{ struct PrintClass <Traits<T, Types...>, Index, std::enable_if_t<Index == Traits<T, Types...>::size() - 1>>{ static void print(std::ostream& ost, const T &traitedClass){ static void print(std::ostream& ost, const T &traitedClass){ ost << '"' << Traits<T, Types...>::template getName<Traits<T, Types...>::size() - 1>() << "\" : "; ost << '"' << Traits<T, Types...>::template getName<Traits<T, Types...>::size() - 1>() << "\" : "; VariableExport::_writeWar(ost, Traits<T, Types...>::template getReference<Traits<T, Types...>::size() - 1>()->getValue(traitedClass)); VariableExport::exportVariable(ost, Traits<T, Types...>::template getReference<Traits<T, Types...>::size() - 1>()->getValue(traitedClass)); } } }; }; Loading @@ -241,15 +160,15 @@ struct VariableExport { struct PrintClass<T, Index, std::enable_if_t<Index == Traits<T>::ttype::size() - 1>>{ struct PrintClass<T, Index, std::enable_if_t<Index == Traits<T>::ttype::size() - 1>>{ static void print(std::ostream& ost, const T &traitedClass){ static void print(std::ostream& ost, const T &traitedClass){ ost << '"' << Traits<T>::ttype::template getName<Traits<T>::ttype::size() - 1>() << "\" : "; ost << '"' << Traits<T>::ttype::template getName<Traits<T>::ttype::size() - 1>() << "\" : "; VariableExport::_writeWar(ost, Traits<T>::ttype::template getReference<Traits<T>::ttype::size() - 1>()->getValue(traitedClass)); VariableExport::exportVariable(ost, Traits<T>::ttype::template getReference<Traits<T>::ttype::size() - 1>()->getValue(traitedClass)); } } }; }; template<typename T> template<typename T> static auto _writeWar(std::ostream& ost, const T &traitedClass) auto exportVariable(std::ostream& ost, const T &traitedClass) -> typename std::enable_if< -> typename std::enable_if< Detail::has_default_traits<T>::value has_default_traits<T>::value >::type >::type { { ost << "{ "; ost << "{ "; Loading @@ -258,6 +177,6 @@ struct VariableExport { } } }; } #endif // VARIABLEEXPORT_H #endif // VARIABLEEXPORT_H