Commit fa12766d authored by Laurentiu Nicola's avatar Laurentiu Nicola

ENH: Remove OpenThreads adapters

parent a850674b
......@@ -154,7 +154,7 @@ The \code{OTB} contains the following subdirectories:
OTB is organized into different modules, each one covering different part of image processing.
It is therefore important to understand the source code directory structure---found in \code{OTB/Modules}---.
\begin{itemize}
\item \code{OTB/Modules/Adapters}---Adapters for Boost, Curl, Gdal, OpenThreads and Ossim.
\item \code{OTB/Modules/Adapters}---Adapters for Boost, Curl, Gdal and Ossim.
\item \code{OTB/Modules/Applications}---a set of applications modules that can be launched in different ways
(command-line, graphical interface, Python/Java), refer to the OTB Cookbook for more information.
\item \code{OTB/Modules/Core}---core classes, macro definitions,
......@@ -166,16 +166,16 @@ It is therefore important to understand the source code directory structure---fo
instance, pansharpening.
\item \code{OTB/Modules/Hyperspectral}---hyperspectral images analysis.
\item \code{OTB/Modules/IO}---classes that support the reading
and writing of data.
and writing of data.
\item \code{OTB/Modules/Learning}---several functionalities for
supervised learning and classification.
\item \code{OTB/Modules/OBIA}---Object Based Image Analysis filters
and data structures.
and data structures.
\item \code{OTB/Modules/Radiometry}---classes allowing to compute
vegetation indices and radiometric corrections.
\item \code{OTB/Modules/Registration}---classes for registration of images or other data structures to each other.
\item \code{OTB/Modules/Remote}---Functions to fetch remote modules.
\item \code{OTB/Modules/Segmentation}---several functionalities for image segmentation.
vegetation indices and radiometric corrections.
\item \code{OTB/Modules/Registration}---classes for registration of images or other data structures to each other.
\item \code{OTB/Modules/Remote}---Functions to fetch remote modules.
\item \code{OTB/Modules/Segmentation}---several functionalities for image segmentation.
\item \code{OTB/Modules/ThirdParty}---Modules that import OTB's dependencies.
\item \code{OTB/Modules/Wrappers}---Applications wrappers with several access points (command-line, QT Gui, SWIG\ldots).
\end{itemize}
......
#
# Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# 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.
#
project(OTBOpenThreadsAdapters)
set(OTBOpenThreadsAdapters_LIBRARIES OTBOpenThreadsAdapters)
otb_module_impl()
/*
* Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* 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 otbThreads_h
#define otbThreads_h
namespace otb
{
/** \class Threads
* \brief Operation from open threads that are used in Monteverdi
*
* Implement the sleep operation from openthreads to remove Monteverdi
* dependence to openthreads at compile time.
*
*
* \ingroup OTBOpenThreadsAdapters
*/
class Threads
{
public:
static int Sleep(unsigned int microsec);
};
} // namespace otb
#endif
#
# Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# 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.
#
set(DOCUMENTATION "Adapters for the OpenThreads library (thread interface for
C++).")
otb_module(OTBOpenThreadsAdapters
DEPENDS
OTBOpenThreads
TEST_DEPENDS
OTBITK
OTBTestKernel
DESCRIPTION
"${DOCUMENTATION}"
)
#
# Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# 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.
#
set(OTBOpenThreadsAdapters_SRC
otbThreads.cxx
)
add_library(OTBOpenThreadsAdapters ${OTBOpenThreadsAdapters_SRC})
target_link_libraries(OTBOpenThreadsAdapters
${OTBOpenThreads_LIBRARIES}
)
otb_module_target(OTBOpenThreadsAdapters)
/*
* Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* 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 "otbThreads.h"
#include <OpenThreads/Thread>
namespace otb
{
int Threads::Sleep(unsigned int microsec)
{
return OpenThreads::Thread::microSleep(microsec);
}
}
#
# Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# 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.
#
otb_module_test()
set(OTBOpenThreadsAdaptersTests
otbOpenThreadsAdaptersTestDriver.cxx
otbThreadsTest.cxx
)
add_executable(otbOpenThreadsAdaptersTestDriver ${OTBOpenThreadsAdaptersTests})
target_link_libraries(otbOpenThreadsAdaptersTestDriver ${OTBOpenThreadsAdapters-Test_LIBRARIES})
otb_module_target_label(otbOpenThreadsAdaptersTestDriver)
# Tests Declaration
otb_add_test(NAME ioTvThreadsTest COMMAND otbOpenThreadsAdaptersTestDriver otbThreadsTest)
/*
* Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* 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 "otbTestMain.h"
void RegisterTests()
{
REGISTER_TEST(otbThreadsTest);
}
/*
* Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* 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 <cstdlib>
#include "otbThreads.h"
#include "itkMacro.h"
int otbThreadsTest(int itkNotUsed(argc), char* itkNotUsed(argv) [])
{
otb::Threads::Sleep(10);
return EXIT_SUCCESS;
}
......@@ -43,7 +43,6 @@ ENABLE_SHARED
TEST_DEPENDS
OTBCommandLineParser
OTBOpenThreadsAdapters
OTBTestKernel
DESCRIPTION
......
......@@ -21,11 +21,12 @@
#include <fstream>
#include <chrono>
#include <cstdlib>
#include <thread>
#include "otbCoordinateToName.h"
#include "otbCurlHelperStub.h"
#include "otbThreads.h"
int otbCoordinateToNameTest(int argc, char* argv[])
{
......@@ -50,9 +51,10 @@ int otbCoordinateToNameTest(int argc, char* argv[])
if ((argc > 4) && atoi(argv[4]) == 1)
{
using namespace std::chrono_literals;
conv->MultithreadOn();
conv->Evaluate();
otb::Threads::Sleep(10000000); //Make sure that the web request has the time to complete
std::this_thread::sleep_for(10s);
}
else
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment