ソースを参照

New coding style

Eric Ramat 5 年 前
コミット
bd4a9be85e
1 ファイル変更84 行追加79 行削除
  1. 84 79
      src/qss/GraphManager.hpp

+ 84 - 79
src/qss/GraphManager.hpp

@@ -1,5 +1,5 @@
 /**
- * @file kernel/pdevs/qss/GraphManager.hpp
+ * @file kernel/qss/GraphManager.hpp
  * @author The ARTIS Development Team
  * See the AUTHORS or Authors.txt file
  */
@@ -33,84 +33,89 @@
 #include <artis-star/kernel/qss/Quantifier.hpp>
 
 namespace artis {
-    namespace qss {
-
-        template<class DerivativeParameters>
-        struct QSSParameters {
-            artis::qss::IntegratorParameters integrator;
-            artis::qss::QuantifierParameters quantifier;
-            DerivativeParameters derivative;
-        };
-
-        template<class Time,
-                class Derivative,
-                class DerivativeParameters = artis::common::NoParameters>
-        class GraphManager :
-                public artis::pdevs::GraphManager<Time, QSSParameters<DerivativeParameters>, artis::common::NoParameters> {
-        public:
-            enum submodels {
-                S_Derivative, S_Integrator, S_Quantifier
-            };
-
-            enum inputs {
-                RESET
-            };
-
-            enum outputs {
-                OUT
-            };
-
-            GraphManager(common::Coordinator<Time>* coordinator,
-                    const QSSParameters<DerivativeParameters>& parameters,
-                    const artis::common::NoParameters& graph_parameters)
-                    :
-                    artis::pdevs::GraphManager<Time, QSSParameters<DerivativeParameters>, artis::common::NoParameters>(
-                            coordinator,
-                            parameters,
-                            graph_parameters
-                    ),
-                    _derivative("d", parameters.derivative),
-                    _integrator("i", parameters.integrator),
-                    _quantifier("q", parameters.quantifier)
-            {
-                this->add_child(S_Derivative, &_derivative);
-                this->add_child(S_Integrator, &_integrator);
-                this->add_child(S_Quantifier, &_quantifier);
-
-                coordinator->input_port({RESET, "reset"});
-                coordinator->output_port({OUT, "out"});
-
-                this->in({coordinator, RESET})
-                        >> this->in({&_derivative, Derivative::RESET});
-                this->in({coordinator, RESET})
-                        >> this->in({&_integrator, Integrator<Time>::RESET});
-                this->in({coordinator, RESET})
-                        >> this->in({&_quantifier, Quantifier<Time>::RESET});
-
-                this->out({&_derivative, Derivative::OUT})
-                        >> this->in({&_integrator, Integrator<Time>::X_DOT});
-                this->out({&_integrator, Integrator<Time>::OUT})
-                        >> this->in({&_quantifier, Quantifier<Time>::IN});
-                this->out({&_quantifier, Quantifier<Time>::OUT})
-                        >> this->in({&_integrator, Integrator<Time>::QUANTA});
-                this->out({&_integrator, Integrator<Time>::OUT})
-                        >> this->out({coordinator, OUT});
-                this->out({&_integrator, Integrator<Time>::OUT})
-                        >> this->in({&_derivative, Derivative::IN});
-            }
-
-            ~GraphManager() override = default;
-
-            artis::pdevs::Simulator<Time, Derivative, DerivativeParameters>*
-            derivative() { return &_derivative; }
-
-        private:
-            artis::pdevs::Simulator<Time, Derivative, DerivativeParameters> _derivative;
-            artis::pdevs::Simulator<Time, artis::qss::Integrator<Time>, artis::qss::IntegratorParameters> _integrator;
-            artis::pdevs::Simulator<Time, artis::qss::Quantifier<Time>, artis::qss::QuantifierParameters> _quantifier;
-        };
-
-    }
+namespace qss {
+
+template<class DerivativeParameters>
+struct QSSParameters {
+  artis::qss::IntegratorParameters integrator;
+  artis::qss::QuantifierParameters quantifier;
+  DerivativeParameters derivative;
+};
+
+template<class Time,
+    class Derivative,
+    class DerivativeParameters = artis::common::NoParameters>
+class GraphManager :
+    public artis::pdevs::GraphManager<Time,
+                                      QSSParameters<DerivativeParameters>,
+                                      artis::common::NoParameters> {
+public:
+  enum submodels {
+    S_Derivative, S_Integrator, S_Quantifier
+  };
+
+  enum inputs {
+    RESET
+  };
+
+  enum outputs {
+    OUT
+  };
+
+  GraphManager(common::Coordinator <Time> *coordinator,
+               const QSSParameters<DerivativeParameters> &parameters,
+               const artis::common::NoParameters &graph_parameters)
+      :
+      artis::pdevs::GraphManager<Time,
+                                 QSSParameters<DerivativeParameters>,
+                                 artis::common::NoParameters>(
+          coordinator,
+          parameters,
+          graph_parameters
+      ),
+      _derivative("d", parameters.derivative),
+      _integrator("i", parameters.integrator),
+      _quantifier("q", parameters.quantifier) {
+    this->add_child(S_Derivative, &_derivative);
+    this->add_child(S_Integrator, &_integrator);
+    this->add_child(S_Quantifier, &_quantifier);
+
+    coordinator->input_port({RESET, "reset"});
+    coordinator->output_port({OUT, "out"});
+
+    this->in({coordinator, RESET})
+        >> this->in({&_derivative, Derivative::RESET});
+    this->in({coordinator, RESET})
+        >> this->in({&_integrator, Integrator<Time>::RESET});
+    this->in({coordinator, RESET})
+        >> this->in({&_quantifier, Quantifier<Time>::RESET});
+
+    this->out({&_derivative, Derivative::OUT})
+        >> this->in({&_integrator, Integrator<Time>::X_DOT});
+    this->out({&_integrator, Integrator<Time>::OUT})
+        >> this->in({&_quantifier, Quantifier<Time>::IN});
+    this->out({&_quantifier, Quantifier<Time>::OUT})
+        >> this->in({&_integrator, Integrator<Time>::QUANTA});
+    this->out({&_integrator, Integrator<Time>::OUT})
+        >> this->out({coordinator, OUT});
+    this->out({&_integrator, Integrator<Time>::OUT})
+        >> this->in({&_derivative, Derivative::IN});
+  }
+
+  ~GraphManager() override = default;
+
+  artis::pdevs::Simulator<Time, Derivative, DerivativeParameters> *
+  derivative() { return &_derivative; }
+
+private:
+  artis::pdevs::Simulator<Time, Derivative, DerivativeParameters> _derivative;
+  artis::pdevs::Simulator<Time, artis::qss::Integrator<Time>, artis::qss::IntegratorParameters>
+      _integrator;
+  artis::pdevs::Simulator<Time, artis::qss::Quantifier<Time>, artis::qss::QuantifierParameters>
+      _quantifier;
+};
+
+}
 }
 
 #endif