123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838 |
- #pragma once
- #include <functional>
- #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 <typename T> T Get () const { }
- template <> eSTR::DString Get () const { return m_sString; }
- template <> eSTR::WString Get () const { return m_wString; }
- template <typename T> 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 <eSTR::DString> ();
- }
- inline operator eSTR::WString () const
- {
- return GetAs <eSTR::WString> ();
- }
- };
- //-----------------------------------------------------------------------------
- // 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 <eSTR::DString (UINT16)> 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;
- };
- }
|