Blame view

src/connections.h 2.07 KB
30448f62   Peter M. Groen   Replace Qt with s...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
  #pragma once
  
  #include "connection.h"
  
  #include <QList>
  #include <QSharedPointer>
  #include <string>
  #include <memory>
  #include <vector>
  
  namespace osdev {
  namespace components {
  
  /*
   *  ______________________________________
   * / My opinions always matter :-)        \
   * |                                      |
   * | - Dan Malek on the linuxppc-embedded |
   * \ list                                 /
   *  --------------------------------------
   *    \
   *     \
   *         .--.
   *        |o_o |
   *        |:_/ |
   *       //   \ \
   *      (|     | )
   *     /'\_   _/`\
   *     \___)=(___/
   *******************************************
   */
  /*!
   * \brief The connections class contains the source- and target
   *        endpoints of function-block connections. In- and outputs
   *        are represented by endpoint objects to be able to translate
   *        those to standard signals and slots.
   */
  
  class Connections
  {
  public:
      /*!
       * \brief CTor
       */
      Connections();
  
      /*!
       * \brief addConnection - Probably adds a connection...
       * \param _source   - The object we want to connect from by UUId
       * \param _target   - The object we want to connect to by UUId
       * \param _output   - The endpoint on the SOURCE by Name
       * \param _input    - The endpoint on the TARGET by Name
       */
      void addConnection(const std::string& _source, const std::string& _target, const std::string& _output, const std::string& _input);
  
      /*!
       * \return  The number of connections stored.
       */
      int count() const { return m_connections.size(); }
  
      /*!
       * \brief Gets the Connection for the specified index.
       * \param index The index for the connection.
       * \return Shared pointer to the connection.
       */
      std::shared_ptr<Connection> getConnection(int index);
  
      /*!
       * \brief Get the connections.
       * \return A list of connection shared pointers.
       */
      std::vector<std::shared_ptr<Connection>> getConnections() const { return m_connections; }
  
  private:
      std::vector<std::shared_ptr<Connection>>    m_connections;
  };
  
  } // namespace components
  } // namespace osdev