00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include <crtdbg.h>
00013 #include <windows.h>
00014
00015 #include "MemoryAlloc.h"
00016
00017 #include "pipeline/SimpleUnit.h"
00018 #include "DerivedUnit.h"
00019
00020
00021
00022
00023
00024
00025
00026 extern "C" __declspec(dllexport) EnumDLLType GetType(void);
00027 extern "C" __declspec(dllexport) TUnitInterface* CreateUnit( TDispatcherInterface * dispatcher );
00028 extern "C" __declspec(dllexport) EnumUnitType GetUnitResultType(void);
00029 extern "C" __declspec(dllexport) const char * GetUnitCreateInfo(void);
00030 extern "C" __declspec(dllexport) const char * GetUnitResultInfo(void);
00031
00032
00033
00034
00035 extern "C" EnumDLLType GetType(void)
00036 {
00037 return ENUM_DLLTYPE_BASIC;
00038 }
00039
00040
00041
00042
00043
00044
00045
00046 extern "C" TUnitInterface* CreateUnit( TDispatcherInterface * dispatcher )
00047 {
00048 TTestUnit * test = new TTestUnit;
00049 TSimpleUnit * unit = new TSimpleUnit( dispatcher, test, FALSE );
00050
00051 return unit;
00052 }
00053
00054
00055
00056 extern "C" __declspec(dllexport) EnumUnitType GetUnitResultType(void)
00057 {
00058 return ENUM_UNITTYPE_INTEGER;
00059 }
00060
00061
00062
00063
00064
00065
00066 extern "C" const char * GetUnitCreateInfo(void)
00067 {
00068 return
00069 "TUnitInterface * CreateUnit( TDispatcherInterface * dispatcher )\n"
00070 "\n"
00071 "dispatcher [in] interface to valid dispatcher";
00072 }
00073
00074
00075
00076
00077
00078
00079 extern "C" const char * GetUnitResultInfo(void)
00080 {
00081 return
00082 "TUnitRetType_integer\n"
00083 "\n"
00084 "This is testing unit that returns average intensity of pixels in gray image.";
00085 }
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098 BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpReserved)
00099 {
00100
00101 switch( fdwReason )
00102 {
00103 case DLL_PROCESS_ATTACH:
00104
00105
00106 #ifdef _DEBUG
00107 _CrtDbgReport(_CRT_WARN, NULL, NULL,NULL,
00108 "============================\n"
00109 "DLL with working unit loaded\n"
00110 "============================\n"
00111 "Example of unit that compute intensity of frames.\n"
00112 );
00113 #endif
00114 break;
00115
00116 case DLL_THREAD_ATTACH:
00117
00118 break;
00119
00120 case DLL_THREAD_DETACH:
00121
00122 break;
00123
00124 case DLL_PROCESS_DETACH:
00125
00126 #ifdef _DEBUG
00127 _CrtDbgReport(_CRT_WARN, NULL, NULL,NULL,
00128 "============================================\n"
00129 "DLL with working unit unloaded\n"
00130 "Memory using:\n"
00131 "\t Blocks via \"operator new\" : %d\n"
00132 "\t Blocks via \"operator new[]\": %d\n"
00133 "\n"
00134 "Allocated objects for results: %u\n"
00135 "============================================\n",
00136 TMemoryAllocStats::m_alloc_normal,
00137 TMemoryAllocStats::m_alloc_array,
00138 TManager<TUnitRetType_integer_implemented>::GetAllocCount()
00139 );
00140 #endif
00141 break;
00142 }
00143 return TRUE;
00144 }