ctkNetworkConnector.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * ctkNetworkConnector.h
  3. * ctkEventBus
  4. *
  5. * Created by Daniele Giunchi on 11/04/10.
  6. * Copyright 2009 B3C. All rights reserved.
  7. *
  8. * See Licence at: http://tiny.cc/QXJ4D
  9. *
  10. */
  11. #ifndef CTKNETWORKCONNECTOR_H
  12. #define CTKNETWORKCONNECTOR_H
  13. //include list
  14. #include "ctkEventDefinitions.h"
  15. namespace ctkEventBus {
  16. /**
  17. Class name: ctkNetworkConnector
  18. This class is the interface class for client/server objects that works over network.
  19. */
  20. class org_commontk_eventbus_EXPORT ctkNetworkConnector : public QObject {
  21. Q_OBJECT
  22. Q_PROPERTY(QString protocol READ protocol);
  23. public:
  24. /// object constructor.
  25. ctkNetworkConnector();
  26. /// create the unique instance of the client.
  27. virtual void createClient(const QString hostName, const unsigned int port) = 0;
  28. /// create the unique instance of the server.
  29. virtual void createServer(const unsigned int port) = 0;
  30. /// Start the server.
  31. virtual void startListen() = 0;
  32. /// Allow to send a network request.
  33. virtual void send(const QString event_id, ctkEventArgumentsList *argList) = 0;
  34. /// retrieve an instance of the object
  35. virtual ctkNetworkConnector *clone() = 0;
  36. /// retrieve the protocol type of the connector
  37. QString protocol();
  38. /// register all the signals and slots
  39. virtual void initializeForEventBus() = 0;
  40. Q_SIGNALS:
  41. /// signal for send a message to through network
  42. void remoteCommunication(const QString event_id, ctkEventArgumentsList *argList);
  43. protected:
  44. QString m_Protocol; ///< define the protocol of the connector (xmlrpc, soap, etc...)
  45. };
  46. } //namespace ctkEventBus
  47. #endif // CTKNETWORKCONNECTOR_H