#pragma once #include #include "DelegateArg.hpp" #include "String.DString.hpp" #include "String.WString.hpp" using namespace eSTR::Literals; #include "Utility.Error.hpp" #ifndef _DELEGATEARG_DLL #define DELEGATEARG_API _declspec(dllimport) #else #define DELEGATEARG_API _declspec(dllexport) #endif #ifndef _DELEGATEARG_DLL #ifdef _WIN64 #ifdef _DEBUG #pragma comment (lib, "ECOM.Utility.DelegateArg64D.lib") #else #pragma comment (lib, "ECOM.Utility.DelegateArg64.lib") #endif #else // X86 #ifdef _DEBUG #pragma comment (lib, "ECOM.Utility.DelegateArgD.lib") #else #pragma comment (lib, "ECOM.Utility.DelegateArg.lib") #endif #endif #endif // _DELEGATEARG_DLL #pragma warning (disable : 4275) namespace ECOM { namespace Utility { class DDateTime; } namespace DICOM { class DICOMCommandSet; class DICOMDataSet; class DICOMFile; using CommandSet = DICOMCommandSet ; using DataSet = DICOMDataSet ; } } class DicomFileHolder; class DStringArray; struct __EventArg_DWString { eSTR::DString m_sString; eSTR::WString m_wString; __EventArg_DWString () { } __EventArg_DWString (const __EventArg_DWString & from) { m_sString = from.m_sString; m_wString = from.m_wString; } void Set (const eSTR::DString & str) { m_sString = str; } void Set (const eSTR::WString & str) { m_wString = str; } void Set (const eSTR::DStringView & str) { m_sString = str; } void Set (const eSTR::WStringView & str) { m_wString = str; } template T Get () const { } template <> eSTR::DString Get () const { return m_sString; } template <> eSTR::WString Get () const { return m_wString; } template T GetAs () const { } template <> eSTR::DString GetAs () const { if (m_sString.GetLength () > 0) return m_sString; return m_wString.ToDString (); } template <> eSTR::WString GetAs () const { if (m_wString.GetLength () > 0) return m_wString; return eSTR::WString (m_sString); } __EventArg_DWString & operator = (const eSTR::DString & str) { Set (str); return (*this); } __EventArg_DWString & operator = (const eSTR::WString & str) { Set (str); return (*this); } __EventArg_DWString & operator = (const eSTR::DStringView & str) { Set (str); return (*this); } __EventArg_DWString & operator = (const eSTR::WStringView & 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 eSTR::DString () const { return GetAs (); } inline operator eSTR::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 (const ECOM::Utility::Error::ErrorCode & ec) : ErrorCode (ec) { } public: const ECOM::Utility::Error::ErrorCode & ErrorCode; }; //----------------------------------------------------------------------------- // 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 (ECOM::Utility::DDateTime * Now) { m_pNow = Now; } public: const ECOM::Utility::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 (eSTR::DString s) { m_String = s; } public: eSTR::DString m_String; }; class DELEGATEARG_API EventArgs_2String : public EventArgs_String { typedef EventArgs_String inherited; DECLARE_RTTI (EventArgs_2String) public: inline EventArgs_2String (eSTR::DString s1, eSTR::DString s2) : inherited (s1), m_String1 (s1) { m_String2 = s2; } public: eSTR::DString & m_String1; eSTR::DString m_String2; }; class DELEGATEARG_API EventArgs_4String : public DelegateArgs { typedef DelegateArgs inherited; DECLARE_RTTI (EventArgs_4String) public: eSTR::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: eSTR::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 (eSTR::WString s) { m_String = s; } inline EventArgs_WString (CV_WString & s) { m_String = s; } inline EventArgs_WString (const wchar_t * s) { m_String = CV_WString (s); } public: eSTR::WString m_String; }; class DELEGATEARG_API EventArgs_2WString : public EventArgs_WString { typedef EventArgs_WString inherited; DECLARE_RTTI (EventArgs_2WString) public: inline EventArgs_2WString (eSTR::WString s1, eSTR::WString s2) : inherited (s1), m_String1 (s1) { m_String2 = s2; } public: eSTR::WString & m_String1; eSTR::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 (eSTR::WString ws, eSTR::DString ds) { m_wString = ws; m_dString = ds; } public: eSTR::WString m_wString; eSTR::DString m_dString; }; class DELEGATEARG_API EventArgs_2DWString : public EventArgs_DWString { typedef EventArgs_DWString inherited; DECLARE_RTTI (EventArgs_2DWString) public: inline EventArgs_2DWString (eSTR::WString ws1, eSTR::DString ds1, eSTR::WString ws2, eSTR::DString ds2) : inherited (ws1, ds1), m_wString1 (ws1), m_dString1 (ds1) { m_wString2 = ws2; m_dString2 = ds2; } public: eSTR::WString & m_wString1; eSTR::DString & m_dString1; eSTR::WString m_wString2; eSTR::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; }; //----------------------------- // 带 2 个参数 //----------------------------- 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, eSTR::DString LocalAE, eSTR::DString RemoteAE) : inherited (DDS) , m_LocalAETitle (LocalAE) , m_RemoteAETitle (RemoteAE) { } public: eSTR::DString m_LocalAETitle; eSTR::DString m_RemoteAETitle; }; //----------------------------------------------------------------------------- // A general DelegateArg of FileName //----------------------------------------------------------------------------- class DELEGATEARG_API EventArgs_FileName : public EventArgs_WString { typedef EventArgs_WString inherited; DECLARE_RTTI (EventArgs_FileName) public: inline EventArgs_FileName (eSTR::WString FN) : inherited (FN), m_FileName (m_String) { } inline EventArgs_FileName (CV_WString & FN) : inherited (FN), m_FileName (m_String) { } inline EventArgs_FileName (const wchar_t * FN) : inherited (FN), m_FileName (m_String) { } public: eSTR::WString & m_FileName; }; //----------------------------------------------------------------------------- // 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_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, int Port) : EventArgs_DicomFile (DicomFile) { m_Calling = eSTR::StringView (Calling); m_Called = eSTR::StringView (Called); m_IP = eSTR::StringView (IP); m_Port = Port; } public: eSTR::DString m_Calling; eSTR::DString m_Called; eSTR::DString m_IP; int m_Port; }; //----------------------------- // 带 6 个参数 //----------------------------- class DELEGATEARG_API EventArgs_DicomFileEx2 : public EventArgs_DicomFile { typedef EventArgs_DicomFile inherited; DECLARE_RTTI (EventArgs_DicomFileEx2) public: inline EventArgs_DicomFileEx2 ( ECOM::DICOM::DICOMFile * DicomFile, eSTR::DString LocalAE, eSTR::DString RemoteAE) : inherited (DicomFile) { m_LocalAETitle = LocalAE; m_RemoteAETitle = RemoteAE; } public: eSTR::DString m_LocalAETitle; eSTR::DString m_RemoteAETitle; }; //----------------------------- // 带 6 个参数 // 用于 BeforeSend, BeforeSave, BeforeCMove //----------------------------- class DELEGATEARG_API EventArgs_DicomFileEx6 : public EventArgs_DicomFileEx2 { typedef EventArgs_DicomFileEx2 inherited; DECLARE_RTTI (EventArgs_DicomFileEx6) public: inline EventArgs_DicomFileEx6 ( ECOM::DICOM::DICOMFile * DicomFile, eSTR::DString LocalAE, eSTR::DString RemoteAE, eSTR::DString CallingVersion, eSTR::DString CalledVersion, eSTR::DString ImageTransferSyntax, eSTR::DString PDUTransferSyntax) : inherited (DicomFile, LocalAE, RemoteAE) { m_CallingVersionClass = CallingVersion; m_CalledVersionClass = CalledVersion; m_ImageTransferSyntax = ImageTransferSyntax; m_PDUTransferSyntax = PDUTransferSyntax; } public: eSTR::DString m_CallingVersionClass; eSTR::DString m_CalledVersionClass; eSTR::DString m_ImageTransferSyntax; eSTR::DString m_PDUTransferSyntax; }; //----------------------------------------------------------------------------- // 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; }; //----------------------------------------------------------------------------- // 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; eSTR::DString m_CallingAETitle; eSTR::DString m_CalledAETitle; eSTR::DString m_ConnectedNode; UINT32 m_ConnectedPort; UINT32 m_ConnectionNumber; double m_ConnectedTime; bool m_bOK; }; namespace DumpEventArgs::DICOM { enum class enDir { In = 1, Out = 2 }; class DELEGATEARG_API Session : public DelegateArgs { typedef DelegateArgs inherited; DECLARE_RTTI (Session) int m_SessionID = 0; }; //----------------------------- // 两个 AETitle //----------------------------- class DELEGATEARG_API AETitle : public Session { typedef Session inherited; DECLARE_RTTI (AETitle) public: AETitle () = default; public: eSTR::DString m_CallingAETitle; eSTR::DString m_CalledAETitle; }; //----------------------------- // DICOM 谈判信息 //----------------------------- class DELEGATEARG_API Negotiation : public AETitle { typedef AETitle inherited; DECLARE_RTTI (Negotiation) public: Negotiation (enDir dir) : m_Dir (dir) {} public: const enDir m_Dir; eSTR::DString m_Type; // "AARQ", "AAAC", "AARJ" eSTR::DString m_Detail; // AARQ.ToString (), AAAC.ToString (), etc. }; //----------------------------- // 命令集 //----------------------------- class DELEGATEARG_API CommandSet : public AETitle { typedef AETitle inherited; DECLARE_RTTI (CommandSet) public: inline CommandSet (enDir dir, const ECOM::DICOM::CommandSet * DCS) : m_Dir (dir), m_DCS (DCS) { ErrorCodeToString = [] (auto) { return eSTR::DString (); }; } public: const enDir m_Dir; const ECOM::DICOM::CommandSet * m_DCS; std::function ErrorCodeToString; }; //----------------------------- // 命令集 + 数据集 //----------------------------- class DELEGATEARG_API CommandDataSet : public CommandSet { typedef CommandSet inherited; DECLARE_RTTI (CommandDataSet) public: inline CommandDataSet (enDir dir, const ECOM::DICOM::CommandSet * DCS, const ECOM::DICOM::DataSet * DDS) : inherited (dir, DCS), m_DDS (DDS) { } public: const ECOM::DICOM::DataSet * m_DDS; }; }