Skip to content

Commit a3218ce

Browse files
author
Daniel Cloran
committed
initial
1 parent b76b8fc commit a3218ce

File tree

8 files changed

+104
-0
lines changed

8 files changed

+104
-0
lines changed

CMakeLists.txt

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
2+
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
3+
4+
project(socketcluster_client)
5+
6+
7+
# random bullshit
8+
# Default to C99
9+
if(NOT CMAKE_C_STANDARD)
10+
set(CMAKE_C_STANDARD 99)
11+
endif()
12+
13+
# Default to C++14
14+
if(NOT CMAKE_CXX_STANDARD)
15+
set(CMAKE_CXX_STANDARD 14)
16+
endif()
17+
18+
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
19+
add_compile_options(-Wall -Wextra -Wpedantic)
20+
endif()
21+
# end random bs
22+
23+
# find dependencies
24+
find_package(jsonc REQUIRED)
25+
find_package(boostbeast REQUIRED)
26+
27+
set(SOURCES)
28+
set(dependencies
29+
jsonc
30+
boostbeast
31+
)
32+
33+
add_executable(main src/main.cpp dependencies)
34+
35+
36+
install(
37+
TARGETS maininstall(DIRECTORY
38+
config
39+
DESTINATION share/${PROJECT_NAME}
40+
)
41+
)

include/ErrorHandler.h

Whitespace-only changes.

include/SCClient.h

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
//
2+
// SCClient.h
3+
//
4+
// Created by Daniel Cloran on 11/2/21.
5+
//
6+
7+
#ifndef SCClient_h
8+
#define SCClient_h
9+
10+
#pragma clang diagnostic push
11+
#pragma clang diagnostic ignored "-Weverything" //ignore warnings in external libs
12+
13+
#include <functional>
14+
#include <iostream>
15+
#include <memory>
16+
#include <string>
17+
#include <thread>
18+
#include <mutex>
19+
#include <condition_variable>
20+
#include "json-c/json.h"
21+
22+
// Callback and Subscription types
23+
typedef std::function<void(std::string event, json_object *data)> socketCallback;
24+
typedef std::tuple<std::string, socketCallback> subscription;
25+
26+
27+
28+
29+
class SCClient
30+
{
31+
public:
32+
// SCClient(); Constructor avaiable to user (also make init socket connection) Singleton SCClient
33+
// SCSocket mySocket = SCClient.create_socket("host", "port")
34+
// create_socket(): takes host, port etc.
35+
// returns socket handle that allows control
36+
37+
38+
// SocketHandler
39+
// subscribe (possible Subscriber)
40+
// unsubscribe
41+
42+
// publish
43+
44+
// publishers
45+
// subscribers
46+
47+
48+
49+
50+
// Some public list of sockets / socket handlers
51+
52+
private:
53+
// void fail(beast::error_code ec, char const* what);
54+
// void on_resolve(beast::error_code ec, tcp::resolver::results_type results);
55+
// void on_connect(beast::error_code ec, tcp::resolver::results_type::endpoint_type ep);
56+
// void on_handshake(beast::error_code ec);
57+
// void on_write(beast::error_code ec, std::size_t bytes_transferred);
58+
// void on_read(beast::error_code ec, std::size_t bytes_transferred);
59+
// void on_close(beast::error_code ec);
60+
};
61+
62+
#endif /* SCClient_h */

src/ErrorHandler.cpp

Whitespace-only changes.

src/ParsingEngine.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// Static Class (Pass Message -> Get Object)

src/SCClient.cpp

Whitespace-only changes.

test/examples/client_classed.cpp

Whitespace-only changes.

test/examples/client_simple.cpp

Whitespace-only changes.

0 commit comments

Comments
 (0)