mirror of
https://gitcode.com/gh_mirrors/ope/OpenFace.git
synced 2026-07-30 15:57:46 +00:00
Feature/opencv4 (#706)
* Travis OpenCV4 update, testing Ubuntu with new OpenCV * Fix to Ubuntu travis * Another attempt at OpenCV 4.0 for Ubuntu * And another OpenCV attempt. * Simplifying the travis script * Ubuntu OpenCV 4 support. * Updating to OpenCV 4, for x64 windows. * Fixes to move to OpenCV 4 on windows. * Travis fix for OpenCV 4 on OSX * Renaming a lib. * Travis opencv4 fix. * Building OpenCV4 versions using appveyor. * Attempt mac travis fix. * Small travis fix. * Travis fix attempt. * First iteration in boost removal and upgrade to C++17 * Test with ocv 4.0 * Moving filesystem out of stdafx * Some more boost testing with cmake. * More CMAKE options * More compiler flag changes * Another attempt at compiler options. * Another attempt. * More filesystem stuff. * Linking to filesystem. * Cmake fix with target linking. * Attempting travis with g++-8 * Attempting to setup g++8 on travis linux. * Another travis change. * Adding OpenBLAS to travis and removing g++-8 * Fixing typo * More travis experiments. * More travis debugging. * A small directory change. * Adding some more travis changes. * travis typo fix. * Some reordering of travis, for cleaner yml * Removing `using namespace std` in order to avoid clash with byte and to make the code more consistent. * Working towards removing std::filesystem requirement, allow boost::filesystem as well. * Making boost an optional dependency * Fixing std issue. * Fixing cmake issue. * Fixing the precompiled header issue. * Another cmake boost fix. * Including missing files. * Removing unnecessary includes. * Removing more includes. * Changes to appveyor build, proper removal of VS2015 * If boost is present, do not need to link to filesystem. * Removing un-needed link library. * oops * Mac attempt at opencv4 travis. * Upgrading OCV to 4.1 on VS2018 * Downloading OpenCV binaries through a script * Triger an appveyor build. * Upgrading VS version. * Attempting VS2017 build * Adding win-32 libraries for OpenCV 4.1 * Adding OpenCV 32 bit libraries.
This commit is contained in:
committed by
GitHub
parent
330383fef7
commit
9147dfe2f3
178
lib/3rdParty/OpenCV/include/opencv2/gapi/util/optional.hpp
vendored
Normal file
178
lib/3rdParty/OpenCV/include/opencv2/gapi/util/optional.hpp
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
// 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.
|
||||
//
|
||||
// Copyright (C) 2018 Intel Corporation
|
||||
|
||||
|
||||
#ifndef OPENCV_GAPI_UTIL_OPTIONAL_HPP
|
||||
#define OPENCV_GAPI_UTIL_OPTIONAL_HPP
|
||||
|
||||
#include "opencv2/gapi/util/variant.hpp"
|
||||
|
||||
// A poor man's `optional` implementation, incompletely modeled against C++17 spec.
|
||||
namespace cv
|
||||
{
|
||||
namespace util
|
||||
{
|
||||
class bad_optional_access: public std::exception
|
||||
{
|
||||
public:
|
||||
virtual const char *what() const noexcept override
|
||||
{
|
||||
return "Bad optional access";
|
||||
}
|
||||
};
|
||||
|
||||
// TODO: nullopt_t
|
||||
|
||||
// Interface ///////////////////////////////////////////////////////////////
|
||||
template<typename T> class optional
|
||||
{
|
||||
public:
|
||||
// Constructors
|
||||
// NB.: there were issues with Clang 3.8 when =default() was used
|
||||
// instead {}
|
||||
optional() {};
|
||||
optional(const optional&) = default;
|
||||
explicit optional(T &&value) noexcept;
|
||||
explicit optional(const T &value) noexcept;
|
||||
optional(optional &&) noexcept;
|
||||
// TODO: optional(nullopt_t) noexcept;
|
||||
// TODO: optional(const optional<U> &)
|
||||
// TODO: optional(optional<U> &&)
|
||||
// TODO: optional(Args&&...)
|
||||
// TODO: optional(initializer_list<U>)
|
||||
// TODO: optional(U&& value);
|
||||
|
||||
// Assignment
|
||||
optional& operator=(const optional& rhs) = default;
|
||||
optional& operator=(optional&& rhs);
|
||||
|
||||
// Observers
|
||||
T* operator-> ();
|
||||
const T* operator-> () const;
|
||||
T& operator* ();
|
||||
const T& operator* () const;
|
||||
// TODO: && versions
|
||||
|
||||
operator bool() const noexcept;
|
||||
bool has_value() const noexcept;
|
||||
|
||||
T& value();
|
||||
const T& value() const;
|
||||
// TODO: && versions
|
||||
|
||||
template<class U>
|
||||
T value_or(U &&default_value) const;
|
||||
|
||||
void swap(optional &other) noexcept;
|
||||
void reset() noexcept;
|
||||
// TODO: emplace
|
||||
|
||||
// TODO: operator==, !=, <, <=, >, >=
|
||||
|
||||
private:
|
||||
struct nothing {};
|
||||
util::variant<nothing, T> m_holder;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
optional<typename std::decay<T>::type> make_optional(T&& value);
|
||||
|
||||
// TODO: Args... and initializer_list versions
|
||||
|
||||
// Implementation //////////////////////////////////////////////////////////
|
||||
template<class T> optional<T>::optional(T &&v) noexcept
|
||||
: m_holder(v)
|
||||
{
|
||||
}
|
||||
|
||||
template<class T> optional<T>::optional(const T &v) noexcept
|
||||
: m_holder(v)
|
||||
{
|
||||
}
|
||||
|
||||
template<class T> optional<T>::optional(optional&& rhs) noexcept
|
||||
: m_holder(std::move(rhs.m_holder))
|
||||
{
|
||||
rhs.reset();
|
||||
}
|
||||
|
||||
template<class T> optional<T>& optional<T>::operator=(optional&& rhs)
|
||||
{
|
||||
m_holder = std::move(rhs.m_holder);
|
||||
rhs.reset();
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<class T> T* optional<T>::operator-> ()
|
||||
{
|
||||
return & *(*this);
|
||||
}
|
||||
|
||||
template<class T> const T* optional<T>::operator-> () const
|
||||
{
|
||||
return & *(*this);
|
||||
}
|
||||
|
||||
template<class T> T& optional<T>::operator* ()
|
||||
{
|
||||
return this->value();
|
||||
}
|
||||
|
||||
template<class T> const T& optional<T>::operator* () const
|
||||
{
|
||||
return this->value();
|
||||
}
|
||||
|
||||
template<class T> optional<T>::operator bool() const noexcept
|
||||
{
|
||||
return this->has_value();
|
||||
}
|
||||
|
||||
template<class T> bool optional<T>::has_value() const noexcept
|
||||
{
|
||||
return util::holds_alternative<T>(m_holder);
|
||||
}
|
||||
|
||||
template<class T> T& optional<T>::value()
|
||||
{
|
||||
if (!this->has_value())
|
||||
throw_error(bad_optional_access());
|
||||
return util::get<T>(m_holder);
|
||||
}
|
||||
|
||||
template<class T> const T& optional<T>::value() const
|
||||
{
|
||||
if (!this->has_value())
|
||||
throw_error(bad_optional_access());
|
||||
return util::get<T>(m_holder);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
template<class U> T optional<T>::value_or(U &&default_value) const
|
||||
{
|
||||
return (this->has_value() ? this->value() : T(default_value));
|
||||
}
|
||||
|
||||
template<class T> void optional<T>::swap(optional<T> &other) noexcept
|
||||
{
|
||||
m_holder.swap(other.m_holder);
|
||||
}
|
||||
|
||||
template<class T> void optional<T>::reset() noexcept
|
||||
{
|
||||
if (this->has_value())
|
||||
m_holder = nothing{};
|
||||
}
|
||||
|
||||
template<class T>
|
||||
optional<typename std::decay<T>::type> make_optional(T&& value)
|
||||
{
|
||||
return optional<typename std::decay<T>::type>(std::forward<T>(value));
|
||||
}
|
||||
} // namespace util
|
||||
} // namespace cv
|
||||
|
||||
#endif // OPENCV_GAPI_UTIL_OPTIONAL_HPP
|
||||
Reference in New Issue
Block a user