GuardDataBridge is the safe access entry for abiDataBridge.
Applications can use it to make C-based APIs safer. it would manage abiRefDataBridge automatically. with that, App user do not need to refCopy_i or destroy abiRefDataBridge manually.
For example: abiRefDataBridge* rawRef = creator(); GuardDataBridge guardFilter(rawRef, true); // take the ownership of rawRef guardFilter.setUserData(userdata, [](void*){ ...free... }); guardFilter.setErrorCallback([](ErrCode c, const char* msg){ stderr << msg; }); ErrCode c = guardFilter.start(config, path); DS_ASSERT(isGood(c)); c = guardFilter.start(config, path); // invoke abiDataBridge::start_i(...) GuardDataMap inputData = ...; // prepare input data // invoke abiDataBridge::process_i(...) c = guardFilter.process(inputData, [](ErrCode c, const abiRefDataMap* d){ GuardDataMap outputData(<em>d); // output data processing std::cout << "output data processing starts" << std::endl; }, [](ErrCode c, const abiRefDataMap d){ GuardDataMap doneData(*d); std::cout << "input data consumed" << std::endl; }); DS_ASSERT(isGood(c)); //... wait for all data processed before stop c = guardFilter.flush(); c = guardFilter.stop(); // invoke abiDataBridge::stop_i(...) guardFilter.reset(); // destroy abiRefDataBridge, when all reference // destroyed, abiDataBridge would be freed.
Definition at line 55 of file databridge.hpp.
Public Types | |
using | abiRefType = abiRefT< abiDataBridge > |
Public Member Functions | |
template<typename... Args> | |
GuardDataBridge (Args &&... args) | |
~GuardDataBridge ()=default | |
ErrCode | process (const struct VideoBridge2dInput *inputData, abiOnDataCB::CppFunc outputDataCB, abiOnBridgeDataCB::CppFunc inputConsumedCB) |
void | setUserData (void *data, DelF delF) |
virtual void * | getUserData () const |
void | setErrorCallback (abiErrorCB::CppFunc errCb) |
ErrCode | start (const std::string &content, const std::string &path="") |
ErrCode | flush () |
ErrCode | stop () |
State | state () const |
std::string | getCaps (CapsPort port) |
std::string | getOutputCaps () |
std::string | getInputCaps () |
GuardTy | cast () |
abiDataBridge * | ptr () const |
abiDataBridge * | operator-> () const |
operator bool () const | |
operator ShrdPtr< abiDataBridge > () | |
abiRefT< abiDataBridge > * | release () |
void | reset (abiRefT< abiDataBridge > *abiref=nullptr) |
abiRefT< abiDataBridge > * | abiRef () const |
|
inherited |
|
inline |
Definition at line 60 of file databridge.hpp.
|
default |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Definition at line 76 of file dataprocess.hpp.
|
inlineinherited |
Definition at line 94 of file dataprocess.hpp.
|
inlineinherited |
Definition at line 101 of file dataprocess.hpp.
|
inlineinherited |
Definition at line 100 of file dataprocess.hpp.
|
inlinevirtualinherited |
Definition at line 55 of file dataprocess.hpp.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inline |
Definition at line 65 of file databridge.hpp.
References ds3d::GuardRef< abiCB >::abiRef(), DS_ASSERT, ds3d::abiDataBridge::process_i(), ds3d::GuardDataT< abiDataBridge >::ptr(), and ds3d::GuardCB< abiCB >::setFn().
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Definition at line 62 of file dataprocess.hpp.
|
inlineinherited |
Definition at line 44 of file dataprocess.hpp.
|
inlineinherited |
Definition at line 70 of file dataprocess.hpp.
|
inlineinherited |
Definition at line 88 of file dataprocess.hpp.
|
inlineinherited |
Definition at line 82 of file dataprocess.hpp.