1 // ANNA - Anna is Not Nothingness Anymore //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
11 #include <anna/core/tracing/Logger.hpp>
12 #include <anna/core/tracing/TraceMethod.hpp>
14 #include <anna/xml/Node.hpp>
15 #include <anna/xml/Attribute.hpp>
17 #include <anna/app/functions.hpp>
19 #include <anna/comm/Network.hpp>
20 #include <anna/comm/Host.hpp>
21 #include <anna/comm/Server.hpp>
23 #include <anna/comm/Communicator.hpp>
24 #include <anna/comm/RoundRobinDelivery.hpp>
25 #include <anna/comm/functions.hpp>
30 void comm::RoundRobinDelivery::do_initialize()
31 throw(RuntimeException) {
32 LOGMETHOD(TraceMethod tm("comm::RoundRobinDelivery", "do_initialize", ANNA_FILE_LOCATION));
33 a_iiserver = comm::Delivery::begin();
36 comm::Resource* comm::RoundRobinDelivery::do_apply()
37 throw(RuntimeException) {
38 LOGMETHOD(TraceMethod tm(Logger::Local7, "comm::RoundRobinDelivery", "do_apply", ANNA_FILE_LOCATION));
39 comm::Resource* result = NULL;
41 if(comm::Delivery::size() == 0)
44 iterator end = a_iiserver;
48 w = resource(a_iiserver);
50 if(w->isAvailable() == true && w->isEnabled() == true) {
55 } while(advance() != end);
60 comm::RoundRobinDelivery::iterator comm::RoundRobinDelivery::advance()
64 if(a_iiserver == comm::Delivery::end())
65 a_iiserver = comm::Delivery::begin();
70 string comm::RoundRobinDelivery::asString() const
72 string result = className();
74 result += comm::Service::asString();
75 return result += " }";
78 xml::Node* comm::RoundRobinDelivery::asXML(xml::Node* parent) const
80 xml::Node* node = parent->createChild("comm.RoundRobinDelivery");
81 comm::Service::asXML(node);