source: libs/QtGui/inc/SgConnectionContainer.h @ 445

Revision 445, 3.1 KB checked in by lmalek, 10 years ago (diff)

Samgar edition by WRUT. Based on Qt. Initial import.

Line 
1#ifndef SGCONNECTIONCONTAINER_H
2#define SGCONNECTIONCONTAINER_H
3
4
5#include "SgConnection.h"
6#include <map>
7
8namespace Sg
9{
10    typedef SgConnection* SgConnectionPtr;
11    /** \brief Type of data where Connections are stored
12     *
13     */
14    typedef std::map<SgNameType, SgConnectionPtr> SgConnectionContainerType;
15
16    /** \breif Iterator to the Ports data storage
17     *
18     */
19    typedef SgConnectionContainerType::iterator SgConnectionContainerIteratorType;
20
21    class SgConnectionContainerIterator: public SgConnectionContainerIteratorType
22    {
23    public:
24        SgConnectionContainerIterator();
25        SgConnectionContainerIterator(const SgConnectionContainerIteratorType &org);
26        SgConnectionPtr& operator* ();
27        SgConnectionPtr* operator->();
28    };
29
30    class SgConnectionContainer: public SgObject
31    {
32    public:
33
34        /** \breif Constructor
35         */
36        SgConnectionContainer(const SgObject* parentObject=0);
37
38        /** \brief Destructor
39         */
40        virtual ~SgConnectionContainer();
41
42        /** \brief Add new Port to the container
43         *
44         *  \param newPort reference to the new Port structure
45         *  \return true on succes, false on failure
46         */
47
48        bool add(const SgModule* module1, const SgPort* port1,
49                 const SgModule* module2, const SgPort* port2,
50                 SgConnection::SgProtocolType protocol, SgConnection::SgNetworkType network);
51
52        /** \brief Delete all Ports and its data
53         *
54         *  \return true on succes, false on failure
55         */
56        bool clear();
57
58        /** \brief Delete port
59         *
60         *  \param portName name of the Port to be deleted
61         *  \return true on succes, false on failure
62         */
63        bool del(const SgNameType & connectionName);
64
65        /** \breif Returns iterator to the port
66         *
67         *  \param portName name of the Port that iterator will be returned
68         *  \return on succes return iterator corresponding to the Port of a name PortName,
69         *          on failure returns value of a null() method
70         */
71        SgConnectionContainerIterator get(const SgNameType &connectionName);
72
73        /** \brief Check if Port exists
74         *
75         *  \param portName name of the Port to check if it exists
76         *  \return true if Port exists, false otherwise
77         */
78        bool exist(const SgNameType &connectionName);
79
80        /** \brief Iterator to the begin of the container
81         *
82         *  \return Iterator to the Port
83         */
84        SgConnectionContainerIterator begin();
85
86        /** \brief Iterator to the end of the container
87         *
88         *  \return Iterator to the Port
89         */
90        SgConnectionContainerIterator end();
91
92        /** \brief Special iterator coresponding to the NULL pointer
93         *
94         *  \return Iterator to the Port
95         */
96        SgConnectionContainerIterator null();
97
98        int size();
99
100    private:
101        /** \breif Container storing Ports
102         */
103        SgConnectionContainerType connections; // list of Connection names
104    };
105
106} // namespac Sg (END)
107
108#endif // SGCONNECTIONCONTAINER_H
Note: See TracBrowser for help on using the repository browser.