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 | Protected Attributes | List of all members
rstudio::launcher_plugins::api::AbstractMultiStream< R, Args > Class Template Referenceabstract

Manages the sending of streamed responses. More...

#include <AbstractMultiStream.hpp>

Inheritance diagram for rstudio::launcher_plugins::api::AbstractMultiStream< R, Args >:
rstudio::launcher_plugins::Noncopyable

Public Member Functions

 AbstractMultiStream (comms::AbstractLauncherCommunicatorPtr in_launcherCommunicator)
 Constructor. More...
 
virtual void addRequest (uint64_t in_requestId, const system::User &in_requestUser)=0
 Adds a request to the stream. More...
 
virtual Error initialize ()=0
 Initializes the response stream. More...
 
bool isEmpty () const
 Checks whether there are any requests listening to this stream. More...
 
virtual void removeRequest (uint64_t in_requestId)
 Removes a request from the multi-stream response. 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

void onAddRequest (uint64_t in_requestId)
 Adds a new request ID to the multi-stream response. More...
 
void onRemoveRequest (uint64_t in_requestId)
 Removes a request from the multi-stream response. More...
 
void sendResponse (Args... in_responseArgs)
 Sends a response to the Launcher for all requests. More...
 
void sendResponse (const std::set< uint64_t > &in_requestIds, Args... in_responseArgs)
 Sends a response to the Launcher for the specified requests. More...
 

Protected Attributes

std::mutex m_mutex
 

Detailed Description

template<typename R, typename ... Args>
class rstudio::launcher_plugins::api::AbstractMultiStream< R, Args >

Manages the sending of streamed responses.

Template Parameters
RThe Response type which should be sent.
Parameters
ArgsThe additional constructor parameters of R, besides the request and sequence IDs.

Constructor & Destructor Documentation

◆ AbstractMultiStream()

template<typename R, typename ... Args>
rstudio::launcher_plugins::api::AbstractMultiStream< R, Args >::AbstractMultiStream ( comms::AbstractLauncherCommunicatorPtr  in_launcherCommunicator)
explicit

Constructor.

Parameters
in_launcherCommunicatorThe launcher communicator which will send the responses.

Member Function Documentation

◆ addRequest()

template<typename R, typename ... Args>
virtual void rstudio::launcher_plugins::api::AbstractMultiStream< R, Args >::addRequest ( uint64_t  in_requestId,
const system::User in_requestUser 
)
pure virtual

Adds a request to the stream.

Parameters
in_requestIdThe ID of the request.
in_requestUserThe user who made the request.

Implemented in rstudio::launcher_plugins::api::AbstractResourceStream.

◆ initialize()

template<typename R, typename ... Args>
virtual Error rstudio::launcher_plugins::api::AbstractMultiStream< R, Args >::initialize ( )
pure virtual

◆ isEmpty()

template<typename R, typename ... Args>
bool rstudio::launcher_plugins::api::AbstractMultiStream< R, Args >::isEmpty ( ) const

Checks whether there are any requests listening to this stream.

Returns
True if this stream has any requests; false otherwise.

◆ onAddRequest()

template<typename R, typename ... Args>
void rstudio::launcher_plugins::api::AbstractMultiStream< R, Args >::onAddRequest ( uint64_t  in_requestId)
protected

Adds a new request ID to the multi-stream response.

NOTE: The mutex must be held when this is called.

Parameters
in_requestIdThe request ID which is listening to this response stream.

◆ onRemoveRequest()

template<typename R, typename ... Args>
void rstudio::launcher_plugins::api::AbstractMultiStream< R, Args >::onRemoveRequest ( uint64_t  in_requestId)
protected

Removes a request from the multi-stream response.

NOTE: The mutex must be held when this is called.

Parameters
in_requestIdThe request ID which has stopped listening to this response stream.

◆ removeRequest()

template<typename R, typename ... Args>
virtual void rstudio::launcher_plugins::api::AbstractMultiStream< R, Args >::removeRequest ( uint64_t  in_requestId)
virtual

Removes a request from the multi-stream response.

Parameters
in_requestIdThe request ID which has stopped listening to this response stream.

◆ sendResponse() [1/2]

template<typename R, typename ... Args>
void rstudio::launcher_plugins::api::AbstractMultiStream< R, Args >::sendResponse ( Args...  in_responseArgs)
protected

Sends a response to the Launcher for all requests.

NOTE: The mutex must be held when this is called.

Parameters
in_responseArgsThe details of the response, if any.

◆ sendResponse() [2/2]

template<typename R, typename ... Args>
void rstudio::launcher_plugins::api::AbstractMultiStream< R, Args >::sendResponse ( const std::set< uint64_t > &  in_requestIds,
Args...  in_responseArgs 
)
protected

Sends a response to the Launcher for the specified requests.

NOTE: The mutex must be held when this is called.

Parameters
in_requestIdsSends the response only for the specified request IDs.
in_responseArgsThe details of the response, if any.

Member Data Documentation

◆ m_mutex

template<typename R, typename ... Args>
std::mutex rstudio::launcher_plugins::api::AbstractMultiStream< R, Args >::m_mutex
mutableprotected

Mutex to protect shared state of the stream.


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