Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backend loading fix #9

Merged
merged 2 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitlint
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ min-length=10
# python-style regex that the commit-msg title must match
# Note that the regex can contradict with other rules if not used correctly
# (e.g. title-must-not-contain-word).
regex=^[A-Za-z0-9 "'.,-_]+: #[0-9]{7}$
regex=^[A-Za-z0-9 "'.,-_]+: #[0-9]+$


[body-max-line-length]
Expand Down
3 changes: 3 additions & 0 deletions knp/backends/cpu/cpu-multi-threaded-backend/impl/backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,4 +392,7 @@ MultiThreadedCPUBackend::ProjectionConstIterator MultiThreadedCPUBackend::end_pr
return projections_.cend();
}


BOOST_DLL_ALIAS(knp::backends::multi_threaded_cpu::MultiThreadedCPUBackend::create, create_knp_backend)

} // namespace knp::backends::multi_threaded_cpu
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
* @kaspersky_support Artiom N.
* @date 21.06.2023
* @license Apache 2.0
* @copyright © 2024 AO Kaspersky Lab
*
* 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
* @copyright © 2024 AO Kaspersky Lab
*
* 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.
*/

Expand Down Expand Up @@ -363,7 +363,4 @@ class KNP_DECLSPEC MultiThreadedCPUBackend : public knp::core::Backend
std::mutex ep_mutex_;
};


BOOST_DLL_ALIAS(knp::backends::multi_threaded_cpu::MultiThreadedCPUBackend::create, create_knp_mcpu_backend)

} // namespace knp::backends::multi_threaded_cpu
3 changes: 3 additions & 0 deletions knp/backends/cpu/cpu-single-threaded-backend/impl/backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,4 +310,7 @@ SingleThreadedCPUBackend::ProjectionConstIterator SingleThreadedCPUBackend::end_
return projections_.cend();
}


BOOST_DLL_ALIAS(knp::backends::single_threaded_cpu::SingleThreadedCPUBackend::create, create_knp_backend)

} // namespace knp::backends::single_threaded_cpu
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
* @kaspersky_support Artiom N.
* @date 30.01.2023
* @license Apache 2.0
* @copyright © 2024 AO Kaspersky Lab
*
* 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
* @copyright © 2024 AO Kaspersky Lab
*
* 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.
*/

Expand Down Expand Up @@ -368,6 +368,4 @@ class KNP_DECLSPEC SingleThreadedCPUBackend : public knp::core::Backend
ProjectionContainer projections_;
};

BOOST_DLL_ALIAS(knp::backends::single_threaded_cpu::SingleThreadedCPUBackend::create, create_knp_backend)

} // namespace knp::backends::single_threaded_cpu
24 changes: 12 additions & 12 deletions knp/core-library/include/knp/core/backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
* @kaspersky_support Artiom N.
* @date 11.01.2023
* @license Apache 2.0
* @copyright © 2024 AO Kaspersky Lab
*
* 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
* @copyright © 2024 AO Kaspersky Lab
*
* 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.
*/

Expand Down
11 changes: 10 additions & 1 deletion knp/tests/framework/backend_loader_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <filesystem>


TEST(FrameworkSuite, BackendLoaderLoad)
TEST(FrameworkSuite, StBackendLoaderLoad)
{
knp::framework::BackendLoader backend_loader;
auto cpu_st_backend{backend_loader.load(knp::testing::get_backend_path())};
Expand All @@ -35,6 +35,15 @@ TEST(FrameworkSuite, BackendLoaderLoad)
}


TEST(FrameworkSuite, MtBackendLoaderLoad)
{
knp::framework::BackendLoader backend_loader;
auto cpu_st_backend{backend_loader.load(knp::testing::get_backend_path("knp-cpu-multi-threaded-backend"))};

EXPECT_NO_THROW((void)cpu_st_backend->get_uid()); //!OCLINT(False positive)
}


TEST(FrameworkSuite, BackendLoaderCheck)
{
const knp::framework::BackendLoader backend_loader;
Expand Down