From: 박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 Date: Fri, 5 Oct 2018 02:01:11 +0000 (+0900) Subject: [nnkit] Introduce nnkit_support_cmdline (#1755) X-Git-Tag: nncc_backup~1624 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=44c6372ca3fab1bb58cf06faf2a1560d9c4997a4;p=platform%2Fcore%2Fml%2Fnnfw.git [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 --- 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