changing compile structure
This commit is contained in:
parent
b25b28a560
commit
c0241fe666
|
@ -68,11 +68,11 @@ SConscript('driver/SConscript')
|
|||
env_library = env.Clone()
|
||||
|
||||
env.objects_shared = []
|
||||
env_library.add_source_files(env.objects_shared, env.sources + env.driver_sources + env.tls_sources, shared=True)
|
||||
env_library.add_source_files(env.objects_shared, env.sources + env.driver_sources, shared=True)
|
||||
env.library_shared = env_library.SharedLibrary('#build/forstio', [env.objects_shared])
|
||||
|
||||
env.objects_static = []
|
||||
env_library.add_source_files(env.objects_static, env.sources + env.driver_sources + env.tls_sources)
|
||||
env_library.add_source_files(env.objects_static, env.sources + env.driver_sources, shared=False)
|
||||
env.library_static = env_library.StaticLibrary('#build/forstio', [env.objects_static])
|
||||
|
||||
env.Alias('library', [env.library_shared, env.library_static])
|
||||
|
|
|
@ -12,5 +12,6 @@ dir_path = Dir('.').abspath
|
|||
env.sources += sorted(glob.glob(dir_path + "/*.cpp"))
|
||||
env.headers += sorted(glob.glob(dir_path + "/*.h"))
|
||||
|
||||
env.tls_sources += sorted(glob.glob(dir_path + "/tls/*.cpp"))
|
||||
env.tls_headers += sorted(glob.glob(dir_path + "/tls/*.h"))
|
||||
base_lib_env = env.Clone();
|
||||
|
||||
SConscript("tls/SConscript");
|
||||
|
|
|
@ -69,4 +69,6 @@ template <typename T> struct VoidUnfix { typedef T Type; };
|
|||
template <> struct VoidUnfix<Void> { typedef void Type; };
|
||||
template <typename T> using UnfixVoid = typename VoidUnfix<T>::Type;
|
||||
|
||||
template <typename... T> constexpr bool always_false = false;
|
||||
|
||||
} // namespace saw
|
||||
|
|
|
@ -11,6 +11,60 @@ template <typename Codec, typename Incoming, typename Outgoing,
|
|||
typename OutContainer = MessageContainer<Outgoing>,
|
||||
typename BufferT = RingBuffer>
|
||||
class StreamingIoPeer {
|
||||
public:
|
||||
/**
|
||||
*
|
||||
*/
|
||||
StreamingIoPeer(
|
||||
Own<ConveyorFeeder<HeapMessageRoot<Incoming, InContainer>>> feed,
|
||||
Own<AsyncIoStream> stream, Codec codec, BufferT in, BufferT out);
|
||||
/**
|
||||
*
|
||||
*/
|
||||
StreamingIoPeer(
|
||||
Own<ConveyorFeeder<HeapMessageRoot<Incoming, InContainer>>> feed,
|
||||
Own<AsyncIoStream> stream);
|
||||
|
||||
/**
|
||||
* Deleted copy and move constructors
|
||||
*/
|
||||
SAW_FORBID_COPY(StreamingIoPeer);
|
||||
SAW_FORBID_MOVE(StreamingIoPeer);
|
||||
|
||||
/**
|
||||
* Send a message to the remote peer
|
||||
*/
|
||||
void send(HeapMessageRoot<Outgoing, OutContainer> builder);
|
||||
|
||||
/**
|
||||
* A phantom conveyor feeder. Meant for interfacing with other components
|
||||
*/
|
||||
ConveyorFeeder<HeapMessageRoot<Outgoing, OutContainer>> &feeder();
|
||||
|
||||
Conveyor<void> onReadDisconnected();
|
||||
|
||||
private:
|
||||
class PeerConveyorFeeder final
|
||||
: public ConveyorFeeder<HeapMessageRoot<Outgoing, OutContainer>> {
|
||||
public:
|
||||
PeerConveyorFeeder(
|
||||
StreamingIoPeer<Codec, Incoming, Outgoing, InContainer,
|
||||
OutContainer, BufferT> &peer_)
|
||||
: peer{peer_} {}
|
||||
|
||||
void feed(T &&data) override { (void)data; }
|
||||
|
||||
void fail(Error &&error) override { (void)error; }
|
||||
|
||||
size_t space() const override { return 0; }
|
||||
|
||||
size_t queued() const override { return 0; }
|
||||
|
||||
private:
|
||||
StreamingIoPeer<Codec, Incoming, Outgoing, InContainer, OutContainer,
|
||||
BufferT> &peer;
|
||||
};
|
||||
|
||||
private:
|
||||
Own<ConveyorFeeder<HeapMessageRoot<Incoming, InContainer>>>
|
||||
incoming_feeder = nullptr;
|
||||
|
@ -25,25 +79,12 @@ private:
|
|||
SinkConveyor sink_read;
|
||||
SinkConveyor sink_write;
|
||||
|
||||
public:
|
||||
StreamingIoPeer(
|
||||
Own<ConveyorFeeder<HeapMessageRoot<Incoming, InContainer>>> feed,
|
||||
Own<AsyncIoStream> stream, Codec codec, BufferT in, BufferT out);
|
||||
StreamingIoPeer(
|
||||
Own<ConveyorFeeder<HeapMessageRoot<Incoming, InContainer>>> feed,
|
||||
Own<AsyncIoStream> stream);
|
||||
|
||||
SAW_FORBID_COPY(StreamingIoPeer);
|
||||
SAW_FORBID_MOVE(StreamingIoPeer);
|
||||
|
||||
void send(HeapMessageRoot<Outgoing, OutContainer> builder);
|
||||
|
||||
Conveyor<void> onReadDisconnected();
|
||||
PeerConveyorFeeder conveyor_feeder;
|
||||
};
|
||||
|
||||
/**
|
||||
* Setup new streaming io peer with the provided network protocols.
|
||||
* This is a convenience wrapper intended for a faster setup of
|
||||
* This is a convenience wrapper intended for a faster setup of this class
|
||||
*/
|
||||
template <typename Codec, typename Incoming, typename Outgoing,
|
||||
typename InContainer = MessageContainer<Incoming>,
|
||||
|
|
|
@ -9,6 +9,7 @@ template<typename Codec, typename Schema> class Rpc;
|
|||
template<typename Codec, typename... Responses, typename... Requests, StringLiteral... Literals>
|
||||
class Rpc<schema::Interface<schema::Function<Responses, Requests, Literals>...>> {
|
||||
public:
|
||||
|
||||
class Client {
|
||||
public:
|
||||
/**
|
||||
|
@ -31,4 +32,4 @@ public:
|
|||
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,24 +5,29 @@
|
|||
namespace saw {
|
||||
namespace schema {
|
||||
|
||||
template <class T, StringLiteral Literal> struct NamedMember {};
|
||||
template <typename T, StringLiteral Literal> struct NamedMember {};
|
||||
|
||||
template <class... T> struct Struct{
|
||||
static_assert(false, "This schema template doesn't support this type of template argument");
|
||||
template <typename... T> struct Struct {
|
||||
static_assert(
|
||||
always_false<T...>,
|
||||
"This schema template doesn't support this type of template argument");
|
||||
};
|
||||
|
||||
template <class... V, StringLiteral... K>
|
||||
template <typename... V, StringLiteral... K>
|
||||
struct Struct<NamedMember<V, K>...> {};
|
||||
|
||||
template <class... T> struct Union{
|
||||
static_assert(false, "This schema template doesn't support this type of template argument");
|
||||
template <typename... T> struct Union {
|
||||
static_assert(
|
||||
always_false<T...>,
|
||||
"This schema template doesn't support this type of template argument");
|
||||
};
|
||||
|
||||
template <class... V, StringLiteral... K> struct Union<NamedMember<V, K>...> {};
|
||||
template <typename... V, StringLiteral... K>
|
||||
struct Union<NamedMember<V, K>...> {};
|
||||
|
||||
template <class T> struct Array {};
|
||||
template <typename T> struct Array {};
|
||||
|
||||
template <class... T> struct Tuple {};
|
||||
template <typename... T> struct Tuple {};
|
||||
|
||||
struct String {};
|
||||
|
||||
|
@ -54,10 +59,13 @@ using Float64 = Primitive<FloatingPoint, 8>;
|
|||
/**
|
||||
* Classes enabling Rpc calls
|
||||
*/
|
||||
template <class Request, class Response, StringLiteral Literal> struct Function {};
|
||||
template <class Request, class Response, StringLiteral Literal>
|
||||
struct Function {};
|
||||
|
||||
template <class... T> struct Interface {
|
||||
static_assert(false, "This schema template doesn't support this type of template argument");
|
||||
static_assert(
|
||||
always_false<T...>,
|
||||
"This schema template doesn't support this type of template argument");
|
||||
};
|
||||
|
||||
template <class... Request, class... Response, StringLiteral... Literal>
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/false
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import glob
|
||||
|
||||
|
||||
Import('env')
|
||||
|
||||
dir_path = Dir('.').abspath
|
||||
|
||||
env.tls_sources += sorted(glob.glob(dir_path + "/*.cpp"))
|
||||
env.tls_headers += sorted(glob.glob(dir_path + "/*.h"))
|
Loading…
Reference in New Issue