#pragma once #include "DelegateArg.hpp" #include "WString.hpp" #ifndef _DELEGATEARG_DLL #define DELEGATEARG_API _declspec(dllimport) #else #define DELEGATEARG_API _declspec(dllexport) #endif #pragma warning (disable : 4275) class DDateTime; namespace ECOM { namespace DICOM { class DICOMDataSet; class DICOMFile; class DICOMCommandSet; } } class ImageShow; class DicomFileHolder; class DString; class DStringArray; struct __EventArg_DWString { DString m_sString; WString m_wString; __EventArg_DWString () { } __EventArg_DWString (const __EventArg_DWString & from) { m_sString = from.m_sString; m_wString = from.m_wString; } void Set (const DString & str) { m_sString = str; } void Set (const WString & str) { m_wString = str; } template T Get () const { } template <> DString Get () const { return m_sString; } template <> WString Get () const { return m_wString; } template T GetAs () const { } template <> DString GetAs () const { if (m_sString.GetLength () > 0) return m_sString; return m_wString.ToDString (); } template <> WString GetAs () const { if (m_wString.GetLength () > 0) return m_wString; return WString (m_sString); } __EventArg_DWString & operator = (const DString & str) { Set (str); return (*this); } __EventArg_DWString & operator = (const WString & str) { Set (str); return (*this); } __EventArg_DWString & operator = (const __EventArg_DWString & from) { if (this == &from) return (*this); m_sString = from.m_sString; m_wString = from.m_wString; return (*this); } inline operator DString () const { return GetAs (); } inline operator WString () const { return GetAs (); } }; //----------------------------------------------------------------------------- // A general DelegateArg of Error //----------------------------------------------------------------------------- class DELEGATEARG_API EventArgs_Error : public DelegateArgs { typedef DelegateArgs inherited; DECLARE_RTTI (EventArgs_Error) public: inline EventArgs_Error (int ec) { iReserved1 = iReserved2 = iReserved3 = iReserved4 = 0; ErrorCode = ec; } inline EventArgs_Error (int ec, const DString & Msg) { iReserved1 = iReserved2 = iReserved3 = iReserved4 = 0; ErrorCode = ec; Message = Msg; } inline EventArgs_Error (int ec, const WString & Msg) { iReserved1 = iReserved2 = iReserved3 = iReserved4 = 0; ErrorCode = ec; Message = Msg; } inline EventArgs_Error (int ec, const DString & Msg, const DString & Src) { iReserved1 = iReserved2 = iReserved3 = iReserved4 = 0; ErrorCode = ec; Message = Msg; Source = Src; } public: int ErrorCode; // 错误代码 int iReserved1; // 保留 int iReserved2; // 保留 int iReserved3; // 保留 int iReserved4; // 保留 DString sReserved1; // 保留 DString sReserved2; // 保留 WString wReserved1; // 保留 WString wReserved2; // 保留 public: __EventArg_DWString Message; // 错误信息 __EventArg_DWString Detail; // 错误的详细信息 __EventArg_DWString Comment; // 说明或注释 __EventArg_DWString Suggestion; // 建议采取的动作 __EventArg_DWString Source; // 发生错误的位置 (源代码文件名,行号,模块名,类名,函数名,等) }; //----------------------------------------------------------------------------- // A general DelegateArg of Pointer //----------------------------------------------------------------------------- class DELEGATEARG_API EventArgs_Pointer : public DelegateArgs { typedef DelegateArgs inherited; DECLARE_RTTI (EventArgs_Pointer) public: inline EventArgs_Pointer (void * ptr) { m_Pointer = ptr; } public: void * m_Pointer; }; //----------------------------------------------------------------------------- // A general DelegateArg of DateTime //----------------------------------------------------------------------------- class DELEGATEARG_API EventArgs_DateTime : public DelegateArgs { typedef DelegateArgs inherited; DECLARE_RTTI (EventArgs_DateTime) public: inline EventArgs_DateTime (DDateTime * Now) { m_pNow = Now; } public: const DDateTime * m_pNow; }; //----------------------------------------------------------------------------- // A general DelegateArg of int //----------------------------------------------------------------------------- class DELEGATEARG_API EventArgs_Int : public DelegateArgs { typedef DelegateArgs inherited; DECLARE_RTTI (EventArgs_Int) public: inline EventArgs_Int (int i) { m_int = i; } public: int m_int; }; class DELEGATEARG_API EventArgs_2Int : public DelegateArgs { typedef DelegateArgs inherited; DECLARE_RTTI (EventArgs_2Int) public: inline EventArgs_2Int (int i1, int i2) { m_int1 = i1; m_int2 = i2; } public: int m_int1; int m_int2; }; class DELEGATEARG_API EventArgs_3Int : public DelegateArgs { typedef DelegateArgs inherited; DECLARE_RTTI (EventArgs_3Int) public: inline EventArgs_3Int (int i1, int i2, int i3) { m_int1 = i1; m_int2 = i2; m_int3 = i3; } public: int m_int1; int m_int2; int m_int3; }; class DELEGATEARG_API EventArgs_4Int : public DelegateArgs { typedef DelegateArgs inherited; DECLARE_RTTI (EventArgs_4Int) public: inline EventArgs_4Int (int i1, int i2, int i3, int i4) { m_int1 = i1; m_int2 = i2; m_int3 = i3; m_int4 = i4; } public: int m_int1; int m_int2; int m_int3; int m_int4; }; class DELEGATEARG_API EventArgs_5Int : public DelegateArgs { typedef DelegateArgs inherited; DECLARE_RTTI (EventArgs_5Int) public: inline EventArgs_5Int (int i1, int i2, int i3, int i4, int i5) { m_int1 = i1; m_int2 = i2; m_int3 = i3; m_int4 = i4; m_int5 = i5; } public: int m_int1; int m_int2; int m_int3; int m_int4; int m_int5; }; //----------------------------------------------------------------------------- // A general DelegateArg of double //----------------------------------------------------------------------------- class DELEGATEARG_API EventArgs_Double : public DelegateArgs { typedef DelegateArgs inherited; DECLARE_RTTI (EventArgs_Double) public: inline EventArgs_Double (double d) { m_double = d; } public: double m_double; }; //----------------------------------------------------------------------------- // A general DelegateArg of DString //----------------------------------------------------------------------------- class DELEGATEARG_API EventArgs_String : public DelegateArgs { typedef DelegateArgs inherited; DECLARE_RTTI (EventArgs_String) public: inline EventArgs_String (DString s) { m_String = s; } public: DString m_String; }; class DELEGATEARG_API EventArgs_2String : public EventArgs_String { typedef EventArgs_String inherited; DECLARE_RTTI (EventArgs_2String) public: inline EventArgs_2String (DString s1, DString s2) : inherited (s1), m_String1 (s1) { m_String2 = s2; } public: DString & m_String1; DString m_String2; }; class DELEGATEARG_API EventArgs_4String : public DelegateArgs { typedef DelegateArgs inherited; DECLARE_RTTI (EventArgs_4String) public: DString m_String [4]; }; class DELEGATEARG_API EventArgs_8String : public DelegateArgs { typedef DelegateArgs inherited; DECLARE_RTTI (EventArgs_8String) public: EventArgs_8String () { } EventArgs_8String (const EventArgs_8String & from) { from.CopyTo (*this); } public: DString m_String [8]; public: void CopyTo (EventArgs_8String & to) const { for (int Index=0; Index<8; Index++) { to.m_String [Index] = m_String [Index]; } } bool IsEqual (const EventArgs_8String & to) const { for (int Index=0; Index<8; Index++) { if (to.m_String [Index] != m_String [Index]) return false; } return true; } EventArgs_8String & operator = (const EventArgs_8String & from) { from.CopyTo (*this); return (*this); } }; inline bool __stdcall operator == (const EventArgs_8String& s1, const EventArgs_8String& s2) { return s1.IsEqual (s2); } //----------------------------------------------------------------------------- // A general DelegateArg of WString //----------------------------------------------------------------------------- class DELEGATEARG_API EventArgs_WString : public DelegateArgs { typedef DelegateArgs inherited; DECLARE_RTTI (EventArgs_WString) public: inline EventArgs_WString (WString s) { m_String = s; } public: WString m_String; }; class DELEGATEARG_API EventArgs_2WString : public EventArgs_WString { typedef EventArgs_WString inherited; DECLARE_RTTI (EventArgs_2WString) public: inline EventArgs_2WString (WString s1, WString s2) : inherited (s1), m_String1 (s1) { m_String2 = s2; } public: WString & m_String1; WString m_String2; }; //----------------------------------------------------------------------------- // A general DelegateArg of DString & WString //----------------------------------------------------------------------------- class DELEGATEARG_API EventArgs_DWString : public DelegateArgs { typedef DelegateArgs inherited; DECLARE_RTTI (EventArgs_DWString) public: inline EventArgs_DWString (WString ws, DString ds) { m_wString = ws; m_dString = ds; } public: WString m_wString; DString m_dString; }; class DELEGATEARG_API EventArgs_2DWString : public EventArgs_DWString { typedef EventArgs_DWString inherited; DECLARE_RTTI (EventArgs_2DWString) public: inline EventArgs_2DWString (WString ws1, DString ds1, WString ws2, DString ds2) : inherited (ws1, ds1), m_wString1 (ws1), m_dString1 (ds1) { m_wString2 = ws2; m_dString2 = ds2; } public: WString & m_wString1; DString & m_dString1; WString m_wString2; DString m_dString2; }; //----------------------------------------------------------------------------- // A general DelegateArg of DICOM DataSet //----------------------------------------------------------------------------- class DELEGATEARG_API EventArgs_DataSet : public DelegateArgs { typedef DelegateArgs inherited; DECLARE_RTTI (EventArgs_DataSet) public: inline EventArgs_DataSet (const ECOM::DICOM::DICOMDataSet * dds) { m_DDS = dds; } public: const ECOM::DICOM::DICOMDataSet * m_DDS; }; class DELEGATEARG_API EventArgs_DataSetEx : public EventArgs_DataSet { typedef EventArgs_DataSet inherited; DECLARE_RTTI (EventArgs_DataSetEx) public: inline EventArgs_DataSetEx (const ECOM::DICOM::DICOMDataSet * DDS, DString LocalAE, DString RemoteAE) : inherited (DDS) { m_LocalAETitle = LocalAE; m_RemoteAETitle = RemoteAE; } public: DString m_LocalAETitle; DString m_RemoteAETitle; }; /* class DELEGATEARG_API EventArgs_DataSetEx2 : public EventArgs_DataSetEx { typedef EventArgs_DataSetEx inherited; DECLARE_RTTI (EventArgs_DataSetEx2) public: inline EventArgs_DataSetEx2 (const DICOMDataSet * DDS, DString LocalAE, DString RemoteAE) : inherited (DDS, LocalAE, RemoteAE) { Reverse1 = Reverse2 = Reverse3 = Reverse4 = 0; } public: DWORD Reverse1; DWORD Reverse2; DWORD Reverse3; DWORD Reverse4; }; */ #if 0 //----------------------------------------------------------------------------- // A general DelegateArg of FileName //----------------------------------------------------------------------------- class DELEGATEARG_API EventArgs_FileName : public DelegateArgs { typedef DelegateArgs inherited; DECLARE_RTTI (EventArgs_FileName) public: inline EventArgs_FileName (WString FN) { m_FileName = FN; } public: WString m_FileName; }; #else class DELEGATEARG_API EventArgs_FileName : public EventArgs_WString { typedef EventArgs_WString inherited; DECLARE_RTTI (EventArgs_FileName) public: inline EventArgs_FileName (WString FN) : inherited (FN), m_FileName (m_String) { } public: WString & m_FileName; }; #endif //----------------------------------------------------------------------------- // A general DelegateArg of DICOMFile //----------------------------------------------------------------------------- class DELEGATEARG_API EventArgs_DicomFile : public DelegateArgs { typedef DelegateArgs inherited; DECLARE_RTTI (EventArgs_DicomFile) public: inline EventArgs_DicomFile (ECOM::DICOM::DICOMFile * DicomFile) { m_DicomFile = DicomFile; } public: ECOM::DICOM::DICOMFile * m_DicomFile; }; class DELEGATEARG_API EventArgs_DicomFileEx : public EventArgs_DicomFile { typedef EventArgs_DicomFile inherited; DECLARE_RTTI (EventArgs_DicomFileEx) public: inline EventArgs_DicomFileEx (ECOM::DICOM::DICOMDataSet * DDS, ECOM::DICOM::DICOMFile * DicomFile) : EventArgs_DicomFile (DicomFile) { m_DDS = DDS; Reverse1 = Reverse2 = Reverse3 = Reverse4 = 0; } public: ECOM::DICOM::DICOMDataSet * m_DDS; public: DWORD Reverse1; DWORD Reverse2; DWORD Reverse3; DWORD Reverse4; }; class DELEGATEARG_API EventArgs_DicomFile_ImportExport : public EventArgs_DicomFile { typedef EventArgs_DicomFile inherited; DECLARE_RTTI (EventArgs_DicomFile_ImportExport) public: inline EventArgs_DicomFile_ImportExport ( ECOM::DICOM::DICOMFile * DicomFile, const char * Calling, const char * Called, const char * IP, const char * Port) : EventArgs_DicomFile (DicomFile) { m_Calling = Calling; m_Called = Called; m_IP = IP; m_Port = Port; } public: DString m_Calling; DString m_Called; DString m_IP; DString m_Port; }; //----------------------------------------------------------------------------- // A general DelegateArg of DicomFileHolder //----------------------------------------------------------------------------- class DELEGATEARG_API EventArgs_DicomFileHolder : public DelegateArgs { typedef DelegateArgs inherited; DECLARE_RTTI (EventArgs_DicomFileHolder) public: inline EventArgs_DicomFileHolder (DicomFileHolder * holder) { m_pHolder = holder; } public: DicomFileHolder * m_pHolder; }; #if 0 //----------------------------------------------------------------------------- // A general DelegateArg of DicomFileHolder //----------------------------------------------------------------------------- class DELEGATEARG_API EventArgs_DicomFileHolderEx2 : public EventArgs_DicomFileHolder { typedef EventArgs_DicomFileHolder inherited; DECLARE_RTTI (EventArgs_DicomFileHolderEx2) public: inline EventArgs_DicomFileHolderEx2 (DicomFileHolder * holder) : EventArgs_DicomFileHolder (holder) { Row = 0; Col = 0; } public: int Row; int Col; }; #endif //----------------------------------------------------------------------------- // A general DelegateArg of DICOM Connect //----------------------------------------------------------------------------- class DELEGATEARG_API EventArgs_Connect : public DelegateArgs { typedef DelegateArgs inherited; DECLARE_RTTI (EventArgs_Connect) public: inline EventArgs_Connect (void) { m_pCommandSet = NULL; m_bOK = true; } public: const ECOM::DICOM::DICOMCommandSet * m_pCommandSet; DString m_CallingAETitle; DString m_CalledAETitle; DString m_ConnectedNode; DString m_ConnectedPort; UINT32 m_ConnectionNumber; double m_ConnectedTime; bool m_bOK; }; #if 0 //----------------------------------------------------------------------------- // A general DelegateArg of EventArgs_2Arg //----------------------------------------------------------------------------- class DELEGATEARG_API EventArgs_2Arg : public DelegateArgs { typedef DelegateArgs inherited; DECLARE_RTTI (EventArgs_2Arg) public: inline EventArgs_2Arg (DelegateArgs * arg1, DelegateArgs * arg2) { m_Arg1 = arg1; m_Arg2 = arg2; } public: DelegateArgs * m_Arg1; DelegateArgs * m_Arg2; }; //----------------------------------------------------------------------------- // A general DelegateArg of EventArgs_3Arg //----------------------------------------------------------------------------- class DELEGATEARG_API EventArgs_3Arg : public DelegateArgs { typedef DelegateArgs inherited; DECLARE_RTTI (EventArgs_3Arg) public: inline EventArgs_3Arg (DelegateArgs * arg1, DelegateArgs * arg2, DelegateArgs * arg3) { m_Arg1 = arg1; m_Arg2 = arg2; m_Arg3 = arg3; } public: DelegateArgs * m_Arg1; DelegateArgs * m_Arg2; DelegateArgs * m_Arg3; }; //----------------------------------------------------------------------------- // A general DelegateArg of EventArgs_4Arg //----------------------------------------------------------------------------- class DELEGATEARG_API EventArgs_4Arg : public DelegateArgs { typedef DelegateArgs inherited; DECLARE_RTTI (EventArgs_4Arg) public: inline EventArgs_4Arg ( DelegateArgs * arg1, DelegateArgs * arg2, DelegateArgs * arg3, DelegateArgs * arg4) { m_Arg1 = arg1; m_Arg2 = arg2; m_Arg3 = arg3; m_Arg4 = arg4; } public: DelegateArgs * m_Arg1; DelegateArgs * m_Arg2; DelegateArgs * m_Arg3; DelegateArgs * m_Arg4; }; //----------------------------------------------------------------------------- // A general DelegateArg of EventArgs_6Arg //----------------------------------------------------------------------------- class DELEGATEARG_API EventArgs_6Arg : public DelegateArgs { typedef DelegateArgs inherited; DECLARE_RTTI (EventArgs_6Arg) public: inline EventArgs_6Arg ( DelegateArgs * arg1, DelegateArgs * arg2, DelegateArgs * arg3, DelegateArgs * arg4, DelegateArgs * arg5, DelegateArgs * arg6) { m_Arg1 = arg1; m_Arg2 = arg2; m_Arg3 = arg3; m_Arg4 = arg4; m_Arg5 = arg5; m_Arg6 = arg6; } public: DelegateArgs * m_Arg1; DelegateArgs * m_Arg2; DelegateArgs * m_Arg3; DelegateArgs * m_Arg4; DelegateArgs * m_Arg5; DelegateArgs * m_Arg6; }; //----------------------------------------------------------------------------- // A general DelegateArg of EventArgs_6Arg //----------------------------------------------------------------------------- class DELEGATEARG_API EventArgs_8Arg : public DelegateArgs { typedef DelegateArgs inherited; DECLARE_RTTI (EventArgs_8Arg) public: inline EventArgs_8Arg ( DelegateArgs * arg1, DelegateArgs * arg2, DelegateArgs * arg3, DelegateArgs * arg4, DelegateArgs * arg5, DelegateArgs * arg6, DelegateArgs * arg7, DelegateArgs * arg8) { m_Arg1 = arg1; m_Arg2 = arg2; m_Arg3 = arg3; m_Arg4 = arg4; m_Arg5 = arg5; m_Arg6 = arg6; m_Arg7 = arg7; m_Arg8 = arg8; } public: DelegateArgs * m_Arg1; DelegateArgs * m_Arg2; DelegateArgs * m_Arg3; DelegateArgs * m_Arg4; DelegateArgs * m_Arg5; DelegateArgs * m_Arg6; DelegateArgs * m_Arg7; DelegateArgs * m_Arg8; }; #endif