src/SocketHandler.h
branchv_0
changeset 3 e701e06ff561
parent 2 fb399fd4f053
child 4 8d036e5e5fcc
equal deleted inserted replaced
2:fb399fd4f053 3:e701e06ff561
    39 
    39 
    40 class SocketHandler : public relpipe::reader::handlers::RelationalReaderStringHandler {
    40 class SocketHandler : public relpipe::reader::handlers::RelationalReaderStringHandler {
    41 private:
    41 private:
    42 	std::wstring_convert<codecvt_utf8<wchar_t>> convertor; // TODO: support also other encodings.
    42 	std::wstring_convert<codecvt_utf8<wchar_t>> convertor; // TODO: support also other encodings.
    43 	Configuration configuration;
    43 	Configuration configuration;
    44 	shared_ptr<Socket> socket;
    44 	std::shared_ptr<Socket> socket;
    45 
    45 
    46 	struct CurrentRelation {
    46 	struct CurrentRelation {
    47 		relpipe::common::type::StringX name;
    47 		relpipe::common::type::StringX name;
    48 		std::vector<relpipe::reader::handlers::AttributeMetadata> attributes;
    48 		std::vector<relpipe::reader::handlers::AttributeMetadata> attributes;
    49 		relpipe::common::type::Integer attributeIndex = 0;
    49 		relpipe::common::type::Integer attributeIndex = 0;
    53 public:
    53 public:
    54 
    54 
    55 	SocketHandler(Configuration configuration) : configuration(configuration) {
    55 	SocketHandler(Configuration configuration) : configuration(configuration) {
    56 		// TODO: do not throw exception from the constructor: Socket::open()
    56 		// TODO: do not throw exception from the constructor: Socket::open()
    57 		// socket = std::make_shared<TCPSocket>(); // TODO: create a TCP, UDP… socket
    57 		// socket = std::make_shared<TCPSocket>(); // TODO: create a TCP, UDP… socket
    58 		socket.reset(SocketFactory::find("tcp://TODO:connectionString")->open("tcp://TODO:connectionString2")); // TODO: connection string
    58 		socket.reset(SocketFactory::find("tcp://TODO:connectionString")->open("tcp://TODO:connectionString2")); // TODO: connection string + check nullptr
    59 	}
    59 	}
    60 
    60 
    61 	void startRelation(relpipe::common::type::StringX name, std::vector<relpipe::reader::handlers::AttributeMetadata> attributes) override {
    61 	void startRelation(relpipe::common::type::StringX name, std::vector<relpipe::reader::handlers::AttributeMetadata> attributes) override {
    62 		currentRelation = CurrentRelation{name, attributes};
    62 		currentRelation = CurrentRelation{name, attributes};
    63 	}
    63 	}