ArnLib
4.0.x
Active Registry Network
|
A client remote monitor to detect changes at server. More...
#include <ArnMonitor.hpp>
Public Slots | |
void | foundChildDeleted (const QString &path) |
Help telling the monitor about deletion of a previous found child. More... | |
Signals | |
void | monitorClosed () |
Signal emitted when the Arn Monitor is closed down. More... | |
void | arnItemCreated (const QString &path) |
Signal emitted when an Arn Data Object is created in the tree below. More... | |
void | arnChildFound (const QString &path) |
Signal emitted for present and newly created childs in the monitor folder. More... | |
void | arnChildFoundFolder (const QString &path) |
Signal emitted for present and newly created folder childs in the monitor folder. More... | |
void | arnChildFoundLeaf (const QString &path) |
Signal emitted for present and newly created leaf childs in the monitor folder. More... | |
void | arnItemDeleted (const QString &path) |
Signal emitted when an Arn Data Object is deleted in the tree below. More... | |
void | arnChildDeleted (const QString &path) |
Signal emitted for deleted childs in the monitor folder. More... | |
void | arnItemModeChanged (const QString &path, int mode) |
Signal emitted when an Arn Data Object changes mode in the tree below. More... | |
void | arnChildModeChanged (const QString &path, int mode) |
Signal emitted for mode changing childs in the monitor folder. More... | |
![]() | |
void | arnLinkDestroyed () |
Signal emitted when the Arn Data Object is destroyed. More... | |
Public Member Functions | |
ArnMonitor (QObject *parent=arnNullptr) | |
ArnMonitor (const QString &path, QObject *parent=arnNullptr) | |
Starts local monitoring. More... | |
~ArnMonitor () | |
void | setClient (ArnClient *client) |
Set the client to be used. More... | |
void | setClient (const QString &id) |
Set the client to be used by its id. More... | |
QString | clientId () const |
Get the id name of the used client More... | |
ArnClient * | client () const |
Get the used client More... | |
void | setMonitorPath (const QString &path, ArnClient *client=arnNullptr) |
Set the path to be monitored. More... | |
bool | start (const QString &path, ArnClient *client) |
Starts the monitoring. More... | |
bool | start (const QString &path) |
Starts the monitoring. More... | |
QString | monitorPath () const |
Get the monitored path More... | |
void | reStart () |
The monitor is restarted. More... | |
void | setReference (void *reference) |
Set an associated external reference. More... | |
void * | reference () const |
Get the stored external reference. More... | |
![]() | |
ArnItemB (QObject *parent=arnNullptr) | |
Standard constructor of a closed handle. More... | |
virtual | ~ArnItemB () |
bool | open (const QString &path) |
Open a handle to an Arn Data Object More... | |
![]() | |
ArnBasicItem () | |
Standard constructor of a closed handle. More... | |
virtual | ~ArnBasicItem () |
bool | open (const QString &path) |
Open a handle to an Arn Data Object More... | |
void | close () |
Close the handle. More... | |
void | destroyLink (bool isGlobal=true) |
Destroy the Arn Data Object More... | |
void | destroyLinkLocal () |
Destroy the local Arn Data Object More... | |
bool | isOpen () const |
State of the handle. More... | |
QString | path (Arn::NameF nameF=Arn::NameF::EmptyOk) const |
Path of the Arn Data Object More... | |
QString | name (Arn::NameF nameF) const |
Name of the Arn Data Object More... | |
void | setReference (void *reference) |
Set an associated external reference. More... | |
void * | reference () const |
Get the stored external reference. More... | |
uint | itemId () const |
Get the id for this ArnItem. More... | |
uint | linkId () const |
Get the id for this Arn Data Object More... | |
int | refCount () const |
Get the number of refs to this Arn Data Object More... | |
bool | isFolder () const |
bool | isProvider () const |
Arn::DataType | type () const |
The type stored in the Arn Data Object More... | |
void | setIgnoreSameValue (bool isIgnore=true) |
Set skipping of equal value. More... | |
bool | isIgnoreSameValue () const |
void | addMode (Arn::ObjectMode mode) |
Add general mode settings for this Arn Data Object More... | |
Arn::ObjectMode | getMode () const |
Use with care, link must be "referenced" before use, otherwise it might have been deleted. More... | |
Arn::ObjectSyncMode | syncMode () const |
ArnBasicItem & | setBiDirMode () |
Set general mode as Bidirectional for this Arn Data Object More... | |
bool | isBiDirMode () const |
ArnBasicItem & | setPipeMode () |
Set general mode as Pipe for this Arn Data Object More... | |
bool | isPipeMode () const |
ArnBasicItem & | setSaveMode () |
Set general mode as Save for this Arn Data Object More... | |
bool | isSaveMode () const |
void | setAtomicOpProvider () |
Set this Arn Data Object as Atomic Operator Provider More... | |
bool | isAtomicOpProvider () const |
ArnBasicItem & | setMaster () |
Set client session sync mode as Master for this ArnItem. More... | |
bool | isMaster () const |
ArnBasicItem & | setAutoDestroy () |
Set client session sync mode as AutoDestroy for this ArnItem. More... | |
bool | isAutoDestroy () const |
void | arnImport (const QByteArray &data, int ignoreSame=Arn::SameValue::DefaultAction) |
Import data to an Arn Data Object More... | |
QByteArray | arnExport () const |
int | toInt (bool *isOk=arnNullptr) const |
double | toDouble (bool *isOk=arnNullptr) const |
ARNREAL | toReal (bool *isOk=arnNullptr) const |
QString | toString (bool *isOk=arnNullptr) const |
QByteArray | toByteArray (bool *isOk=arnNullptr) const |
QVariant | toVariant (bool *isOk=arnNullptr) const |
bool | toBool (bool *isOk=arnNullptr) const |
uint | toUInt (bool *isOk=arnNullptr) const |
qint64 | toInt64 (bool *isOk=arnNullptr) const |
quint64 | toUInt64 (bool *isOk=arnNullptr) const |
ArnBasicItem & | operator= (const ArnBasicItem &other) |
ArnBasicItem & | operator= (int val) |
ArnBasicItem & | operator= (ARNREAL val) |
ArnBasicItem & | operator= (const QString &val) |
ArnBasicItem & | operator= (const QByteArray &val) |
ArnBasicItem & | operator= (const QVariant &val) |
ArnBasicItem & | operator= (const char *val) |
ArnBasicItem & | operator= (uint val) |
ArnBasicItem & | operator= (qint64 val) |
ArnBasicItem & | operator= (quint64 val) |
ArnBasicItem & | operator+= (int val) |
ArnBasicItem & | operator+= (ARNREAL val) |
void | setValue (const ArnBasicItem &other, int ignoreSame=Arn::SameValue::DefaultAction) |
void | setValue (int value, int ignoreSame=Arn::SameValue::DefaultAction) |
Assign an integer to an Arn Data Object More... | |
void | setValue (ARNREAL value, int ignoreSame=Arn::SameValue::DefaultAction) |
Assign an ARNREAL to an Arn Data Object More... | |
void | setValue (bool value, int ignoreSame=Arn::SameValue::DefaultAction) |
Assign a bool to an Arn Data Object More... | |
void | setValue (const QString &value, int ignoreSame=Arn::SameValue::DefaultAction) |
Assign a QString to an Arn Data Object More... | |
void | setValue (const QByteArray &value, int ignoreSame=Arn::SameValue::DefaultAction) |
Assign a QByteArray to an Arn Data Object More... | |
void | setValue (const QVariant &value, int ignoreSame=Arn::SameValue::DefaultAction) |
Assign a QVariant to an Arn Data Object More... | |
void | setValue (const char *value, int ignoreSame=Arn::SameValue::DefaultAction) |
Assign a char* to an Arn Data Object More... | |
void | setValue (uint value, int ignoreSame=Arn::SameValue::DefaultAction) |
Assign an unsigned int to an Arn Data Object More... | |
void | setValue (qint64 value, int ignoreSame=Arn::SameValue::DefaultAction) |
Assign an int 64 bit to an Arn Data Object More... | |
void | setValue (quint64 value, int ignoreSame=Arn::SameValue::DefaultAction) |
Assign an unsigned int 64 bit to an Arn Data Object More... | |
void | setBits (int mask, int value, int ignoreSame=Arn::SameValue::DefaultAction) |
AtomicOp assign an integer to specified bits in an Arn Data Object More... | |
void | addValue (int value) |
AtomicOp adds an integer to an Arn Data Object More... | |
void | addValue (ARNREAL value) |
AtomicOp adds an ARNREAL to an Arn Data Object More... | |
QThread * | thread () const |
Get the thread affinity of this ArnBasicItem. More... | |
void | setEventHandler (QObject *eventHandler) |
Set event handler for this ArnBasicItem. More... | |
QObject * | eventHandler () const |
Get the event handler of this ArnBasicItem. More... | |
void | setUncrossed (bool isUncrossed=true) |
Set a Bidirectional item as Uncrossed. More... | |
bool | isUncrossed () const |
Get the Uncrossed state of an object. More... | |
bool | isAssigning () const |
Tells if this ArnItem is assigned right now. More... | |
![]() | |
ArnCoreItem () | |
Standard constructor of a closed handle. More... | |
virtual | ~ArnCoreItem () |
QThread * | thread () const |
Get the thread affinity of this ArnCoreItem. More... | |
A client remote monitor to detect changes at server.
The monitor must normally be set at a shared path. A none shared path can be used when client is set to 0, i.e. local monitoring.
When the monitor is started, all the arnChildFound signals are emmited for present childs. Later the signals are emmited for newly created childs.
Example usage
Definition at line 65 of file ArnMonitor.hpp.
|
explicit |
Definition at line 64 of file ArnMonitor.cpp.
ArnMonitor::ArnMonitor | ( | const QString & | path, |
QObject * | parent = arnNullptr |
||
) |
Starts local monitoring.
[in] | path | |
[in] | parent |
Definition at line 72 of file ArnMonitor.cpp.
ArnMonitor::~ArnMonitor | ( | ) |
Definition at line 89 of file ArnMonitor.cpp.
|
signal |
Signal emitted for deleted childs in the monitor folder.
The ArnMonitor monitors a folder. Deleted objects in this folder will give this signal.
Example 1: monitorPath = "//Sensors/Temp1/", deleted object = "//Sensors/Temp1/value" ==> path to child = "//Sensors/Temp1/value"
Example 2: monitorPath = "//Sensors/Temp2/", deleted object = "//Sensors/Temp2/folder/" ==> path to child = "//Sensors/Temp2/folder/"
[in] | path | to the child |
|
signal |
Signal emitted for present and newly created childs in the monitor folder.
The ArnMonitor monitors a folder. Present and newly created objects in this folder will give this signal. For newly created objects, the origin comes from the arnItemCreated() signal.
Example 1: monitorPath = "//Sensors/", created object = "//Sensors/Temp1/value" ==> path to child = "//Sensors/Temp1/"
Example 2: monitorPath = "//Sensors/", created object = "//Sensors/Temp2/folder/" ==> path to child = "//Sensors/Temp2/"
[in] | path | to the child |
|
signal |
Signal emitted for present and newly created folder childs in the monitor folder.
The ArnMonitor monitors a folder. Present and newly created folder objects in this folder will give this signal. For newly created childs, the origin comes from the arnItemCreated() signal.
Example: monitorPath = "//Sensors/", created object = "//Sensors/Temp1/value" ==> path to child = "//Sensors/Temp1/"
[in] | path | to the child |
|
signal |
Signal emitted for present and newly created leaf childs in the monitor folder.
The ArnMonitor monitors a folder. Present and newly created leaf objects in this folder will give this signal. For newly created childs, the origin comes from the arnItemCreated() signal.
Example: monitorPath = "//Sensors/", created object = "//Sensors/count" ==> path to child = "//Sensors/count"
[in] | path | to the child |
|
signal |
Signal emitted for mode changing childs in the monitor folder.
The ArnMonitor monitors a folder. Objects changing mode in this folder will give this signal.
Example: monitorPath = "//Sensors/Temp1/", changing mode object = "//Sensors/Temp1/value" ==> path to child = "//Sensors/Temp1/value"
[in] | path | to the child |
[in] | mode | is the new Arn::ObjectMode |
|
signal |
Signal emitted when an Arn Data Object is created in the tree below.
The ArnMonitor monitors a folder. Created objects in this folder or its children below will give this signal. Both created folder and leaf objects will give this signal.
[in] | path | to the created Arn Data Object |
|
signal |
Signal emitted when an Arn Data Object is deleted in the tree below.
The ArnMonitor monitors a folder. Deleted objects in this folder or its children below will give this signal. Both deleted folder and leaf objects will give this signal.
[in] | path | to the deleted Arn Data Object |
|
signal |
Signal emitted when an Arn Data Object changes mode in the tree below.
The ArnMonitor monitors a folder. Objects chnging mode in this folder or its children below will give this signal.
[in] | path | to the mode changing Arn Data Object |
[in] | mode | is the new Arn::ObjectMode |
ArnClient * ArnMonitor::client | ( | ) | const |
Get the used client
Definition at line 126 of file ArnMonitor.cpp.
QString ArnMonitor::clientId | ( | ) | const |
Get the id name of the used client
Definition at line 117 of file ArnMonitor.cpp.
|
slot |
Help telling the monitor about deletion of a previous found child.
The monitor remembers every child it has signalled. If a deleted child reappears later it will not give a signal unless this function is used.
Since ArnLib 3.0 this function is called automatically when a child is deleted. This function is still available to manually handle any problems.
[in] | path | to the deleted child |
Definition at line 377 of file ArnMonitor.cpp.
|
signal |
Signal emitted when the Arn Monitor is closed down.
There is an internal (remote) pickup ArnItem at the monitor path. When the internal ArnItem is destroyed, this ArnMonitor is closed and will give this signal
QString ArnMonitor::monitorPath | ( | ) | const |
Get the monitored path
Definition at line 214 of file ArnMonitor.cpp.
void * ArnMonitor::reference | ( | ) | const |
Get the stored external reference.
Definition at line 239 of file ArnMonitor.cpp.
void ArnMonitor::reStart | ( | ) |
The monitor is restarted.
This makes the monitor forget the signals sent for present children and the arnChildFound signals are emmited again for present childs.
Definition at line 222 of file ArnMonitor.cpp.
void ArnMonitor::setClient | ( | ArnClient * | client | ) |
Set the client to be used.
[in] | client | to be used. If 0, local monitoring is done. |
Definition at line 101 of file ArnMonitor.cpp.
void ArnMonitor::setClient | ( | const QString & | id | ) |
Set the client to be used by its id.
[in] | id | to identify client. If "", local monitoring is done. |
Definition at line 109 of file ArnMonitor.cpp.
void ArnMonitor::setMonitorPath | ( | const QString & | path, |
ArnClient * | client = arnNullptr |
||
) |
Set the path to be monitored.
The monitor must be set at a shared path that is shared using client::addMountPoint(). This function also starts the monitoring using start().
[in] | path | |
[in] | client | to be used. If 0, keep previous set client. |
Definition at line 134 of file ArnMonitor.cpp.
void ArnMonitor::setReference | ( | void * | reference | ) |
Set an associated external reference.
This is typically used when having many ArnMonitors signal connected to a common slot. The slot can then discover the signalling ArnMonitor:s associated structure for further processing.
[in] | reference | Any external structure or id. |
Definition at line 231 of file ArnMonitor.cpp.
bool ArnMonitor::start | ( | const QString & | path, |
ArnClient * | client | ||
) |
Starts the monitoring.
The monitor must normally be set at a shared path that is shared using client::addMountPoint(). A none shared path can be used when client is set to 0, i.e. local monitoring.
[in] | path | |
[in] | client | to be used. If 0, local monitoring is done. |
Definition at line 142 of file ArnMonitor.cpp.
bool ArnMonitor::start | ( | const QString & | path | ) |
Starts the monitoring.
The monitor must normally be set at a shared path that is shared using client::addMountPoint(). A none shared path can be used when client is set to 0, i.e. local monitoring.
[in] | path |
Definition at line 208 of file ArnMonitor.cpp.