Parcourir la source

Fix bug in destructor of Value class and upgrade copyright

Eric Ramat il y a 7 ans
Parent
commit
a0d8bc2878
40 fichiers modifiés avec 139 ajouts et 117 suppressions
  1. 2 0
      .gitignore
  2. 9 1
      src/apps/main.cpp
  3. 1 1
      src/paradevs/common/Bag.hpp
  4. 7 7
      src/paradevs/common/Coordinator.hpp
  5. 8 3
      src/paradevs/common/ExternalEvent.hpp
  6. 1 1
      src/paradevs/common/InternalEvent.hpp
  7. 1 1
      src/paradevs/common/Links.hpp
  8. 5 5
      src/paradevs/common/Model.hpp
  9. 1 1
      src/paradevs/common/Node.hpp
  10. 1 1
      src/paradevs/common/Parameters.hpp
  11. 1 1
      src/paradevs/common/RootCoordinator.hpp
  12. 1 1
      src/paradevs/common/Scheduler.hpp
  13. 5 5
      src/paradevs/common/Simulator.hpp
  14. 30 2
      src/paradevs/common/Value.hpp
  15. 1 1
      src/paradevs/common/scheduler/HeapScheduler.hpp
  16. 1 1
      src/paradevs/common/scheduler/SchedulerHandle.hpp
  17. 1 1
      src/paradevs/common/scheduler/VectorScheduler.hpp
  18. 1 1
      src/paradevs/common/time/DoubleTime.hpp
  19. 1 1
      src/paradevs/common/time/Time.hpp
  20. 1 1
      src/paradevs/common/utils/Multithreading.hpp
  21. 1 1
      src/paradevs/common/utils/String.hpp
  22. 1 1
      src/paradevs/common/utils/Trace.hpp
  23. 7 7
      src/paradevs/kernel/dtss/Coordinator.hpp
  24. 1 1
      src/paradevs/kernel/dtss/Dynamics.hpp
  25. 1 1
      src/paradevs/kernel/dtss/GraphManager.hpp
  26. 6 6
      src/paradevs/kernel/dtss/Simulator.hpp
  27. 7 6
      src/paradevs/kernel/pdevs/Coordinator.hpp
  28. 1 1
      src/paradevs/kernel/pdevs/Dynamics.hpp
  29. 1 1
      src/paradevs/kernel/pdevs/GraphManager.hpp
  30. 5 5
      src/paradevs/kernel/pdevs/Simulator.hpp
  31. 1 1
      src/paradevs/kernel/pdevs/mpi/Coordinator.hpp
  32. 1 1
      src/paradevs/kernel/pdevs/mpi/GraphManager.hpp
  33. 1 1
      src/paradevs/kernel/pdevs/mpi/LogicalProcessor.hpp
  34. 7 7
      src/paradevs/kernel/pdevs/mpi/ModelProxy.hpp
  35. 3 25
      src/paradevs/kernel/pdevs/multithreading/Coordinator.hpp
  36. 7 7
      src/paradevs/kernel/sss/Coordinator.hpp
  37. 1 1
      src/paradevs/kernel/sss/Dynamics.hpp
  38. 1 1
      src/paradevs/kernel/sss/GraphManager.hpp
  39. 1 1
      src/paradevs/kernel/sss/Model.hpp
  40. 6 6
      src/paradevs/kernel/sss/Simulator.hpp

+ 2 - 0
.gitignore

@@ -1,2 +1,4 @@
 *~
 build/
+.idea
+.DS_Store

+ 9 - 1
src/apps/main.cpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -24,7 +24,15 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <paradevs/common/Value.hpp>
+
 int main()
 {
+    paradevs::common::Value v1;
+    paradevs::common::Value v2(10);
+    paradevs::common::Value v3(v2);
+    paradevs::common::Value v4(v1);
+
+    v1 = v2;
     return 0;
 }

+ 1 - 1
src/paradevs/common/Bag.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 7 - 7
src/paradevs/common/Coordinator.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -64,14 +64,14 @@ public :
 
 // DEVS methods
     virtual void observation(std::ostream& file) const =0;
-    virtual void output(typename Time::type t) =0;
-    virtual void post_event(typename Time::type t,
+    virtual void output(const typename Time::type& t) =0;
+    virtual void post_event(const typename Time::type& t,
                             const common::ExternalEvent < Time >& event) =0;
-    virtual typename Time::type dispatch_events(common::Bag < Time >
+    virtual typename Time::type dispatch_events(const common::Bag < Time >&
                                                 bag,
-                                                typename Time::type t) =0;
-    virtual typename Time::type start(typename Time::type t) =0;
-    virtual typename Time::type transition(typename Time::type t) =0;
+                                                const typename Time::type& t) =0;
+    virtual typename Time::type start(const typename Time::type& t) =0;
+    virtual typename Time::type transition(const typename Time::type& t) =0;
 };
 
 } } // namespace paradevs common

+ 8 - 3
src/paradevs/common/ExternalEvent.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -50,7 +50,7 @@ class ExternalEvent
 {
 public:
     ExternalEvent(const std::string& port_name, const Value& content) :
-        _port_name(port_name), _model(0), _content(content)
+        _port_name(port_name), _model(nullptr), _content(content)
     { }
 
     ExternalEvent(const Node < Time >& node, const Value& content) :
@@ -59,7 +59,12 @@ public:
         _content(content)
     { }
 
-    ExternalEvent()
+    ExternalEvent(const ExternalEvent& event) :
+        _port_name(event._port_name), _model(event._model),
+        _content(event._content)
+    { }
+
+    ExternalEvent() : _model(nullptr)
     { }
 
     virtual ~ExternalEvent()

+ 1 - 1
src/paradevs/common/InternalEvent.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
src/paradevs/common/Links.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 5 - 5
src/paradevs/common/Model.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -173,11 +173,11 @@ public:
 
     // devs methods
     virtual void observation(std::ostream& file) const =0;
-    virtual void output(typename Time::type t) =0;
-    virtual void post_event(typename Time::type t,
+    virtual void output(const typename Time::type& t) =0;
+    virtual void post_event(const typename Time::type& t,
                             const common::ExternalEvent < Time >& event) = 0;
-    virtual typename Time::type start(typename Time::type t) =0;
-    virtual typename Time::type transition(typename Time::type t) =0;
+    virtual typename Time::type start(const typename Time::type& t) =0;
+    virtual typename Time::type transition(const typename Time::type& t) =0;
 
     // scheduler
     void handle(SchedulerHandle handle)

+ 1 - 1
src/paradevs/common/Node.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
src/paradevs/common/Parameters.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
src/paradevs/common/RootCoordinator.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
src/paradevs/common/Scheduler.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 5 - 5
src/paradevs/common/Simulator.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -55,11 +55,11 @@ public :
 
 // DEVS methods
     virtual void observation(std::ostream& file) const =0;
-    virtual void output(typename Time::type t) =0;
-    virtual void post_event(typename Time::type t,
+    virtual void output(const typename Time::type& t) =0;
+    virtual void post_event(const typename Time::type& t,
                             const common::ExternalEvent < Time >& event) = 0;
-    virtual typename Time::type start(typename Time::type t) =0;
-    virtual typename Time::type transition(typename Time::type t) =0;
+    virtual typename Time::type start(const typename Time::type& t) =0;
+    virtual typename Time::type transition(const typename Time::type& t) =0;
 };
 
 } } // namespace paradevs common

+ 30 - 2
src/paradevs/common/Value.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -33,6 +33,8 @@
 #include <cstring>
 #include <typeinfo>
 
+#include <iostream>
+
 namespace paradevs { namespace common {
 
 class Value
@@ -51,8 +53,19 @@ public:
     Value(const char* value, unsigned int size)
     { assign(value, size * sizeof(char), typeid(char*).hash_code()); }
 
+    Value(const Value& value)
+    {
+        if (value._content) {
+            assign(value._content, value._size, value._type_id);
+        } else {
+            _content = nullptr;
+            _size = 0;
+            _type_id = 0;
+        }
+    }
+
     virtual ~Value()
-    { /* if (_content) delete[] _content; */ }
+    { if (_content) delete _content; }
 
     bool empty() const
     { return _content == nullptr; }
@@ -65,6 +78,21 @@ public:
         return *(T*)(_content);
     }
 
+    void operator=(const Value& value)
+    {
+        if (_content) {
+            delete _content;
+        }
+        if (value._content) {
+            assign(value._content, value._size, value._type_id);
+        } else {
+            _content = nullptr;
+            _size = 0;
+            _type_id = 0;
+        }
+    }
+
+
     std::string to_string() const
     {
         return std::string();

+ 1 - 1
src/paradevs/common/scheduler/HeapScheduler.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
src/paradevs/common/scheduler/SchedulerHandle.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
src/paradevs/common/scheduler/VectorScheduler.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
src/paradevs/common/time/DoubleTime.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
src/paradevs/common/time/Time.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
src/paradevs/common/utils/Multithreading.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
src/paradevs/common/utils/String.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
src/paradevs/common/utils/Trace.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 7 - 7
src/paradevs/kernel/dtss/Coordinator.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -70,7 +70,7 @@ public:
     virtual ~Coordinator()
     { }
 
-    typename Time::type start(typename Time::type t)
+    typename Time::type start(const typename Time::type& t)
     {
 
 #ifdef WITH_TRACE
@@ -102,8 +102,8 @@ public:
         return type::_tn;
     }
 
-    typename Time::type dispatch_events(common::Bag < Time > bag,
-                                        typename Time::type t)
+    typename Time::type dispatch_events(const common::Bag < Time >& bag,
+                                        const typename Time::type& t)
     {
 
 #ifdef WITH_TRACE
@@ -136,7 +136,7 @@ public:
         }
     }
 
-    void output(typename Time::type t)
+    void output(const typename Time::type& t)
     {
 
 #ifdef WITH_TRACE
@@ -164,7 +164,7 @@ public:
 
     }
 
-    void post_event(typename Time::type t,
+    void post_event(const typename Time::type& t,
                     const common::ExternalEvent < Time >& event)
     {
 
@@ -192,7 +192,7 @@ public:
 
     }
 
-    typename Time::type transition(typename Time::type t)
+    typename Time::type transition(const typename Time::type& t)
     {
 
 #ifdef WITH_TRACE

+ 1 - 1
src/paradevs/kernel/dtss/Dynamics.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
src/paradevs/kernel/dtss/GraphManager.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 6 - 6
src/paradevs/kernel/dtss/Simulator.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -43,7 +43,7 @@ class Simulator : public common::Simulator < Time >
     typedef Simulator < Time, Dynamics, Parameters > type;
 
 public:
-    Simulator(const std::string& name, typename Time::type time_step,
+    Simulator(const std::string& name, const typename Time::type& time_step,
         const Parameters& parameters) :
         common::Model < Time >(name),
         common::Simulator < Time >(name),
@@ -54,7 +54,7 @@ public:
     ~Simulator()
     {  }
 
-    typename Time::type start(typename Time::type t)
+    typename Time::type start(const typename Time::type& t)
     {
 
 #ifdef WITH_TRACE
@@ -87,7 +87,7 @@ public:
         _dynamics.observation(file);
     }
 
-    void output(typename Time::type t)
+    void output(const typename Time::type& t)
     {
 
 #ifdef WITH_TRACE
@@ -118,7 +118,7 @@ public:
 
     }
 
-    void post_event(typename Time::type t,
+    void post_event(const typename Time::type& t,
                     const common::ExternalEvent < Time >& event)
     {
 
@@ -146,7 +146,7 @@ public:
 
     }
 
-    typename Time::type transition(typename Time::type t)
+    typename Time::type transition(const typename Time::type& t)
     {
 
  #ifdef WITH_TRACE

+ 7 - 6
src/paradevs/kernel/pdevs/Coordinator.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -72,7 +72,7 @@ public:
         return ss.str();
     }
 
-    typename Time::type start(typename Time::type t)
+    typename Time::type start(const typename Time::type& t)
     {
 
 #ifdef WITH_TRACE
@@ -113,7 +113,7 @@ public:
  *   ...
  *  send done to parent
  **************************************************/
-    void output(typename Time::type t)
+    void output(const typename Time::type& t)
     {
 
 #ifdef WITH_TRACE
@@ -164,7 +164,7 @@ public:
  *   tl = t
  *   tn = min(tn_d | d in D)
  *******************************************************************/
-    typename Time::type transition(typename Time::type t)
+    typename Time::type transition(const typename Time::type& t)
     {
 
 #ifdef WITH_TRACE
@@ -212,7 +212,7 @@ public:
         return type::_tn;
     }
 
-    void post_event(typename Time::type t,
+    void post_event(const typename Time::type& t,
                     const common::ExternalEvent < Time >& event)
     {
 
@@ -243,7 +243,8 @@ public:
  * when y-message(y_d, t) with output y_d from d
  *******************************************************************/
     typename Time::type dispatch_events(
-        common::Bag < Time > bag, typename Time::type t)
+        const common::Bag < Time >& bag,
+        const typename Time::type& t)
     {
 
 #ifdef WITH_TRACE

+ 1 - 1
src/paradevs/kernel/pdevs/Dynamics.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
src/paradevs/kernel/pdevs/GraphManager.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 5 - 5
src/paradevs/kernel/pdevs/Simulator.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -67,7 +67,7 @@ public :
  *   tl = t - e
  *   tn = tl + ta(s)
  *************************************************/
-    typename Time::type start(typename Time::type t)
+    typename Time::type start(const typename Time::type& t)
     {
 
 #ifdef WITH_TRACE
@@ -106,7 +106,7 @@ public :
  *     y = lambda(s)
  *     send y-message(y,t) to parent
  *************************************************/
-    void output(typename Time::type t)
+    void output(const typename Time::type& t)
     {
 
 #ifdef WITH_TRACE
@@ -137,7 +137,7 @@ public :
 
     }
 
-    void post_event(typename Time::type t,
+    void post_event(const typename Time::type& t,
                     const common::ExternalEvent < Time >& event)
     {
 
@@ -177,7 +177,7 @@ public :
  *  tn = t + ta(s)
  *  tl = t
  *************************************************/
-    typename Time::type transition(typename Time::type t)
+    typename Time::type transition(const typename Time::type& t)
     {
 
 #ifdef WITH_TRACE

+ 1 - 1
src/paradevs/kernel/pdevs/mpi/Coordinator.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
src/paradevs/kernel/pdevs/mpi/GraphManager.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
src/paradevs/kernel/pdevs/mpi/LogicalProcessor.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 7 - 7
src/paradevs/kernel/pdevs/mpi/ModelProxy.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -74,7 +74,7 @@ public:
         (void) file;
     }
 
-    virtual void output(typename Time::type t)
+    virtual void output(const typename Time::type& t)
     {
         try {
             typename common::Bag < Time > bag;
@@ -87,7 +87,7 @@ public:
         }
     }
 
-    virtual void post_event(typename Time::type t,
+    virtual void post_event(const typename Time::type& t,
                             const common::ExternalEvent < Time >& event)
     {
         try {
@@ -98,8 +98,8 @@ public:
         }
     }
 
-    virtual typename Time::type dispatch_events(common::Bag < Time > bag,
-                                                typename Time::type t)
+    virtual typename Time::type dispatch_events(common::Bag < Time >& bag,
+                                                const typename Time::type& t)
     {
         for (auto & event : bag) {
             event.set_model(this);
@@ -108,7 +108,7 @@ public:
             parent_type::get_parent())->dispatch_events(bag, t);
     }
 
-    virtual typename Time::type start(typename Time::type t)
+    virtual typename Time::type start(const typename Time::type& t)
     {
         try {
             _communicator.send(_rank, start_send_tag, t);
@@ -124,7 +124,7 @@ public:
         return type::_tn;
     }
 
-    virtual typename Time::type transition(typename Time::type t)
+    virtual typename Time::type transition(const typename Time::type& t)
     {
         try {
             _communicator.send(_rank, transition_send_tag, t);

+ 3 - 25
src/paradevs/kernel/pdevs/multithreading/Coordinator.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -164,7 +164,7 @@ public:
         { }
     }
 
-    typename Time::type start(typename Time::type t)
+    typename Time::type start(const typename Time::type& t)
     {
         _received = 0;
         for (auto & child : parent_type::_graph_manager.children()) {
@@ -191,7 +191,7 @@ public:
     virtual int get_receiver_number(typename Time::type t)
     { return type::_event_table.get_current_models(t).size(); }
 
-    typename Time::type transition(typename Time::type t)
+    typename Time::type transition(const typename Time::type& t)
     {
         assert(t >= type::_tl and t <= type::_tn);
 
@@ -210,28 +210,6 @@ public:
         }
 
         if (_received > 0) {
-
-            // double sum = 0;
-            // double max = 0;
-            // double min = 100000;
-
-            // for (auto & model : receivers) {
-            //     if (not model->is_atomic()) {
-            //         int n = model->get_receiver_number(t);
-
-            //         sum += n;
-            //         if (max < n) max = n;
-            //         if (min > n) min = n;
-
-            //         std::cout << t << "\t" << model->get_name()
-            //                   << "\t" << n << std::endl;
-
-            //     }
-            // }
-            // std::cout << t << "\t" << (sum / receivers.size())
-            //           << "\t" << (sum / max)
-            //           << "\t" << min << "\t" << max << std::endl;
-
             _received_mutex.lock();
             type::_graph_manager.transition(receivers, t);
 

+ 7 - 7
src/paradevs/kernel/sss/Coordinator.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -80,7 +80,7 @@ public:
     virtual std::string to_string(int level) const
     { return common::Coordinator < Time >::to_string(level); }
 
-    typename Time::type start(typename Time::type t)
+    typename Time::type start(const typename Time::type& t)
     {
         assert(_graph_manager.children().size() > 0);
 
@@ -92,8 +92,8 @@ public:
         return type::_tn;
     }
 
-    typename Time::type dispatch_events(common::Bag < Time > bag,
-                                        typename Time::type t)
+    typename Time::type dispatch_events(const common::Bag < Time >& bag,
+                                        const typename Time::type& t)
     {
         _graph_manager.dispatch_events(bag, t);
         return type::_tn;
@@ -106,7 +106,7 @@ public:
         }
     }
 
-    void output(typename Time::type t)
+    void output(const typename Time::type& t)
     {
         if (t == type::_tn) {
             for (auto & model : _graph_manager.children()) {
@@ -121,7 +121,7 @@ public:
         }
     }
 
-    void post_event(typename Time::type t,
+    void post_event(const typename Time::type& t,
                     const common::ExternalEvent < Time >& event)
     {
         if (t == type::_tn) {
@@ -131,7 +131,7 @@ public:
         }
     }
 
-    typename Time::type transition(typename Time::type t)
+    typename Time::type transition(const typename Time::type& t)
     {
         if (t == type::_tn) {
             bool end = true;

+ 1 - 1
src/paradevs/kernel/sss/Dynamics.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
src/paradevs/kernel/sss/GraphManager.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
src/paradevs/kernel/sss/Model.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 6 - 6
src/paradevs/kernel/sss/Simulator.hpp

@@ -8,7 +8,7 @@
  * PARADEVS - the multimodeling and simulation environment
  * This file is a part of the PARADEVS environment
  *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ * Copyright (C) 2013-2016 ULCO http://www.univ-littoral.fr
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -46,7 +46,7 @@ class Simulator : public common::Simulator < Time >,
     typedef Simulator < Time, Dynamics, Parameters > type;
 
 public:
-    Simulator(const std::string& name, typename Time::type time_step,
+    Simulator(const std::string& name, const typename Time::type& time_step,
         const Parameters& parameters) :
         common::Model < Time >(name),
         common::Simulator < Time >(name),
@@ -64,7 +64,7 @@ public:
     virtual std::string to_string(int level) const
     { return common::Simulator < Time >::to_string(level); }
 
-    typename Time::type start(typename Time::type t)
+    typename Time::type start(const typename Time::type& t)
     {
 
 #ifdef WITH_TRACE
@@ -97,7 +97,7 @@ public:
         _dynamics.observation(file);
     }
 
-    void output(typename Time::type t)
+    void output(const typename Time::type& t)
     {
 
 #ifdef WITH_TRACE
@@ -128,7 +128,7 @@ public:
 
     }
 
-    void post_event(typename Time::type t,
+    void post_event(const typename Time::type& t,
                     const common::ExternalEvent < Time >& event)
     {
 
@@ -156,7 +156,7 @@ public:
 
     }
 
-    typename Time::type transition(typename Time::type t)
+    typename Time::type transition(const typename Time::type& t)
     {
 
  #ifdef WITH_TRACE