snaplock: snaplock::snaplock_messenger Class Reference

snaplock::snaplock_messenger Class Reference

Handle messages from the Snap Communicator server. More...

#include <snaplock.h>

Inheritance diagram for snaplock::snaplock_messenger:
Collaboration diagram for snaplock::snaplock_messenger:
Public Types typedef std::shared_ptr< snaplock_messengerpointer_t   Public Member Functions  snaplock_messenger (snaplock *sl, std::string const &addr, int port)  The messenger initialization. More...
   snaplock_messenger (snaplock_messenger const &rhs)=delete   virtual ~snaplock_messenger () override   snaplock_messengeroperator= (snaplock_messenger const &rhs)=delete   virtual void process_connected () override  The connection was established with Snap! Communicator. More...
  virtual void process_connection_failed (std::string const &error_message) override  The messenger could not connect to snapcommunicator. More...
  Protected Attributes snaplockf_snaplock = nullptr   Detailed Description

This class is an implementation of the TCP client message connection so we can handle incoming messages.

Definition at line 153 of file snaplock.h.

Member Typedef Documentation
typedef std::shared_ptr<snaplock_messenger> snaplock::snaplock_messenger::pointer_t

Definition at line 157 of file snaplock.h.

Constructor & Destructor Documentation
snaplock::snaplock_messenger::snaplock_messenger ( snaplocksl, std::string const &  addr, int  port  )

The messenger is a connection to the snapcommunicator server.

From the outside, we receive LOCK, UNLOCK, STOP, and LOG messages. We implement a few other generic messages too (HELP, READY...) Then we support "internal" messages that each snaplock send to each other such as LOCKENTERING, ADDTICKET, etc.

We use a permanent connection so if the snapcommunicator restarts for whatever reason, we reconnect automatically.

[in]slThe snaplock server we are listening for. [in]addrThe address to connect to. Most often it is [in]portThe port to listen on (4040).

Definition at line 78 of file snaplock_messenger.cpp.

snaplock::snaplock_messenger::snaplock_messenger ( snaplock_messenger const &  rhs) delete
virtual snaplock::snaplock_messenger::~snaplock_messenger ( ) inlineoverridevirtual

Definition at line 161 of file snaplock.h.

Member Function Documentation
snaplock_messenger& snaplock::snaplock_messenger::operator= ( snaplock_messenger const &  rhs) delete
void snaplock::snaplock_messenger::process_connected ( ) overridevirtual

Whenever the connection is established with the Snap! Communicator, this callback function is called.

The messenger reacts by REGISTERing the snaplock with the Snap! Communicator.

Reimplemented in snaplock::snaplock_tool.

Definition at line 113 of file snaplock_messenger.cpp.

void snaplock::snaplock_messenger::process_connection_failed ( std::string const &  error_message) overridevirtual

This function is called whenever the messengers fails to connect to the snapcommunicator server. This could be because snapcommunicator is not running or because the configuration information for the snaplock is wrong...

[in]error_messageAn error message.

Reimplemented in snaplock::snaplock_tool.

Definition at line 95 of file snaplock_messenger.cpp.

Member Data Documentation
The documentation for this class was generated from the following files:

This document is part of the Snap! Websites Project.

Copyright by Made to Order Software Corp.

Syndicate content

Snap! Websites
An Open Source CMS System in C++

Contact Us Directly