diff options
author | Patrick Ruoff <c14-radioactive@19e81ba0-9b1a-49c3-bd6c-561e1906d5fb> | 2012-09-21 14:00:34 +0000 |
---|---|---|
committer | Patrick Ruoff <c14-radioactive@19e81ba0-9b1a-49c3-bd6c-561e1906d5fb> | 2012-09-21 14:00:34 +0000 |
commit | ab0d60becc2d1b89c812193c179892d6acd4912f (patch) | |
tree | 2dae7d2c10e1cc3a5bd73ee8ae2ee609c69a1b7b | |
parent | ddc63cdda186fe31435fde839c3d5b68040a0d0f (diff) |
RAII-style dll management 1: Replaced autoptr and release with virtual destructors
git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@155 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
35 files changed, 167 insertions, 188 deletions
diff --git a/FTNoIR_Filter_Accela/ftnoir_filter_accela.cpp b/FTNoIR_Filter_Accela/ftnoir_filter_accela.cpp index e6a009f0..60b895a4 100644 --- a/FTNoIR_Filter_Accela/ftnoir_filter_accela.cpp +++ b/FTNoIR_Filter_Accela/ftnoir_filter_accela.cpp @@ -29,11 +29,6 @@ FTNoIR_Filter::~FTNoIR_Filter() }
-void FTNoIR_Filter::Release()
-{
- delete this;
-}
-
void FTNoIR_Filter::Initialize()
{
loadSettings();
@@ -152,7 +147,7 @@ void FTNoIR_Filter::FilterHeadPoseData(THeadPoseData *current_camera_position, T // _GetFilter@0 - Common name decoration for __stdcall functions in C language.
#pragma comment(linker, "/export:GetFilter=_GetFilter@0")
-FTNOIR_FILTER_BASE_EXPORT FILTERHANDLE __stdcall GetFilter()
+FTNOIR_FILTER_BASE_EXPORT IFilterPtr __stdcall GetFilter()
{
return new FTNoIR_Filter;
}
diff --git a/FTNoIR_Filter_Accela/ftnoir_filter_accela_dialog.cpp b/FTNoIR_Filter_Accela/ftnoir_filter_accela_dialog.cpp index 4f7a478b..b9a1724c 100644 --- a/FTNoIR_Filter_Accela/ftnoir_filter_accela_dialog.cpp +++ b/FTNoIR_Filter_Accela/ftnoir_filter_accela_dialog.cpp @@ -181,7 +181,7 @@ void FilterControls::save() { // _GetFilterDialog@0 - Common name decoration for __stdcall functions in C language.
#pragma comment(linker, "/export:GetFilterDialog=_GetFilterDialog@0")
-FTNOIR_FILTER_BASE_EXPORT FILTERDIALOGHANDLE __stdcall GetFilterDialog( )
+FTNOIR_FILTER_BASE_EXPORT IFilterDialogPtr __stdcall GetFilterDialog( )
{
return new FilterControls;
}
diff --git a/FTNoIR_Filter_Accela/ftnoir_filter_accela_dll.cpp b/FTNoIR_Filter_Accela/ftnoir_filter_accela_dll.cpp index c76f2203..ccd1aaae 100644 --- a/FTNoIR_Filter_Accela/ftnoir_filter_accela_dll.cpp +++ b/FTNoIR_Filter_Accela/ftnoir_filter_accela_dll.cpp @@ -84,7 +84,7 @@ void FTNoIR_FilterDll::getIcon(QIcon *icon) // _GetFilterDll@0 - Common name decoration for __stdcall functions in C language.
#pragma comment(linker, "/export:GetFilterDll=_GetFilterDll@0")
-FTNOIR_FILTER_BASE_EXPORT FILTERDLLHANDLE __stdcall GetFilterDll()
+FTNOIR_FILTER_BASE_EXPORT IFilterDllPtr __stdcall GetFilterDll()
{
return new FTNoIR_FilterDll;
}
diff --git a/FTNoIR_Filter_Base/ftnoir_filter_base.h b/FTNoIR_Filter_Base/ftnoir_filter_base.h index 600243fc..71d2faf0 100644 --- a/FTNoIR_Filter_Base/ftnoir_filter_base.h +++ b/FTNoIR_Filter_Base/ftnoir_filter_base.h @@ -10,8 +10,14 @@ #include <QMessageBox>
#include <QSettings>
-#include "..\FaceTrackNoIR\AutoClosePtr.h"
+////////////////////////////////////////////////////////////////////////////////
+#ifdef __cplusplus
+# define EXTERN_C extern "C"
+#else
+# define EXTERN_C
+#endif // __cplusplus
+////////////////////////////////////////////////////////////////////////////////
// COM-Like abstract interface.
// This interface doesn't require __declspec(dllexport/dllimport) specifier.
// Method calls are dispatched via virtual table.
@@ -19,32 +25,22 @@ // Instances are obtained via factory function.
struct IFilter
{
- virtual void Release() = 0;
+ virtual ~IFilter() {}
virtual void Initialize() = 0;
virtual void FilterHeadPoseData(THeadPoseData *current_camera_position, THeadPoseData *target_camera_position, THeadPoseData *new_camera_position, bool newTarget) = 0;
};
-// Handle type. In C++ language the interface type is used.
-typedef IFilter* FILTERHANDLE;
-typedef AutoClosePtr<IFilter, void, &IFilter::Release> IFilterPtr;
-typedef IFilter *(__stdcall *importGetFilter)(void);
-
-////////////////////////////////////////////////////////////////////////////////
-//
-#ifdef __cplusplus
-# define EXTERN_C extern "C"
-#else
-# define EXTERN_C
-#endif // __cplusplus
+typedef IFilter* IFilterPtr;
+//typedef IFilter *(__stdcall *importGetFilter)(void);
// Factory function that creates instances of the Filter object.
EXTERN_C
FTNOIR_FILTER_BASE_EXPORT
-FILTERHANDLE
+IFilterPtr
__stdcall
-GetFilter(
- void);
+GetFilter(void);
+////////////////////////////////////////////////////////////////////////////////
// COM-Like abstract interface.
// This interface doesn't require __declspec(dllexport/dllimport) specifier.
// Method calls are dispatched via virtual table.
@@ -52,20 +48,21 @@ GetFilter( // Instances are obtained via factory function.
struct IFilterDialog
{
- virtual void Release() = 0; // Member required to enable Auto-remove
+ virtual ~IFilterDialog() {}
virtual void Initialize(QWidget *parent, IFilterPtr ptr) = 0;
};
-// Handle type. In C++ language the interface type is used.
-typedef IFilterDialog* FILTERDIALOGHANDLE;
+typedef IFilterDialog* IFilterDialogPtr;
+
// Factory function that creates instances of the Filter object.
EXTERN_C
FTNOIR_FILTER_BASE_EXPORT
-FILTERDIALOGHANDLE
+IFilterDialogPtr
__stdcall
GetFilterDialog(void);
+////////////////////////////////////////////////////////////////////////////////
// COM-Like abstract interface.
// This interface doesn't require __declspec(dllexport/dllimport) specifier.
// Method calls are dispatched via virtual table.
@@ -73,7 +70,7 @@ GetFilterDialog(void); // Instances are obtained via factory function.
struct IFilterDll
{
- virtual void Release() = 0; // Member required to enable Auto-remove
+ virtual ~IFilterDll() {}
virtual void Initialize() = 0;
virtual void getFullName(QString *strToBeFilled) = 0;
@@ -82,13 +79,12 @@ struct IFilterDll virtual void getIcon(QIcon *icon) = 0;
};
-// Handle type. In C++ language the interface type is used.
-typedef IFilterDll* FILTERDLLHANDLE;
+typedef IFilterDll* IFilterDllPtr;
// Factory function that creates instances of the Filter object.
EXTERN_C
FTNOIR_FILTER_BASE_EXPORT
-FILTERDLLHANDLE
+IFilterDllPtr
__stdcall
GetFilterDll(void);
diff --git a/FTNoIR_Filter_EWMA2/ftnoir_filter_ewma2.cpp b/FTNoIR_Filter_EWMA2/ftnoir_filter_ewma2.cpp index 965cfd73..fac0e13c 100644 --- a/FTNoIR_Filter_EWMA2/ftnoir_filter_ewma2.cpp +++ b/FTNoIR_Filter_EWMA2/ftnoir_filter_ewma2.cpp @@ -230,7 +230,7 @@ void FTNoIR_Filter::FilterHeadPoseData(THeadPoseData *current_camera_position, T // _GetFilter@0 - Common name decoration for __stdcall functions in C language.
#pragma comment(linker, "/export:GetFilter=_GetFilter@0")
-FTNOIR_FILTER_BASE_EXPORT FILTERHANDLE __stdcall GetFilter()
+FTNOIR_FILTER_BASE_EXPORT IFilterPtr __stdcall GetFilter()
{
return new FTNoIR_Filter;
}
diff --git a/FTNoIR_Filter_EWMA2/ftnoir_filter_ewma2_dialog.cpp b/FTNoIR_Filter_EWMA2/ftnoir_filter_ewma2_dialog.cpp index 9653d4bc..c7798ac0 100644 --- a/FTNoIR_Filter_EWMA2/ftnoir_filter_ewma2_dialog.cpp +++ b/FTNoIR_Filter_EWMA2/ftnoir_filter_ewma2_dialog.cpp @@ -191,7 +191,7 @@ void FilterControls::save() { // _GetFilterDialog@0 - Common name decoration for __stdcall functions in C language.
#pragma comment(linker, "/export:GetFilterDialog=_GetFilterDialog@0")
-FTNOIR_FILTER_BASE_EXPORT FILTERDIALOGHANDLE __stdcall GetFilterDialog( )
+FTNOIR_FILTER_BASE_EXPORT IFilterDialogPtr __stdcall GetFilterDialog( )
{
return new FilterControls;
}
diff --git a/FTNoIR_Protocol_Base/ftnoir_protocol_base.h b/FTNoIR_Protocol_Base/ftnoir_protocol_base.h index 1711a08e..d8ab755f 100644 --- a/FTNoIR_Protocol_Base/ftnoir_protocol_base.h +++ b/FTNoIR_Protocol_Base/ftnoir_protocol_base.h @@ -24,6 +24,7 @@ *********************************************************************************/
/*
Modifications (last one on top):
+
20110415 - WVR: Added overloaded operator - and -=
*/
@@ -39,6 +40,14 @@ #include "windows.h"
//#include "winable.h"
+////////////////////////////////////////////////////////////////////////////////
+#ifdef __cplusplus
+# define EXTERN_C extern "C"
+#else
+# define EXTERN_C
+#endif // __cplusplus
+
+////////////////////////////////////////////////////////////////////////////////
// COM-Like abstract interface.
// This interface doesn't require __declspec(dllexport/dllimport) specifier.
// Method calls are dispatched via virtual table.
@@ -46,7 +55,7 @@ // Instances are obtained via factory function.
struct IProtocol
{
- virtual void Release() = 0; // Member required to enable Auto-remove
+ virtual ~IProtocol() {}
virtual void Initialize() = 0;
virtual bool checkServerInstallationOK ( HANDLE handle ) = 0;
virtual void sendHeadposeToGame( T6DOF *headpose ) = 0;
@@ -57,26 +66,16 @@ struct IProtocol virtual void getDescription(QString *strToBeFilled) = 0;
};
-// Handle type. In C++ language the iterface type is used.
-typedef IProtocol* PROTOCOLHANDLE;
-
-////////////////////////////////////////////////////////////////////////////////
-//
-#ifdef __cplusplus
-# define EXTERN_C extern "C"
-#else
-# define EXTERN_C
-#endif // __cplusplus
+typedef IProtocol* IProtocolPtr;
// Factory function that creates instances of the Protocol object.
EXTERN_C
FTNOIR_PROTOCOL_BASE_EXPORT
-PROTOCOLHANDLE
+IProtocolPtr
__stdcall
-GetProtocol(
- void);
-
+GetProtocol(void);
+////////////////////////////////////////////////////////////////////////////////
// COM-Like abstract interface.
// This interface doesn't require __declspec(dllexport/dllimport) specifier.
// Method calls are dispatched via virtual table.
@@ -84,7 +83,7 @@ GetProtocol( // Instances are obtained via factory function.
struct IProtocolDialog
{
- virtual void Release() = 0; // Member required to enable Auto-remove
+ virtual ~IProtocolDialog() {}
virtual void Initialize(QWidget *parent) = 0;
virtual void getFullName(QString *strToBeFilled) = 0;
@@ -93,13 +92,12 @@ struct IProtocolDialog virtual void getIcon(QIcon *icon) = 0;
};
-// Handle type. In C++ language the iterface type is used.
-typedef IProtocolDialog* PROTOCOLDIALOGHANDLE;
+typedef IProtocolDialog* IProtocolDialogPtr;
// Factory function that creates instances of the Protocol object.
EXTERN_C
FTNOIR_PROTOCOL_BASE_EXPORT
-PROTOCOLDIALOGHANDLE
+IProtocolDialogPtr
__stdcall
GetProtocolDialog(void);
diff --git a/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.cpp b/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.cpp index 0713f557..a2a9505a 100644 --- a/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.cpp +++ b/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.cpp @@ -239,7 +239,7 @@ void FTNoIR_Protocol_FG::getNameFromGame( char *dest ) // _GetProtocol@0 - Common name decoration for __stdcall functions in C language.
#pragma comment(linker, "/export:GetProtocol=_GetProtocol@0")
-FTNOIR_PROTOCOL_BASE_EXPORT PROTOCOLHANDLE __stdcall GetProtocol()
+FTNOIR_PROTOCOL_BASE_EXPORT IProtocolPtr __stdcall GetProtocol()
{
return new FTNoIR_Protocol_FG;
}
@@ -427,7 +427,7 @@ void FGControls::chkLocalPCOnlyChanged() { // _GetProtocolDialog@0 - Common name decoration for __stdcall functions in C language.
#pragma comment(linker, "/export:GetProtocolDialog=_GetProtocolDialog@0")
-FTNOIR_PROTOCOL_BASE_EXPORT PROTOCOLDIALOGHANDLE __stdcall GetProtocolDialog( )
+FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialogPtr __stdcall GetProtocolDialog( )
{
return new FGControls;
}
diff --git a/FTNoIR_Protocol_FSUIPC/FTNoIR_Protocol_FSUIPC.cpp b/FTNoIR_Protocol_FSUIPC/FTNoIR_Protocol_FSUIPC.cpp index 848d115f..b4d6bebe 100644 --- a/FTNoIR_Protocol_FSUIPC/FTNoIR_Protocol_FSUIPC.cpp +++ b/FTNoIR_Protocol_FSUIPC/FTNoIR_Protocol_FSUIPC.cpp @@ -224,7 +224,7 @@ void FTNoIR_Protocol_FSUIPC::getNameFromGame( char *dest ) // _GetProtocol@0 - Common name decoration for __stdcall functions in C language.
#pragma comment(linker, "/export:GetProtocol=_GetProtocol@0")
-FTNOIR_PROTOCOL_BASE_EXPORT PROTOCOLHANDLE __stdcall GetProtocol()
+FTNOIR_PROTOCOL_BASE_EXPORT IProtocolPtr __stdcall GetProtocol()
{
return new FTNoIR_Protocol_FSUIPC;
}
@@ -386,7 +386,7 @@ void FSUIPCControls::getLocationOfDLL() // _GetProtocolDialog@0 - Common name decoration for __stdcall functions in C language.
#pragma comment(linker, "/export:GetProtocolDialog=_GetProtocolDialog@0")
-FTNOIR_PROTOCOL_BASE_EXPORT PROTOCOLDIALOGHANDLE __stdcall GetProtocolDialog( )
+FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialogPtr __stdcall GetProtocolDialog( )
{
return new FSUIPCControls;
}
diff --git a/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.cpp b/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.cpp index d51072e5..43326d6a 100644 --- a/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.cpp +++ b/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT.cpp @@ -334,7 +334,7 @@ void FTNoIR_Protocol_FT::getNameFromGame( char *dest ) // _GetProtocol@0 - Common name decoration for __stdcall functions in C language.
#pragma comment(linker, "/export:GetProtocol=_GetProtocol@0")
-FTNOIR_PROTOCOL_BASE_EXPORT PROTOCOLHANDLE __stdcall GetProtocol()
+FTNOIR_PROTOCOL_BASE_EXPORT IProtocolPtr __stdcall GetProtocol()
{
return new FTNoIR_Protocol_FT;
}
@@ -476,7 +476,7 @@ void FTControls::save() { // _GetProtocolDialog@0 - Common name decoration for __stdcall functions in C language.
#pragma comment(linker, "/export:GetProtocolDialog=_GetProtocolDialog@0")
-FTNOIR_PROTOCOL_BASE_EXPORT PROTOCOLDIALOGHANDLE __stdcall GetProtocolDialog( )
+FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialogPtr __stdcall GetProtocolDialog( )
{
return new FTControls;
}
diff --git a/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT_vc9.vcproj b/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT_vc9.vcproj index 7c709f5e..6e807762 100644 --- a/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT_vc9.vcproj +++ b/FTNoIR_Protocol_FT/FTNoIR_Protocol_FT_vc9.vcproj @@ -177,11 +177,11 @@ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
- RelativePath="..\FTNoIR_Protocol_Base\ftnoir_Protocol_base.h"
+ RelativePath="..\FTNoIR_Protocol_Base\ftnoir_protocol_base.h"
>
</File>
<File
- RelativePath="..\FTNoIR_Protocol_Base\ftnoir_Protocol_base_global.h"
+ RelativePath="..\FTNoIR_Protocol_Base\ftnoir_protocol_base_global.h"
>
</File>
<File
diff --git a/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.cpp b/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.cpp index 096b957a..399fc012 100644 --- a/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.cpp +++ b/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.cpp @@ -395,7 +395,7 @@ void FTNoIR_Protocol_FTIR::getNameFromGame( char *dest ) // _GetProtocol@0 - Common name decoration for __stdcall functions in C language.
#pragma comment(linker, "/export:GetProtocol=_GetProtocol@0")
-FTNOIR_PROTOCOL_BASE_EXPORT PROTOCOLHANDLE __stdcall GetProtocol()
+FTNOIR_PROTOCOL_BASE_EXPORT IProtocolPtr __stdcall GetProtocol()
{
return new FTNoIR_Protocol_FTIR;
}
@@ -551,7 +551,7 @@ void FTIRControls::save() { // _GetProtocolDialog@0 - Common name decoration for __stdcall functions in C language.
#pragma comment(linker, "/export:GetProtocolDialog=_GetProtocolDialog@0")
-FTNOIR_PROTOCOL_BASE_EXPORT PROTOCOLDIALOGHANDLE __stdcall GetProtocolDialog( )
+FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialogPtr __stdcall GetProtocolDialog( )
{
return new FTIRControls;
}
diff --git a/FTNoIR_Protocol_FTN/FTNoIR_Protocol_FTN.cpp b/FTNoIR_Protocol_FTN/FTNoIR_Protocol_FTN.cpp index 9326c544..877d4aeb 100644 --- a/FTNoIR_Protocol_FTN/FTNoIR_Protocol_FTN.cpp +++ b/FTNoIR_Protocol_FTN/FTNoIR_Protocol_FTN.cpp @@ -194,7 +194,7 @@ void FTNoIR_Protocol_FTN::getNameFromGame( char *dest ) // _GetProtocol@0 - Common name decoration for __stdcall functions in C language.
#pragma comment(linker, "/export:GetProtocol=_GetProtocol@0")
-FTNOIR_PROTOCOL_BASE_EXPORT PROTOCOLHANDLE __stdcall GetProtocol()
+FTNOIR_PROTOCOL_BASE_EXPORT IProtocolPtr __stdcall GetProtocol()
{
return new FTNoIR_Protocol_FTN;
}
@@ -352,7 +352,7 @@ void FTNControls::save() { // _GetProtocolDialog@0 - Common name decoration for __stdcall functions in C language.
#pragma comment(linker, "/export:GetProtocolDialog=_GetProtocolDialog@0")
-FTNOIR_PROTOCOL_BASE_EXPORT PROTOCOLDIALOGHANDLE __stdcall GetProtocolDialog( )
+FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialogPtr __stdcall GetProtocolDialog( )
{
return new FTNControls;
}
diff --git a/FTNoIR_Protocol_MOUSE/FTNoIR_Protocol_MOUSE.cpp b/FTNoIR_Protocol_MOUSE/FTNoIR_Protocol_MOUSE.cpp index 60ad4eaa..98371eef 100644 --- a/FTNoIR_Protocol_MOUSE/FTNoIR_Protocol_MOUSE.cpp +++ b/FTNoIR_Protocol_MOUSE/FTNoIR_Protocol_MOUSE.cpp @@ -288,7 +288,7 @@ void FTNoIR_Protocol_MOUSE::getNameFromGame( char *dest ) // _GetProtocol@0 - Common name decoration for __stdcall functions in C language.
#pragma comment(linker, "/export:GetProtocol=_GetProtocol@0")
-FTNOIR_PROTOCOL_BASE_EXPORT PROTOCOLHANDLE __stdcall GetProtocol()
+FTNOIR_PROTOCOL_BASE_EXPORT IProtocolPtr __stdcall GetProtocol()
{
return new FTNoIR_Protocol_MOUSE;
}
@@ -487,7 +487,7 @@ void MOUSEControls::save() { // _GetProtocolDialog@0 - Common name decoration for __stdcall functions in C language.
#pragma comment(linker, "/export:GetProtocolDialog=_GetProtocolDialog@0")
-FTNOIR_PROTOCOL_BASE_EXPORT PROTOCOLDIALOGHANDLE __stdcall GetProtocolDialog( )
+FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialogPtr __stdcall GetProtocolDialog( )
{
return new MOUSEControls;
}
diff --git a/FTNoIR_Protocol_PPJOY/FTNoIR_Protocol_PPJOY.cpp b/FTNoIR_Protocol_PPJOY/FTNoIR_Protocol_PPJOY.cpp index 8a092d2e..bfecfeb3 100644 --- a/FTNoIR_Protocol_PPJOY/FTNoIR_Protocol_PPJOY.cpp +++ b/FTNoIR_Protocol_PPJOY/FTNoIR_Protocol_PPJOY.cpp @@ -213,7 +213,7 @@ void FTNoIR_Protocol_PPJOY::getNameFromGame( char *dest ) // _GetProtocol@0 - Common name decoration for __stdcall functions in C language.
#pragma comment(linker, "/export:GetProtocol=_GetProtocol@0")
-FTNOIR_PROTOCOL_BASE_EXPORT PROTOCOLHANDLE __stdcall GetProtocol()
+FTNOIR_PROTOCOL_BASE_EXPORT IProtocolPtr __stdcall GetProtocol()
{
return new FTNoIR_Protocol_PPJOY;
}
@@ -367,7 +367,7 @@ void PPJOYControls::virtualJoystickSelected( int index ) // _GetProtocolDialog@0 - Common name decoration for __stdcall functions in C language.
#pragma comment(linker, "/export:GetProtocolDialog=_GetProtocolDialog@0")
-FTNOIR_PROTOCOL_BASE_EXPORT PROTOCOLDIALOGHANDLE __stdcall GetProtocolDialog( )
+FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialogPtr __stdcall GetProtocolDialog( )
{
return new PPJOYControls;
}
diff --git a/FTNoIR_Protocol_SC/FTNoIR_Protocol_SC.cpp b/FTNoIR_Protocol_SC/FTNoIR_Protocol_SC.cpp index 3b2e982b..1c3290c6 100644 --- a/FTNoIR_Protocol_SC/FTNoIR_Protocol_SC.cpp +++ b/FTNoIR_Protocol_SC/FTNoIR_Protocol_SC.cpp @@ -381,7 +381,7 @@ void FTNoIR_Protocol_SC::getNameFromGame( char *dest ) // _GetProtocol@0 - Common name decoration for __stdcall functions in C language.
#pragma comment(linker, "/export:GetProtocol=_GetProtocol@0")
-FTNOIR_PROTOCOL_BASE_EXPORT PROTOCOLHANDLE __stdcall GetProtocol()
+FTNOIR_PROTOCOL_BASE_EXPORT IProtocolPtr __stdcall GetProtocol()
{
return new FTNoIR_Protocol_SC;
}
@@ -506,7 +506,7 @@ void SCControls::save() { // _GetProtocolDialog@0 - Common name decoration for __stdcall functions in C language.
#pragma comment(linker, "/export:GetProtocolDialog=_GetProtocolDialog@0")
-FTNOIR_PROTOCOL_BASE_EXPORT PROTOCOLDIALOGHANDLE __stdcall GetProtocolDialog( )
+FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialogPtr __stdcall GetProtocolDialog( )
{
return new SCControls;
}
diff --git a/FTNoIR_Tracker_Base/ftnoir_tracker_base.h b/FTNoIR_Tracker_Base/ftnoir_tracker_base.h index 0fd01280..396df4d1 100644 --- a/FTNoIR_Tracker_Base/ftnoir_tracker_base.h +++ b/FTNoIR_Tracker_Base/ftnoir_tracker_base.h @@ -24,6 +24,7 @@ *********************************************************************************/
/*
Modifications (last one on top):
+ 20122109 - C14: Replaced Release with virtual destructor
20120009 - WVR: Removed AutoClosePtr (seemed like it didn't work OK)
20110415 - WVR: Added overloaded operator - and -=
*/
@@ -35,6 +36,14 @@ #include <QtGui/QWidget>
#include <QtGui/QFrame>
+////////////////////////////////////////////////////////////////////////////////
+#ifdef __cplusplus
+# define EXTERN_C extern "C"
+#else
+# define EXTERN_C
+#endif // __cplusplus
+
+////////////////////////////////////////////////////////////////////////////////
// COM-Like abstract interface.
// This interface doesn't require __declspec(dllexport/dllimport) specifier.
// Method calls are dispatched via virtual table.
@@ -42,8 +51,7 @@ // Instances are obtained via factory function.
struct ITracker
{
- virtual ~ITracker() {};
-// virtual void Release() = 0; // Member required to enable Auto-remove
+ virtual ~ITracker() {}
virtual void Initialize( QFrame *videoframe ) = 0;
virtual void StartTracker( HWND parent_window ) = 0;
virtual void StopTracker(bool exit) = 0;
@@ -58,26 +66,16 @@ struct ITracker }
};
-// Handle type. In C++ language the interface type is used.
-typedef ITracker* TRACKERHANDLE;
-
-////////////////////////////////////////////////////////////////////////////////
-//
-#ifdef __cplusplus
-# define EXTERN_C extern "C"
-#else
-# define EXTERN_C
-#endif // __cplusplus
+typedef ITracker* ITrackerPtr;
// Factory function that creates instances of the Tracker object.
EXTERN_C
FTNOIR_TRACKER_BASE_EXPORT
-TRACKERHANDLE
+ITrackerPtr
__stdcall
-GetTracker(
- void);
-
+GetTracker(void);
+////////////////////////////////////////////////////////////////////////////////
// COM-Like abstract interface.
// This interface doesn't require __declspec(dllexport/dllimport) specifier.
// Method calls are dispatched via virtual table.
@@ -85,21 +83,22 @@ GetTracker( // Instances are obtained via factory function.
struct ITrackerDialog
{
+ virtual ~ITrackerDialog() {}
virtual void Initialize(QWidget *parent) = 0;
virtual void registerTracker(ITracker *tracker) = 0;
virtual void unRegisterTracker() = 0;
};
-// Handle type. In C++ language the iterface type is used.
-typedef ITrackerDialog* TRACKERDIALOGHANDLE;
+typedef ITrackerDialog* ITrackerDialogPtr;
// Factory function that creates instances of the Tracker object.
EXTERN_C
FTNOIR_TRACKER_BASE_EXPORT
-TRACKERDIALOGHANDLE
+ITrackerDialogPtr
__stdcall
GetTrackerDialog(void);
+////////////////////////////////////////////////////////////////////////////////
// COM-Like abstract interface.
// This interface doesn't require __declspec(dllexport/dllimport) specifier.
// Method calls are dispatched via virtual table.
@@ -107,7 +106,7 @@ GetTrackerDialog(void); // Instances are obtained via factory function.
struct ITrackerDll
{
-// virtual void Release() = 0; // Member required to enable Auto-remove
+ virtual ~ITrackerDll() {}
virtual void Initialize() = 0;
virtual void getFullName(QString *strToBeFilled) = 0;
@@ -116,13 +115,12 @@ struct ITrackerDll virtual void getIcon(QIcon *icon) = 0;
};
-// Handle type. In C++ language the interface type is used.
-typedef ITrackerDll* TRACKERDLLHANDLE;
+typedef ITrackerDll* ITrackerDllPtr;
// Factory function that creates instances of the Tracker object.
EXTERN_C
FTNOIR_TRACKER_BASE_EXPORT
-TRACKERDLLHANDLE
+ITrackerDllPtr
__stdcall
GetTrackerDll(void);
diff --git a/FTNoIR_Tracker_FD/ftnoir_tracker_facedetect.cpp b/FTNoIR_Tracker_FD/ftnoir_tracker_facedetect.cpp index 1602db85..620fb9fd 100644 --- a/FTNoIR_Tracker_FD/ftnoir_tracker_facedetect.cpp +++ b/FTNoIR_Tracker_FD/ftnoir_tracker_facedetect.cpp @@ -208,7 +208,7 @@ void FTNoIR_Tracker::loadSettings() { // _GetTracker@0 - Common name decoration for __stdcall functions in C language.
#pragma comment(linker, "/export:GetTracker=_GetTracker@0")
-FTNOIR_TRACKER_BASE_EXPORT TRACKERHANDLE __stdcall GetTracker()
+FTNOIR_TRACKER_BASE_EXPORT ITrackerPtr __stdcall GetTracker()
{
return new FTNoIR_Tracker;
}
diff --git a/FTNoIR_Tracker_FD/ftnoir_tracker_facedetect_dialog.cpp b/FTNoIR_Tracker_FD/ftnoir_tracker_facedetect_dialog.cpp index 3c080898..71b19242 100644 --- a/FTNoIR_Tracker_FD/ftnoir_tracker_facedetect_dialog.cpp +++ b/FTNoIR_Tracker_FD/ftnoir_tracker_facedetect_dialog.cpp @@ -174,7 +174,7 @@ void TrackerControls::doCancel() { // _GetTrackerDialog@0 - Common name decoration for __stdcall functions in C language.
#pragma comment(linker, "/export:GetTrackerDialog=_GetTrackerDialog@0")
-FTNOIR_TRACKER_BASE_EXPORT TRACKERDIALOGHANDLE __stdcall GetTrackerDialog( )
+FTNOIR_TRACKER_BASE_EXPORT ITrackerDialogPtr __stdcall GetTrackerDialog( )
{
return new TrackerControls;
}
diff --git a/FTNoIR_Tracker_FD/ftnoir_tracker_facedetect_dll.cpp b/FTNoIR_Tracker_FD/ftnoir_tracker_facedetect_dll.cpp index 6bfa1284..8e010e3e 100644 --- a/FTNoIR_Tracker_FD/ftnoir_tracker_facedetect_dll.cpp +++ b/FTNoIR_Tracker_FD/ftnoir_tracker_facedetect_dll.cpp @@ -79,7 +79,7 @@ void FTNoIR_TrackerDll::getIcon(QIcon *icon) // _GetTrackerDll@0 - Common name decoration for __stdcall functions in C language.
#pragma comment(linker, "/export:GetTrackerDll=_GetTrackerDll@0")
-FTNOIR_TRACKER_BASE_EXPORT TRACKERDLLHANDLE __stdcall GetTrackerDll()
+FTNOIR_TRACKER_BASE_EXPORT ITrackerDllPtr __stdcall GetTrackerDll()
{
return new FTNoIR_TrackerDll;
}
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp index 6301ddd0..f6682c58 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp @@ -198,7 +198,7 @@ void Tracker::CenterTracker() //-----------------------------------------------------------------------------
#pragma comment(linker, "/export:GetTracker=_GetTracker@0")
-FTNOIR_TRACKER_BASE_EXPORT TRACKERHANDLE __stdcall GetTracker()
+FTNOIR_TRACKER_BASE_EXPORT ITrackerPtr __stdcall GetTracker()
{
return new Tracker;
}
\ No newline at end of file diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp index e13ed94a..a76a33d9 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp @@ -14,6 +14,8 @@ TrackerDialog::TrackerDialog()
: settings_dirty(false), tracker(NULL), timer(this), trans_calib_running(false)
{
+ setAttribute(Qt::WA_DeleteOnClose, false);
+
ui.setupUi( this );
settings.load_ini();
@@ -68,6 +70,11 @@ TrackerDialog::TrackerDialog() timer.start(100);
}
+TrackerDialog::~TrackerDialog()
+{
+ qDebug()<<"TrackerDialog::~TrackerDialog";
+}
+
void TrackerDialog::startstop_trans_calib(bool start)
{
if (start)
@@ -93,7 +100,7 @@ void TrackerDialog::trans_calib_step() tracker->get_pose(&X_CM);
trans_calib.update(X_CM.R, X_CM.t);
cv::Vec3f t_MH = trans_calib.get_estimate();
- qDebug()<<"TrackerDialog:: current translation estimate: "<<t_MH[0]<<t_MH[1]<<t_MH[2];
+ //qDebug()<<"TrackerDialog:: current translation estimate: "<<t_MH[0]<<t_MH[1]<<t_MH[2];
ui.tx_spin->setValue(t_MH[0]);
ui.ty_spin->setValue(t_MH[1]);
ui.tz_spin->setValue(t_MH[2]);
@@ -209,7 +216,7 @@ void TrackerDialog::unRegisterTracker() //-----------------------------------------------------------------------------
#pragma comment(linker, "/export:GetTrackerDialog=_GetTrackerDialog@0")
-FTNOIR_TRACKER_BASE_EXPORT TRACKERDIALOGHANDLE __stdcall GetTrackerDialog( )
+FTNOIR_TRACKER_BASE_EXPORT ITrackerDialogPtr __stdcall GetTrackerDialog( )
{
return new TrackerDialog;
}
\ No newline at end of file diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h index 09bbb839..81f6fc83 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h @@ -22,6 +22,7 @@ class TrackerDialog : public QWidget, Ui::UICPTClientControls, public ITrackerDi Q_OBJECT
public:
TrackerDialog();
+ ~TrackerDialog();
// ITrackerDialog interface
void Initialize(QWidget *parent);
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.cpp b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.cpp index a9df65ac..3210a027 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.cpp +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.cpp @@ -34,7 +34,7 @@ void TrackerDll::getIcon(QIcon *icon) //-----------------------------------------------------------------------------
#pragma comment(linker, "/export:GetTrackerDll=_GetTrackerDll@0")
-FTNOIR_TRACKER_BASE_EXPORT TRACKERDLLHANDLE __stdcall GetTrackerDll()
+FTNOIR_TRACKER_BASE_EXPORT ITrackerDllPtr __stdcall GetTrackerDll()
{
return new TrackerDll;
}
diff --git a/FTNoIR_Tracker_PT/point_extractor.cpp b/FTNoIR_Tracker_PT/point_extractor.cpp index a415f24e..b26f7068 100644 --- a/FTNoIR_Tracker_PT/point_extractor.cpp +++ b/FTNoIR_Tracker_PT/point_extractor.cpp @@ -66,44 +66,44 @@ const vector<Vec2f>& PointExtractor::extract_points(Mat frame, float dt, bool dr }
//*/
- // Method 2: floodfill - /* - // extract blobs - struct BlobInfo - { - BlobInfo() : m00(0), m10(0), m01(0) {} - long m00; - long m10; - long m01; - }; - vector<BlobInfo> blobs; - int blob_count = 1; - - for (int y=0; y < frame_bw.rows; y++) { - for (int x=0; x < frame_bw.cols; x++) { - if (frame_bw.at<unsigned char>(y,x) != 255) continue; - Rect rect; - floodFill(frame_bw, Point(x,y), Scalar(blob_count), &rect, Scalar(0), Scalar(0), 4); - BlobInfo blob; - for (int i=rect.y; i < (rect.y+rect.height); i++) { - for (int j=rect.x; j < (rect.x+rect.width); j++) { - if (frame_bw.at<unsigned char>(i,j) != blob_count) continue; - blob.m00++; - blob.m01+=i; - blob.m10+=j; - } - } - blobs.push_back(blob); - blob_count++; - if (blob_count >= 255) break; - } - } - - // extract points - Vec2f c; - points.clear(); - float m00_min = 3.14*min_size*min_size; - float m00_max = 3.14*max_size*max_size; + // Method 2: floodfill
+ /*
+ // extract blobs
+ struct BlobInfo
+ {
+ BlobInfo() : m00(0), m10(0), m01(0) {}
+ long m00;
+ long m10;
+ long m01;
+ };
+ vector<BlobInfo> blobs;
+ int blob_count = 1;
+
+ for (int y=0; y < frame_bw.rows; y++) {
+ for (int x=0; x < frame_bw.cols; x++) {
+ if (frame_bw.at<unsigned char>(y,x) != 255) continue;
+ Rect rect;
+ floodFill(frame_bw, Point(x,y), Scalar(blob_count), &rect, Scalar(0), Scalar(0), 4);
+ BlobInfo blob;
+ for (int i=rect.y; i < (rect.y+rect.height); i++) {
+ for (int j=rect.x; j < (rect.x+rect.width); j++) {
+ if (frame_bw.at<unsigned char>(i,j) != blob_count) continue;
+ blob.m00++;
+ blob.m01+=i;
+ blob.m10+=j;
+ }
+ }
+ blobs.push_back(blob);
+ blob_count++;
+ if (blob_count >= 255) break;
+ }
+ }
+
+ // extract points
+ Vec2f c;
+ points.clear();
+ float m00_min = 3.14*min_size*min_size;
+ float m00_max = 3.14*max_size*max_size;
for (vector<BlobInfo>::iterator iter = blobs.begin();
iter!= blobs.end();
++iter)
@@ -114,8 +114,8 @@ const vector<Vec2f>& PointExtractor::extract_points(Mat frame, float dt, bool dr c[0] = (m.m10/float(m.m00) - frame.cols/2)/frame.cols;
c[1] = -(m.m01/float(m.m00) - frame.rows/2)/frame.cols;
points.push_back(c);
- } - */ + }
+ */
// draw output image
if (draw_output)
diff --git a/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi.cpp b/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi.cpp index 75c63b74..52fff404 100644 --- a/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi.cpp +++ b/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi.cpp @@ -214,7 +214,7 @@ bool FTNoIR_Tracker::SMCreateMapping() // _GetTracker@0 - Common name decoration for __stdcall functions in C language.
#pragma comment(linker, "/export:GetTracker=_GetTracker@0")
-FTNOIR_TRACKER_BASE_EXPORT TRACKERHANDLE __stdcall GetTracker()
+FTNOIR_TRACKER_BASE_EXPORT ITrackerPtr __stdcall GetTracker()
{
return new FTNoIR_Tracker;
}
diff --git a/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi_dialog.cpp b/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi_dialog.cpp index 87c01b9c..ab2ff262 100644 --- a/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi_dialog.cpp +++ b/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi_dialog.cpp @@ -304,7 +304,7 @@ void TrackerControls::doCommand(int command, int value) // _GetTrackerDialog@0 - Common name decoration for __stdcall functions in C language.
#pragma comment(linker, "/export:GetTrackerDialog=_GetTrackerDialog@0")
-FTNOIR_TRACKER_BASE_EXPORT TRACKERDIALOGHANDLE __stdcall GetTrackerDialog( )
+FTNOIR_TRACKER_BASE_EXPORT ITrackerDialogPtr __stdcall GetTrackerDialog( )
{
return new TrackerControls;
}
diff --git a/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi_dll.cpp b/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi_dll.cpp index 0b77142b..5f01568f 100644 --- a/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi_dll.cpp +++ b/FTNoIR_Tracker_SM/ftnoir_tracker_faceapi_dll.cpp @@ -79,7 +79,7 @@ void FTNoIR_TrackerDll::getIcon(QIcon *icon) // _GetTrackerDll@0 - Common name decoration for __stdcall functions in C language.
#pragma comment(linker, "/export:GetTrackerDll=_GetTrackerDll@0")
-FTNOIR_TRACKER_BASE_EXPORT TRACKERDLLHANDLE __stdcall GetTrackerDll()
+FTNOIR_TRACKER_BASE_EXPORT ITrackerDllPtr __stdcall GetTrackerDll()
{
return new FTNoIR_TrackerDll;
}
diff --git a/FTNoIR_Tracker_UDP/ftnoir_tracker_udp.cpp b/FTNoIR_Tracker_UDP/ftnoir_tracker_udp.cpp index 4d367013..5229ff06 100644 --- a/FTNoIR_Tracker_UDP/ftnoir_tracker_udp.cpp +++ b/FTNoIR_Tracker_UDP/ftnoir_tracker_udp.cpp @@ -196,7 +196,7 @@ void FTNoIR_Tracker::loadSettings() { // _GetTracker@0 - Common name decoration for __stdcall functions in C language.
#pragma comment(linker, "/export:GetTracker=_GetTracker@0")
-FTNOIR_TRACKER_BASE_EXPORT TRACKERHANDLE __stdcall GetTracker()
+FTNOIR_TRACKER_BASE_EXPORT ITrackerPtr __stdcall GetTracker()
{
return new FTNoIR_Tracker;
}
diff --git a/FTNoIR_Tracker_UDP/ftnoir_tracker_udp_dialog.cpp b/FTNoIR_Tracker_UDP/ftnoir_tracker_udp_dialog.cpp index 48e61ba4..c5bee64f 100644 --- a/FTNoIR_Tracker_UDP/ftnoir_tracker_udp_dialog.cpp +++ b/FTNoIR_Tracker_UDP/ftnoir_tracker_udp_dialog.cpp @@ -169,7 +169,7 @@ void TrackerControls::save() { // _GetTrackerDialog@0 - Common name decoration for __stdcall functions in C language.
#pragma comment(linker, "/export:GetTrackerDialog=_GetTrackerDialog@0")
-FTNOIR_TRACKER_BASE_EXPORT TRACKERDIALOGHANDLE __stdcall GetTrackerDialog( )
+FTNOIR_TRACKER_BASE_EXPORT ITrackerDialogPtr __stdcall GetTrackerDialog( )
{
return new TrackerControls;
}
diff --git a/FTNoIR_Tracker_UDP/ftnoir_tracker_udp_dll.cpp b/FTNoIR_Tracker_UDP/ftnoir_tracker_udp_dll.cpp index be81ac80..a086a888 100644 --- a/FTNoIR_Tracker_UDP/ftnoir_tracker_udp_dll.cpp +++ b/FTNoIR_Tracker_UDP/ftnoir_tracker_udp_dll.cpp @@ -79,7 +79,7 @@ void FTNoIR_TrackerDll::getIcon(QIcon *icon) // _GetTrackerDll@0 - Common name decoration for __stdcall functions in C language.
#pragma comment(linker, "/export:GetTrackerDll=_GetTrackerDll@0")
-FTNOIR_TRACKER_BASE_EXPORT TRACKERDLLHANDLE __stdcall GetTrackerDll()
+FTNOIR_TRACKER_BASE_EXPORT ITrackerDllPtr __stdcall GetTrackerDll()
{
return new FTNoIR_TrackerDll;
}
diff --git a/FaceTrackNoIR/FaceTrackNoIR.cpp b/FaceTrackNoIR/FaceTrackNoIR.cpp index d6fa5ce4..00e3a87c 100644 --- a/FaceTrackNoIR/FaceTrackNoIR.cpp +++ b/FaceTrackNoIR/FaceTrackNoIR.cpp @@ -50,7 +50,10 @@ // Setup the Main Dialog
//
FaceTrackNoIR::FaceTrackNoIR(QWidget *parent, Qt::WFlags flags) :
-QMainWindow(parent, flags)
+QMainWindow(parent, flags),
+pTrackerDialog(NULL),
+pProtocolDialog(NULL),
+pFilterDialog(NULL)
{
cameraDetected = false;
@@ -63,7 +66,6 @@ QMainWindow(parent, flags) _curve_config = 0;
tracker = 0;
- pTrackerDialog = NULL;
// _display = 0;
l = 0;
trayIcon = 0;
@@ -995,7 +997,7 @@ QString libName; // Delete the existing QDialog
//
if (pProtocolDialog) {
- pProtocolDialog.Release();
+ delete pProtocolDialog;
}
// Show the appropriate Protocol-server Settings
@@ -1050,7 +1052,8 @@ QString libName; // Delete the existing QDialog
//
if (pFilterDialog) {
- pFilterDialog.Release();
+ delete pFilterDialog;
+ pFilterDialog = NULL;
}
// Show the appropriate Protocol-server Settings
@@ -1174,7 +1177,8 @@ ITrackerDll *pTrackerDll; // Pointer to Filter info instance (in DLL) // Delete the existing QDialog
//
if (pProtocolDialog) {
- pProtocolDialog.Release();
+ delete pProtocolDialog;
+ pProtocolDialog = NULL;
}
// Show the appropriate Protocol-server Settings
diff --git a/FaceTrackNoIR/FaceTrackNoIR.h b/FaceTrackNoIR/FaceTrackNoIR.h index d2b9cdde..e3cf798e 100644 --- a/FaceTrackNoIR/FaceTrackNoIR.h +++ b/FaceTrackNoIR/FaceTrackNoIR.h @@ -42,26 +42,16 @@ #include "ui_FTNoIR_Preferences.h"
#include "ui_FTNoIR_Curves.h"
-//
#include "..\ftnoir_protocol_base\FTNoIR_Protocol_base.h"
#include "..\ftnoir_tracker_base\FTNoIR_Tracker_base.h"
#include "..\ftnoir_filter_base\FTNoIR_Filter_base.h"
-#include "AutoClosePtr.h"
-// 1a. COM-Like usage with smart pointer.
-// No need to call `ITracker::Release'; the instance will
-// be released automatically in destructor of the smart pointer.
-//typedef AutoClosePtr<ITrackerDialog, void, &ITrackerDialog::Release> ITrackerDialogPtr;
-typedef ITrackerDialog *(WINAPI *importGetTrackerDialog)(void);
-typedef ITrackerDll *(WINAPI *importGetTrackerDll)(void);
-
-typedef AutoClosePtr<IProtocolDialog, void, &IProtocolDialog::Release> IProtocolDialogPtr;
-typedef IProtocolDialog *(WINAPI *importGetProtocolDialog)(void);
-typedef AutoClosePtr<IFilterDialog, void, &IFilterDialog::Release> IFilterDialogPtr;
-typedef IFilterDialog *(WINAPI *importGetFilterDialog)(void);
-
-typedef AutoClosePtr<IFilterDll, void, &IFilterDll::Release> IFilterDllPtr;
-typedef IFilterDll *(WINAPI *importGetFilterDll)(void);
+typedef ITrackerDialogPtr (WINAPI *importGetTrackerDialog)(void);
+typedef ITrackerDllPtr (WINAPI *importGetTrackerDll)(void);
+typedef IProtocolDialogPtr (WINAPI *importGetProtocolDialog)(void);
+//typedef IProtocolDllPtr (WINAPI *importGetProtocolDll)(void);
+typedef IFilterDialogPtr (WINAPI *importGetFilterDialog)(void);
+typedef IFilterDllPtr (WINAPI *importGetFilterDll)(void);
#include <Dshow.h>
@@ -93,7 +83,7 @@ private: QStringList filterFileList; // List of Filter-DLL-files, that are present in the program-folder
QStringList trackerFileList; // List of Tracker-DLL-files, that are present in the program-folder
- ITrackerDialog *pTrackerDialog; // Pointer to Tracker dialog instance (in DLL)
+ ITrackerDialogPtr pTrackerDialog; // Pointer to Tracker dialog instance (in DLL)
IProtocolDialogPtr pProtocolDialog; // Pointer to Protocol dialog instance (in DLL)
IFilterDialogPtr pFilterDialog; // Pointer to Filter dialog instance (in DLL)
diff --git a/FaceTrackNoIR/FaceTrackNoIR_vc9.vcproj b/FaceTrackNoIR/FaceTrackNoIR_vc9.vcproj index 1d27b1e8..d7540dce 100644 --- a/FaceTrackNoIR/FaceTrackNoIR_vc9.vcproj +++ b/FaceTrackNoIR/FaceTrackNoIR_vc9.vcproj @@ -191,10 +191,6 @@ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
- RelativePath=".\AutoClosePtr.h"
- >
- </File>
- <File
RelativePath=".\ExcelServer.cpp"
>
</File>
@@ -310,8 +306,8 @@ >
<Tool
Name="VCCustomBuildTool"
- Description="Moc'ing $(InputFileName)..."
- CommandLine=""$(QTDIR)\bin\moc.exe" -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_THREAD_SUPPORT -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_NETWORK_LIB -DQT_DLL -I".\GeneratedFiles\." -I"$(QTDIR)\include\." -I".\GeneratedFiles\$(ConfigurationName)\." -I"$(QTDIR)\include\QtCore\." -I"$(QTDIR)\include\QtNetwork\." -I"$(QTDIR)\include\QtGui\." -I"$(QTDIR)\include\QtOpenGL\." -I"$(QTDIR)\include\QtWebKit\." -I"$(QTDIR)\include\QtTest\." -I"$(SolutionDir)\FTNoIR_Tracker_UDP\." -I"$(SolutionDir)\FTNoIR_Tracker_UDP\GeneratedFiles\." -I"$(SolutionDir)\FTNoIR_Filter_EWMA2\." -I"C:\Program Files (x86)\Microsoft DirectX SDK (February 2010)\Include\." ".\FTNoIR_cxx_protocolserver.h" -o ".\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp"
"
+ Description="Moc'ing FTNoIR_cxx_protocolserver.h..."
+ CommandLine=""$(QTDIR)\bin\moc.exe" "$(InputPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp" -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_THREAD_SUPPORT -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_NETWORK_LIB -DQT_DLL "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtNetwork" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWebKit" "-I$(QTDIR)\include\QtTest" "-I$(SolutionDir)\QFunctionConfigurator\QFunctionConfigurator" "-I$(DXSDK_DIR)\Include"
"
AdditionalDependencies=""$(QTDIR)\bin\moc.exe";$(InputPath)"
Outputs="".\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp""
/>
@@ -321,8 +317,8 @@ >
<Tool
Name="VCCustomBuildTool"
- Description="Moc'ing $(InputFileName)..."
- CommandLine=""$(QTDIR)\bin\moc.exe" "$(InputPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp" -DQT_CORE_LIB -DQT_DLL -DQT_GUI_LIB -DQT_LARGEFILE_SUPPORT -DQT_OPENGL_LIB -DQT_THREAD_SUPPORT -DUNICODE -DWIN32 -I"$(QTDIR)\include\." -I"$(QTDIR)\include\QtCore\." -I"$(QTDIR)\include\QtGui\." -I"$(QTDIR)\include\QtNetwork\." -I"$(QTDIR)\include\QtOpenGL\." -I"$(QTDIR)\include\QtTest\." -I"$(QTDIR)\include\QtWebKit\." -I".\." -I".\GeneratedFiles\$(ConfigurationName)\." -I".\GeneratedFiles\."
"
+ Description="Moc'ing FTNoIR_cxx_protocolserver.h..."
+ CommandLine=""$(QTDIR)\bin\moc.exe" "$(InputPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp" -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_THREAD_SUPPORT -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_DLL "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtNetwork" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWebKit" "-I$(QTDIR)\include\QtTest" "-I$(SolutionDir)\QFunctionConfigurator\QFunctionConfigurator" "-I$(DXSDK_DIR)\Include"
"
AdditionalDependencies=""$(QTDIR)\bin\moc.exe";$(InputPath)"
Outputs="".\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp""
/>
diff --git a/FaceTrackNoIR/tracker.h b/FaceTrackNoIR/tracker.h index d7c0506e..fd5c1d61 100644 --- a/FaceTrackNoIR/tracker.h +++ b/FaceTrackNoIR/tracker.h @@ -46,16 +46,10 @@ #include "..\ftnoir_tracker_base\FTNoIR_Tracker_base.h"
#include "..\ftnoir_protocol_base\FTNoIR_Protocol_base.h"
#include "..\ftnoir_filter_base\FTNoIR_Filter_base.h"
-//#include "AutoClosePtr.h"
-
-// 1a. COM-Like usage with smart pointer.
-// No need to call `ITracker::Release'; the instance will
-// be released automatically in destructor of the smart pointer.
-//typedef AutoClosePtr<ITracker, void, &ITracker::Release> ITrackerPtr;
-typedef ITracker *(WINAPI *importGetTracker)(void);
-typedef AutoClosePtr<IProtocol, void, &IProtocol::Release> IProtocolPtr;
-typedef IProtocol *(WINAPI *importGetProtocol)(void);
+typedef ITrackerPtr (WINAPI *importGetTracker)(void);
+typedef IProtocolPtr (WINAPI *importGetProtocol)(void);
+typedef IFilterPtr (WINAPI *importGetFilter)(void);
// include the DirectX Library files
#pragma comment (lib, "dinput8.lib")
@@ -179,7 +173,7 @@ private: static T6DOF new_camera;
static T6DOF output_camera;
- ITracker *pTracker; // Pointer to Tracker instance (in DLL)
+ ITrackerPtr pTracker; // Pointer to Tracker instance (in DLL)
static IProtocolPtr pProtocol; // Pointer to Protocol instance (in DLL)
static IFilterPtr pFilter; // Pointer to Filter instance (in DLL)
|