21 #ifdef GENOM_SERIALIZATION
22 #include <boost/archive/binary_iarchive.hpp>
23 #include <boost/archive/binary_oarchive.hpp>
24 #include <boost/serialization/base_object.hpp>
25 #include <boost/serialization/list.hpp>
26 #endif //GENOM_SERIALIZATION
46 const std::list<PortReferenceSharedPtr>& inPortReferences)
throw (
Error) {
50 std::list<PortSharedPtr>::const_iterator portIt = inPorts.begin();
51 for(; portIt != inPorts.end(); portIt++) {
52 newPortList->addChildPort(*portIt);
54 std::list<PortReferenceSharedPtr>::const_iterator portRefIt = inPortReferences.begin();
55 for(; portRefIt != inPortReferences.end(); portRefIt++) {
56 newPortList->addChildPortReference(*portRefIt);
75 const boost::shared_ptr<_Tp>& inType,
size_t& inoutCurrentWidth)
throw (
Error) {
78 typedef boost::shared_ptr<_Tp>
Pointer;
79 size_t updatedSize = inoutCurrentWidth + inType->
getSize();
80 if(updatedSize > inNet->getSize()) {
84 switch(inNet->getCompositionType()) {
87 if(1 == inType->getSize()) {
96 std::vector<NetSharedPtr> children;
97 inNet->getChildren(children);
99 switch(inType->getCompositionType()) {
104 connectElementToNet(children[inoutCurrentWidth], inType, inoutCurrentWidth);
110 std::vector<Pointer> cTypes;
111 inType->getChildren(cTypes);
113 for(
size_t i = inoutCurrentWidth; i < updatedSize; i++, j++) {
114 connectElementToNet(children[i], cTypes[j], inoutCurrentWidth);
119 std::vector<Pointer> cTypes;
120 inType->getChildren(cTypes);
121 for(
typename std::vector<Pointer>::iterator it = cTypes.begin(); it != cTypes.end();
123 connectElementToNet(inNet, *it, inoutCurrentWidth);
142 for(std::list<PortListElement>::iterator it = mElements.begin(); it != mElements.end(); ++it) {
144 switch((*it).getType()) {
145 case PortListElement::eElementTypePort: {
146 connectElementToNet(inNet, (*it).getPort(), count);
149 case PortListElement::eElementTypePortReference: {
150 connectElementToNet(inNet, (*it).getPortReference(), count);
168 return newConnection;
187 for(std::list<PortListElement>::const_iterator it =
mElements.begin(); it !=
mElements.end();
189 switch((*it).getType()) {
191 size += (*it).getPort()->getSize();
195 size += (*it).getPortReference()->getSize();
221 #ifdef GENOM_SERIALIZATION
223 template <
class Archive>
void PortList::PortListElement::serialize(Archive& ar,
unsigned int ) {
229 template <
class Archive>
void PortList::serialize(Archive& ar,
unsigned int) {
230 ar & boost::serialization::base_object<Connectable>(*this);
231 ar & boost::serialization::base_object<SelfReferencing<PortList> >(*this);
236 template void PortList::serialize<boost::archive::binary_iarchive>(
237 boost::archive::binary_iarchive& ar,
const unsigned int);
239 template void PortList::serialize<boost::archive::binary_oarchive>(
240 boost::archive::binary_oarchive& ar,
const unsigned int);
242 #endif //GENOM_SERIALIZATION
virtual Connection connect(const NetSharedPtr &inNet)=0
void connectPortListToNet(const PortListSharedPtr &inPortList)
void getChildren(std::list< PortListElement > &outPorts)
PortReferenceSharedPtr mPortReference
An object that is connectable to a Net.
virtual PortListSharedPtr newPortListPtr(const std::list< PortSharedPtr > &inPorts, const std::list< PortReferenceSharedPtr > &inPortReferences)
std::list< NetSharedPtr >::iterator Connection
void runVisitor(_Tp &inoutVisited, BaseVisitor &inoutVisitor)
void connectElementToNet(const NetSharedPtr &inNet, const boost::shared_ptr< _Tp > &inType, size_t &inoutCurrentWidth)
virtual void disconnect()
void addChildPortReference(const PortReferenceSharedPtr &inPortRef)
The Error object thrown by different methods of EdifOM.
boost::shared_ptr< Type > Pointer
boost::shared_ptr< Net > NetSharedPtr
A base class for Visitor.
boost::shared_ptr< PortReference > PortReferenceSharedPtr
boost::shared_ptr< PortList > PortListSharedPtr
Represents an ordered list of port references.
virtual void accept(BaseVisitor &inoutVisitor)
boost::shared_ptr< Port > PortSharedPtr
virtual Connection connect(const NetSharedPtr &inNet)
void disconnectPortListFromNet(const PortListSharedPtr &inPortList)
void addChildPort(const PortSharedPtr &inPort)
PortElement PortListElement
std::list< PortListElement > mElements
void setCurrentLocation(const std::string &inFunction, const std::string &inFile, uint32_t inLine)