+void yp2::filter::FrontendNet::configure(const xmlNode * ptr)
+{
+ if (!ptr || !ptr->children)
+ {
+ throw yp2::filter::FilterException("No ports for Frontend");
+ }
+ std::vector<std::string> ports;
+ for (ptr = ptr->children; ptr; ptr = ptr->next)
+ {
+ if (ptr->type != XML_ELEMENT_NODE)
+ continue;
+ if (!strcmp((const char *) ptr->name, "port"))
+ {
+ std::string port = yp2::xml::get_text(ptr);
+ ports.push_back(port);
+
+ }
+ else if (!strcmp((const char *) ptr->name, "threads"))
+ {
+ std::string threads_str = yp2::xml::get_text(ptr);
+ int threads = atoi(threads_str.c_str());
+ if (threads < 1)
+ throw yp2::filter::FilterException("Bad value for threads: "
+ + threads_str);
+ m_p->m_no_threads = threads;
+ }
+ else
+ {
+ throw yp2::filter::FilterException("Bad element "
+ + std::string((const char *)
+ ptr->name));
+ }
+ }
+ m_p->m_ports = ports;
+}
+