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

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

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

Line 
1#ifndef SGMODULECONTAINER_H
2#define SGMODULECONTAINER_H
3
4#include "SgModule.h"
5#include <map>
6
7namespace Sg
8{
9    typedef SgModule* SgModulePtr;
10    /** \brief Type of data where modules are stored
11     *
12     */
13    typedef std::map<SgNameType, SgModulePtr> SgModuleContainerType;
14
15    /** \breif Iterator to the modules data storage
16     *
17     */
18    typedef SgModuleContainerType::iterator SgModuleContainerIteratorType;
19
20    class SgModuleContainerIterator: public SgModuleContainerIteratorType
21    {
22    public:
23        SgModuleContainerIterator();
24        SgModuleContainerIterator(const SgModuleContainerIteratorType &org);
25        SgModulePtr& operator* ();
26        SgModulePtr* operator->();
27    };
28
29    /** \brief This class models container in witch all modules are stored
30     *
31     */
32    class SgModuleContainer : public SgObject
33    {
34    public:
35        SgModuleContainer(const SgObject* parentObject=0);
36
37        /** \breif Destructor
38         */
39        virtual ~SgModuleContainer();
40
41
42        /** \brief Add new module to the container
43         *
44         *  \param newModuleName a new port name to be added
45         *  \return true on succes, false on failure
46         */
47        bool add(const SgNameType & newModuleName, const SgNameType &categoryName="", const SgNameType &subCategoryName="");
48
49        /** \brief Add a new port to the module stored in the container
50         *
51         *  \param moduleName name of the module to whitch new port should be added
52         *  \param newPortName a new port name to be added
53         *  \return true on succes, false on failure
54         */
55        bool addPort(const SgNameType & moduleName, const SgNameType & newPortName);
56
57        /** \brief Delete all modules and its data
58         *
59         *  \return true on succes, false on failure
60         */
61        bool clear();
62
63        /** \brief Delete module
64         *
65         *  \param moduleName name of the module to be deleted
66         *  \return true on succes, false on failure
67         */
68        bool del(const SgNameType &moduleName);
69
70        /** \breif Delete port from the module stored in the container
71         *
72         *  \param moduleName name of the module from whitch port should be removed
73         *  \param portName name of the port to be removed
74         *  \return true on succes, false on failure
75         */
76        bool delPort(const SgNameType &moduleName, const SgNameType &portName);
77
78        /** \breif Returns iterator to the module
79         *
80         *  \param moduleName name of the module that iterator will be returned
81         *  \return on succes return iterator corresponding to the module of a name moduleName,
82         *          on failure returns value of a null() method
83         */
84        SgModuleContainerIterator get(const SgNameType &moduleName);
85
86        /** \brief Check if module exists
87         *
88         *  \param moduleName name of the module to check if it exists
89         *  \return true if module exists, false otherwise
90         */
91        bool exist(const SgNameType &moduleName);
92
93        /** \brief Iterator to the begin of the container
94         *
95         *  \return Iterator to the module
96         */
97        SgModuleContainerIterator begin();
98
99        /** \brief Iterator to the end of the container
100         *
101         *  \return Iterator to the module
102         */
103        SgModuleContainerIterator end();
104
105        /** \brief Special iterator coresponding to the NULL pointer
106         *
107         *  \return Iterator to the module
108         */
109        SgModuleContainerIterator null();
110
111        int size();
112
113    private:
114        /** \breif Container storing modules
115         */
116        SgModuleContainerType modules; // list of modules names
117    };
118} // namespace Sg (END)
119
120#endif // SGMODULECONTAINER_H
Note: See TracBrowser for help on using the repository browser.