Bladeren bron

Added trace instanciation

gbeurier 7 jaren geleden
bovenliggende
commit
f77de96766
1 gewijzigde bestanden met toevoegingen van 22 en 6 verwijderingen
  1. 22 6
      src/artis/utils/Trace.hpp

+ 22 - 6
src/artis/utils/Trace.hpp

@@ -55,7 +55,7 @@ class Externals;
 
 namespace artis { namespace utils {
 
-enum TraceType { NONE = 0, CHECK, CONSTRUCT, SUBMODEL_ADD, INTERNAL_DECL,
+enum TraceType { NONE = 0, CHECK = 1, CONSTRUCT, SUBMODEL_ADD, INTERNAL_DECL,
                  EXTERNAL_DECL, INTERNAL_LINK, INIT, START, BEFORE_COMPUTE,
                  COMPUTE, PUT, AFTER_COMPUTE, DESTRUCT, KERNEL};
 static const std::vector <std::string> TraceTypesStr = {
@@ -150,6 +150,15 @@ public:
     const std::string& tgt_internal_var() const
     { return KernelInfo::term(_tgt_internal_var); }
 
+    unsigned int var_idx() const
+    { return _var; }
+
+    unsigned int tgt_internal_var_idx() const
+    { return _tgt_internal_var; }
+
+    unsigned int tgt_model_idx() const
+    { return _tgt_model; }
+
     bool is_internal_var() const
     { return _internal_var; }
 
@@ -203,9 +212,11 @@ class TraceElement
 private:
     TraceElement(bool from_kernel, const std::string& model_name,
                  typename Time::type time, TraceType type) :
-        _model_name(model_name), _time(time), _type(type),
+        _time(time), _type(type),
         _from_kernel(from_kernel)
-    { }
+    {
+        _model_name = KernelInfo::term(model_name);
+    }
 
 public:
     TraceElement() : _time(Time::null), _type(NONE),
@@ -214,9 +225,11 @@ public:
 
     TraceElement(const std::string& model_name, typename Time::type time,
                  TraceType type) :
-        _model_name(model_name), _time(time), _type(type),
+        _time(time), _type(type),
         _from_kernel(false)
-    { }
+    {
+        _model_name = KernelInfo::term(model_name);
+    }
 
     virtual ~TraceElement()
     { }
@@ -225,6 +238,9 @@ public:
     { return _comment; }
 
     const std::string& get_model_name() const
+    { return KernelInfo::term(_model_name); }
+
+    unsigned int get_model_name_idx() const
     { return _model_name; }
 
     typename Time::type get_time() const
@@ -269,7 +285,7 @@ public:
     }
 
 private:
-    std::string         _model_name;
+    unsigned int        _model_name;
     typename Time::type _time;
     TraceType           _type;
     std::string         _comment;