RStudio Launcher Plugin SDK  1.1.3
A software development kit for creating plugins that work the the RStudio Launcher.
Public Member Functions | Protected Member Functions | List of all members
rstudio::launcher_plugins::comms::AbstractLauncherCommunicator Class Referenceabstract

Base class responsible for communicating the the launcher. The type of communication is implementation dependent. More...

#include <AbstractLauncherCommunicator.hpp>

Inheritance diagram for rstudio::launcher_plugins::comms::AbstractLauncherCommunicator:
rstudio::launcher_plugins::Noncopyable

Public Member Functions

virtual ~AbstractLauncherCommunicator ()=default
 Virtual destructor to allow for inheritance.
 
void registerRequestHandler (std::unique_ptr< RequestHandler > &&in_requestHandler)
 Registers a request handler for all requests. More...
 
void sendResponse (const api::Response &in_response)
 Sends the response to the RStudio Launcher. More...
 
virtual Error start ()
 Starts the communicator. More...
 
virtual void stop ()
 Stops the communicator. More...
 
virtual void waitForExit ()
 Blocks until the communicator has successfully stopped. More...
 
- Public Member Functions inherited from rstudio::launcher_plugins::Noncopyable
 Noncopyable ()=default
 Default constructor.
 
 Noncopyable (const Noncopyable &)=delete
 Deleted copy constructor.
 
Noncopyableoperator= (const Noncopyable &)=delete
 Deleted assignment operator.
 

Protected Member Functions

 AbstractLauncherCommunicator (size_t in_maxMessageSize, const OnError &in_onError)
 Constructor. More...
 
void reportError (const Error &in_error)
 Reports an error and stops the communicator. More...
 
void onDataReceived (const char *in_data, size_t in_length)
 Handles data that is received from the RStudio Launcher. More...
 
template<typename Derived >
std::shared_ptr< Derived > shared_from_derived ()
 

Detailed Description

Base class responsible for communicating the the launcher. The type of communication is implementation dependent.

Constructor & Destructor Documentation

◆ AbstractLauncherCommunicator()

rstudio::launcher_plugins::comms::AbstractLauncherCommunicator::AbstractLauncherCommunicator ( size_t  in_maxMessageSize,
const OnError in_onError 
)
protected

Constructor.

Parameters
in_maxMessageSizeThe maximum allowable size of a message which can be received from or sent to the RStudio Launcher.
in_onErrorError handler to allow the creator of this communicator to receive communications errors.

Member Function Documentation

◆ onDataReceived()

void rstudio::launcher_plugins::comms::AbstractLauncherCommunicator::onDataReceived ( const char *  in_data,
size_t  in_length 
)
protected

Handles data that is received from the RStudio Launcher.

Parameters
in_dataThe data received from the RStudio Launcher.
in_lengthThe length of the data received from the RStudio Launcher.

◆ registerRequestHandler()

void rstudio::launcher_plugins::comms::AbstractLauncherCommunicator::registerRequestHandler ( std::unique_ptr< RequestHandler > &&  in_requestHandler)

Registers a request handler for all requests.

Parameters
in_requestHandlerThe handler for the request.

◆ reportError()

void rstudio::launcher_plugins::comms::AbstractLauncherCommunicator::reportError ( const Error in_error)
protected

Reports an error and stops the communicator.

Parameters
in_errorThe error to report.

◆ sendResponse()

void rstudio::launcher_plugins::comms::AbstractLauncherCommunicator::sendResponse ( const api::Response in_response)

Sends the response to the RStudio Launcher.

Parameters
in_responseThe response to be sent to the RStudio Launcher.

◆ shared_from_derived()

template<typename Derived >
std::shared_ptr<Derived> rstudio::launcher_plugins::comms::AbstractLauncherCommunicator::shared_from_derived ( )
inlineprotected

@breif Template method which allows classes which inherit AbstractLauncherCommunicator to get a shared_ptr to themselves.

Template Parameters
DerivedType of the class which inherits from AbstractLauncherCommunicator.
Returns
A shared_ptr to this derived class.

◆ start()

virtual Error rstudio::launcher_plugins::comms::AbstractLauncherCommunicator::start ( )
virtual

Starts the communicator.

Child classes which override this method should also invoke the base method.

Returns
Success if the communicator could be started; Error otherwise.

◆ stop()

virtual void rstudio::launcher_plugins::comms::AbstractLauncherCommunicator::stop ( )
virtual

Stops the communicator.

Child classes which override this method should also invoke the base method.

◆ waitForExit()

virtual void rstudio::launcher_plugins::comms::AbstractLauncherCommunicator::waitForExit ( )
virtual

Blocks until the communicator has successfully stopped.

Child classes which override this method should also invoke the base method.


The documentation for this class was generated from the following file: