Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
e5d1790b
Commit
e5d1790b
authored
Nov 23, 2017
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10018 from alalek:ocl_binary_cache
parents
fed2a277
8e6280fc
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
231 additions
and
0 deletions
+231
-0
ocl.hpp
modules/core/include/opencv2/core/ocl.hpp
+2
-0
filesystem.hpp
modules/core/include/opencv2/core/utils/filesystem.hpp
+38
-0
filesystem.private.hpp
...es/core/include/opencv2/core/utils/filesystem.private.hpp
+64
-0
lock.private.hpp
modules/core/include/opencv2/core/utils/lock.private.hpp
+119
-0
glob.cpp
modules/core/src/glob.cpp
+8
-0
ocl.cpp
modules/core/src/ocl.cpp
+0
-0
filesystem.cpp
modules/core/src/utils/filesystem.cpp
+0
-0
No files found.
modules/core/include/opencv2/core/ocl.hpp
View file @
e5d1790b
...
...
@@ -261,6 +261,8 @@ public:
void
setUseSVM
(
bool
enabled
);
struct
Impl
;
inline
Impl
*
getImpl
()
const
{
return
(
Impl
*
)
p
;
}
//protected:
Impl
*
p
;
};
...
...
modules/core/include/opencv2/core/utils/filesystem.hpp
0 → 100644
View file @
e5d1790b
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
#ifndef OPENCV_UTILS_FILESYSTEM_HPP
#define OPENCV_UTILS_FILESYSTEM_HPP
namespace
cv
{
namespace
utils
{
namespace
fs
{
CV_EXPORTS
bool
exists
(
const
cv
::
String
&
path
);
CV_EXPORTS
bool
isDirectory
(
const
cv
::
String
&
path
);
CV_EXPORTS
cv
::
String
getcwd
();
CV_EXPORTS
bool
createDirectory
(
const
cv
::
String
&
path
);
CV_EXPORTS
bool
createDirectories
(
const
cv
::
String
&
path
);
#ifdef __OPENCV_BUILD
// TODO
//CV_EXPORTS cv::String getTempDirectory();
/**
* @brief Returns directory to store OpenCV cache files
* Create sub-directory in common OpenCV cache directory if it doesn't exist.
* @param sub_directory_name name of sub-directory. NULL or "" value asks to return root cache directory.
* @param configuration_name optional name of configuration parameter name which overrides default behavior.
* @return Path to cache directory. Returns empty string if cache directories support is not available. Returns "disabled" if cache disabled by user.
*/
CV_EXPORTS
cv
::
String
getCacheDirectory
(
const
char
*
sub_directory_name
,
const
char
*
configuration_name
=
NULL
);
#endif
}}}
// namespace
#endif // OPENCV_UTILS_FILESYSTEM_HPP
modules/core/include/opencv2/core/utils/filesystem.private.hpp
0 → 100644
View file @
e5d1790b
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
#ifndef OPENCV_UTILS_FILESYSTEM_PRIVATE_HPP
#define OPENCV_UTILS_FILESYSTEM_PRIVATE_HPP
// TODO Move to CMake?
#ifndef OPENCV_HAVE_FILESYSTEM_SUPPORT
# if defined(__EMSCRIPTEN__) || defined(__native_client__)
/* no support */
# elif defined __ANDROID__ || defined __linux__ || defined _WIN32 || \
defined __FreeBSD__ || defined __bsdi__
# define OPENCV_HAVE_FILESYSTEM_SUPPORT 1
# elif defined(__APPLE__)
# include <TargetConditionals.h>
# if (defined(TARGET_OS_OSX) && TARGET_OS_OSX) || (!defined(TARGET_OS_OSX) && !TARGET_OS_IPHONE)
# define OPENCV_HAVE_FILESYSTEM_SUPPORT 1 // OSX only
# endif
# else
/* unknown */
# endif
# ifndef OPENCV_HAVE_FILESYSTEM_SUPPORT
# define OPENCV_HAVE_FILESYSTEM_SUPPORT 0
# endif
#endif
#if OPENCV_HAVE_FILESYSTEM_SUPPORT
namespace
cv
{
namespace
utils
{
namespace
fs
{
/**
* File-based lock object.
*
* Provides interprocess synchronization mechanism.
* Platform dependent.
*
* Supports multiple readers / single writer access pattern (RW / readers–writer / shared-exclusive lock).
*
* File must exist.
* File can't be re-used (for example, I/O operations via std::fstream is not safe)
*/
class
CV_EXPORTS
FileLock
{
public
:
explicit
FileLock
(
const
char
*
fname
);
~
FileLock
();
void
lock
();
//< acquire exclusive (writer) lock
void
unlock
();
//< release exclusive (writer) lock
void
lock_shared
();
//< acquire sharable (reader) lock
void
unlock_shared
();
//< release sharable (reader) lock
struct
Impl
;
protected
:
Impl
*
pImpl
;
private
:
FileLock
(
const
FileLock
&
);
// disabled
FileLock
&
operator
=
(
const
FileLock
&
);
// disabled
};
}}}
// namespace
#endif
#endif // OPENCV_UTILS_FILESYSTEM_PRIVATE_HPP
modules/core/include/opencv2/core/utils/lock.private.hpp
0 → 100644
View file @
e5d1790b
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
#ifndef OPENCV_UTILS_LOCK_HPP
#define OPENCV_UTILS_LOCK_HPP
namespace
cv
{
namespace
utils
{
/** @brief A simple scoped lock (RAII-style locking for exclusive/write access).
*
* Emulate std::lock_guard (C++11), partially std::unique_lock (C++11),
*/
template
<
class
_Mutex
>
class
lock_guard
{
public
:
typedef
_Mutex
Mutex
;
explicit
inline
lock_guard
(
Mutex
&
m
)
:
mutex_
(
&
m
)
{
mutex_
->
lock
();
}
inline
~
lock_guard
()
{
if
(
mutex_
)
mutex_
->
unlock
();
}
inline
void
release
()
{
CV_DbgAssert
(
mutex_
);
mutex_
->
unlock
();
mutex_
=
NULL
;
}
private
:
Mutex
*
mutex_
;
private
:
lock_guard
(
const
lock_guard
&
);
// disabled
lock_guard
&
operator
=
(
const
lock_guard
&
);
// disabled
};
/** @brief A shared scoped lock (RAII-style locking for shared/reader access).
*
* Emulate boost::shared_lock_guard, subset of std::shared_lock (C++14),
*/
template
<
class
_Mutex
>
class
shared_lock_guard
{
public
:
typedef
_Mutex
Mutex
;
explicit
inline
shared_lock_guard
(
Mutex
&
m
)
:
mutex_
(
&
m
)
{
mutex_
->
lock_shared
();
}
inline
~
shared_lock_guard
()
{
if
(
mutex_
)
mutex_
->
unlock_shared
();
}
inline
void
release
()
{
CV_DbgAssert
(
mutex_
);
mutex_
->
unlock_shared
();
mutex_
=
NULL
;
}
protected
:
Mutex
*
mutex_
;
private
:
shared_lock_guard
(
const
shared_lock_guard
&
);
// disabled
shared_lock_guard
&
operator
=
(
const
shared_lock_guard
&
);
// disabled
};
/** @brief An optional simple scoped lock (RAII-style locking for exclusive/write access).
*
* Doesn't lock if mutex pointer is NULL.
*
* @sa lock_guard
*/
template
<
class
_Mutex
>
class
optional_lock_guard
{
public
:
typedef
_Mutex
Mutex
;
explicit
inline
optional_lock_guard
(
Mutex
*
m
)
:
mutex_
(
m
)
{
if
(
mutex_
)
mutex_
->
lock
();
}
inline
~
optional_lock_guard
()
{
if
(
mutex_
)
mutex_
->
unlock
();
}
private
:
Mutex
*
mutex_
;
private
:
optional_lock_guard
(
const
optional_lock_guard
&
);
// disabled
optional_lock_guard
&
operator
=
(
const
optional_lock_guard
&
);
// disabled
};
/** @brief An optional shared scoped lock (RAII-style locking for shared/reader access).
*
* Doesn't lock if mutex pointer is NULL.
*
* @sa shared_lock_guard
*/
template
<
class
_Mutex
>
class
optional_shared_lock_guard
{
public
:
typedef
_Mutex
Mutex
;
explicit
inline
optional_shared_lock_guard
(
Mutex
*
m
)
:
mutex_
(
m
)
{
if
(
mutex_
)
mutex_
->
lock_shared
();
}
inline
~
optional_shared_lock_guard
()
{
if
(
mutex_
)
mutex_
->
unlock_shared
();
}
protected
:
Mutex
*
mutex_
;
private
:
optional_shared_lock_guard
(
const
optional_shared_lock_guard
&
);
// disabled
optional_shared_lock_guard
&
operator
=
(
const
optional_shared_lock_guard
&
);
// disabled
};
}}
// namespace
#endif // OPENCV_UTILS_LOCK_HPP
modules/core/src/glob.cpp
View file @
e5d1790b
...
...
@@ -42,6 +42,8 @@
#include "precomp.hpp"
#include "opencv2/core/utils/filesystem.hpp"
#if defined _WIN32 || defined WINCE
# include <windows.h>
const
char
dir_separators
[]
=
"/
\\
"
;
...
...
@@ -169,6 +171,12 @@ static bool isDir(const cv::String& path, DIR* dir)
#endif
}
bool
cv
::
utils
::
fs
::
isDirectory
(
const
cv
::
String
&
path
)
{
CV_INSTRUMENT_REGION
()
return
isDir
(
path
,
NULL
);
}
static
bool
wildcmp
(
const
char
*
string
,
const
char
*
wild
)
{
// Based on wildcmp written by Jack Handy - <A href="mailto:jakkhandy@hotmail.com">jakkhandy@hotmail.com</A>
...
...
modules/core/src/ocl.cpp
View file @
e5d1790b
This diff is collapsed.
Click to expand it.
modules/core/src/utils/filesystem.cpp
0 → 100644
View file @
e5d1790b
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment