source: libs/SamgarWRUTed/tags/1.0/QtGui/inc/SgPortContainer.h @ 447

Revision 447, 2.6 KB checked in by lmalek, 10 years ago (diff)

tree structure reorganization

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