Commit cb901d75 authored by Davis King's avatar Davis King

Added an overload of bsp_connect() and bsp_listen() for 4 argument

functions.
parent ff52f171
......@@ -269,6 +269,22 @@ namespace dlib
ARG3 arg3
);
template <
typename funct_type,
typename ARG1,
typename ARG2,
typename ARG3,
typename ARG4
>
friend void bsp_connect (
const std::vector<std::pair<std::string,unsigned short> >& hosts,
funct_type& funct,
ARG1 arg1,
ARG2 arg2,
ARG3 arg3,
ARG4 arg4
);
// -----------------------------------
template <
......@@ -315,6 +331,22 @@ namespace dlib
ARG3 arg3
);
template <
typename funct_type,
typename ARG1,
typename ARG2,
typename ARG3,
typename ARG4
>
friend void bsp_listen (
unsigned short listening_port,
funct_type& funct,
ARG1 arg1,
ARG2 arg2,
ARG3 arg3,
ARG4 arg4
);
// -----------------------------------
};
......@@ -409,6 +441,33 @@ namespace dlib
obj.close_all_connections_gracefully();
}
// ----------------------------------------------------------------------------------------
template <
typename funct_type,
typename ARG1,
typename ARG2,
typename ARG3,
typename ARG4
>
void bsp_connect (
const std::vector<std::pair<std::string,unsigned short> >& hosts,
funct_type& funct,
ARG1 arg1,
ARG2 arg2,
ARG3 arg3,
ARG4 arg4
)
{
impl::map_id_to_con cons;
const unsigned long node_id = 0;
connect_all(cons, hosts, node_id);
send_out_connection_orders(cons, hosts);
bsp_context obj(node_id, cons);
funct(obj,arg1,arg2,arg3,arg4);
obj.close_all_connections_gracefully();
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
......@@ -495,6 +554,32 @@ namespace dlib
obj.close_all_connections_gracefully();
}
// ----------------------------------------------------------------------------------------
template <
typename funct_type,
typename ARG1,
typename ARG2,
typename ARG3,
typename ARG4
>
void bsp_listen (
unsigned short listening_port,
funct_type& funct,
ARG1 arg1,
ARG2 arg2,
ARG3 arg3,
ARG4 arg4
)
{
impl::map_id_to_con cons;
unsigned long node_id;
listen_and_connect_all(node_id, cons, listening_port);
bsp_context obj(node_id, cons);
funct(obj,arg1,arg2,arg3,arg4);
obj.close_all_connections_gracefully();
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
......
......@@ -160,6 +160,24 @@ namespace dlib
ARG3 arg3
);
// ----------------------------------------------------------------------------------------
template <
typename funct_type,
typename ARG1,
typename ARG2,
typename ARG3,
typename ARG4
>
void bsp_connect (
const std::vector<std::pair<std::string,unsigned short> >& hosts,
funct_type& funct,
ARG1 arg1,
ARG2 arg2,
ARG3 arg3,
ARG4 arg4
);
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
......@@ -213,6 +231,24 @@ namespace dlib
ARG3 arg3
);
// ----------------------------------------------------------------------------------------
template <
typename funct_type,
typename ARG1,
typename ARG2,
typename ARG3,
typename ARG4
>
void bsp_listen (
unsigned short listening_port,
funct_type& funct,
ARG1 arg1,
ARG2 arg2,
ARG3 arg3,
ARG4 arg4
);
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment