From 219dc02d8af2822e01c03e87de050ed367e08fca Mon Sep 17 00:00:00 2001
From: Jaime Arias Almeida <arias@lipn.univ-paris13.fr>
Date: Tue, 1 Oct 2019 17:08:05 +0200
Subject: [PATCH] removing std namespace from headers

---
 AUTHORS.md                        |  6 ++++++
 docs/setup.hpp                    |  5 +++++
 src/amas/action.hpp               |  8 ++------
 src/amas/automata.hpp             | 26 ++++++++++++++++++--------
 src/amas/automaton.hpp            | 27 +++++++++++++++++----------
 src/amas/channel.cpp              |  2 ++
 src/amas/channel.hpp              | 16 ++++++++--------
 src/amas/label.cpp                |  2 ++
 src/amas/label.hpp                |  8 ++++++++
 src/amas/state.cpp                |  1 +
 src/amas/state.hpp                |  7 ++++---
 src/amas/state_type.cpp           |  2 ++
 src/amas/state_type.hpp           | 13 ++++---------
 src/amas/synchronization.cpp      |  3 ++-
 src/amas/synchronization.hpp      | 14 ++++++++++++--
 src/amas/synchronization_type.cpp |  6 ++++--
 src/amas/synchronization_type.hpp | 22 ++++++++++++----------
 src/amas/transition.cpp           |  2 ++
 src/amas/transition.hpp           |  2 +-
 src/translator.cpp                |  2 ++
 tests/amas/state.cpp              |  3 +++
 21 files changed, 117 insertions(+), 60 deletions(-)

diff --git a/AUTHORS.md b/AUTHORS.md
index 98c9627..70e802c 100644
--- a/AUTHORS.md
+++ b/AUTHORS.md
@@ -2,3 +2,9 @@
 
 - Jaime ARIAS (arias@lipn.univ-paris13.fr)
 - Giann Karlo AGUIRRE SAMBONÍ (giannkas1@gmail.com)
+
+The development of this tool has been support by:
+
+- PICS CNRS Project PARTIES (2019)
+- PHC Van Gogh Project PAMPAS (2019)
+- BQR Project AMOJAS (2018)
diff --git a/docs/setup.hpp b/docs/setup.hpp
index d728a74..e39e8a0 100644
--- a/docs/setup.hpp
+++ b/docs/setup.hpp
@@ -18,6 +18,11 @@
  * @defgroup eamas Extended Asynchronous Multi-Agents Systems
  */
 
+/**
+ * @defgroup eamas_action EAMAS' Actions
+ * @ingroup eamas
+ */
+
 /**
  * @defgroup adt2amas Translator ADTree into EAMAS
  */
diff --git a/src/amas/action.hpp b/src/amas/action.hpp
index 1a5028f..0026320 100644
--- a/src/amas/action.hpp
+++ b/src/amas/action.hpp
@@ -1,12 +1,10 @@
 #ifndef ACTION_HPP
 #define ACTION_HPP
 
-#include <iostream>
+#include <string>
 #include <vector>
-// #include "amas_visitor.hpp"
-
-// class AMASVisitor;
 
+//! \ingroup eamas_action
 //! Action entity, associated to a transition to represent either a
 //! Synchronization or a Label implementations.
 /*! Action is an abstract class since it has at least one pure virtual
@@ -20,8 +18,6 @@ class Action {
   //! A pure virtual member.
   virtual std::string get_info() = 0;
 
-  // virtual void accept(AMASVisitor &visitor) = 0;
-
   //! A pure virtual member.
   virtual std::vector<std::string> get_info_vector() = 0;
 };
diff --git a/src/amas/automata.hpp b/src/amas/automata.hpp
index e8f9f05..dd51aae 100644
--- a/src/amas/automata.hpp
+++ b/src/amas/automata.hpp
@@ -1,6 +1,9 @@
 #ifndef AUTOMATA_HPP
 #define AUTOMATA_HPP
 
+#include <set>
+#include <string>
+#include <vector>
 #include "automaton.hpp"
 #include "channel.hpp"
 #include "parser/amas_visitor.hpp"
@@ -9,6 +12,8 @@ class Automaton;
 class AMASVisitor;
 
 /**
+ * \ingroup eamas
+ *
  * Automata entity, a bunch of automaton and channels to synchronize them.
  * Basically, it is a class to model and control a system which has several
  * agents (Automaton) and channels. The former communicate and synchronize
@@ -22,7 +27,7 @@ class Automata {
      ids must be unique and can not exist twice same Automaton instances in
      Automata.
   */
-  set<int> automaton_ids_;
+  std::set<int> automaton_ids_;
 
   //! A private attribute of set type to collect integers.
   /*!
@@ -30,21 +35,21 @@ class Automata {
      ids must be unique and can not exist twice same Channel instances in
      Automata.
   */
-  set<int> channel_ids_;
+  std::set<int> channel_ids_;
 
   //! A private attribute of vector type to collect Automaton pointers.
   /*!
       It is used to save Automaton pointers which are in the Automata. The
      pointers here must be correlated with ids saved in automaton_ids_.
   */
-  vector<Automaton *> vector_automaton_;
+  std::vector<Automaton *> vector_automaton_;
 
   //! A private attribute of vector type to collect Channel pointers.
   /*!
       It is used to save Channel pointers which are in the Automata. The
      pointers here must be correlated with ids saved in channel_ids_.
   */
-  vector<Channel *> channels_;
+  std::vector<Channel *> channels_;
 
  public:
   //! Automata constructor.
@@ -53,6 +58,7 @@ An instance of Automata is created empty and following, it is possible to add
 Automaton and Channel instances.
 */
   Automata();
+
   //! Action destructor.
   ~Automata();
 
@@ -63,7 +69,7 @@ Automaton and Channel instances.
       Member part of getters.
       \return A vector of type Automaton pointers.
   */
-  vector<Automaton *> get_vector_automaton();
+  std::vector<Automaton *> get_vector_automaton();
 
   //! A public method to get ids of Automaton instances associated with this
   //! Automata instance.
@@ -72,14 +78,14 @@ Automaton and Channel instances.
       \return A set of type int which are Automaton ids associated with this
      Automata instance.
   */
-  set<int> get_automaton_ids();
+  std::set<int> get_automaton_ids();
 
   //! A public method to get vector pointers of Channel instances.
   /*!
       Member part of getters.
       \return A vector of type Channel pointers.
   */
-  vector<Channel *> get_channels();
+  std::vector<Channel *> get_channels();
 
   //! A public method to get a information type of string.
   /*!
@@ -87,8 +93,12 @@ Automaton and Channel instances.
       \return A string which contain information about an Automata instance,
      their Automaton and Channel instances.
   */
-  string get_info();
+  std::string get_info();
 
+  //! A public method implementing the visitor pattern
+  /*!
+      @param visitor is a visitor instance
+   */
   void accept(AMASVisitor &visitor);
 
   /* Sets */
diff --git a/src/amas/automaton.hpp b/src/amas/automaton.hpp
index 9258b80..7d2c396 100644
--- a/src/amas/automaton.hpp
+++ b/src/amas/automaton.hpp
@@ -2,6 +2,7 @@
 #define AUTOMATON_HPP
 
 #include <set>
+#include <string>
 #include <vector>
 #include "action.hpp"
 #include "parser/amas_visitor.hpp"
@@ -13,6 +14,7 @@ class AMASVisitor;
 class State;
 class Transition;
 
+//! \ingroup eamas
 //! Automaton entity, compose by states and transitions to connect them.
 /*!
     A class to model an agent which is an abstract machine with states and
@@ -49,7 +51,7 @@ class Automaton {
       It is used to save State ids to take advantage of set definition since ids
      must be unique and can not exist twice same State instances in Automaton.
   */
-  set<int> state_ids_;
+  std::set<int> state_ids_;
 
   //! A private attribute of set type to collect integers.
   /*!
@@ -57,21 +59,21 @@ class Automaton {
      since ids must be unique and can not exist twice same Transition instances
      in Automaton.
   */
-  set<int> transition_ids_;
+  std::set<int> transition_ids_;
 
   //! A private attribute of vector type to collect State pointers.
   /*!
       It is used to save State pointers which are in the Automaton. The pointers
      here must be correlated with ids saved in state_ids_.
   */
-  vector<State *> states_;
+  std::vector<State *> states_;
 
   //! A private attribute of vector type to collect Transition pointers.
   /*!
       It is used to save Transition pointers which are in the Automaton. The
      pointers here must be correlated with ids saved in transition_ids_.
   */
-  vector<Transition *> transitions_;
+  std::vector<Transition *> transitions_;
 
   //! A private method to remove a Transition instance to an Automaton instance
   //! because removing a state.
@@ -105,6 +107,7 @@ class Automaton {
      of this Automaton instance.
   */
   Automaton(State *initial_state);
+
   //! Automaton destructor.
   /*!
       It deletes their pointer to initial_state_.
@@ -133,7 +136,7 @@ class Automaton {
       \return A set of type int which are State ids associated with this
      Automaton instance.
   */
-  set<int> get_state_ids();
+  std::set<int> get_state_ids();
 
   //! A public method to get ids of Transition instances associated with this
   //! Automaton instance.
@@ -142,21 +145,21 @@ class Automaton {
       \return A set of type int which are Transition ids associated with this
      Automaton instance.
   */
-  set<int> get_transition_ids();
+  std::set<int> get_transition_ids();
 
   //! A public method to get vector pointers of State instances.
   /*!
       Member part of getters.
       \return A vector of type State pointers.
   */
-  vector<State *> get_states();
+  std::vector<State *> get_states();
 
   //! A public method to get vector pointers of Transition instances.
   /*!
       Member part of getters.
       \return A vector of type Transition pointers.
   */
-  vector<Transition *> get_transitions();
+  std::vector<Transition *> get_transitions();
 
   //! A public method to get a information type of string.
   /*!
@@ -165,8 +168,12 @@ class Automaton {
      their State and Transition instances. Indentation applied for each
      Transition instance associated with a particular State.
   */
-  string get_info();
+  std::string get_info();
 
+  //! A public method implementing the visitor pattern
+  /*!
+      @param visitor is a visitor instance
+   */
   void accept(AMASVisitor &visitor);
 
   /* Sets */
@@ -196,7 +203,7 @@ class Automaton {
      same entries.
   */
   void add_transition(State *source_state, State *destination_state,
-                      Action *action, vector<Update *> updates = {});
+                      Action *action, std::vector<Update *> updates = {});
 
   //! A public method to add an State instance to an Automaton instance.
   /*!
diff --git a/src/amas/channel.cpp b/src/amas/channel.cpp
index 9359eb6..611efb0 100644
--- a/src/amas/channel.cpp
+++ b/src/amas/channel.cpp
@@ -1,5 +1,7 @@
 #include "channel.hpp"
 
+using namespace std;
+
 Channel::Channel(string name) : name_(name) {
   ++current_id;
   id = current_id;
diff --git a/src/amas/channel.hpp b/src/amas/channel.hpp
index 89068b9..d03db8e 100644
--- a/src/amas/channel.hpp
+++ b/src/amas/channel.hpp
@@ -1,11 +1,11 @@
 #ifndef CHANNEL_HPP
 #define CHANNEL_HPP
 
-#include <iostream>
-
-using namespace std;
+#include <string>
 
 /**
+ * @ingroup eamas_action
+ *
  * Channel entity, part of Automata used to synchronize Automaton.
  * This class is used to  allow a way where several agents can synchronize (Send
  * or Receive) regard to name Channel. It has an unique id number.
@@ -31,7 +31,7 @@ class Channel {
   /**
    * A private attribute of string type to save a Channel name instance.
    */
-  string name_;
+  std::string name_;
 
  public:
   /**
@@ -40,7 +40,7 @@ class Channel {
    *
    * @param name is a default argument which if not passed, is an empty string.
    */
-  Channel(string name = "");
+  Channel(std::string name = "");
   /**
    * Channel destructor.
    */
@@ -59,7 +59,7 @@ class Channel {
    *
    * @return A string type corresponding to the name of a Channel instance.
    */
-  string get_name();
+  std::string get_name();
 
   /**
    * A public method to get the info of a Channel instance.
@@ -67,7 +67,7 @@ class Channel {
    * @return A string type corresponding to the word (Channel) concatenate with
    * id number and name of a Channel instance.
    */
-  string get_info();
+  std::string get_info();
 
   /* Sets */
 
@@ -76,6 +76,6 @@ class Channel {
    *
    * @param name is a string for the new name to be assigned in name_ attribute.
    */
-  void set_name(string name);
+  void set_name(std::string name);
 };
 #endif
diff --git a/src/amas/label.cpp b/src/amas/label.cpp
index 5580e00..a5c263c 100644
--- a/src/amas/label.cpp
+++ b/src/amas/label.cpp
@@ -1,5 +1,7 @@
 #include "label.hpp"
 
+using namespace std;
+
 Label::Label(string name) : name_(name) {}
 
 Label::~Label() {}
diff --git a/src/amas/label.hpp b/src/amas/label.hpp
index 1453896..4e6741f 100644
--- a/src/amas/label.hpp
+++ b/src/amas/label.hpp
@@ -9,6 +9,8 @@
 class AMASVisitor;
 
 /**
+ * @ingroup eamas_action
+ *
  * Label entity, an Action which does not synchronize.
  *
  * It is an implementation for Action interface and set a name for an action
@@ -29,6 +31,7 @@ class Label : public Action {
    * @param name is a default argument which if not passed, is an empty string.
    */
   Label(std::string name = "");
+
   /**
    * Label destructor.
    */
@@ -50,6 +53,11 @@ class Label : public Action {
    */
   std::string get_info();
 
+  /**
+   * A public method implementing the visitor pattern
+   *
+   * @param visitor is a visitor instance
+   */
   void accept(AMASVisitor &visitor);
 
   /**
diff --git a/src/amas/state.cpp b/src/amas/state.cpp
index 1c91e34..375eb82 100644
--- a/src/amas/state.cpp
+++ b/src/amas/state.cpp
@@ -1,5 +1,6 @@
 #include "state.hpp"
 #include <string>
+#include <vector>
 
 using namespace std;
 
diff --git a/src/amas/state.hpp b/src/amas/state.hpp
index 0c39347..edf2354 100644
--- a/src/amas/state.hpp
+++ b/src/amas/state.hpp
@@ -2,6 +2,7 @@
 #define STATE_HPP
 
 #include <string>
+#include <vector>
 #include "parser/amas_visitor.hpp"
 #include "state_type.hpp"
 #include "transition.hpp"
@@ -41,7 +42,7 @@ class State {
    * A private attribute of vector type to collect Transition pointers.
    * It is used to save Transition pointers associated with a State instance.
    */
-  vector<Transition *> transitions_;
+  std::vector<Transition *> transitions_;
 
  public:
   /**
@@ -79,7 +80,7 @@ class State {
    * @return A vector of type Transition pointers, which are associated to a
    * State instance.
    */
-  vector<Transition *> get_transitions();
+  std::vector<Transition *> get_transitions();
 
   /**
    * A public method to get the info of a State instance.
@@ -116,6 +117,6 @@ class State {
    * @param transitions is a vector for the new transition pointers to be
    * assigned in transitions_ attribute.
    */
-  void set_transitions(vector<Transition *> transitions);
+  void set_transitions(std::vector<Transition *> transitions);
 };
 #endif
diff --git a/src/amas/state_type.cpp b/src/amas/state_type.cpp
index 2c35f99..84927d9 100644
--- a/src/amas/state_type.cpp
+++ b/src/amas/state_type.cpp
@@ -1,5 +1,7 @@
 #include "state_type.hpp"
 
+using namespace std;
+
 string to_string(StateType st) {
   string _st = "";
   switch (st) {
diff --git a/src/amas/state_type.hpp b/src/amas/state_type.hpp
index 627a972..70a37fc 100644
--- a/src/amas/state_type.hpp
+++ b/src/amas/state_type.hpp
@@ -1,21 +1,16 @@
 #ifndef STATE_TYPE_HPP
 #define STATE_TYPE_HPP
 
-#include <iostream>
 #include <string>
 
-using namespace std;
-
 /**
+ * @ingroup eamas
+ *
  * StateType enum class.
  *
  * by definition there are three types of States: initial, normal and accepted.
  */
-enum class StateType {
-  Normal,   // 0
-  Initial,  // 1
-  Accepted  // 2
-};
+enum class StateType { Normal, Initial, Accepted };
 
 // methods
 
@@ -26,6 +21,6 @@ enum class StateType {
  * @return A string type corresponding to the mapping function implemented for
  * the st argument.
  */
-string to_string(StateType st);
+std::string to_string(StateType st);
 
 #endif
diff --git a/src/amas/synchronization.cpp b/src/amas/synchronization.cpp
index 9bd6159..7622a11 100644
--- a/src/amas/synchronization.cpp
+++ b/src/amas/synchronization.cpp
@@ -1,5 +1,6 @@
 #include "synchronization.hpp"
-#include <bits/stdc++.h>
+
+using namespace std;
 
 Synchronization::Synchronization(SynchronizationType synchronization_type,
                                  Channel *channel)
diff --git a/src/amas/synchronization.hpp b/src/amas/synchronization.hpp
index a0e17f3..8079608 100644
--- a/src/amas/synchronization.hpp
+++ b/src/amas/synchronization.hpp
@@ -1,6 +1,8 @@
 #ifndef SYNCHRONIZATION_HPP
 #define SYNCHRONIZATION_HPP
 
+#include <string>
+#include <vector>
 #include "action.hpp"
 #include "channel.hpp"
 #include "parser/amas_visitor.hpp"
@@ -9,6 +11,8 @@
 class AMASVisitor;
 
 /**
+ * @ingroup eamas_action
+ *
  * Synchronization entity, an action used to synchronize automaton.
  *
  * It is an implementation for Action interface and set a type to synchronize
@@ -41,6 +45,7 @@ class Synchronization : public Action {
   Synchronization(
       SynchronizationType synchronization_type = SynchronizationType::Send,
       Channel *channel = nullptr);
+
   /**
    * Channel destructor.
    */
@@ -69,8 +74,13 @@ class Synchronization : public Action {
    * Synchronization type concatenate the name of the Channel instance
    * associated.
    */
-  string get_info();
+  std::string get_info();
 
+  /**
+   * A public method implementing the visitor pattern
+   *
+   * @param visitor is a visitor instance
+   */
   void accept(AMASVisitor &visitor);
 
   /**
@@ -80,7 +90,7 @@ class Synchronization : public Action {
    * conversion of Synchronization type and a push back of the name of the
    * Channel instance associated.
    */
-  vector<string> get_info_vector();
+  std::vector<std::string> get_info_vector();
 
   /* Sets */
   /**
diff --git a/src/amas/synchronization_type.cpp b/src/amas/synchronization_type.cpp
index ed69278..5d38469 100644
--- a/src/amas/synchronization_type.cpp
+++ b/src/amas/synchronization_type.cpp
@@ -1,8 +1,10 @@
 #include "synchronization_type.hpp"
 
-string to_string(SynchronizationType sh) {
+using namespace std;
+
+string to_string(SynchronizationType sync_type) {
   string sh_ = "";
-  switch (sh) {
+  switch (sync_type) {
     case SynchronizationType::Send:
       sh_ = "!";
       break;
diff --git a/src/amas/synchronization_type.hpp b/src/amas/synchronization_type.hpp
index 80e31d3..fcf0cda 100644
--- a/src/amas/synchronization_type.hpp
+++ b/src/amas/synchronization_type.hpp
@@ -1,23 +1,25 @@
 #ifndef SYNCHRONIZATION_TYPE_HPP
 #define SYNCHRONIZATION_TYPE_HPP
 
-#include <iostream>
-
-using namespace std;
+#include <string>
 
 /**
+ * @ingroup eamas_action
+ *
  * SynchronizationType enum class.
  *
  * Eventually, automaton does synchronization which must be a match: Send or
  * Receive.
  */
-enum class SynchronizationType {
-  Send,    // 0
-  Receive  // 1
-};
+enum class SynchronizationType { Send, Receive };
 
-// methods
-
-string to_string(SynchronizationType sh);
+/**
+ * Returns the string representation of the synchronization type.
+ *
+ * @param sync_type synchronization type.
+ *
+ * @return a string with the synchronization type.
+ */
+std::string to_string(SynchronizationType sync_type);
 
 #endif
diff --git a/src/amas/transition.cpp b/src/amas/transition.cpp
index f972641..aed9b9a 100644
--- a/src/amas/transition.cpp
+++ b/src/amas/transition.cpp
@@ -1,6 +1,8 @@
 #include "transition.hpp"
 #include "update.hpp"
 
+using namespace std;
+
 Transition::Transition(State *source_state, State *destination_state,
                        Action *action, vector<Update *> updates)
     : source_state_(source_state),
diff --git a/src/amas/transition.hpp b/src/amas/transition.hpp
index 2d04f0b..4b08cd0 100644
--- a/src/amas/transition.hpp
+++ b/src/amas/transition.hpp
@@ -126,7 +126,7 @@ class Transition {
    * @return A string type corresponding to the to the word (Transition)
    * concatenate with id number and info of a Action instance.
    */
-  string get_info();
+  std::string get_info();
 
   void accept(AMASVisitor &visitor);
 
diff --git a/src/translator.cpp b/src/translator.cpp
index cdef6af..346d447 100644
--- a/src/translator.cpp
+++ b/src/translator.cpp
@@ -9,6 +9,8 @@
 #include "leaf.hpp"
 #include "variable.hpp"
 
+using namespace std;
+
 Translator::Translator() {}
 Translator::~Translator() {}
 
diff --git a/tests/amas/state.cpp b/tests/amas/state.cpp
index dbb569c..fcf2f49 100644
--- a/tests/amas/state.cpp
+++ b/tests/amas/state.cpp
@@ -1,5 +1,8 @@
 #include "state.hpp"
 #include <catch.hpp>
+#include <vector>
+
+using namespace std;
 
 /* TODO:
  * 1) Change state type by a property of the state
-- 
GitLab