00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef TORC_GENERIC_OM_PORTLIST_HPP
00017 #define TORC_GENERIC_OM_PORTLIST_HPP
00018
00019
00020 #ifdef GENOM_SERIALIZATION
00021 #include <boost/serialization/access.hpp>
00022 #endif //GENOM_SERIALIZATION
00023
00024 #include <list>
00025
00026 #include "torc/generic/om/PointerTypes.hpp"
00027 #include "torc/generic/om/DumpRestoreConfig.hpp"
00028 #include "torc/generic/om/Connectable.hpp"
00029 #include "torc/generic/om/FactoryType.hpp"
00030 #include "torc/generic/om/VisitorType.hpp"
00031 #include "torc/generic/om/PortElement.hpp"
00032
00033 namespace torc { namespace generic { class PortElement; } }
00034
00035 namespace torc {
00036
00037 namespace generic {
00038
00039
00040
00041
00042
00043
00044
00045
00046 class PortList
00047 : public Connectable,
00048 public SelfReferencing<PortList> {
00049
00050 #ifdef GENOM_SERIALIZATION
00051 friend class boost::serialization::access;
00052 #endif //GENOM_SERIALIZATION
00053
00054 friend class FactoryType<PortList>;
00055
00056 public:
00057 typedef PortElement PortListElement;
00058
00059 typedef VisitorType<PortList> Visitor;
00060
00061
00062
00063
00064 class Factory: public FactoryType<PortList>
00065 {
00066 public:
00067 using FactoryType<PortList>::create;
00068
00069
00070
00071
00072
00073
00074
00075
00076 virtual PortListSharedPtr
00077 newPortListPtr( const std::list< PortSharedPtr > & inPorts,
00078 const std::list< PortReferenceSharedPtr > & inPortReferences ) throw(Error);
00079 };
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093 virtual void
00094 accept(BaseVisitor & inoutVisitor) throw(Error);
00095
00096
00097
00098
00099
00100
00101
00102 virtual Connection
00103 connect(const NetSharedPtr & inNet) throw(Error);
00104
00105 using Connectable::disconnect;
00106
00107
00108
00109
00110
00111
00112
00113
00114 virtual void
00115 disconnect(const Connection & inConnection) throw(Error);
00116
00117
00118
00119
00120
00121 size_t
00122 getSize() const throw();
00123
00124
00125
00126
00127
00128
00129 void
00130 addChildPort( const PortSharedPtr &inPort ) throw();
00131
00132
00133
00134
00135
00136
00137 void
00138 addChildPortReference(
00139 const PortReferenceSharedPtr &inPortRef ) throw();
00140
00141
00142
00143
00144
00145 void
00146 getChildren( std::list< PortListElement > &outPorts ) throw();
00147
00148 virtual
00149 ~PortList() throw();
00150
00151 protected:
00152 PortList();
00153
00154 private:
00155 template<typename _Tp>
00156 void
00157 connectElementToNet( const NetSharedPtr &inNet,
00158 const boost::shared_ptr<_Tp> &inType,
00159 size_t &inoutCurrentWidth ) throw(Error);
00160
00161 #ifdef GENOM_SERIALIZATION
00162 template<class Archive> void
00163 serialize( Archive &ar, unsigned int );
00164 #endif //GENOM_SERIALIZATION
00165
00166 private:
00167 std::list< PortListElement > mElements;
00168 };
00169
00170 }
00171
00172 }
00173 #endif // TORC_GENERIC_OM_PORTLIST_HPP