torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PortElement.hpp
Go to the documentation of this file.
1 // Torc - Copyright 2011-2013 University of Southern California. All Rights Reserved.
2 // $HeadURL$
3 // $Id$
4 
5 // This program is free software: you can redistribute it and/or modify it under the terms of the
6 // GNU General Public License as published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
11 // the GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License along with this program. If
14 // not, see <http://www.gnu.org/licenses/>.
15 
16 #ifndef TORC_GENERIC_PORTELEMENT_HPP
17 #define TORC_GENERIC_PORTELEMENT_HPP
18 
20 
21 namespace torc { namespace generic { class Port; } }
22 namespace torc { namespace generic { class PortReference; } }
23 
24 namespace torc {
25 namespace generic {
26 
27 /**
28  * @brief Represents port element like port or port reference.
29  *
30  */
31 
32 class PortElement {
33 public:
34  /**
35  * @enum ElementType
36  * Port element type
37  */
38  enum ElementType {
40  };
41 
42  /**
43  * Get the port element type
44  *
45  * @return port element type
46  */
47  inline const ElementType getType() const;
48 
49  /**
50  * Set the port element type
51  *
52  * @param[in] Pointer to port element type
53  */
54  void setType(const ElementType& inSource);
55 
56  /**
57  * Get the port from the composition
58  *
59  * @return Pointer to port from the composition
60  */
61  inline const PortSharedPtr getPort() const;
62 
63  /**
64  * Get the port reference from the composition
65  *
66  * @return Pointer to port reference from the composition
67  */
68  inline const PortReferenceSharedPtr getPortReference() const;
69 
70  PortElement();
71  PortElement(const PortSharedPtr& inPort);
72  PortElement(const PortReferenceSharedPtr& inPortRef);
73 
74  PortElement(const PortElement& inRhs);
75 
76  PortElement& operator =(const PortElement& inRhs);
77 
78  ~PortElement() throw ();
79 
80 private:
84 };
85 
86 inline const PortElement::ElementType PortElement::getType() const {
87  return mType;
88 }
89 
90 inline const PortSharedPtr PortElement::getPort() const {
91  return mPort;
92 }
93 
95  return mPortReference;
96 }
97 
98 } // namespace generic
99 } // namespace torc
100 
101 #endif // TORC_GENERIC_PORTELEMENT_HPP
const PortReferenceSharedPtr getPortReference() const
Definition: PortElement.hpp:94
const ElementType getType() const
Definition: PortElement.hpp:86
PortReferenceSharedPtr mPortReference
Definition: PortElement.hpp:83
Represents port element like port or port reference.
Definition: PortElement.hpp:32
PortElement & operator=(const PortElement &inRhs)
Definition: PortElement.cpp:45
const PortSharedPtr getPort() const
Definition: PortElement.hpp:90
boost::shared_ptr< PortReference > PortReferenceSharedPtr
void setType(const ElementType &inSource)
Definition: PortElement.cpp:30
boost::shared_ptr< Port > PortSharedPtr