LibreOffice Module binaryurp (master) 1
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
binaryurp::Bridge Class Reference

#include <bridge.hxx>

Inheritance diagram for binaryurp::Bridge:
[legend]
Collaboration diagram for binaryurp::Bridge:
[legend]

Classes

struct  SubStub
 

Public Member Functions

 Bridge (rtl::Reference< BridgeFactory > const &factory, OUString name, com::sun::star::uno::Reference< com::sun::star::connection::XConnection > const &connection, com::sun::star::uno::Reference< com::sun::star::bridge::XInstanceProvider > provider)
 
void start ()
 
void terminate (bool final)
 
const com::sun::star::uno::Reference< com::sun::star::connection::XConnection > & getConnection () const
 
const com::sun::star::uno::Reference< com::sun::star::bridge::XInstanceProvider > & getProvider () const
 
com::sun::star::uno::Mapping & getCppToBinaryMapping ()
 
BinaryAny mapCppToBinaryAny (com::sun::star::uno::Any const &cppAny)
 
uno_ThreadPool getThreadPool ()
 
rtl::Reference< WritergetWriter ()
 
com::sun::star::uno::UnoInterfaceReference registerIncomingInterface (OUString const &oid, com::sun::star::uno::TypeDescription const &type)
 
OUString registerOutgoingInterface (com::sun::star::uno::UnoInterfaceReference const &object, com::sun::star::uno::TypeDescription const &type)
 
com::sun::star::uno::UnoInterfaceReference findStub (OUString const &oid, com::sun::star::uno::TypeDescription const &type)
 
void releaseStub (OUString const &oid, com::sun::star::uno::TypeDescription const &type)
 
void resurrectProxy (Proxy &proxy)
 
void revokeProxy (Proxy &proxy)
 
void freeProxy (Proxy &proxy)
 
void incrementCalls (bool normalCall) noexcept
 
void decrementCalls ()
 
void incrementActiveCalls () noexcept
 
void decrementActiveCalls () noexcept
 
bool makeCall (OUString const &oid, com::sun::star::uno::TypeDescription const &member, bool setter, std::vector< BinaryAny > &&inArguments, BinaryAny *returnValue, std::vector< BinaryAny > *outArguments)
 
void sendRequestChangeRequest ()
 
void handleRequestChangeReply (bool exception, BinaryAny const &returnValue)
 
void handleCommitChangeReply (bool exception, BinaryAny const &returnValue)
 
void handleRequestChangeRequest (rtl::ByteSequence const &tid, std::vector< BinaryAny > const &inArguments)
 
void handleCommitChangeRequest (rtl::ByteSequence const &tid, std::vector< BinaryAny > const &inArguments)
 
OutgoingRequest lastOutgoingRequest (rtl::ByteSequence const &tid)
 
bool isProtocolPropertiesRequest (std::u16string_view oid, com::sun::star::uno::TypeDescription const &type) const
 
void setCurrentContextMode ()
 
bool isCurrentContextMode ()
 

Private Types

enum  State {
  STATE_INITIAL ,
  STATE_STARTED ,
  STATE_TERMINATED ,
  STATE_FINAL
}
 
enum  Mode {
  MODE_REQUESTED ,
  MODE_REPLY_MINUS1 ,
  MODE_REPLY_0 ,
  MODE_REPLY_1 ,
  MODE_WAIT ,
  MODE_NORMAL ,
  MODE_NORMAL_WAIT
}
 
typedef std::vector< com::sun::star::uno::Reference< com::sun::star::lang::XEventListener > > Listeners
 
typedef std::map< com::sun::star::uno::TypeDescription, SubStubStub
 
typedef std::map< OUString, StubStubs
 

Private Member Functions

 Bridge (const Bridge &)=delete
 
Bridgeoperator= (const Bridge &)=delete
 
virtual ~Bridge () override
 
virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL getInstance (OUString const &sInstanceName) override
 
virtual OUString SAL_CALL getName () override
 
virtual OUString SAL_CALL getDescription () override
 
virtual void SAL_CALL dispose () override
 
virtual void SAL_CALL addEventListener (com::sun::star::uno::Reference< com::sun::star::lang::XEventListener > const &xListener) override
 
virtual void SAL_CALL removeEventListener (com::sun::star::uno::Reference< com::sun::star::lang::XEventListener > const &aListener) override
 
void sendCommitChangeRequest ()
 
void sendProtPropRequest (OutgoingRequest::Kind kind, std::vector< BinaryAny > const &inArguments)
 
void makeReleaseCall (OUString const &oid, com::sun::star::uno::TypeDescription const &type)
 
void sendRequest (rtl::ByteSequence const &tid, OUString const &oid, com::sun::star::uno::TypeDescription const &type, com::sun::star::uno::TypeDescription const &member, std::vector< BinaryAny > &&inArguments)
 
void throwException (bool exception, BinaryAny const &value)
 
com::sun::star::uno::Any mapBinaryToCppAny (BinaryAny const &binaryAny)
 
bool becameUnused () const
 
void terminateWhenUnused (bool unused)
 
void checkDisposed ()
 

Private Attributes

rtl::Reference< BridgeFactoryfactory_
 
OUString name_
 
com::sun::star::uno::Reference< com::sun::star::connection::XConnection > connection_
 
com::sun::star::uno::Reference< com::sun::star::bridge::XInstanceProvider > provider_
 
com::sun::star::uno::Environment binaryUno_
 
com::sun::star::uno::Mapping cppToBinaryMapping_
 
com::sun::star::uno::Mapping binaryToCppMapping_
 
rtl::ByteSequence protPropTid_
 
OUString protPropOid_
 
com::sun::star::uno::TypeDescription protPropType_
 
com::sun::star::uno::TypeDescription protPropRequest_
 
com::sun::star::uno::TypeDescription protPropCommit_
 
OutgoingRequests outgoingRequests_
 
osl::Condition passive_
 
osl::Condition terminated_
 
std::mutex mutex_
 
State state_
 
Listeners listeners_
 
uno_ThreadPool threadPool_
 
rtl::Reference< Writerwriter_
 
rtl::Reference< Readerreader_
 
bool currentContextMode_
 
Stubs stubs_
 
std::size_t proxies_
 
std::size_t calls_
 
bool normalCall_
 
std::size_t activeCalls_
 
Mode mode_
 
sal_Int32 random_
 

Detailed Description

Definition at line 67 of file bridge.hxx.

Member Typedef Documentation

◆ Listeners

typedef std::vector< com::sun::star::uno::Reference< com::sun::star::lang::XEventListener > > binaryurp::Bridge::Listeners
private

Definition at line 225 of file bridge.hxx.

◆ Stub

typedef std::map< com::sun::star::uno::TypeDescription, SubStub > binaryurp::Bridge::Stub
private

Definition at line 229 of file bridge.hxx.

◆ Stubs

typedef std::map< OUString, Stub > binaryurp::Bridge::Stubs
private

Definition at line 231 of file bridge.hxx.

Member Enumeration Documentation

◆ Mode

Enumerator
MODE_REQUESTED 
MODE_REPLY_MINUS1 
MODE_REPLY_0 
MODE_REPLY_1 
MODE_WAIT 
MODE_NORMAL 
MODE_NORMAL_WAIT 

Definition at line 235 of file bridge.hxx.

◆ State

Enumerator
STATE_INITIAL 
STATE_STARTED 
STATE_TERMINATED 
STATE_FINAL 

Definition at line 233 of file bridge.hxx.

Constructor & Destructor Documentation

◆ Bridge() [1/2]

binaryurp::Bridge::Bridge ( rtl::Reference< BridgeFactory > const &  factory,
OUString  name,
com::sun::star::uno::Reference< com::sun::star::connection::XConnection > const &  connection,
com::sun::star::uno::Reference< com::sun::star::bridge::XInstanceProvider >  provider 
)

◆ Bridge() [2/2]

binaryurp::Bridge::Bridge ( const Bridge )
privatedelete

◆ ~Bridge()

binaryurp::Bridge::~Bridge ( )
overrideprivatevirtual

Definition at line 838 of file bridge.cxx.

References dispose(), mutex_, name_, SAL_WARN_IF, state_, STATE_STARTED, and STATE_TERMINATED.

Member Function Documentation

◆ addEventListener()

void binaryurp::Bridge::addEventListener ( com::sun::star::uno::Reference< com::sun::star::lang::XEventListener > const &  xListener)
overrideprivatevirtual

Definition at line 925 of file bridge.cxx.

References listeners_, mutex_, state_, STATE_INITIAL, and STATE_STARTED.

◆ becameUnused()

bool binaryurp::Bridge::becameUnused ( ) const
private

Definition at line 1030 of file bridge.cxx.

References calls_, normalCall_, proxies_, and stubs_.

Referenced by decrementCalls(), freeProxy(), and releaseStub().

◆ checkDisposed()

void binaryurp::Bridge::checkDisposed ( )
private

Definition at line 1043 of file bridge.cxx.

References state_, STATE_INITIAL, and STATE_STARTED.

Referenced by getThreadPool(), and getWriter().

◆ decrementActiveCalls()

void binaryurp::Bridge::decrementActiveCalls ( )
noexcept

Definition at line 578 of file bridge.cxx.

References activeCalls_, mutex_, and passive_.

Referenced by makeCall().

◆ decrementCalls()

void binaryurp::Bridge::decrementCalls ( )

◆ dispose()

void binaryurp::Bridge::dispose ( void  )
overrideprivatevirtual

Definition at line 912 of file bridge.cxx.

References passive_, and terminate().

Referenced by ~Bridge().

◆ findStub()

css::uno::UnoInterfaceReference binaryurp::Bridge::findStub ( OUString const &  oid,
com::sun::star::uno::TypeDescription const &  type 
)

Definition at line 459 of file bridge.cxx.

References i, mutex_, stubs_, type, and typelib_typedescription_isAssignableFrom().

Referenced by registerIncomingInterface().

◆ freeProxy()

void binaryurp::Bridge::freeProxy ( Proxy proxy)

◆ getConnection()

const com::sun::star::uno::Reference< com::sun::star::connection::XConnection > & binaryurp::Bridge::getConnection ( ) const
inline

Definition at line 90 of file bridge.hxx.

References connection_.

◆ getCppToBinaryMapping()

com::sun::star::uno::Mapping & binaryurp::Bridge::getCppToBinaryMapping ( )
inline

Definition at line 95 of file bridge.hxx.

References cppToBinaryMapping_.

◆ getDescription()

OUString binaryurp::Bridge::getDescription ( )
overrideprivatevirtual

Definition at line 907 of file bridge.cxx.

References connection_, and name_.

◆ getInstance()

css::uno::Reference< css::uno::XInterface > binaryurp::Bridge::getInstance ( OUString const &  sInstanceName)
overrideprivatevirtual

◆ getName()

OUString binaryurp::Bridge::getName ( )
overrideprivatevirtual

Definition at line 903 of file bridge.cxx.

References name_.

◆ getProvider()

const com::sun::star::uno::Reference< com::sun::star::bridge::XInstanceProvider > & binaryurp::Bridge::getProvider ( ) const
inline

Definition at line 93 of file bridge.hxx.

References provider_.

◆ getThreadPool()

uno_ThreadPool binaryurp::Bridge::getThreadPool ( )

Definition at line 365 of file bridge.cxx.

References checkDisposed(), mutex_, and threadPool_.

Referenced by makeCall().

◆ getWriter()

rtl::Reference< Writer > binaryurp::Bridge::getWriter ( )

◆ handleCommitChangeReply()

void binaryurp::Bridge::handleCommitChangeReply ( bool  exception,
BinaryAny const &  returnValue 
)

◆ handleCommitChangeRequest()

void binaryurp::Bridge::handleCommitChangeRequest ( rtl::ByteSequence const &  tid,
std::vector< BinaryAny > const &  inArguments 
)

◆ handleRequestChangeReply()

void binaryurp::Bridge::handleRequestChangeReply ( bool  exception,
BinaryAny const &  returnValue 
)

◆ handleRequestChangeRequest()

void binaryurp::Bridge::handleRequestChangeRequest ( rtl::ByteSequence const &  tid,
std::vector< BinaryAny > const &  inArguments 
)

◆ incrementActiveCalls()

void binaryurp::Bridge::incrementActiveCalls ( )
noexcept

Definition at line 569 of file bridge.cxx.

References activeCalls_, calls_, mutex_, and passive_.

Referenced by makeCall().

◆ incrementCalls()

void binaryurp::Bridge::incrementCalls ( bool  normalCall)
noexcept

Definition at line 551 of file bridge.cxx.

References calls_, mutex_, and normalCall_.

Referenced by makeCall(), and sendProtPropRequest().

◆ isCurrentContextMode()

bool binaryurp::Bridge::isCurrentContextMode ( )

Definition at line 833 of file bridge.cxx.

References currentContextMode_, and mutex_.

◆ isProtocolPropertiesRequest()

bool binaryurp::Bridge::isProtocolPropertiesRequest ( std::u16string_view  oid,
com::sun::star::uno::TypeDescription const &  type 
) const

Definition at line 822 of file bridge.cxx.

References protPropOid_, protPropType_, and type.

◆ lastOutgoingRequest()

OutgoingRequest binaryurp::Bridge::lastOutgoingRequest ( rtl::ByteSequence const &  tid)

◆ makeCall()

bool binaryurp::Bridge::makeCall ( OUString const &  oid,
com::sun::star::uno::TypeDescription const &  member,
bool  setter,
std::vector< BinaryAny > &&  inArguments,
BinaryAny returnValue,
std::vector< BinaryAny > *  outArguments 
)

◆ makeReleaseCall()

void binaryurp::Bridge::makeReleaseCall ( OUString const &  oid,
com::sun::star::uno::TypeDescription const &  type 
)
private

Definition at line 977 of file bridge.cxx.

References sendRequest(), binaryurp::cache::size, and type.

Referenced by freeProxy(), and registerIncomingInterface().

◆ mapBinaryToCppAny()

css::uno::Any binaryurp::Bridge::mapBinaryToCppAny ( BinaryAny const &  binaryAny)
private

Definition at line 1019 of file bridge.cxx.

References binaryToCppMapping_, in, and uno_copyAndConvertData().

Referenced by handleCommitChangeRequest(), and throwException().

◆ mapCppToBinaryAny()

BinaryAny binaryurp::Bridge::mapCppToBinaryAny ( com::sun::star::uno::Any const &  cppAny)

◆ operator=()

Bridge & binaryurp::Bridge::operator= ( const Bridge )
privatedelete

◆ registerIncomingInterface()

css::uno::UnoInterfaceReference binaryurp::Bridge::registerIncomingInterface ( OUString const &  oid,
com::sun::star::uno::TypeDescription const &  type 
)

Definition at line 379 of file bridge.cxx.

References binaryUno_, findStub(), makeReleaseCall(), mutex_, proxies_, and type.

◆ registerOutgoingInterface()

OUString binaryurp::Bridge::registerOutgoingInterface ( com::sun::star::uno::UnoInterfaceReference const &  object,
com::sun::star::uno::TypeDescription const &  type 
)

Definition at line 412 of file bridge.cxx.

References binaryUno_, i, binaryurp::Proxy::isProxy(), mutex_, SAL_MAX_UINT32, stubs_, and type.

◆ releaseStub()

void binaryurp::Bridge::releaseStub ( OUString const &  oid,
com::sun::star::uno::TypeDescription const &  type 
)

Definition at line 482 of file bridge.cxx.

References becameUnused(), binaryUno_, i, mutex_, stubs_, terminateWhenUnused(), and type.

◆ removeEventListener()

void binaryurp::Bridge::removeEventListener ( com::sun::star::uno::Reference< com::sun::star::lang::XEventListener > const &  aListener)
overrideprivatevirtual

Definition at line 941 of file bridge.cxx.

References i, listeners_, and mutex_.

◆ resurrectProxy()

void binaryurp::Bridge::resurrectProxy ( Proxy proxy)

Definition at line 516 of file bridge.cxx.

References binaryUno_, binaryurp::Proxy::getOid(), binaryurp::Proxy::getType(), and p.

◆ revokeProxy()

void binaryurp::Bridge::revokeProxy ( Proxy proxy)

Definition at line 527 of file bridge.cxx.

References binaryUno_.

◆ sendCommitChangeRequest()

void binaryurp::Bridge::sendCommitChangeRequest ( )
private

◆ sendProtPropRequest()

void binaryurp::Bridge::sendProtPropRequest ( OutgoingRequest::Kind  kind,
std::vector< BinaryAny > const &  inArguments 
)
private

◆ sendRequest()

void binaryurp::Bridge::sendRequest ( rtl::ByteSequence const &  tid,
OUString const &  oid,
com::sun::star::uno::TypeDescription const &  type,
com::sun::star::uno::TypeDescription const &  member,
std::vector< BinaryAny > &&  inArguments 
)
private

Definition at line 1004 of file bridge.cxx.

References getWriter(), and type.

Referenced by makeCall(), and makeReleaseCall().

◆ sendRequestChangeRequest()

void binaryurp::Bridge::sendRequestChangeRequest ( )

◆ setCurrentContextMode()

void binaryurp::Bridge::setCurrentContextMode ( )

Definition at line 828 of file bridge.cxx.

References currentContextMode_, and mutex_.

Referenced by handleCommitChangeReply(), and handleCommitChangeRequest().

◆ start()

void binaryurp::Bridge::start ( )

◆ terminate()

void binaryurp::Bridge::terminate ( bool  final)

◆ terminateWhenUnused()

void binaryurp::Bridge::terminateWhenUnused ( bool  unused)
private

Definition at line 1034 of file bridge.cxx.

References terminate().

Referenced by decrementCalls(), freeProxy(), and releaseStub().

◆ throwException()

void binaryurp::Bridge::throwException ( bool  exception,
BinaryAny const &  value 
)
private

Member Data Documentation

◆ activeCalls_

std::size_t binaryurp::Bridge::activeCalls_
private

Definition at line 272 of file bridge.hxx.

Referenced by decrementActiveCalls(), and incrementActiveCalls().

◆ binaryToCppMapping_

com::sun::star::uno::Mapping binaryurp::Bridge::binaryToCppMapping_
private

Definition at line 247 of file bridge.hxx.

Referenced by getInstance(), and mapBinaryToCppAny().

◆ binaryUno_

com::sun::star::uno::Environment binaryurp::Bridge::binaryUno_
private

◆ calls_

std::size_t binaryurp::Bridge::calls_
private

Definition at line 270 of file bridge.hxx.

Referenced by becameUnused(), decrementCalls(), incrementActiveCalls(), and incrementCalls().

◆ connection_

com::sun::star::uno::Reference< com::sun::star::connection::XConnection > binaryurp::Bridge::connection_
private

Definition at line 242 of file bridge.hxx.

Referenced by getConnection(), getDescription(), and terminate().

◆ cppToBinaryMapping_

com::sun::star::uno::Mapping binaryurp::Bridge::cppToBinaryMapping_
private

Definition at line 246 of file bridge.hxx.

Referenced by getCppToBinaryMapping(), and mapCppToBinaryAny().

◆ currentContextMode_

bool binaryurp::Bridge::currentContextMode_
private

Definition at line 267 of file bridge.hxx.

Referenced by isCurrentContextMode(), and setCurrentContextMode().

◆ factory_

rtl::Reference< BridgeFactory > binaryurp::Bridge::factory_
private

Definition at line 239 of file bridge.hxx.

Referenced by terminate().

◆ listeners_

Listeners binaryurp::Bridge::listeners_
private

Definition at line 263 of file bridge.hxx.

Referenced by addEventListener(), removeEventListener(), and terminate().

◆ mode_

Mode binaryurp::Bridge::mode_
private

◆ mutex_

std::mutex binaryurp::Bridge::mutex_
private

◆ name_

OUString binaryurp::Bridge::name_
private

Definition at line 240 of file bridge.hxx.

Referenced by getDescription(), getName(), and ~Bridge().

◆ normalCall_

bool binaryurp::Bridge::normalCall_
private

Definition at line 271 of file bridge.hxx.

Referenced by becameUnused(), and incrementCalls().

◆ outgoingRequests_

OutgoingRequests binaryurp::Bridge::outgoingRequests_
private

Definition at line 253 of file bridge.hxx.

Referenced by lastOutgoingRequest(), makeCall(), and sendProtPropRequest().

◆ passive_

osl::Condition binaryurp::Bridge::passive_
private

Definition at line 254 of file bridge.hxx.

Referenced by decrementActiveCalls(), dispose(), and incrementActiveCalls().

◆ protPropCommit_

com::sun::star::uno::TypeDescription binaryurp::Bridge::protPropCommit_
private

Definition at line 252 of file bridge.hxx.

Referenced by handleCommitChangeRequest(), and sendProtPropRequest().

◆ protPropOid_

OUString binaryurp::Bridge::protPropOid_
private

Definition at line 249 of file bridge.hxx.

Referenced by isProtocolPropertiesRequest(), and sendProtPropRequest().

◆ protPropRequest_

com::sun::star::uno::TypeDescription binaryurp::Bridge::protPropRequest_
private

Definition at line 251 of file bridge.hxx.

Referenced by handleRequestChangeRequest(), and sendProtPropRequest().

◆ protPropTid_

rtl::ByteSequence binaryurp::Bridge::protPropTid_
private

Definition at line 248 of file bridge.hxx.

Referenced by sendProtPropRequest().

◆ protPropType_

com::sun::star::uno::TypeDescription binaryurp::Bridge::protPropType_
private

Definition at line 250 of file bridge.hxx.

Referenced by isProtocolPropertiesRequest(), and sendProtPropRequest().

◆ provider_

com::sun::star::uno::Reference< com::sun::star::bridge::XInstanceProvider > binaryurp::Bridge::provider_
private

Definition at line 244 of file bridge.hxx.

Referenced by getProvider().

◆ proxies_

std::size_t binaryurp::Bridge::proxies_
private

Definition at line 269 of file bridge.hxx.

Referenced by becameUnused(), freeProxy(), and registerIncomingInterface().

◆ random_

sal_Int32 binaryurp::Bridge::random_
private

Definition at line 276 of file bridge.hxx.

Referenced by handleRequestChangeRequest(), and sendRequestChangeRequest().

◆ reader_

rtl::Reference< Reader > binaryurp::Bridge::reader_
private

Definition at line 266 of file bridge.hxx.

Referenced by start(), and terminate().

◆ state_

State binaryurp::Bridge::state_
private

Definition at line 262 of file bridge.hxx.

Referenced by addEventListener(), checkDisposed(), start(), terminate(), and ~Bridge().

◆ stubs_

Stubs binaryurp::Bridge::stubs_
private

Definition at line 268 of file bridge.hxx.

Referenced by becameUnused(), findStub(), registerOutgoingInterface(), releaseStub(), and terminate().

◆ terminated_

osl::Condition binaryurp::Bridge::terminated_
private

Definition at line 259 of file bridge.hxx.

Referenced by terminate().

◆ threadPool_

uno_ThreadPool binaryurp::Bridge::threadPool_
private

Definition at line 264 of file bridge.hxx.

Referenced by getThreadPool(), start(), and terminate().

◆ writer_

rtl::Reference< Writer > binaryurp::Bridge::writer_
private

Definition at line 265 of file bridge.hxx.

Referenced by getWriter(), start(), and terminate().


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