Remove type_safe library
This commit is contained in:
20 files changed
+76
-57
No files matched your search
@@ -34,6 +34,9 @@ jobs:
|
||||
- name: Build without threads
|
||||
run: cmake -B ${{github.workspace}}/build -D CMAKE_C_COMPILER=gcc-10 -D CMAKE_CXX_COMPILER=g++-10 -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DUSE_WERROR=ON -DCALYP_MANAGED_RESOURCES=OFF -DCALYP_THREADED_MODULES=OFF; cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
|
||||
|
||||
- name: Build without threads
|
||||
run: cmake -B ${{github.workspace}}/build -D CMAKE_C_COMPILER=gcc-10 -D CMAKE_CXX_COMPILER=g++-10 -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DUSE_WERROR=ON -DUSE_OPENCV=OFF -DUSE_FFMPEG=OFF; cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
|
||||
|
||||
check-tests:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
+1
-20
@@ -104,7 +104,7 @@ SET(UPDATE_CHANNEL
|
||||
# ####################################################################################################################################################
|
||||
INCLUDE(FetchContent)
|
||||
|
||||
SET(FETCHCONTENT_BASE_DIR "${CMAKE_BINARY_DIR}/deps")
|
||||
SET(FETCHCONTENT_BASE_DIR "${CMAKE_BINARY_DIR}/deps")
|
||||
|
||||
# Doxygen
|
||||
IF(BUILD_DOC)
|
||||
@@ -118,24 +118,6 @@ SET_PACKAGE_PROPERTIES(
|
||||
TYPE OPTIONAL
|
||||
)
|
||||
|
||||
# Type safe
|
||||
FETCHCONTENT_DECLARE(
|
||||
type_safe
|
||||
GIT_REPOSITORY https://github.com/foonathan/type_safe
|
||||
GIT_TAG v0.2.2
|
||||
SOURCE_DIR "${CMAKE_BINARY_DIR}/deps/type_safe"
|
||||
)
|
||||
|
||||
SET_PACKAGE_PROPERTIES(
|
||||
type_safe PROPERTIES
|
||||
URL "https://github.com/foonathan/type_safe"
|
||||
DESCRIPTION "Zero overhead abstractions that use the C++ type system to prevent bugs."
|
||||
TYPE REQUIRED
|
||||
)
|
||||
FETCHCONTENT_MAKEAVAILABLE(type_safe)
|
||||
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/deps/type_safe/include/ ${CMAKE_BINARY_DIR}/deps/type_safe/external/debug_assert/)
|
||||
ADD_DEFINITIONS(-DTYPE_SAFE_ENABLE_ASSERTIONS=0 -DTYPE_SAFE_ENABLE_PRECONDITION_CHECKS=0 -DDEBUG_ASSERT_DISABLE)
|
||||
|
||||
# Catch2 and Google Tests
|
||||
IF(BUILD_TESTS)
|
||||
FETCHCONTENT_DECLARE(googletest URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip)
|
||||
@@ -175,7 +157,6 @@ IF(BUILD_TESTS)
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
|
||||
# OpenCV
|
||||
OPTION(USE_OPENCV "Add OpenCV support" ON)
|
||||
IF(USE_OPENCV)
|
||||
|
||||
@@ -131,7 +131,7 @@ bool CalypAppModuleIf::apply( bool isPlaying, bool disableThreads )
|
||||
}
|
||||
}
|
||||
|
||||
if( !( isPlaying && m_pcModule->m_uiModuleRequirements.is_set( ClpModuleFeature::SkipWhilePlaying ) ) )
|
||||
if( !( isPlaying && m_pcModule->has( ClpModuleFeature::SkipWhilePlaying ) ) )
|
||||
{
|
||||
m_frameList.clear();
|
||||
for( unsigned int i = 0; i < m_pcModule->m_uiNumberOfFrames; i++ )
|
||||
|
||||
@@ -81,12 +81,11 @@ public:
|
||||
auto getSubWindowList() const -> const std::vector<VideoSubWindow*>& { return m_pcSubWindow; }
|
||||
|
||||
CalypModuleIf* getModule() { return m_pcModule.get(); }
|
||||
auto getModuleRequirements() const -> ClpModuleFeatures { return m_pcModule->m_uiModuleRequirements; }
|
||||
auto hasFeature( ClpModuleFeature feature ) const -> bool { return m_pcModule->has( feature ); }
|
||||
std::string moduleInfo() const { return m_pcModule->moduleInfo(); }
|
||||
void update( bool isPlaying );
|
||||
bool apply( bool isPlaying = false, bool disableThreads = false );
|
||||
bool process();
|
||||
// void setPlaying( bool isPlaying );
|
||||
bool isRunning() const;
|
||||
void show();
|
||||
void disable();
|
||||
|
||||
@@ -69,7 +69,7 @@ void ModuleSubWindow::updateVideoWindowInfo()
|
||||
}
|
||||
}
|
||||
}
|
||||
if( module_ptr->getModuleRequirements().is_set( ClpModuleFeature::HasInfo ) )
|
||||
if( module_ptr->hasFeature( ClpModuleFeature::HasInfo ) )
|
||||
{
|
||||
QStringList list = QString::fromStdString( module_ptr->moduleInfo() ).split( '\n' );
|
||||
windowInfoList.append( list );
|
||||
|
||||
@@ -283,7 +283,7 @@ void ModulesHandle::activateModule()
|
||||
{
|
||||
int minNumFrames = numberOfFrames;
|
||||
int maxNumFrames = numberOfFrames;
|
||||
if( pcCurrAppModuleIf->m_pcModule->m_uiModuleRequirements.is_set( ClpModuleFeature::VariableNumOfFrames ) )
|
||||
if( pcCurrAppModuleIf->m_pcModule->has( ClpModuleFeature::VariableNumOfFrames ) )
|
||||
{
|
||||
minNumFrames = numberOfFrames;
|
||||
maxNumFrames = 255;
|
||||
@@ -356,7 +356,7 @@ void ModulesHandle::activateModule()
|
||||
pcCurrAppModuleIf->m_pcSubWindow[i] = videoSubWindowList.at( i );
|
||||
}
|
||||
|
||||
if( pcCurrAppModuleIf->m_pcModule->m_uiModuleRequirements.is_set( ClpModuleFeature::Options ) )
|
||||
if( pcCurrAppModuleIf->m_pcModule->has( ClpModuleFeature::Options ) )
|
||||
{
|
||||
ModulesHandleOptDialog moduleOptDialog( m_pcParent, pcCurrAppModuleIf.get() );
|
||||
if( moduleOptDialog.runConfiguration() == QDialog::Rejected )
|
||||
@@ -373,7 +373,7 @@ void ModulesHandle::activateModule()
|
||||
|
||||
if( pcCurrAppModuleIf->m_pcModule->m_iModuleType == ClpModuleType::FrameProcessing )
|
||||
{
|
||||
if( bShowModulesNewWindow || pcCurrAppModuleIf->m_pcModule->m_uiModuleRequirements.is_set( ClpModuleFeature::NewWindow ) )
|
||||
if( bShowModulesNewWindow || pcCurrAppModuleIf->m_pcModule->has( ClpModuleFeature::NewWindow ) )
|
||||
{
|
||||
auto pcModuleSubWindow = new ModuleSubWindow( pcCurrAppModuleIf.get() );
|
||||
pcModuleSubWindow->resetWindowName();
|
||||
|
||||
@@ -121,7 +121,7 @@ void VideoStreamSubWindow::updateVideoWindowInfo()
|
||||
}
|
||||
}
|
||||
}
|
||||
if( m_pcDisplayModule->getModuleRequirements() & ClpModuleFeature::HasInfo )
|
||||
if( m_pcDisplayModule->hasFeature( ClpModuleFeature::HasInfo ) )
|
||||
{
|
||||
QStringList list = QString::fromStdString( m_pcDisplayModule->moduleInfo() ).split( '\n' );
|
||||
windowInfoList.append( list );
|
||||
|
||||
@@ -156,7 +156,7 @@ void VideoSubWindow::keyPressEvent( QKeyEvent* event )
|
||||
{
|
||||
if( m_pcDisplayModule )
|
||||
{
|
||||
if( m_pcDisplayModule->getModuleRequirements().is_set( ClpModuleFeature::KeysShortcuts ) )
|
||||
if( m_pcDisplayModule->hasFeature( ClpModuleFeature::KeysShortcuts ) )
|
||||
{
|
||||
bool bRet = false;
|
||||
switch( event->key() )
|
||||
|
||||
+1
-3
@@ -22,7 +22,7 @@ SET(Calyp_Lib_Stream_SRCS
|
||||
|
||||
SET(Calyp_Lib_OptionParser_SRCS CalypOptions.h CalypOptions.cpp)
|
||||
|
||||
SET(Calyp_Lib_Modules_SRCS CalypOptions.h CalypOptions.cpp)
|
||||
SET(Calyp_Lib_Modules_SRCS CalypModuleIf.h CalypModuleIf.cpp)
|
||||
|
||||
SET(Calyp_Lib_SRCS CalypLib.h CalypDefs.h ${Calyp_Lib_Frame_SRCS} ${Calyp_Lib_Stream_SRCS} ${Calyp_Lib_OptionParser_SRCS} ${Calyp_Lib_Modules_SRCS})
|
||||
|
||||
@@ -44,8 +44,6 @@ IF(USE_OPENCV)
|
||||
LIST(APPEND Calyp_Lib_SRCS StreamHandlerOpenCV.h)
|
||||
LIST(APPEND Calyp_Lib_SRCS StreamHandlerOpenCV.cpp)
|
||||
|
||||
LIST(APPEND Calyp_Lib_SRCS CalypOpenCVModuleIf.cpp)
|
||||
|
||||
LIST(APPEND CMAKE_CFG_LINKER_LIBSS ${OpenCV_LIBRARIES})
|
||||
LIST(APPEND CMAKE_CFG_INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS})
|
||||
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
/**
|
||||
* \file CalypDefs.h
|
||||
* \ingroup CalypLibGrp
|
||||
* \brief Define basic types, new types and enumerations
|
||||
* \brief Define basic types, new types and enumerations (private use only)
|
||||
*/
|
||||
|
||||
#ifndef __CALYPDEFS_H__
|
||||
|
||||
@@ -22,16 +22,17 @@
|
||||
* \brief Calyp modules interface for OpenCV
|
||||
*/
|
||||
|
||||
#include "CalypFrame.h"
|
||||
#include "CalypModuleIf.h"
|
||||
|
||||
// OpenCV
|
||||
#include <opencv2/opencv.hpp>
|
||||
|
||||
#include "CalypFrame.h"
|
||||
#include "PixelFormats.h"
|
||||
#include "config.h"
|
||||
|
||||
bool CalypOpenCVModuleIf::create( std::vector<CalypFrame*> apcFrameList )
|
||||
{
|
||||
#ifdef USE_OPENCV
|
||||
_BASIC_MODULE_API_2_CHECK_
|
||||
bool bRet = false;
|
||||
std::vector<Mat> acMatList( apcFrameList.size() );
|
||||
@@ -51,10 +52,14 @@ bool CalypOpenCVModuleIf::create( std::vector<CalypFrame*> apcFrameList )
|
||||
return false;
|
||||
}
|
||||
return bRet;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
CalypFrame* CalypOpenCVModuleIf::process( std::vector<CalypFrame*> apcFrameList )
|
||||
{
|
||||
#ifdef USE_OPENCV
|
||||
m_pcOutputFrame->reset();
|
||||
std::vector<Mat> acMatList( apcFrameList.size() );
|
||||
for( unsigned i = 0; i < apcFrameList.size(); i++ )
|
||||
@@ -64,8 +69,35 @@ CalypFrame* CalypOpenCVModuleIf::process( std::vector<CalypFrame*> apcFrameList
|
||||
Mat* cvOutput = process_using_opencv( acMatList );
|
||||
m_pcOutputFrame->fromMat( *cvOutput );
|
||||
return m_pcOutputFrame.get();
|
||||
#else
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
void CalypOpenCVModuleIf::destroy()
|
||||
{
|
||||
}
|
||||
|
||||
ClpModuleFeature operator|( ClpModuleFeature lhs, ClpModuleFeature rhs )
|
||||
{
|
||||
return static_cast<ClpModuleFeature>(
|
||||
static_cast<std::underlying_type_t<ClpModuleFeature>>( lhs ) |
|
||||
static_cast<std::underlying_type_t<ClpModuleFeature>>( rhs ) );
|
||||
}
|
||||
|
||||
ClpModuleFeature operator&( ClpModuleFeature lhs, ClpModuleFeature rhs )
|
||||
{
|
||||
return static_cast<ClpModuleFeature>(
|
||||
static_cast<std::underlying_type_t<ClpModuleFeature>>( lhs ) &
|
||||
static_cast<std::underlying_type_t<ClpModuleFeature>>( rhs ) );
|
||||
}
|
||||
|
||||
auto CalypModuleIf::getModuleLongName() -> const char*
|
||||
{
|
||||
return m_pchModuleLongName ? m_pchModuleLongName : m_pchModuleName;
|
||||
}
|
||||
|
||||
auto CalypModuleIf::has( ClpModuleFeature feature ) -> bool
|
||||
{
|
||||
return ( m_uiModuleRequirements & feature ) != ClpModuleFeature::None;
|
||||
}
|
||||
+16
-18
@@ -35,7 +35,6 @@
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
#include <type_safe/flag_set.hpp>
|
||||
#include <vector>
|
||||
|
||||
#include "CalypFrame.h"
|
||||
@@ -95,19 +94,18 @@ enum class ClpModuleType : std::uint8_t
|
||||
* Features/Requirements of a module
|
||||
* @see m_uiModuleRequirements
|
||||
*/
|
||||
enum class ClpModuleFeature
|
||||
enum class ClpModuleFeature : std::uint64_t
|
||||
{
|
||||
None,
|
||||
SkipWhilePlaying,
|
||||
Options,
|
||||
NewWindow,
|
||||
KeysShortcuts,
|
||||
VariableNumOfFrames,
|
||||
HasInfo,
|
||||
_flag_set_size
|
||||
None = 0,
|
||||
SkipWhilePlaying = 1,
|
||||
Options = 2,
|
||||
NewWindow = 4,
|
||||
KeysShortcuts = 8,
|
||||
VariableNumOfFrames = 16,
|
||||
HasInfo = 32,
|
||||
};
|
||||
|
||||
using ClpModuleFeatures = type_safe::flag_set<ClpModuleFeature>;
|
||||
auto operator|( ClpModuleFeature lhs, ClpModuleFeature rhs ) -> ClpModuleFeature;
|
||||
|
||||
enum Module_Key_Supported
|
||||
{
|
||||
@@ -117,6 +115,8 @@ enum Module_Key_Supported
|
||||
MODULE_KEY_DOWN,
|
||||
};
|
||||
|
||||
class CalypFrame;
|
||||
|
||||
/**
|
||||
* \class CalypModuleIf
|
||||
* \ingroup CalypLib Calyp_Modules
|
||||
@@ -134,10 +134,8 @@ public:
|
||||
virtual ~CalypModuleIf() = default;
|
||||
virtual void destroy(){};
|
||||
|
||||
const char* getModuleLongName()
|
||||
{
|
||||
return m_pchModuleLongName ? m_pchModuleLongName : m_pchModuleName;
|
||||
}
|
||||
auto getModuleLongName() -> const char*;
|
||||
auto has( ClpModuleFeature feature ) -> bool;
|
||||
|
||||
/**
|
||||
* Module API version 1
|
||||
@@ -175,7 +173,7 @@ public:
|
||||
//! Number of frames
|
||||
unsigned int m_uiNumberOfFrames{ 1 };
|
||||
//! Features/Requirements
|
||||
ClpModuleFeatures m_uiModuleRequirements{ ClpModuleFeature::None };
|
||||
ClpModuleFeature m_uiModuleRequirements{ ClpModuleFeature::None };
|
||||
|
||||
unsigned int m_iFrameBufferCount{ 0 };
|
||||
|
||||
@@ -197,7 +195,7 @@ class CalypOpenCVModuleIf : public CalypModuleIf
|
||||
using Mat = cv::Mat;
|
||||
|
||||
public:
|
||||
CalypOpenCVModuleIf() { m_bConvertToGray = false; };
|
||||
CalypOpenCVModuleIf() = default;
|
||||
virtual ~CalypOpenCVModuleIf() {}
|
||||
|
||||
// Common API
|
||||
@@ -216,7 +214,7 @@ public:
|
||||
protected:
|
||||
// const char* m_pchPythonFunctionName;
|
||||
std::unique_ptr<CalypFrame> m_pcOutputFrame;
|
||||
bool m_bConvertToGray;
|
||||
bool m_bConvertToGray{ false };
|
||||
};
|
||||
|
||||
using CalypModulePtr = std::unique_ptr<CalypModuleIf>;
|
||||
|
||||
@@ -38,12 +38,13 @@
|
||||
|
||||
#include "CalypOptions.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
|
||||
#include "config.h"
|
||||
#include "lib/CalypFrame.h"
|
||||
#include "lib/CalypModuleIf.h"
|
||||
|
||||
struct ParseFailure : public std::exception
|
||||
|
||||
+2
-2
@@ -42,10 +42,10 @@
|
||||
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "CalypDefs.h"
|
||||
|
||||
/**
|
||||
* \class CalypOptions
|
||||
* \ingroup CalypLibGrp
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#define __FILTERCOMPONENT_H__
|
||||
|
||||
// CalypLib
|
||||
#include "lib/CalypFrame.h"
|
||||
#include "lib/CalypModuleIf.h"
|
||||
|
||||
class FilterComponentModule : public CalypModuleIf
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
|
||||
#include "FrameDifference.h"
|
||||
|
||||
#include "lib/CalypFrame.h"
|
||||
|
||||
FrameDifference::FrameDifference()
|
||||
{
|
||||
/* Module Definition */
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
|
||||
#include "FrameMask.h"
|
||||
|
||||
#include "lib/CalypFrame.h"
|
||||
|
||||
FrameMask::FrameMask()
|
||||
{
|
||||
/* Module Definition */
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#define __INTERFRAMEVARIANCE_H__
|
||||
|
||||
// CalypLib
|
||||
#include "lib/CalypFrame.h"
|
||||
#include "lib/CalypModuleIf.h"
|
||||
|
||||
class InterFrameVariance : public CalypModuleIf
|
||||
|
||||
@@ -319,7 +319,7 @@ int CalypTools::Open( int argc, char* argv[] )
|
||||
return -1;
|
||||
}
|
||||
|
||||
if( m_pcCurrModuleIf->m_uiModuleRequirements & ClpModuleFeature::VariableNumOfFrames )
|
||||
if( m_pcCurrModuleIf->has( ClpModuleFeature::VariableNumOfFrames ) )
|
||||
{
|
||||
m_pcCurrModuleIf->m_uiNumberOfFrames = m_apcInputStreams.size();
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "config.h"
|
||||
#include "lib/CalypDefs.h"
|
||||
#include "lib/CalypOptions.h"
|
||||
|
||||
class CalypToolsCmdParser
|
||||
|
||||
Reference in new issue
Block a user