summaryrefslogtreecommitdiffhomepage
path: root/FaceTrackNoIR
diff options
context:
space:
mode:
authorPatrick Ruoff <c14-radioactive@19e81ba0-9b1a-49c3-bd6c-561e1906d5fb>2012-09-21 14:00:34 +0000
committerPatrick Ruoff <c14-radioactive@19e81ba0-9b1a-49c3-bd6c-561e1906d5fb>2012-09-21 14:00:34 +0000
commitab0d60becc2d1b89c812193c179892d6acd4912f (patch)
tree2dae7d2c10e1cc3a5bd73ee8ae2ee609c69a1b7b /FaceTrackNoIR
parentddc63cdda186fe31435fde839c3d5b68040a0d0f (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
Diffstat (limited to 'FaceTrackNoIR')
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.cpp14
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.h24
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR_vc9.vcproj12
-rw-r--r--FaceTrackNoIR/tracker.h14
4 files changed, 24 insertions, 40 deletions
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&apos;ing $(InputFileName)..."
- CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; -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&quot;.\GeneratedFiles\.&quot; -I&quot;$(QTDIR)\include\.&quot; -I&quot;.\GeneratedFiles\$(ConfigurationName)\.&quot; -I&quot;$(QTDIR)\include\QtCore\.&quot; -I&quot;$(QTDIR)\include\QtNetwork\.&quot; -I&quot;$(QTDIR)\include\QtGui\.&quot; -I&quot;$(QTDIR)\include\QtOpenGL\.&quot; -I&quot;$(QTDIR)\include\QtWebKit\.&quot; -I&quot;$(QTDIR)\include\QtTest\.&quot; -I&quot;$(SolutionDir)\FTNoIR_Tracker_UDP\.&quot; -I&quot;$(SolutionDir)\FTNoIR_Tracker_UDP\GeneratedFiles\.&quot; -I&quot;$(SolutionDir)\FTNoIR_Filter_EWMA2\.&quot; -I&quot;C:\Program Files (x86)\Microsoft DirectX SDK (February 2010)\Include\.&quot; &quot;.\FTNoIR_cxx_protocolserver.h&quot; -o &quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot;&#x0D;&#x0A;"
+ Description="Moc&apos;ing FTNoIR_cxx_protocolserver.h..."
+ CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; &quot;$(InputPath)&quot; -o &quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot; -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 &quot;-I.\GeneratedFiles&quot; &quot;-I.\GeneratedFiles\$(ConfigurationName)\.&quot; &quot;-I$(QTDIR)\include&quot; &quot;-I$(QTDIR)\include\QtCore&quot; &quot;-I$(QTDIR)\include\QtNetwork&quot; &quot;-I$(QTDIR)\include\QtGui&quot; &quot;-I$(QTDIR)\include\QtOpenGL&quot; &quot;-I$(QTDIR)\include\QtWebKit&quot; &quot;-I$(QTDIR)\include\QtTest&quot; &quot;-I$(SolutionDir)\QFunctionConfigurator\QFunctionConfigurator&quot; &quot;-I$(DXSDK_DIR)\Include&quot;&#x0D;&#x0A;"
AdditionalDependencies="&quot;$(QTDIR)\bin\moc.exe&quot;;$(InputPath)"
Outputs="&quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot;"
/>
@@ -321,8 +317,8 @@
>
<Tool
Name="VCCustomBuildTool"
- Description="Moc&apos;ing $(InputFileName)..."
- CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; &quot;$(InputPath)&quot; -o &quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot; -DQT_CORE_LIB -DQT_DLL -DQT_GUI_LIB -DQT_LARGEFILE_SUPPORT -DQT_OPENGL_LIB -DQT_THREAD_SUPPORT -DUNICODE -DWIN32 -I&quot;$(QTDIR)\include\.&quot; -I&quot;$(QTDIR)\include\QtCore\.&quot; -I&quot;$(QTDIR)\include\QtGui\.&quot; -I&quot;$(QTDIR)\include\QtNetwork\.&quot; -I&quot;$(QTDIR)\include\QtOpenGL\.&quot; -I&quot;$(QTDIR)\include\QtTest\.&quot; -I&quot;$(QTDIR)\include\QtWebKit\.&quot; -I&quot;.\.&quot; -I&quot;.\GeneratedFiles\$(ConfigurationName)\.&quot; -I&quot;.\GeneratedFiles\.&quot;&#x0D;&#x0A;"
+ Description="Moc&apos;ing FTNoIR_cxx_protocolserver.h..."
+ CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; &quot;$(InputPath)&quot; -o &quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot; -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_THREAD_SUPPORT -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_DLL &quot;-I.\GeneratedFiles&quot; &quot;-I.\GeneratedFiles\$(ConfigurationName)\.&quot; &quot;-I$(QTDIR)\include&quot; &quot;-I$(QTDIR)\include\QtCore&quot; &quot;-I$(QTDIR)\include\QtNetwork&quot; &quot;-I$(QTDIR)\include\QtGui&quot; &quot;-I$(QTDIR)\include\QtOpenGL&quot; &quot;-I$(QTDIR)\include\QtWebKit&quot; &quot;-I$(QTDIR)\include\QtTest&quot; &quot;-I$(SolutionDir)\QFunctionConfigurator\QFunctionConfigurator&quot; &quot;-I$(DXSDK_DIR)\Include&quot;&#x0D;&#x0A;"
AdditionalDependencies="&quot;$(QTDIR)\bin\moc.exe&quot;;$(InputPath)"
Outputs="&quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot;"
/>
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)