Skip to content

DataLogger

class DataLogger : public karabo::core::Device

@brief A DataLogger device is assigned devices in the distributed
system and logs their slow control data.

DataLoggers are managed by the karabo::devices::DataLoggerManager.

Each is able to log any number of devices. This list can be specified at instantiation, but can also dynamically changed by the slots slotTagDeviceToBeDiscontinued and slotAddDevicesToBeLogged. When the logger is ready to log data, its state changes from INIT to NORMAL.

Functions

Name Description
initializeLoggerSpecific Do some actions here that may require asynchronous logic ... and, finally, startConnection() should be called This function may be overridden by derived classes but at the end the 'startConnection' function should be called as a last step of initialization
removeFrom Helper to remove an element from a vector element - needs protection by m_perDeviceDataMutex.
appendTo Helper to add an element to a vector element - needs protection by m_perDeviceDataMutex.
preDestruction Override preDestruction from Device class
slotTagDeviceToBeDiscontinued FIXME: Update text This tags a device to be discontinued, three cases have to be distinguished (a) Regular shut-down of the device (wasValidUpToNow = true, reason = 'D') (b) Silent death of the device (wasValidUpToNow = true, reason = 'D') (c) Start-up of this (DataLogger) device whilst the device was alive (wasValidUpToNow = false, reason = 'L') This slot will be called by the DataLoggerManager
handleConfigConnected Helper for connecting to signalChanged
updateTableAndFlush Flush data in file hierarchy or to the database tables aReplyPtr : if pointer to an AsyncReply that (if non-empty) has to be called without argument when done
allowLock "Flush" data accumulated in the internal cache to the external storage (file, database,...) This device may not be locked Return : false

Function Details

allowLock

bool allowLock() const

"Flush" data accumulated in the internal cache to the external storage (file, database,...) This device may not be locked

Return : false

appendTo

bool appendTo(const std::string& str, const std::string& vectorProp)

Helper to add an element to a vector element - needs protection by m_perDeviceDataMutex. Note that if the same element is already in, it will not be added again.

str : the element to add

vectorProp : the key of the vector element

Return : whether it was added (i.e. false if 'str' was already in the vectorProperty

handleConfigConnected

void handleConfigConnected(const DeviceData::Pointer& data, const std::shared_ptr<std::atomic<unsigned int>>& counter)

Helper for connecting to signalChanged

initializeLoggerSpecific

virtual void initializeLoggerSpecific()

Do some actions here that may require asynchronous logic ... and, finally, startConnection() should be called This function may be overridden by derived classes but at the end the 'startConnection' function should be called as a last step of initialization

preDestruction

void preDestruction() override

Override preDestruction from Device class

removeFrom

bool removeFrom(const std::string& str, const std::string& vectorProp)

Helper to remove an element from a vector element - needs protection by m_perDeviceDataMutex. Note that if the same element is in the vector more than once, only the first one is removed.

str : the element to remove

vectorProp : the key of the vector element

Return : whether could be removed

slotTagDeviceToBeDiscontinued

void slotTagDeviceToBeDiscontinued(const std::string& reason, const std::string& deviceId)

FIXME: Update text This tags a device to be discontinued, three cases have to be distinguished

(a) Regular shut-down of the device (wasValidUpToNow = true, reason = 'D') (b) Silent death of the device (wasValidUpToNow = true, reason = 'D') (c) Start-up of this (DataLogger) device whilst the device was alive (wasValidUpToNow = false, reason = 'L')

This slot will be called by the DataLoggerManager

updateTableAndFlush

void updateTableAndFlush(const std::shared_ptr<SignalSlotable::AsyncReply>& aReplyPtr)

Flush data in file hierarchy or to the database tables

aReplyPtr : if pointer to an AsyncReply that (if non-empty) has to be called without argument when done