1 #include <samchon/protocol/ExternalSystemRole.hpp> 2 #include <samchon/protocol/ExternalSystem.hpp> 19 name = xml->getProperty(
"name");
21 constructListeners(
sendListeners, xml->get(
"sendListeners")->at(0) );
22 constructListeners(
replyListeners, xml->get(
"replyListeners")->at(0) );
24 void ExternalSystemRole::constructListeners(set<string> &listenerSet, shared_ptr<XML> xml)
27 if(xml->has(
"listener") ==
false)
30 shared_ptr<XMLList> &xmlList = xml->get(
"listener");
31 for (
size_t i = 0; i < xmlList->size(); i++)
32 listenerSet.insert( xmlList->at(i)->getValue() );
75 xml->setProperty(
"name",
name);
77 xml->push_back( toListenersXML(
sendListeners,
"sendListeners") );
78 xml->push_back( toListenersXML(
replyListeners,
"replyListeners") );
82 auto ExternalSystemRole::toListenersXML(
const set<string> &listenerSet,
const string &tag)
const -> shared_ptr<XML>
84 shared_ptr<XML> xml(
new XML());
87 for (
auto it = listenerSet.begin(); it != listenerSet.end(); it++)
89 shared_ptr<XML> listener(
new XML());
90 listener->setTag(
"listener");
91 listener->setValue(*it);
93 xml->push_back(listener);
auto getSystem() const -> ExternalSystem *
Get an external system driver.
An entity, a standard data class.
ExternalSystem * system
A driver of external system containing the ExternalSystemRole.
virtual auto toXML() const -> std::shared_ptr< library::XML >
Get an XML object represents the Entity.
virtual auto key() const -> std::string override
Get a key that can identify the Entity uniquely.
std::string name
A name representing the role.
virtual void construct(std::shared_ptr< library::XML >) override
Construct data of the Entity from an XML object.
virtual void sendData(std::shared_ptr< Invoke >)
Sends message to a related system.
std::set< std::string > sendListeners
Listeners to send in the role.
auto hasSendListener(const std::string &) const -> bool
Test whether has a listener for send in the role.
virtual void sendData(std::shared_ptr< Invoke >) override
Send a message.
Package of network protocol and libraries.
virtual auto TAG() const -> std::string override
A tag name when represented by XML.
A network driver for an external system.
std::set< std::string > replyListeners
Listeners to reply in the role.
XML is a class representing xml object.
auto hasReplyListener(const std::string &) const -> bool
Test whether has a listener for reply in the role.
virtual auto toXML() const -> std::shared_ptr< library::XML > override
Get an XML object represents the Entity.