5 #ifndef LIBFORB_BASE_STUB_HPP 6 #define LIBFORB_BASE_STUB_HPP 13 #include <forb/stream/shared_memory.hpp> 14 #include <forb/stream/socket.hpp> 15 #include <forb/stream/stream.hpp> 19 class remote_registry;
74 bool _force_socket =
false;
125 void force_socket() {
126 _force_socket =
true;
137 void set_skeleton(std::string address,
int port);
142 virtual bool _match(
const std::string &type)
const = 0;
148 static std::vector<base_stub *> &
_protos();
153 static remote_var _create(
const std::string &type);
160 bool is_nil(
const std::shared_ptr<T> &ptr) {
161 static_assert(std::is_base_of<base_stub, T>::value,
162 "The given type is not derived from forb::base_stub!");
163 return ptr ==
nullptr;
168 bool is_nil(
const std::unique_ptr<T> &ptr) {
169 static_assert(std::is_base_of<base_stub, T>::value,
170 "The given type is not derived from forb::base_stub!");
171 return ptr ==
nullptr;
178 #endif //LIBFORB_BASE_STUB_HPP virtual remote_var _create_empty() const =0
Creates a new empty stub object of the current type.
static std::vector< base_stub * > & _protos()
Returns a reference to the vector of prototypes of all known stub implementations.
Definition: base_stub.cpp:133
C++ wrapper of the Socket POSIX API, which uses IPv4 and blocking communication.
Definition: socket.hpp:28
bool is_nil(const std::shared_ptr< T > &ptr)
Returns true if the given pointer to a base_stub (or derived class) is null.
Definition: base_stub.hpp:160
The class from which any automatically generated stub will inherit.
Definition: base_stub.hpp:35
Virtual class that represents a stream.
Definition: stream.hpp:69
This function implements a memcpy abstract that is valid also for volatile data.
Definition: base_skeleton.hpp:15
Emulates a complete registry of all active remote objects that use this framework.
Definition: remote_registry.hpp:17
Implementation of the forbcc::strams::stream API that uses a Linux Shared Memory to communicate...
Definition: shared_memory.hpp:21
stream * rpcstream
The pointer to the stream that will be used to make call requests.
Definition: base_stub.hpp:60
base_stub()=default
Default constructor, creates an empty stub handle.
std::mutex _mutex
The mutex that avoids concurrent call requests using the same stub handle.
Definition: base_stub.hpp:56
forb::streams::shared_memory::size_t buffer_size_t
The type of the buffer size.
Definition: base_stub.hpp:43
void wait_return()
Waits the termination of the call request.
Definition: base_stub.cpp:107
shared_memory::size_t buffer_size() const
The size of the buffer within the shared memory (if shared memory is adopted as data exchange stream)...
Definition: base_stub.hpp:107
stream * datastream
The pointer to the stream that will be used to exchange data.
Definition: base_stub.hpp:64
std::shared_ptr< base_stub > remote_ptr
Shared pointer to a base_class object (or a derived class).
Definition: base_stub.hpp:27
void init_call(call_id_t code)
Initializes a new call request.
Definition: base_stub.cpp:80
uint16_t call_id_t
The type that will be used to transmit the call_id.
Definition: declarations.hpp:12
virtual ~base_stub() noexcept=default
Virtual destructor.
std::size_t size_t
An unsigned size type.
Definition: stream.hpp:72
std::unique_ptr< base_stub > remote_var
Unique pointer to a base_class object (or a derived class).
Definition: base_stub.hpp:30
virtual bool _match(const std::string &type) const =0
Returns true of the type string equals the fully qualified name of the given stub class...