From 2aa2af0007b7e969845642027c635cd3fd9c8aea Mon Sep 17 00:00:00 2001 From: Claudius Holeksa Date: Wed, 3 May 2023 20:34:02 +0200 Subject: Moved dirs and added codec-json dir --- forstio/codec/.nix/derivation.nix | 31 -------------- forstio/codec/SConscript | 38 ----------------- forstio/codec/SConstruct | 66 ----------------------------- forstio/codec/data.h | 89 --------------------------------------- forstio/codec/proto_kel.h | 41 ------------------ forstio/codec/schema.h | 79 ---------------------------------- 6 files changed, 344 deletions(-) delete mode 100644 forstio/codec/.nix/derivation.nix delete mode 100644 forstio/codec/SConscript delete mode 100644 forstio/codec/SConstruct delete mode 100644 forstio/codec/data.h delete mode 100644 forstio/codec/proto_kel.h delete mode 100644 forstio/codec/schema.h (limited to 'forstio/codec') diff --git a/forstio/codec/.nix/derivation.nix b/forstio/codec/.nix/derivation.nix deleted file mode 100644 index c9fac2e..0000000 --- a/forstio/codec/.nix/derivation.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ lib -, stdenvNoCC -, scons -, clang -, clang-tools -, version -, forstio -}: - -let - -in stdenvNoCC.mkDerivation { - pname = "forstio-codec"; - inherit version; - - src = ./..; - - enableParallelBuilding = true; - - buildInputs = [ - forstio.core - ]; - - nativeBuildInputs = [ - scons - clang - clang-tools - ]; - - outputs = ["out" "dev"]; -} diff --git a/forstio/codec/SConscript b/forstio/codec/SConscript deleted file mode 100644 index c038d42..0000000 --- a/forstio/codec/SConscript +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/false - -import os -import os.path -import glob - - -Import('env') - -dir_path = Dir('.').abspath - -# Environment for base library -codec_env = env.Clone(); - -codec_env.sources = sorted(glob.glob(dir_path + "/*.cpp")) -codec_env.headers = sorted(glob.glob(dir_path + "/*.h")) - -env.sources += codec_env.sources; -env.headers += codec_env.headers; - -## Shared lib -objects_shared = [] -codec_env.add_source_files(objects_shared, codec_env.sources, shared=True); -codec_env.library_shared = codec_env.SharedLibrary('#build/forstio-codec', [objects_shared]); - -## Static lib -objects_static = [] -codec_env.add_source_files(objects_static, codec_env.sources, shared=False); -codec_env.library_static = codec_env.StaticLibrary('#build/forstio-codec', [objects_static]); - -# Set Alias -env.Alias('library_codec', [codec_env.library_shared, codec_env.library_static]); - -env.targets += ['library_codec']; - -# Install -env.Install('$prefix/lib/', [codec_env.library_shared, codec_env.library_static]); -env.Install('$prefix/include/forstio/codec/', [codec_env.headers]); diff --git a/forstio/codec/SConstruct b/forstio/codec/SConstruct deleted file mode 100644 index 0d7b7c6..0000000 --- a/forstio/codec/SConstruct +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env python3 - -import sys -import os -import os.path -import glob -import re - - -if sys.version_info < (3,): - def isbasestring(s): - return isinstance(s,basestring) -else: - def isbasestring(s): - return isinstance(s, (str,bytes)) - -def add_kel_source_files(self, sources, filetype, lib_env=None, shared=False, target_post=""): - - if isbasestring(filetype): - dir_path = self.Dir('.').abspath - filetype = sorted(glob.glob(dir_path+"/"+filetype)) - - for path in filetype: - target_name = re.sub( r'(.*?)(\.cpp|\.c\+\+)', r'\1' + target_post, path ) - if shared: - target_name+='.os' - sources.append( self.SharedObject( target=target_name, source=path ) ) - else: - target_name+='.o' - sources.append( self.StaticObject( target=target_name, source=path ) ) - pass - -def isAbsolutePath(key, dirname, env): - assert os.path.isabs(dirname), "%r must have absolute path syntax" % (key,) - -env_vars = Variables( - args=ARGUMENTS -) - -env_vars.Add('prefix', - help='Installation target location of build results and headers', - default='/usr/local/', - validator=isAbsolutePath -) - -env=Environment(ENV=os.environ, variables=env_vars, CPPPATH=[], - CPPDEFINES=['SAW_UNIX'], - CXXFLAGS=['-std=c++20','-g','-Wall','-Wextra'], - LIBS=['forstio-core']) -env.__class__.add_source_files = add_kel_source_files -env.Tool('compilation_db'); -env.cdb = env.CompilationDatabase('compile_commands.json'); - -env.objects = []; -env.sources = []; -env.headers = []; -env.targets = []; - -Export('env') -SConscript('SConscript') - -env.Alias('cdb', env.cdb); -env.Alias('all', [env.targets]); -env.Default('all'); - -env.Alias('install', '$prefix') diff --git a/forstio/codec/data.h b/forstio/codec/data.h deleted file mode 100644 index 1682ae7..0000000 --- a/forstio/codec/data.h +++ /dev/null @@ -1,89 +0,0 @@ -#pragma once - -#include -#include "schema.h" - -namespace saw { -namespace encode { -struct Native {}; -} -/* - * Helper for the basic message container, so the class doesn't have to be - * specialized 10 times. - */ -template struct native_data_type; - -template <> -struct native_data_type> { - using type = int8_t; -}; - -template <> -struct native_data_type> { - using type = int16_t; -}; - -template <> -struct native_data_type> { - using type = int32_t; -}; - -template <> -struct native_data_type> { - using type = int64_t; -}; - -template <> -struct native_data_type> { - using type = uint8_t; -}; - -template <> -struct native_data_type> { - using type = uint16_t; -}; - -template <> -struct native_data_type> { - using type = uint32_t; -}; - -template <> -struct native_data_type> { - using type = uint64_t; -}; - -template <> -struct native_data_type> { - using type = float; -}; - -template -class data { -private: - static_assert(always_false, "Type not supported"); -}; - -template<> -class data { -private: - std::string value_; -public: - SAW_FORBID_COPY(data); - - data(std::string&& value__):value_{std::move(value__)}{} - - std::size_t size() const { - return value_.size(); - } - - bool operator==(const data& data){ - return value_ == data.value_; - } -}; - -template -class data, encode::Native> { -private: -}; -} diff --git a/forstio/codec/proto_kel.h b/forstio/codec/proto_kel.h deleted file mode 100644 index 3b4ebac..0000000 --- a/forstio/codec/proto_kel.h +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once - -#include "data.h" - -#include - -namespace saw { -namespace encode { -struct ProtoKel {}; -} - -template -class data { -private: - own buffer_; -public: - data(own&& buffer__):buffer_{std::move(buffer__)}{} - - buffer& get_buffer(){ - return *buffer_; - } - - const buffer& get_buffer() const { - return *buffer_; - } -}; - -template -class codec { -private: -public: - error_or> decode(const data& encoded){ - return make_error(); - } - - error_or> encode(const data& native){ - return make_error(); - } -}; -} -} diff --git a/forstio/codec/schema.h b/forstio/codec/schema.h deleted file mode 100644 index b23aaa1..0000000 --- a/forstio/codec/schema.h +++ /dev/null @@ -1,79 +0,0 @@ -#pragma once - -#include -#include - -namespace saw { -namespace schema { -// NOLINTBEGIN -template struct NamedMember {}; - -template struct Struct { - static_assert( - always_false, - "This schema template doesn't support this type of template argument"); -}; - -template -struct Struct...> {}; - -template struct Union { - static_assert( - always_false, - "This schema template doesn't support this type of template argument"); -}; - -template -struct Union...> {}; - -template struct Array {}; - -template FixedArray {}; - -template struct Tuple {}; - -struct String {}; - -struct SignedInteger {}; -struct UnsignedInteger {}; -struct FloatingPoint {}; - -template struct Primitive { - static_assert(((std::is_same_v || - std::is_same_v)&&(N == 1 || N == 2 || - N == 4 || N == 8)) || - (std::is_same_v && (N == 4 || N == 8)), - "Primitive Type is not supported"); -}; - -using Int8 = Primitive; -using Int16 = Primitive; -using Int32 = Primitive; -using Int64 = Primitive; - -using UInt8 = Primitive; -using UInt16 = Primitive; -using UInt32 = Primitive; -using UInt64 = Primitive; - -using Float32 = Primitive; -using Float64 = Primitive; - -/** - * Classes enabling Rpc calls - */ -template -struct Function {}; - -template struct Interface { - static_assert( - always_false, - "This schema template doesn't support this type of template argument"); -}; - -template -struct Interface...> {}; - -// NOLINTEND -} // namespace schema -} // namespace saw -- cgit v1.2.3