PrevNextUpHome SophiaFramework UNIVERSE 5.3

25.4. Macro for Callback

25.4.1. Macro for declaring the callback function

The callback function is declared using the macro of which name starts with XALLBACK_DECLARE_.

Table 25.10. Macro for callback declaration (file)

Macro Meaning Used methods
XALLBACK_DECLARE_SFXFILE Macro for declaring the callback function of SFXFile class SFXFile::ScheduleRead

Table 25.11. Macro for callback declaration (network)

Macro Meaning Used methods
XALLBACK_DECLARE_SFXINETADDRESS Macro for declaring the callback function of SFXInetAddress class SFXInetAddress::Resolve
XALLBACK_DECLARE_SFXSOCKETADDRESS Macro for declaring the callback function of SFXSocketAddress class SFXInetAddress::Resolve (inherits from SFXInetAddress class)
XALLBACK_DECLARE_SFXHTTPCONNECTION Macro for declaring the callback function of SFXHTTPConnection class SFXHTTPConnection::Connect
XALLBACK_DECLARE_SFXTCPSOCKET Macro for declaring the callback function of SFXTCPSocket class SFXTCPSocket::Connect, SFXTCPSocket::ScheduleAccept, SFXTCPSocket::ScheduleBind, SFXTCPSocket::ScheduleListen, SFXTCPSocket::ScheduleRead, SFXTCPSocket::ScheduleWrite
XALLBACK_DECLARE_SFXSSLSOCKET Macro for declaring the callback function of SFXSSLSocket class SFXSSLSocket::Connect, SFXSSLSocket::Negotiate, SFXSSLSocket::ScheduleBind, SFXSSLSocket::ScheduleRead, SFXSSLSocket::ScheduleWrite
XALLBACK_DECLARE_SFXUDPSOCKET Macro for declaring the callback function of SFXUDPSocket class SFXUDPSocket::ScheduleBind, SFXUDPSocket::ScheduleReceive, SFXUDPSocket::ScheduleSend
XALLBACK_DECLARE_SFXSMTPSENDER Macro for declaring the callback function of SFXSMTPSender class SFXSMTPSender::SendMessage, SFXSMTPSender::SendText
XALLBACK_DECLARE_SFXPOP3RECEIVER Macro for declaring the callback function of SFXPOP3Receiver class SFXPOP3Receiver::Delete, SFXPOP3Receiver::Receive
XALLBACK_DECLARE_SFXSMTP Macro for declaring the callback function of SFXSMTP class SFXSMTP::Connect
XALLBACK_DECLARE_SFXPOP3 Macro for declaring the callback function of SFXPOP3 class SFXPOP3::Connect

Table 25.12. Macro for callback declaration (stream)

Macro Meaning Used methods
XALLBACK_DECLARE_SFXSTREAMREADER Macro for declaring the callback function of SFXStreamReader class SFXStreamReader::Fetch
XALLBACK_DECLARE_SFXSTREAMWRITER Macro for declaring the callback function of SFXStreamWriter class SFXStreamWriter::Flush
XALLBACK_DECLARE_SFXANSISTRINGSTREAMREADER Macro for declaring the callback function of SFXAnsiStringStreamReader class SFXStreamReader::Fetch(inherits from SFXStreamReader class)
XALLBACK_DECLARE_SFXANSISTRINGSTREAMWRITER Macro for declaring the callback function of SFXAnsiStringStreamWriter class SFXStreamWriter::Flush(inherits from SFXStreamWriter class)
XALLBACK_DECLARE_SFXWIDESTRINGSTREAMREADER Macro for declaring the callback function of SFXWideStringStreamReader class SFXStreamReader::Fetch(inherits from SFXStreamReader class)
XALLBACK_DECLARE_SFXWIDESTRINGSTREAMWRITER Macro for declaring the callback function of SFXWideStringStreamWriter class SFXStreamWriter::Flush(inherits from SFXStreamWriter class)
XALLBACK_DECLARE_SFXBINARYSTREAMREADER Macro for declaring the callback function of SFXBinaryStreamReader class SFXStreamReader::Fetch(inherits from SFXStreamReader class)
XALLBACK_DECLARE_SFXBINARYSTREAMWRITER Macro for declaring the callback function of SFXBinaryStreamWriter class SFXStreamWriter::Flush(inherits from SFXStreamWriter class)
XALLBACK_DECLARE_SFXELASTICSTREAMREADER Macro for declaring the callback function of SFXElasticStreamReader class SFXElasticStreamReader::Fetch
XALLBACK_DECLARE_SFXELASTICSTREAMWRITER Macro for declaring the callback function of SFXElasticStreamWriter class SFXElasticStreamWriter::Flush

Table 25.13. Macro for callback declaration (storage)

Macro Meaning Used methods
XALLBACK_DECLARE_SFXFILE Macro for declaring the callback function of SFXFile class SFXFile::ScheduleRead
XALLBACK_DECLARE_SFXHTTPCONNECTION Macro for declaring the callback function of SFXHTTPConnection class SFXHTTPConnection::Connect
XALLBACK_DECLARE_SFXTCPSOCKET Macro for declaring the callback function of SFXTCPSocket class SFXTCPSocket::Connect, SFXTCPSocket::ScheduleAccept, SFXTCPSocket::ScheduleBind, SFXTCPSocket::ScheduleListen, SFXTCPSocket::ScheduleRead, SFXTCPSocket::ScheduleWrite
XALLBACK_DECLARE_SFXSSLSOCKET Macro for declaring the callback function of SFXSSLSocket class SFXSSLSocket::Connect, SFXSSLSocket::Negotiate, SFXSSLSocket::ScheduleBind, SFXSSLSocket::ScheduleRead, SFXSSLSocket::ScheduleWrite
XALLBACK_DECLARE_SFXSOURCE Macro for declaring the callback function of SFXSource class SFXSource::ScheduleRead
XALLBACK_DECLARE_SFXZIPDECODER Macro for declaring the callback function of SFXZIPDecoder class SFXZIPDecoder::ScheduleRead

Table 25.14. Macro for callback declaration (other utilities)

Macro Meaning Used methods
XALLBACK_DECLARE_SFXCALLBACK Macro for declaring the callback function of SFXCallback class SFXCallback::Set
XALLBACK_DECLARE_SFXTASK Macro for declaring the callback function of SFXTask class SFXTask::Set
XALLBACK_DECLARE_SFXTIMER Macro for declaring the callback function of SFXTimer class SFXTimer::Set
XALLBACK_DECLARE_SFXEDITOR Macro for declaring the callback function of SFXEditor class SFXEditor::Open
XALLBACK_DECLARE_SFCAPPLICATION Macro for declaring the callback function of SFCApplication class SFCApplication::RegisterBypass, SFCApplication::UnregisterBypass
XALLBACK_DECLARE_SFYAPPLICATION Macro for declaring the callback function of SFYApplication class SFCApplication::RegisterBypass, SFCApplication::UnregisterBypass
[Note] Note
The argument is the name of callback function.

25.4.2. Macro for callback implementation

Callback is implemented by macro whose name beginning with XALLBACK_IMPLEMENT_.

Table 25.15. Macro for callback implementation (file)

Macro 3rd argument Meaning
XALLBACK_IMPLEMENT_SFXFILE error (error type) Macro for implementing the callback function of SFXFile class

Table 25.16. Macro for callback implementation (network)

Macro 3rd argument Meaning
XALLBACK_IMPLEMENT_SFXINETADDRESS error (error type) Macro for implementing the callback function of SFXInetAddress class
XALLBACK_IMPLEMENT_SFXSOCKETADDRESS error (error type) Macro for implementing the callback function of SFXSocketAddress class
XALLBACK_IMPLEMENT_SFXHTTPCONNECTION error (error type) Macro for implementing the callback function of SFXHTTPConnection class
XALLBACK_IMPLEMENT_SFXTCPSOCKET error (error type) Macro for implementing the callback function of SFXTCPSocket class
XALLBACK_IMPLEMENT_SFXSSLSOCKET error (error type) Macro for implementing the callback function of SFXSSLSocket class
XALLBACK_IMPLEMENT_SFXUDPSOCKET error (error type) Macro for implementing the callback function of SFXUDPSocket class
XALLBACK_IMPLEMENT_SFXSMTPSENDER error (error type) Macro for implementing the callback function of SFXSMTPSender class
XALLBACK_IMPLEMENT_SFXPOP3RECEIVER error (error type) Macro for implementing the callback function of SFXPOP3Receiver class
XALLBACK_IMPLEMENT_SFXSMTP error (error type) Macro for implementing the callback function of SFXSMTP class
XALLBACK_IMPLEMENT_SFXPOP3 error (error type) Macro for implementing the callback function of SFXPOP3 class

Table 25.17. Macro for callback implementation (stream)

Macro 3rd argument Meaning
XALLBACK_IMPLEMENT_SFXSTREAMREADER error (error type) Macro for implementing the callback function of SFXStreamReader class
XALLBACK_IMPLEMENT_SFXSTREAMWRITER error (error type) Macro for implementing the callback function of SFXStreamWriter class
XALLBACK_IMPLEMENT_SFXANSISTRINGSTREAMREADER error (error type) Macro for implementing the callback function of SFXAnsiStringStreamReader class
XALLBACK_IMPLEMENT_SFXANSISTRINGSTREAMWRITER error (error type) Macro for implementing the callback function of SFXAnsiStringStreamWriter class
XALLBACK_IMPLEMENT_SFXWIDESTRINGSTREAMREADER error (error type) Macro for implementing the callback function of SFXWideStringStreamReader class
XALLBACK_IMPLEMENT_SFXWIDESTRINGSTREAMWRITER error (error type) Macro for implementing the callback function of SFXWideStringStreamWriter class
XALLBACK_IMPLEMENT_SFXBINARYSTREAMREADER error (error type) Macro for implementing the callback function of SFXBinaryStreamReader class
XALLBACK_IMPLEMENT_SFXBINARYSTREAMWRITER error (error type) Macro for implementing the callback function of SFXBinaryStreamWriter class
XALLBACK_IMPLEMENT_SFXELASTICSTREAMREADER error (error type) Macro for implementing the callback function of SFXElasticStreamReader class
XALLBACK_IMPLEMENT_SFXELASTICSTREAMWRITER error (error type) Macro for implementing the callback function of SFXElasticStreamWriter class

Table 25.18. Macro for callback implementation ( storage)

Macro 3rd argument Meaning
XALLBACK_IMPLEMENT_SFXFILE error (error type) Macro for implementing the callback function of SFXFile class
XALLBACK_IMPLEMENT_SFXHTTPCONNECTION error (error type) Macro for implementing the callback function of SFXHTTPConnection class
XALLBACK_IMPLEMENT_SFXTCPSOCKET error (error type) Macro for implementing the callback function of SFXTCPSocket class
XALLBACK_IMPLEMENT_SFXSSLSOCKET error (error type) Macro for implementing the callback function of SFXSSLSocket class
XALLBACK_IMPLEMENT_SFXSOURCE error (error type) Macro for implementing the callback function of SFXSource class
XALLBACK_IMPLEMENT_SFXZIPDECODER error (error type) Macro for implementing the callback function of SFXZIPDecoder class

Table 25.19. Macro for callback implementation (other utilities)

Macro 3rd argument Meaning
XALLBACK_IMPLEMENT_SFXCALLBACK none Macro for implementing the callback function of SFXCallback class
XALLBACK_IMPLEMENT_SFXTASK none Macro for implementing the callback function of SFXTask class
XALLBACK_IMPLEMENT_SFXTIMER none Macro for implementing the callback function of SFXTimer class
XALLBACK_IMPLEMENT_SFXEDITOR error(error type) Macro for implementing the callback function of SFXEditor class, which is called after the native text input
XALLBACK_IMPLEMENT_SFCAPPLICATION event(SFXEventConstRef type) Macro for implementing the callback function of SFCApplication class, which is called by receiving an event during the registration of the highest priority event handler
XALLBACK_IMPLEMENT_SFYAPPLICATION SFXEventConstRef Macro for implementing the callback function of SFYApplication class, which inherits from the XALLBACK_IMPLEMENT_SFCAPPLICATION macro and is the same as the XALLBACK_IMPLEMENT_SFCAPPLICATION macro
[Note]
1st argument is the class name, 2nd argument is the name of callback function, and 3rd argument depends on the type of callback function.
[Note] About the return value of 3rd argument of error type

The error value defined in the "AEEError.h" during connection or sending/receiveing data will be returned.

25.4.3. Macro for registering the callback function

The callback function is registered using the macro of which name starts with XALLBACK_. In almost case, the XALLBACK_INTERNAL macro is used to register a callback function.

Table 25.20. Macro for registering the callback function

Macro Meaning
XALLBACK_INTERNAL Pass the pointer to the callback function and the reference to the internal instance.
XALLBACK_EXTERNAL Pass the pointer to the callback function and the reference to the external instance.
XALLBACK_NULL Regard the callback function as being executed though the actual callback function will not be called.
[Note] Note
The name of callback function is specified as an argument.

25.4.3.1. XALLBACK_FUNCTION macro

The XALLBACK_FUNCTION is a macro to get the entry name of a callback function, defined as follows:

#define    XALLBACK_FUNCTION(FUNCTION)    FUNCTION##SCP

Table 25.21. Macro argument

No. Content Description
1 function name member function name to get the entry name of a callback function

25.4.3.2. XALLBACK_INTERNAL macro

The XALLBACK_INTERNAL is a macro to get the pointer to a callback function and the reference to its internal instance, defined as follows:

This macro is used when registering a callback function with the pointer to a callback function and the reference to its internal instance.

#define    XALLBACK_INTERNAL(FUNCTION)    (XALLBACK_FUNCTION(FUNCTION)), (this)

Table 25.22. Macro argument

No. Content Description
1 function name member function name to get the entry name of a callback function

25.4.3.3. XALLBACK_EXTERNAL macro

The XALLBACK_EXTERNAL is a macro to get the pointer to a callback function and the reference to an external instance, defined as follows:

This macro is used when registering a callback function with the pointer to a callback function and the reference to an external instance.

#define    XALLBACK_EXTERNAL(FUNCTION, REFERENCE)    (XALLBACK_FUNCTION(FUNCTION)), ((REFERENCE))

Table 25.23. Macro argument

No. Content Description
1 function name member function name to get the entry name of a callback function
2 instance variable name variable name for an external instance
[Note] XALLBACK_INTERNAL macro and XALLBACK_EXTERNAL macro

When a callback function refers to the same class instance, you get the callback function with the XALLBACK_INTERNAL macro. At this time, the callback function is automatically expanded into a sentence with the this variable.

When a callback function refers to the external class instance, you get the callback function with the XALLBACK_EXTERNAL macro. At this time, the callback function is automatically expanded into a sentence with the instance variable of external class specified with an argument.

Since almost all callback functions refer to the same class instance, the XALLBACK_INTERNAL macro is used in almost case.

In case the this variable cannot be used because of inside the static function etc., or not the this variable but an external class instance should be passed, the XALLBACK_EXTERNAL macro is used

25.4.3.4. XALLBACK_NULL macro

The XALLBACK_NULL is a macro to get a null callback function, defined as follows:

Though any actual callback function is never called, the callback function is regarded as being handled.

#define    XALLBACK_NULL    (null), (null)