|
HLCC Documentation 2.2.0
|
CiiOldbDataPointAsync is a wrapper for class CiiOldbDataPoint, to allow asynchronous writes to the OLDB. All other methods are delegating in the same thread, but could be made async as well in the future. More...
#include <ciiOldbDataPointAsync.hpp>
Classes | |
| struct | OldbData |
| Value type for data for buffering and writing to OLDB. This base class is used as an interface toward the client of CiiOldbDataPointAsync. More... | |
| struct | OldbDataWithPromise |
| Value type for data for buffering and writing to OLDB. This subclass is used internally by CiiOldbDataPointAsync. More... | |
Public Member Functions | |
| CiiOldbDataPointAsync (std::string name, std::shared_ptr< elt::oldb::CiiOldbDataPoint< T > > delegate, boost::asio::thread_pool &async_exec, const log4cplus::Logger &logger, std::size_t buffer_capacity=1) | |
| Constructor. | |
| virtual | ~CiiOldbDataPointAsync () |
| std::shared_ptr< elt::oldb::CiiOldbDpValue< T > > | ReadValue (bool check_bad_quality=true) |
| boost::future< typename CiiOldbDataPointAsync< T >::OldbData > | WriteValue (const T &value, int64_t timestamp=elt::oldb::CiiOldbUtil::Now(), elt::oldb::CiiOldbDpQuality quality=elt::oldb::CiiOldbDpQuality::OK, bool is_disable_publishing=false) |
| boost::future< typename CiiOldbDataPointAsync< T >::OldbData > | SetQuality (elt::oldb::CiiOldbDpQuality quality, bool is_disable_publishing=false) |
CiiOldbDataPointAsync is a wrapper for class CiiOldbDataPoint, to allow asynchronous writes to the OLDB. All other methods are delegating in the same thread, but could be made async as well in the future.
Note that once a CiiOldbDataPoint has been wrapped by this class, it should no longer be used directly, because that would mean calling CiiOldbDataPoint method from 2 different threads (client thread and async pool worker thread). CiiOldbDataPoint::SetQuality internally first reads the current value from OLDB and, without locking, later writes both value and quality data. This creates a race condition that could overwrite in the OLDB a new value that was set using the WriteValue method. Eventually CII may make SetQuality thread-safe, because it looks atomic, even though generally OLDB access is not meant to support transactions.
| hlcc::oldbmux::CiiOldbDataPointAsync< T >::CiiOldbDataPointAsync | ( | std::string | name, |
| std::shared_ptr< elt::oldb::CiiOldbDataPoint< T > > | delegate, | ||
| boost::asio::thread_pool & | async_exec, | ||
| const log4cplus::Logger & | logger, | ||
| std::size_t | buffer_capacity = 1 ) |
Constructor.
|
virtual |
| std::shared_ptr< elt::oldb::CiiOldbDpValue< T > > hlcc::oldbmux::CiiOldbDataPointAsync< T >::ReadValue | ( | bool | check_bad_quality = true | ) |
| boost::future< typename CiiOldbDataPointAsync< T >::OldbData > hlcc::oldbmux::CiiOldbDataPointAsync< T >::SetQuality | ( | elt::oldb::CiiOldbDpQuality | quality, |
| bool | is_disable_publishing = false ) |
| boost::future< typename CiiOldbDataPointAsync< T >::OldbData > hlcc::oldbmux::CiiOldbDataPointAsync< T >::WriteValue | ( | const T & | value, |
| int64_t | timestamp = elt::oldb::CiiOldbUtil::Now(), | ||
| elt::oldb::CiiOldbDpQuality | quality = elt::oldb::CiiOldbDpQuality::OK, | ||
| bool | is_disable_publishing = false ) |
Note that for using nested class CiiOldbDataPointAsync<T>::OldbData as a template parameter, the "typename" keyword has to be added. Somehow because OldbData depends on template parameter T only through its outer type CiiOldbDataPointAsync. See also upcoming C++ change http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0634r3.html