ArnLib  4.0.x
Active Registry Network
ArnMonitor Class Reference

A client remote monitor to detect changes at server. More...

#include <ArnMonitor.hpp>

Inheritance diagram for ArnMonitor:
Collaboration diagram for ArnMonitor:

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...
 
- Signals inherited from ArnItemB
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...
 
ArnClientclient () 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...
 
- Public Member Functions inherited from ArnItemB
 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...
 
- Public Member Functions inherited from ArnBasicItem
 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
 
ArnBasicItemsetBiDirMode ()
 Set general mode as Bidirectional for this Arn Data Object More...
 
bool isBiDirMode () const
 
ArnBasicItemsetPipeMode ()
 Set general mode as Pipe for this Arn Data Object More...
 
bool isPipeMode () const
 
ArnBasicItemsetSaveMode ()
 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
 
ArnBasicItemsetMaster ()
 Set client session sync mode as Master for this ArnItem. More...
 
bool isMaster () const
 
ArnBasicItemsetAutoDestroy ()
 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
 
ArnBasicItemoperator= (const ArnBasicItem &other)
 
ArnBasicItemoperator= (int val)
 
ArnBasicItemoperator= (ARNREAL val)
 
ArnBasicItemoperator= (const QString &val)
 
ArnBasicItemoperator= (const QByteArray &val)
 
ArnBasicItemoperator= (const QVariant &val)
 
ArnBasicItemoperator= (const char *val)
 
ArnBasicItemoperator= (uint val)
 
ArnBasicItemoperator= (qint64 val)
 
ArnBasicItemoperator= (quint64 val)
 
ArnBasicItemoperator+= (int val)
 
ArnBasicItemoperator+= (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...
 
- Public Member Functions inherited from ArnCoreItem
 ArnCoreItem ()
 Standard constructor of a closed handle. More...
 
virtual ~ArnCoreItem ()
 
QThread * thread () const
 Get the thread affinity of this ArnCoreItem. More...
 

Detailed Description

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

// In class declare
ArnMonitor* _arnMon;
ArnClient* _client;
// In class code
_arnMon = new ArnMonitor( this);
_arnMon->start("//Pipes/", _client);
connect( _arnMon, SIGNAL(arnChildFound(QString)), this, SLOT(netChildFound(QString)));

Definition at line 65 of file ArnMonitor.hpp.

Constructor & Destructor Documentation

◆ ArnMonitor() [1/2]

ArnMonitor::ArnMonitor ( QObject *  parent = arnNullptr)
explicit

Definition at line 64 of file ArnMonitor.cpp.

◆ ArnMonitor() [2/2]

ArnMonitor::ArnMonitor ( const QString &  path,
QObject *  parent = arnNullptr 
)

Starts local monitoring.

Parameters
[in]path
[in]parent
See also
start()

Definition at line 72 of file ArnMonitor.cpp.

◆ ~ArnMonitor()

ArnMonitor::~ArnMonitor ( )

Definition at line 89 of file ArnMonitor.cpp.

Member Function Documentation

◆ arnChildDeleted

void ArnMonitor::arnChildDeleted ( const QString &  path)
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/"

Parameters
[in]pathto the child
See also
arnItemDeleted()

◆ arnChildFound

void ArnMonitor::arnChildFound ( const QString &  path)
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/"

Parameters
[in]pathto the child
See also
arnItemCreated()

◆ arnChildFoundFolder

void ArnMonitor::arnChildFoundFolder ( const QString &  path)
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/"

Parameters
[in]pathto the child
See also
arnItemCreated()
arnChildFound()

◆ arnChildFoundLeaf

void ArnMonitor::arnChildFoundLeaf ( const QString &  path)
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"

Parameters
[in]pathto the child
See also
arnChildFound()

◆ arnChildModeChanged

void ArnMonitor::arnChildModeChanged ( const QString &  path,
int  mode 
)
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"

Parameters
[in]pathto the child
[in]modeis the new Arn::ObjectMode
See also
arnItemModeChanged()

◆ arnItemCreated

void ArnMonitor::arnItemCreated ( const QString &  path)
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.

Parameters
[in]pathto the created Arn Data Object

◆ arnItemDeleted

void ArnMonitor::arnItemDeleted ( const QString &  path)
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.

Parameters
[in]pathto the deleted Arn Data Object

◆ arnItemModeChanged

void ArnMonitor::arnItemModeChanged ( const QString &  path,
int  mode 
)
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.

Parameters
[in]pathto the mode changing Arn Data Object
[in]modeis the new Arn::ObjectMode

◆ client()

ArnClient * ArnMonitor::client ( ) const

Get the used client

Returns
The client
See also
setClient()

Definition at line 126 of file ArnMonitor.cpp.

◆ clientId()

QString ArnMonitor::clientId ( ) const

Get the id name of the used client

Returns
The client id name
See also
setClient()

Definition at line 117 of file ArnMonitor.cpp.

◆ foundChildDeleted

void ArnMonitor::foundChildDeleted ( const QString &  path)
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.

Parameters
[in]pathto the deleted child

Definition at line 377 of file ArnMonitor.cpp.

◆ monitorClosed

void ArnMonitor::monitorClosed ( )
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

◆ monitorPath()

QString ArnMonitor::monitorPath ( ) const

Get the monitored path

Returns
The path
See also
start()

Definition at line 214 of file ArnMonitor.cpp.

◆ reference()

void * ArnMonitor::reference ( ) const

Get the stored external reference.

Returns
The associated external reference
See also
setReference()

Definition at line 239 of file ArnMonitor.cpp.

◆ reStart()

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.

◆ setClient() [1/2]

void ArnMonitor::setClient ( ArnClient client)

Set the client to be used.

Parameters
[in]clientto be used. If 0, local monitoring is done.

Definition at line 101 of file ArnMonitor.cpp.

◆ setClient() [2/2]

void ArnMonitor::setClient ( const QString &  id)

Set the client to be used by its id.

Parameters
[in]idto identify client. If "", local monitoring is done.

Definition at line 109 of file ArnMonitor.cpp.

◆ setMonitorPath()

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().

Parameters
[in]path
[in]clientto be used. If 0, keep previous set client.
See also
start()
Deprecated:
Use start() instead, client parameter is changed.

Definition at line 134 of file ArnMonitor.cpp.

◆ setReference()

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.

Parameters
[in]referenceAny external structure or id.
See also
reference()

Definition at line 231 of file ArnMonitor.cpp.

◆ start() [1/2]

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.

Parameters
[in]path
[in]clientto be used. If 0, local monitoring is done.

Definition at line 142 of file ArnMonitor.cpp.

◆ start() [2/2]

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.

Parameters
[in]path

Definition at line 208 of file ArnMonitor.cpp.


The documentation for this class was generated from the following files: