📄 stafconnectionprovider.h
字号:
typedef STAFRC_t (*STAFConnectionProviderConnectFunc_t)( STAFConnectionProvider_t provider, STAFConnection_t *connection, void *connectInfo, unsigned int connectInfoLevel, STAFString_t *errorBuffer);typedef STAFRC_t (*STAFConnectionProviderGetMyNetworkIDsFunc_t)( STAFConnectionProvider_t provider, STAFStringConst_t *logicalID, STAFStringConst_t *physicalID, STAFString_t *errorBuffer);typedef STAFRC_t (*STAFConnectionProviderGetOptionsFunc_t)( STAFConnectionProvider_t provider, STAFObject_t *options, STAFString_t *errorBuffer);typedef STAFRC_t (*STAFConnectionProviderGetPropertyFunc_t)( STAFConnectionProvider_t provider, STAFConnectionProviderProperty_t property, STAFStringConst_t *value, STAFString_t *errorBuffer);typedef STAFRC_t (*STAFConnectionReadFunc_t)( STAFConnection_t connection, void *buffer, unsigned int readLength, STAFString_t *errorBuffer);typedef STAFRC_t (*STAFConnectionReadUIntFunc_t)( STAFConnection_t connection, unsigned int *uint, STAFString_t *errorBuffer);typedef STAFRC_t (*STAFConnectionReadSTAFStringFunc_t)( STAFConnection_t connection, STAFString_t *stafString, STAFString_t *errorBuffer);typedef STAFRC_t (*STAFConnectionWriteFunc_t)( STAFConnection_t connection, void *buffer, unsigned int writeLength, STAFString_t *errorBuffer);typedef STAFRC_t (*STAFConnectionWriteUIntFunc_t)( STAFConnection_t connection, unsigned int uint, STAFString_t *errorBuffer);typedef STAFRC_t (*STAFConnectionWriteSTAFStringFunc_t)( STAFConnection_t connection, STAFStringConst_t stafString, STAFString_t *errorBuffer);typedef STAFRC_t (*STAFConnectionGetPeerNetworkIDsFunc_t)( STAFConnection_t connection, STAFStringConst_t *logicalID, STAFStringConst_t *physicalID, STAFString_t *errorBuffer);typedef STAFRC_t (*STAFConnectionDestructFunc_t)( STAFConnection_t *connection, STAFString_t *errorBuffer);// Function table definitiontypedef struct STAFConnectionProviderFunctionTable{ STAFConnectionProviderConstructFunc_t provConstruct; STAFConnectionProviderStartFunc_t provStart; STAFConnectionProviderStopFunc_t provStop; STAFConnectionProviderDestructFunc_t provDestruct; STAFConnectionProviderConnectFunc_t provConnect; STAFConnectionProviderGetMyNetworkIDsFunc_t provGetMyNetworkIDs; STAFConnectionProviderGetOptionsFunc_t provGetOptions; STAFConnectionProviderGetPropertyFunc_t provGetProperty; STAFConnectionReadFunc_t connRead; STAFConnectionReadUIntFunc_t connReadUInt; STAFConnectionReadSTAFStringFunc_t connReadSTAFString; STAFConnectionWriteFunc_t connWrite; STAFConnectionWriteUIntFunc_t connWriteUInt; STAFConnectionWriteSTAFStringFunc_t connWriteSTAFString; STAFConnectionGetPeerNetworkIDsFunc_t connGetPeerNetworkIDs; STAFConnectionDestructFunc_t connDestruct;} STAFConnectionProviderFunctionTable;// Utility APIs/******************************************************************************//* STAFConnectionProviderLoad - This will fill in a connection provider *//* function table given a dynamic library *//* linked to the provider *//* *//* Accepts: (In) Connection provider dynamic library *//* (Out) Pointer to a connetion provider function table *//* (Out) Pointer to error buffer *//* *//* Returns: kSTAFOk, on success *//* other on error *//******************************************************************************/STAFRC_t STAFConnectionProviderLoad(STAFDynamicLibrary_t library, STAFConnectionProviderFunctionTable *funcs, STAFString_t *errorBuffer);#ifdef __cplusplus}#include <deque>#include "STAFRefPtr.h"class STAFConnection;typedef STAFRefPtr<STAFConnection> STAFConnectionPtr;class STAFConnectionProvider;typedef STAFRefPtr<STAFConnectionProvider> STAFConnectionProviderPtr;class STAFConnectionProvider{public: typedef std::deque<STAFString> OptionList; typedef STAFRC_t (* NewConnectionFunc)( const STAFConnectionProvider *provider, STAFConnectionPtr &connection); static STAFConnectionProviderPtr createRefPtr( const STAFString &name, const STAFString &connLib, void *constructInfo, unsigned int constructInfoLevel); static STAFConnectionProvider *create( const STAFString &name, const STAFString &connLib, void *constructInfo, unsigned int constructInfoLevel); void start(NewConnectionFunc newConnFunc); void stop(); void getMyNetworkIDs(STAFString &logicalIdentifier, STAFString &physicalIdentifier) const; void getOptions(STAFObjectPtr &options) const; STAFString getProperty(STAFConnectionProviderProperty_t property) const; const STAFString &getName() const; const STAFString &getLibrary() const; STAFConnectionPtr connect(const STAFString &endpoint) const; ~STAFConnectionProvider();private: // Don't allow copy construction or assignment STAFConnectionProvider(const STAFConnectionProvider &); STAFConnectionProvider &operator=(const STAFConnectionProvider &); STAFConnectionProvider(const STAFString &name, const STAFString &library, STAFDynamicLibrary_t connLib, STAFConnectionProvider_t provider, const STAFConnectionProviderFunctionTable funcTable); static STAFRC_t handleNewConnection( STAFConnectionProvider_t provider, STAFConnection_t conn, const STAFConnectionProviderFunctionTable *funcTable, void *data); STAFString fName; STAFString fLibrary; STAFDynamicLibrary_t fConnLib; STAFConnectionProvider_t fProvider; STAFConnectionProviderFunctionTable fFuncTable; NewConnectionFunc fNewConnFunc;};class STAFConnection{public: void read(void *buffer, unsigned int size); unsigned int readUInt(); void readUInt(unsigned int &uint); STAFString readString(); void readString(STAFString &theString); void write(void *buffer, unsigned int size); void writeUInt(unsigned int uint); void writeString(const STAFString &theString); void getPeerNetworkIDs(STAFString &logicalIdentifier, STAFString &physicalIdentifier); ~STAFConnection();private: friend class STAFConnectionProvider; // Don't allow copy construction or assignment STAFConnection(const STAFConnection &); STAFConnection &operator=(const STAFConnection &); STAFConnection(STAFConnection_t conn, const STAFConnectionProviderFunctionTable *funcTable); STAFConnection_t fConn; const STAFConnectionProviderFunctionTable *fFuncTable;};STAF_EXCEPTION_DEFINITION(STAFConnectionProviderException, STAFException);STAF_EXCEPTION_DEFINITION(STAFConnectionProviderConnectException, STAFConnectionProviderException);STAF_EXCEPTION_DEFINITION(STAFConnectionProviderConnectTimeoutException, STAFConnectionProviderConnectException);STAF_EXCEPTION_DEFINITION(STAFConnectionException, STAFException);STAF_EXCEPTION_DEFINITION(STAFConnectionIOException, STAFConnectionException);// Now include inline definitions#ifndef STAF_NATIVE_COMPILER#include "STAFConnectionProviderInlImpl.cpp"#endif// End C++ language definitions// End #ifdef __cplusplus#endif#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -