#include "beagle/Beagle.hpp" #include "TransportSendTCPIPOp.hpp" #include "Socket.hpp" #include #include using namespace Beagle; using namespace std; TransportSendTCPIPOp::TransportSendTCPIPOp(const string& inName) : TransportSendOp(inName) { } TransportSendTCPIPOp::~TransportSendTCPIPOp() { } void TransportSendTCPIPOp::initialize(System& ioSystem) { TransportSendOp::initialize(ioSystem); } void TransportSendTCPIPOp::send(const Individual::Bag& inIndividuals, Context &ioContext) { if (mAddresses.empty()) { Beagle_LogBasicM( ioContext.getSystem().getLogger(), "transport", "Beagle::TransportSendTCPIPOp", "Warning! There are no addresses to send individuals" ); return; } // Convert the bag into a string string lMessage = inIndividuals.serialize(); // Send to addresses for (unsigned int i=0; igetValue() == "Address" ); UInt::Handle lPort; String::Handle lName; for (PACC::XML::ConstIterator lNode = inNode->getFirstChild(); lNode; lNode = lNode->getNextSibling()) { // Read port if (lNode->getValue() == "Port") { lPort = new UInt; PACC::XML::ConstIterator lPortNode = lNode->getFirstChild(); Beagle_AssertM( lPortNode->getType() == PACC::XML::eString ); std::istringstream lISS( lPortNode->getValue() ); lISS >> lPort->getWrappedValue(); } // Read name else if (lNode->getValue() == "Name") { lName = new String; PACC::XML::ConstIterator lNameNode = lNode->getFirstChild(); Beagle_AssertM( lNameNode->getType() == PACC::XML::eString ); std::istringstream lISS( lNameNode->getValue().c_str() ); lName->getWrappedValue() = lNameNode->getValue().c_str(); } } if (lPort!=NULL && lName!=NULL) { PACC::Socket::Address lAddress(*lPort,lName->getWrappedValue().c_str()); mAddresses.push_back( lAddress ); } else { // error reading address } } void TransportSendTCPIPOp::write(PACC::XML::Streamer& ioStreamer, bool inIndent) const { using namespace std; cout << "In TransportSendTCPIPOp::write()\n"; /* ioStreamer.openTag(getName()); ioStreamer.openTag("Addresses"); for (unsigned int i=0; i