Add first version
[ric-plt/sdl.git] / src / redis / hiredissystem.cpp
diff --git a/src/redis/hiredissystem.cpp b/src/redis/hiredissystem.cpp
new file mode 100644 (file)
index 0000000..2d37920
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+   Copyright (c) 2018-2019 Nokia.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+*/
+
+#include "private/redis/hiredissystem.hpp"
+
+using namespace shareddatalayer::redis;
+
+redisContext* HiredisSystem::redisConnect(const char* ip, int port)
+{
+    return ::redisConnect(ip, port);
+}
+
+void* HiredisSystem::redisCommandArgv(redisContext* context, int argc, const char** argv, const size_t* argvlen)
+{
+    return ::redisCommandArgv(context, argc, argv, argvlen);
+}
+
+void HiredisSystem::freeReplyObject(void* reply)
+{
+    ::freeReplyObject(reply);
+}
+
+void HiredisSystem::redisFree(redisContext* context)
+{
+    ::redisFree(context);
+}
+
+redisAsyncContext* HiredisSystem::redisAsyncConnect(const char* ip, int port)
+{
+    return ::redisAsyncConnect(ip, port);
+}
+
+int HiredisSystem::redisAsyncSetConnectCallback(redisAsyncContext* ac, redisConnectCallback* fn)
+{
+    return ::redisAsyncSetConnectCallback(ac, fn);
+}
+
+int HiredisSystem::redisAsyncSetDisconnectCallback(redisAsyncContext* ac, redisDisconnectCallback* fn)
+{
+    return ::redisAsyncSetDisconnectCallback(ac, fn);
+}
+
+int HiredisSystem::redisAsyncCommandArgv(redisAsyncContext* ac,
+                                         redisCallbackFn* fn,
+                                         void* privdata,
+                                         int argc,
+                                         const char** argv,
+                                         const size_t* argvlen)
+{
+    return ::redisAsyncCommandArgv(ac, fn, privdata, argc, argv, argvlen);
+}
+
+void HiredisSystem::redisAsyncHandleRead(redisAsyncContext* ac)
+{
+    ::redisAsyncHandleRead(ac);
+}
+
+void HiredisSystem::redisAsyncHandleWrite(redisAsyncContext* ac)
+{
+    ::redisAsyncHandleWrite(ac);
+}
+
+void HiredisSystem::redisAsyncDisconnect(redisAsyncContext* ac)
+{
+    ::redisAsyncDisconnect(ac);
+}
+
+void HiredisSystem::redisAsyncFree(redisAsyncContext* ac)
+{
+    ::redisAsyncFree(ac);
+}
+
+HiredisSystem& HiredisSystem::getHiredisSystem() noexcept
+{
+    static HiredisSystem hiredisSystem;
+    return hiredisSystem;
+}