You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
# include "rpc/rpc_client_c.h"
# include "rpc/rpc_client_c_impl.h"
# include <stdexcept>
# include <cstring>
extern " C " {
RpcClient * rpc_client_create ( const char * read_pipe , const char * write_pipe ) {
try {
IpcPipeChannel * channel = new IpcPipeChannel ( read_pipe , write_pipe ) ;
// Проверяем, что канал открылся успешно
// (IpcPipeChannel может вывести ошибку, но не бросает исключение)
// Для простоты считаем, что если конструктор завершился, всё О К
return new RpcClient ( channel ) ;
} catch ( . . . ) {
return nullptr ;
}
}
void rpc_client_destroy ( RpcClient * client ) {
if ( client ) {
delete client ;
}
}
IpcMarshallerHandle * rpc_client_create_marshaller ( RpcClient * client , int object_id ) {
if ( ! client | | ! client - > channel ) {
return nullptr ;
}
try {
IpcMarshaller * marshaller = new IpcMarshaller ( * client - > channel , object_id ) ;
return new IpcMarshallerHandle ( marshaller ) ;
} catch ( . . . ) {
return nullptr ;
}
}
void rpc_marshaller_destroy ( IpcMarshallerHandle * marshaller ) {
if ( marshaller ) {
delete marshaller ;
}
}
} // extern "C"