From 44c6372ca3fab1bb58cf06faf2a1560d9c4997a4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=A2=85=ED=98=84/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Staff=20Engineer/=EC=82=BC=EC=84=B1?= =?utf8?q?=EC=A0=84=EC=9E=90?= Date: Fri, 5 Oct 2018 11:01:11 +0900 Subject: [PATCH] [nnkit] Introduce nnkit_support_cmdline (#1755) * [nnkit] Introduce nnkit_support_cmdline This commit introduces nnkit_support_cmdline (v0.1) which includes VectorArguments that implements CmdlineArguments interface. Signed-off-by: Jonghyun Park * Add missing license notice --- contrib/nnkit/libs/support/cmdline/CMakeLists.txt | 5 +++ .../cmdline/include/nnkit/VectorArguments.h | 43 ++++++++++++++++++++++ .../libs/support/cmdline/src/VectorArguments.cpp | 28 ++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 contrib/nnkit/libs/support/cmdline/CMakeLists.txt create mode 100644 contrib/nnkit/libs/support/cmdline/include/nnkit/VectorArguments.h create mode 100644 contrib/nnkit/libs/support/cmdline/src/VectorArguments.cpp diff --git a/contrib/nnkit/libs/support/cmdline/CMakeLists.txt b/contrib/nnkit/libs/support/cmdline/CMakeLists.txt new file mode 100644 index 0000000..52419a8 --- /dev/null +++ b/contrib/nnkit/libs/support/cmdline/CMakeLists.txt @@ -0,0 +1,5 @@ +file(GLOB_RECURSE SOURCES "src/*.cpp") + +add_library(nnkit_support_cmdline STATIC ${SOURCES}) +target_include_directories(nnkit_support_cmdline PUBLIC include) +target_link_libraries(nnkit_support_cmdline PUBLIC nnkit_intf_cmdline) diff --git a/contrib/nnkit/libs/support/cmdline/include/nnkit/VectorArguments.h b/contrib/nnkit/libs/support/cmdline/include/nnkit/VectorArguments.h new file mode 100644 index 0000000..37b0908 --- /dev/null +++ b/contrib/nnkit/libs/support/cmdline/include/nnkit/VectorArguments.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved + * + * 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. + */ + +#ifndef __NNKIT_VECTOR_ARGUMENTS_H__ +#define __NNKIT_VECTOR_ARGUMENTS_H__ + +#include + +#include +#include + +namespace nnkit +{ + +class VectorArguments final : public CmdlineArguments +{ +public: + uint32_t size(void) const override { return _args.size(); } + const char *at(uint32_t nth) const override { return _args.at(nth).c_str(); } + +public: + VectorArguments &append(const std::string &arg); + +private: + std::vector _args; +}; + +} // namespace nnkit + +#endif // __NNKIT_VECTOR_ARGUMENTS_H__ diff --git a/contrib/nnkit/libs/support/cmdline/src/VectorArguments.cpp b/contrib/nnkit/libs/support/cmdline/src/VectorArguments.cpp new file mode 100644 index 0000000..f7d5478 --- /dev/null +++ b/contrib/nnkit/libs/support/cmdline/src/VectorArguments.cpp @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved + * + * 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 "nnkit/VectorArguments.h" + +namespace nnkit +{ + +VectorArguments &VectorArguments::append(const std::string &arg) +{ + _args.emplace_back(arg); + return (*this); +} + +} // namespace nnkit -- 2.7.4