Closes an entity when it goes out of scope: a subscription, an endpoint, a model, an instrument profile connection or any other entity with a close() method.
More...
|
|
| AutoClose () noexcept=default |
| | Creates an empty AutoClose.
|
| | AutoClose (std::shared_ptr< T > entity) noexcept |
| | Creates an AutoClose that closes the entity.
|
|
| AutoClose (AutoClose &&other) noexcept |
| | Takes the entity of the other AutoClose, which becomes empty.
|
|
AutoClose & | operator= (AutoClose &&other) noexcept |
| | Closes the current entity and takes the entity of the other AutoClose, which becomes empty.
|
|
| ~AutoClose () noexcept |
| | Closes the entity.
|
|
void | reset () noexcept |
| | Closes the entity now and makes this AutoClose empty.
|
| std::shared_ptr< T > | release () noexcept |
| | Makes this AutoClose empty without closing the entity.
|
| const std::shared_ptr< T > & | get () const noexcept |
| T * | operator-> () const noexcept |
| T & | operator* () const noexcept |
| | operator bool () const noexcept |
template<typename T>
class AutoClose< T >
Closes an entity when it goes out of scope: a subscription, an endpoint, a model, an instrument profile connection or any other entity with a close() method.
See Lifetime of the entities.
The AutoClose is moved, not copied: one AutoClose closes the entity once. The other pointers to the entity stay valid and point to the closed entity. An exception of close() in the destructor or in reset() is reported to ErrorManager.
Do not wrap a default endpoint (DXEndpoint::getInstance()): closing it closes it for the whole process.
const dxfcpp::AutoClose endpoint{dxfcpp::DXEndpoint::create()->connect("demo.dxfeed.com:7300")};
const dxfcpp::AutoClose subscription{endpoint->getFeed()->createSubscription(dxfcpp::Quote::TYPE)};
subscription->addEventListener<dxfcpp::Quote>([&](const auto "es) {
});
subscription->addSymbols("AAPL");
- Template Parameters
-