REC RPC library
|
#include "rec/rpc/serialization/rec_rpc_serialization_TopicInfo.h"
#include "rec/rpc/rec_rpc_Exception.h"
#include "rec/rpc/defines.h"
#include <QHostAddress>
Go to the source code of this file.
Classes | |
struct | rec::rpc::TopicListenerBase |
topic listener wrapper interface More... | |
Namespaces | |
rec | |
rec::rpc | |
Macros | |
#define | DECLARE_TOPICLISTENER(TOPICNAME) |
Declare a topic listener in the server or client class definition. More... | |
#define | BEGIN_TOPICLISTENER_DEFINITION(CLASSNAME, TOPICNAME) |
Begin the implementation of a topic listener. More... | |
#define | END_TOPICLISTENER_DEFINITION } |
End of a topic listener implementation. More... | |
#define | REGISTER_TOPICLISTENER(TOPICNAME) registerTopicListener( #TOPICNAME, createTopic##TOPICNAME##Listener() ); |
Register a topic listener. More... | |
#define | UNREGISTER_TOPICLISTENER(TOPICNAME) unregisterTopicListener( #TOPICNAME ); |
Unregister a topic listener. More... | |
#define | IS_TOPICLISTENER_REGISTERED(TOPICNAME) isTopicListenerRegistered( #TOPICNAME ); |
Check if a topic listener for a given topic is registered. More... | |
#define | DECLARE_TOPICINFOCHANGED(TOPICNAME) |
Declare a topic info listener in the server or client class definition. More... | |
#define | BEGIN_TOPICINFOCHANGED_DEFINITION(CLASSNAME, TOPICNAME) |
Begin the implementation of a topic info listener. More... | |
#define | END_TOPICINFOCHANGED_DEFINITION } |
End of a topic info listener implementation. More... | |
#define | REGISTER_TOPICINFOCHANGED(TOPICNAME) registerTopicListener( #TOPICNAME "__info", createTopic##TOPICNAME##InfoChanged() ); |
Register a topic info listener. More... | |
#define | UNREGISTER_TOPICINFOCHANGED(TOPICNAME) unregisterTopicListener( #TOPICNAME "__info" ); |
Unregister a topic info listener. More... | |
#define | IS_TOPICINFOCHANGED_REGISTERED(TOPICNAME) isTopicListenerRegistered( #TOPICNAME "__info" ); |
Check if a topic info listener for a given topic is registered. More... | |
#define | PREPARE_TOPIC(TOPICNAME) |
#define | PUBLISH_TOPIC publishTopic( topicName, dataPtr ); |
#define | PUBLISH_TOPIC_SIMPLE(TOPICNAME, DATA) publishTopic( #TOPICNAME, rec::rpc::detail::createSerializable< topic##TOPICNAME##Data >( DATA ) ); |
#define | PUBLISH_TOPIC_SIMPLE_EMPTY(TOPICNAME) publishTopic( #TOPICNAME, rec::rpc::detail::createSerializable< rec::rpc::serialization::Serializable >() ); |
Functions | |
REC_RPC_EXPORT int | rec::rpc::getLibraryMajorVersion () |
Get the library's major version. More... | |
REC_RPC_EXPORT int | rec::rpc::getLibraryMinorVersion () |
Get the library's minor version. More... | |
REC_RPC_EXPORT int | rec::rpc::getLibraryPatchVersion () |
Get the library's patch version. More... | |
REC_RPC_EXPORT QString | rec::rpc::getLibraryVersionSuffix () |
Get the library's version suffix. More... | |
REC_RPC_EXPORT int | rec::rpc::getLibraryDate () |
Get the library's version date. More... | |
REC_RPC_EXPORT void | rec::rpc::getLibraryVersion (int *major, int *minor, int *patch, QString *suffix, int *date) |
Get the library's version. More... | |
REC_RPC_EXPORT QString | rec::rpc::getLibraryVersionString () |
Get the library's version as string. More... | |
Variables | |
const int | rec::rpc::defaultPort = 9280 |
The TCP port which will be used by default if no other one is specified. More... | |
#define BEGIN_TOPICINFOCHANGED_DEFINITION | ( | CLASSNAME, | |
TOPICNAME | |||
) |
Begin the implementation of a topic info listener.
Place this macro above the implementation of a topic info listener. The topic info is accessible via "info". Data type is rec::rpc::ClientInfoSet. If an error occurred, the error code is stored in errorCode.
CLASSNAME | Name of your server or client class. |
TOPICNAME | Name of the topic (without qoutes). |
Definition at line 335 of file rec_rpc_common.h.
#define BEGIN_TOPICLISTENER_DEFINITION | ( | CLASSNAME, | |
TOPICNAME | |||
) |
Begin the implementation of a topic listener.
Place this macro above the implementation of a topic listener. The topic data are accessible via "data". The type of "data" is topic<TOPICNAME>Data. This type name must be defined and derived from Serializable. The IP address and the TCP port of the calling client are accessible via "client" (type rec::rpc::ClientInfo). If an error occurred, the error code is stored in errorCode.
CLASSNAME | Name of your server or client class. |
TOPICNAME | Name of the RPC function (without qoutes). |
Definition at line 242 of file rec_rpc_common.h.
#define DECLARE_TOPICINFOCHANGED | ( | TOPICNAME | ) |
Declare a topic info listener in the server or client class definition.
Use this macro to declare a topic info listener in the definition of your own server or client class derived from rec::rpc::Server or rec::rpc::Client. All code which is necessary to register and invoke the topic listener is inserted automatically. A topic info listener notifies you when a client registers or unregisters a topic listener for a topic.
TOPICNAME | Name of the topic (without qoutes). |
Definition at line 313 of file rec_rpc_common.h.
#define DECLARE_TOPICLISTENER | ( | TOPICNAME | ) |
Declare a topic listener in the server or client class definition.
Use this macro to declare a topic listener in the definition of your own server or client class derived from rec::rpc::Server or rec::rpc::Client. All code which is necessary to register and invoke the topic listener is inserted automatically.
TOPICNAME | Name of the topic (without qoutes). |
Definition at line 222 of file rec_rpc_common.h.
#define END_TOPICINFOCHANGED_DEFINITION } |
End of a topic info listener implementation.
Definition at line 361 of file rec_rpc_common.h.
#define END_TOPICLISTENER_DEFINITION } |
End of a topic listener implementation.
Definition at line 268 of file rec_rpc_common.h.
#define IS_TOPICINFOCHANGED_REGISTERED | ( | TOPICNAME | ) | isTopicListenerRegistered( #TOPICNAME "__info" ); |
Check if a topic info listener for a given topic is registered.
TOPICNAME | Name of the topic (without quotes). |
Definition at line 394 of file rec_rpc_common.h.
#define IS_TOPICLISTENER_REGISTERED | ( | TOPICNAME | ) | isTopicListenerRegistered( #TOPICNAME ); |
Check if a topic listener for a given topic is registered.
TOPICNAME | Name of the topic (without quotes). |
Definition at line 302 of file rec_rpc_common.h.
#define PREPARE_TOPIC | ( | TOPICNAME | ) |
This macro declares and initializes the topic data for a topic to be published. Below this macro, the topic data can be modified. It is accessibla via "data". After adpting the topic data, PUBLISH_TOPIC must be called (without parameter).
TOPICNAME | Name of the topic. |
Definition at line 405 of file rec_rpc_common.h.
#define PUBLISH_TOPIC publishTopic( topicName, dataPtr ); |
This macro calls publishTopic() with the appropriate topic name and data. PREPARE_TOPIC must be above this macro!
rec::rpc::Exception | Error codes: NoConnection, NoSuchTopic, AccessDenied. |
Definition at line 418 of file rec_rpc_common.h.
#define PUBLISH_TOPIC_SIMPLE | ( | TOPICNAME, | |
DATA | |||
) | publishTopic( #TOPICNAME, rec::rpc::detail::createSerializable< topic##TOPICNAME##Data >( DATA ) ); |
This macro declares and initializes the topic data for a topic to be published. It can be used if the topic data is only one single value. It calls publishTopic() with the appropriate topic name and data.
TOPICNAME | Name of the topic. |
DATA | The single topic data value. |
rec::rpc::Exception | Error codes: NoConnection, NoSuchTopic, AccessDenied. |
Definition at line 432 of file rec_rpc_common.h.
#define PUBLISH_TOPIC_SIMPLE_EMPTY | ( | TOPICNAME | ) | publishTopic( #TOPICNAME, rec::rpc::detail::createSerializable< rec::rpc::serialization::Serializable >() ); |
Definition at line 434 of file rec_rpc_common.h.
#define REGISTER_TOPICINFOCHANGED | ( | TOPICNAME | ) | registerTopicListener( #TOPICNAME "__info", createTopic##TOPICNAME##InfoChanged() ); |
Register a topic info listener.
This method is used to add a topic info listener that is invoked when a client registers or unregisters a topic listener for a topic.
TOPICNAME | Name of the topic (without quotes). |
rec::rpc::Exception | Error codes: NoSuchTopic. |
Definition at line 374 of file rec_rpc_common.h.
#define REGISTER_TOPICLISTENER | ( | TOPICNAME | ) | registerTopicListener( #TOPICNAME, createTopic##TOPICNAME##Listener() ); |
Register a topic listener.
This method is used to add a topic listener that is invoked when the data of a topic change. It creates the wrapper object and calls registerTopicListener automatically.
TOPICNAME | Name of the topic (without quotes). |
rec::rpc::Exception | Error codes: NoSuchTopic. |
Definition at line 282 of file rec_rpc_common.h.
#define UNREGISTER_TOPICINFOCHANGED | ( | TOPICNAME | ) | unregisterTopicListener( #TOPICNAME "__info" ); |
Unregister a topic info listener.
This macro is used to remove a topic info listener.
TOPICNAME | Name of the topic (without quotes). |
Definition at line 385 of file rec_rpc_common.h.
#define UNREGISTER_TOPICLISTENER | ( | TOPICNAME | ) | unregisterTopicListener( #TOPICNAME ); |
Unregister a topic listener.
This macro is used to remove a topic listener.
TOPICNAME | Name of the topic (without quotes). |
Definition at line 293 of file rec_rpc_common.h.