From ac58704c38d15c475d1c3879176cc42587844ac7 Mon Sep 17 00:00:00 2001
From: Tomas Jakubec <jakubto1@fjfi.cvut.cz>
Date: Wed, 20 Nov 2019 13:06:02 +0100
Subject: [PATCH] DBG fix

---
 TemplateTest/TemplateTest.pro                |  1 -
 TemplateTest/main.cpp                        | 32 +++++++++++---------
 Unstructured_mesh/Unstructured_mesh.pro.user |  2 +-
 Unstructured_mesh/main.cpp                   |  2 +-
 src/Debug/ConsoleLogger.h                    |  4 +--
 src/Debug/VariableExport.h                   | 32 ++++++++++----------
 6 files changed, 37 insertions(+), 36 deletions(-)

diff --git a/TemplateTest/TemplateTest.pro b/TemplateTest/TemplateTest.pro
index 9206ecf..595bdaa 100644
--- a/TemplateTest/TemplateTest.pro
+++ b/TemplateTest/TemplateTest.pro
@@ -4,5 +4,4 @@ CONFIG -= app_bundle
 CONFIG -= qt
 
 SOURCES += \
-        ../debug/debug.cpp \
         main.cpp
diff --git a/TemplateTest/main.cpp b/TemplateTest/main.cpp
index dcfda49..98818ea 100644
--- a/TemplateTest/main.cpp
+++ b/TemplateTest/main.cpp
@@ -1,7 +1,7 @@
-#include "../debug/Debug.h"
-#include "../Unstructured_mesh/UnstructuredMesh/UnstructuredMesh.h"
-#include "../Unstructured_mesh/UnstructuredMesh/MeshDataContainer/MemberApproach.h"
-#include "../Unstructured_mesh/UnstructuredMesh/MeshDataContainer/Traits.h"
+#include "../src/Debug/Debug.h"
+#include "../src/UnstructuredMesh/UnstructuredMesh.h"
+#include "../src/Traits/MemberApproach/MemberApproach.h"
+#include "../src/Traits/Traits.h"
 #include <functional>
 #include <type_traits>
 #include <iostream>
@@ -69,18 +69,20 @@ void testDebug() {
     Vertex<7, double> vert;
     DBGVAR(vert, vert.getCoordinates());
 
-    DBGVAR((Detail::is_exportable<decltype(vec)>::value));
+    DBGVAR((IsExportable<decltype(vec)>::value));
 
-    DBGVAR((Detail::is_exportable<double>::value));
+    DBGVAR((IsExportable<double>::value));
 
-    DBGVAR(Detail::is_indexable<double>::value);
+    DBGVAR(IsIndexable<double>::value);
 
-    DBGVAR(Detail::is_indexable<decltype(vec)>::value);
+    DBGVAR(IsIndexable<decltype(vec)>::value);
 
-    DBGVAR(Detail::is_indexable<decltype(vert)>::value);
+    DBGVAR(IsIndexable<decltype(vert)>::value);
 
     Subelement<size_t> s({1});
     DBGVAR(s);
+    //auto v = {1,2,3};
+    //DBGVAR(v);
 
     HTMLDBGVAR(r, i, c, list, vec, b, m);
 
@@ -92,7 +94,7 @@ void testDebug() {
 //The concept implementation
 template<typename T>
 class NeedIterator{
-    static_assert (Detail::is_iterable<T>::value, "The type must be iterable");
+    static_assert (IsIterable<T>::value, "The type must be iterable");
 public:
     NeedIterator(const T&){}
 };
@@ -301,7 +303,7 @@ void testMemberRef(){
     Traits<tempData>::ttype::getReference<1>()->setValue(&d, {42.15,84.30,42.15});
 
     DBGVAR(Traits<tempData>::ttype::getName<0>(),(Traits<tempData>::ttype::getReference<0>()->getValue(&d)), Traits<tempData>::ttype::getName<1>(),(Traits<tempData, double, Vector<3,double>>::getReference<1>()->getValue(&d)), d.velocity);
-    DBGVAR(Traits<tempData>::is_specialized,Detail::has_default_traits<tempData>::value, d);
+    DBGVAR(Traits<tempData>::is_specialized,HasDefaultTraits<tempData>::value, d);
 
     ExportTest e;
     DBGVAR(e, ClassC<>());
@@ -312,7 +314,7 @@ void testMemberRef(){
 
 
 
-#include "../Unstructured_mesh/UnstructuredMesh/MeshDataContainer/Singleton.h"
+#include "../src/Singleton/Singleton.h"
 /*
 Test of order of constructors
 */
@@ -548,11 +550,11 @@ void testFunction() {
 
 int main()
 {
-
+    testDebug();
     //testOperator();
-    //testMemberRef();
+    testMemberRef();
     //testConstrucorOrder();
-    testFunction();
+    //testFunction();
     return 0;
 }
 
diff --git a/Unstructured_mesh/Unstructured_mesh.pro.user b/Unstructured_mesh/Unstructured_mesh.pro.user
index fe3e615..41ebde8 100644
--- a/Unstructured_mesh/Unstructured_mesh.pro.user
+++ b/Unstructured_mesh/Unstructured_mesh.pro.user
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 4.10.0, 2019-11-20T00:19:29. -->
+<!-- Written by QtCreator 4.10.0, 2019-11-20T11:13:14. -->
 <qtcreator>
  <data>
   <variable>EnvironmentId</variable>
diff --git a/Unstructured_mesh/main.cpp b/Unstructured_mesh/main.cpp
index 42bff06..26fcbad 100644
--- a/Unstructured_mesh/main.cpp
+++ b/Unstructured_mesh/main.cpp
@@ -1,6 +1,6 @@
 #include <iostream>
 //#define UNDEBUG
-//#define CONSOLE_COLOURED_OUTPUT
+#define CONSOLE_COLOURED_OUTPUT
 #include "../src/Debug/Debug.h"
 #include "../src/UnstructuredMesh/UnstructuredMesh.h"
 #include "../src/UnstructuredMesh/MeshFunctions/MeshFunctions.h"
diff --git a/src/Debug/ConsoleLogger.h b/src/Debug/ConsoleLogger.h
index 840f2a4..f574189 100644
--- a/src/Debug/ConsoleLogger.h
+++ b/src/Debug/ConsoleLogger.h
@@ -47,7 +47,7 @@ public:
 #ifdef CONSOLE_COLOURED_OUTPUT
 #ifdef _WIN32
         HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
-        std::cerr << "In file " << cppFile << " at line " << line << " variable " << name << " has value of ";
+        std::cerr << "In file " << cppFile << " at line " << line << " variable ";
         SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY);
         std::cerr << name;
         SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
@@ -75,7 +75,7 @@ public:
 #ifdef CONSOLE_COLOURED_OUTPUT
 #ifdef _WIN32
         HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
-        std::cerr << "In file " << cppFile << " at line " << line << " variable " << name << " has value of ";
+        std::cerr << "In file " << cppFile << " at line " << line << " variable ";
         SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY);
         std::cerr << name;
         SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
diff --git a/src/Debug/VariableExport.h b/src/Debug/VariableExport.h
index 1293d4e..95e0cc6 100644
--- a/src/Debug/VariableExport.h
+++ b/src/Debug/VariableExport.h
@@ -6,17 +6,17 @@
 #include "../Traits/Traits.h"
 #include "../Traits/CustomTypeTraits.h"
 
-namespace VariableExport {
+struct VariableExport {
 
 
-    void exportVariable(std::ostream& ost, ...)
+    static void exportVariable(std::ostream& ost, ...)
     {
         ost << "\"variable is not exportable\"" << std::endl;
     }
 
 
     template<typename T>
-    auto exportVariable(std::ostream& ost, const T& b)
+    static auto exportVariable(std::ostream& ost, const T& b)
       -> typename std::enable_if<
              IsExportable<T>::value &&
             !std::is_same<T, bool>::value &&
@@ -30,31 +30,31 @@ namespace VariableExport {
 
 
 
-    void exportVariable(std::ostream& ost, const bool& b)
+    static void exportVariable(std::ostream& ost, const bool& b)
     {
         ost << (b == true ? "true" : "false");
     }
 
-    void exportVariable(std::ostream& ost, const std::string& str)
+    static void exportVariable(std::ostream& ost, const std::string& str)
     {
         ost << '"' << str << '"';
     }
 
 
-    void exportVariable(std::ostream& ost, const char* str)
+    static void exportVariable(std::ostream& ost, const char* str)
     {
         ost << '"' << str << '"';
     }
 
 
-    void exportVariable(std::ostream& ost, const char str)
+    static void exportVariable(std::ostream& ost, const char str)
     {
         ost << '"' << str << '"';
     }
 
 
     template<typename T1, typename T2>
-    auto exportVariable(std::ostream& ost, const std::pair<T1,T2>& b) -> void
+    static auto exportVariable(std::ostream& ost, const std::pair<T1,T2>& b) -> void
     {
         ost << "{ ";
         exportVariable(ost, b.first);
@@ -64,7 +64,7 @@ namespace VariableExport {
     }
 
     template<typename T>
-    auto exportVariable(std::ostream& ost, const T &list)
+    static auto exportVariable(std::ostream& ost, const T &list)
       -> typename std::enable_if<
               IsIterable<T>::value &&
              !IsExportable<T>::value &&
@@ -86,7 +86,7 @@ namespace VariableExport {
 
 
     template<typename T>
-    auto exportVariable(std::ostream& ost, const T &list)
+    static auto exportVariable(std::ostream& ost, const T &list)
       -> typename std::enable_if<
               IsIndexable<T>::value &&
              !IsIterable<T>::value &&
@@ -107,7 +107,7 @@ namespace VariableExport {
 
 
     template<typename T>
-    auto exportVariable(std::ostream& ost, const T &list)
+    static auto exportVariable(std::ostream& ost, const T &list)
       -> typename std::enable_if<
               IsTNLIndexable<T>::value &&
              !IsIndexable<T>::value &&
@@ -130,9 +130,9 @@ namespace VariableExport {
 
 
     template<typename T>
-    void exportVariable(std::ostream& ost, const std::initializer_list<T> &list)
+    static void exportVariable(std::ostream& ost, const std::initializer_list<T> &list)
     {
-        auto it = list.begin();
+        static auto it = list.begin();
         ost << "[ ";
         while (it != list.end()){
             exportVariable(ost, *it);
@@ -145,7 +145,7 @@ namespace VariableExport {
     }
 
 
-    template<typename T,unsigned int Index = 0, typename VOID = void>
+    template<typename T,unsigned int Index = 0, typename Void = void>
     struct PrintClass{
         static void print(std::ostream& ost, const T &traitedClass){
             ost << '"' << Traits<T>::ttype::template getName<Index>() << "\" : ";
@@ -185,7 +185,7 @@ namespace VariableExport {
 
 
     template<typename T>
-    auto exportVariable(std::ostream& ost, const T &traitedClass)
+    static auto exportVariable(std::ostream& ost, const T &traitedClass)
       -> typename std::enable_if<
              HasDefaultTraits<T>::value
          >::type
@@ -196,6 +196,6 @@ namespace VariableExport {
     }
 
 
-}
+};
 
 #endif // VARIABLEEXPORT_H
-- 
GitLab