ArnLib  4.0.x
Active Registry Network
ArnAdaptItem Class Reference

! Non Qt and threadsafe handle for an Arn Data Object. More...

#include <ArnAdaptItem.hpp>

Inheritance diagram for ArnAdaptItem:
Collaboration diagram for ArnAdaptItem:

Public Types

typedef void(* ChangedCB) (ArnAdaptItem &target, const QByteArray &value)
 
typedef void(* LinkDestroyedCB) (ArnAdaptItem &target)
 
typedef void(* ArnEventCB) (QEvent *ev, int arnEvIdx)
 

Public Member Functions

 ArnAdaptItem ()
 Standard constructor of a closed handle. More...
 
virtual ~ArnAdaptItem ()
 
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
 
Arn::ObjectSyncMode syncMode () const
 
ArnAdaptItemsetBiDirMode ()
 Set general mode as Bidirectional for this Arn Data Object More...
 
bool isBiDirMode () const
 
ArnAdaptItemsetPipeMode ()
 Set general mode as Pipe for this Arn Data Object More...
 
bool isPipeMode () const
 
ArnAdaptItemsetSaveMode ()
 Set general mode as Save for this Arn Data Object More...
 
bool isSaveMode () const
 
ArnAdaptItemsetMaster ()
 Set client session sync mode as Master for this ArnItem. More...
 
bool isMaster () const
 
ArnAdaptItemsetAutoDestroy ()
 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
 
ArnAdaptItemoperator= (const ArnAdaptItem &other)
 
ArnAdaptItemoperator= (int val)
 
ArnAdaptItemoperator= (ARNREAL val)
 
ArnAdaptItemoperator= (const QString &val)
 
ArnAdaptItemoperator= (const QByteArray &val)
 
ArnAdaptItemoperator= (const QVariant &val)
 
ArnAdaptItemoperator= (const char *val)
 
ArnAdaptItemoperator= (uint val)
 
ArnAdaptItemoperator= (qint64 val)
 
ArnAdaptItemoperator= (quint64 val)
 
ArnAdaptItemoperator+= (int val)
 
ArnAdaptItemoperator+= (ARNREAL val)
 
void setValue (const ArnAdaptItem &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...
 
ARN_RecursiveMutexmutex () const
 Get the mutex of this ArnAdaptItem. More...
 
QThread * thread () const
 Get the thread affinity of this ArnAdaptItem. More...
 
void setChangedCallback (ChangedCB changedCB)
 Set changed-callback for this ArnAdaptItem. More...
 
ChangedCB ChangedCallback () const
 Get the changed-callback of this ArnAdaptItem. More...
 
void setLinkDestroyedCallback (LinkDestroyedCB linkDestroyedCB)
 Set link-destroyed-callback for this ArnAdaptItem. More...
 
LinkDestroyedCB linkDestroyedCallback () const
 Get the link-destroyed-callback of this ArnAdaptItem. More...
 
void setArnEventCallback (ArnEventCB evCB)
 Set event callback for this ArnAdaptItem. More...
 
ArnEventCB arnEventCallback () const
 Get the event callback of this ArnAdaptItem. More...
 
void setUncrossed (bool isUncrossed=true)
 Set a Bidirectional item as Uncrossed. More...
 
bool isUncrossed () const
 Get the Uncrossed state of an object. More...
 

Additional Inherited Members

- Protected 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...
 
- Protected 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

! Non Qt and threadsafe handle for an Arn Data Object.

About ArnItem access

See ArnItem.

ArnAdaptItem is based on ArnBasicItem and is used to get a handle (pointer) for accessing an Arn Data Object. It is very similar to ArnBasicItem but it is slower and its typical usage is in a non Qt thread. It don't use or need a Qt eventloop.

There can be any amount of ArnAdaptItem:s opened (pointing) to the same Arn Data object. Deleting the ArnAdaptItem won't effect the Arn Data object.

This class is thread-safe, so any thread could use its instances. This includes booth Qt (based on QThread) and non Qt started thread.

For callbacks it's easiest to use setChangedCallback() and setLinkDestroyedCallback() when this is sufficient. For advanced usage it's also possible to use setArnEventCallback() which gives all possible events but is more complicated and includes decoding of an event structure.

Example usage

// In class declare
ArnAdaptItem _arnTime;
static void arnEvCallback( QEvent* ev, int arnEvIdx);
// In class code
_arnTime.open("//Chat/Time/value");
_arnTime.setChangedCallback( &MyClass::changedCallback);
_arnTime.setLinkDestroyedCallback( &MyClass::linkDestroyedCallback);
_arnTime.setArnEventCallback( &MyClass::arnEvCallback);
_arnTime = "Undefined ...";
void MyClass::changedCallback( ArnAdaptItem& item, const QByteArray& value)
{
// Is setup as Changed callback for my ArnAdaptItem.
// Code must be threadsafe.
qDebug() << "MyClass ValueChange: inItemPath=" << item.path()
<< " value=" << value;
}
void MyClass::linkDestroyedCallback( ArnAdaptItem& item)
{
// Is setup as link-destroyed callback for my ArnAdaptItem.
// Code must be threadsafe.
qDebug() << "MyClass LinkDestroyed: inItemPath=" << item.path()
}
void MyClass::arnEvCallback( QEvent* ev, int arnEvIdx)
{
// Is setup as ArnEvent callback for my ArnAdaptItem.
// Code must be threadsafe.
switch (arnEvIdx) {
{
ArnEvValueChange* e = static_cast<ArnEvValueChange*>( ev);
ArnAdaptItem* item = static_cast<ArnAdaptItem*>( e->target());
if (!item) break; // No target, deleted/closed ...
QByteArray val = e->valueData() ? *e->valueData() : item->toByteArray();
qDebug() << "MyClass EvValueChange: inItemPath=" << item->path()
<< " value=" << val;
break;
}
{
ArnEvModeChange* e = static_cast<ArnEvModeChange*>( ev);
ArnAdaptItem* item = static_cast<ArnAdaptItem*>( e->target());
if (!item) return; // No target, deleted/closed ...
QMutexLocker mutexLocker( &item->mutex()); // Force atomic operation on target
qDebug() << "EvModeChange: path=" << e->path() << " mode=" << e->mode()
<< " inItemPath=" << item->path();
break;
}
default:
break;
}
}

Definition at line 133 of file ArnAdaptItem.hpp.

Member Typedef Documentation

◆ ArnEventCB

typedef void(* ArnAdaptItem::ArnEventCB) (QEvent *ev, int arnEvIdx)

Definition at line 140 of file ArnAdaptItem.hpp.

◆ ChangedCB

typedef void(* ArnAdaptItem::ChangedCB) (ArnAdaptItem &target, const QByteArray &value)

Definition at line 138 of file ArnAdaptItem.hpp.

◆ LinkDestroyedCB

typedef void(* ArnAdaptItem::LinkDestroyedCB) (ArnAdaptItem &target)

Definition at line 139 of file ArnAdaptItem.hpp.

Constructor & Destructor Documentation

◆ ArnAdaptItem()

ArnAdaptItem::ArnAdaptItem ( )

Standard constructor of a closed handle.

Definition at line 70 of file ArnAdaptItem.cpp.

◆ ~ArnAdaptItem()

ArnAdaptItem::~ArnAdaptItem ( )
virtual

Definition at line 77 of file ArnAdaptItem.cpp.

Member Function Documentation

◆ addMode()

void ArnAdaptItem::addMode ( Arn::ObjectMode  mode)

Add general mode settings for this Arn Data Object

If this ArnItem is in closed state, the added modes will be stored and the real mode change is done when this ArnItem is opened to an Arn Data Object. This implies that ArnItems can benefit from setting modes before opening.

Parameters
[in]modeThe modes to be added.
See also
getMode()
Modes

Definition at line 221 of file ArnAdaptItem.cpp.

◆ addValue() [1/2]

void ArnAdaptItem::addValue ( int  value)

AtomicOp adds an integer to an Arn Data Object

Operation is done atomicly. If bidir, it can also be done remotely by an AtomicOpProvider

Parameters
[in]valueto be added to this Arn Data Object
See also
setAtomicOpProvider()

Definition at line 644 of file ArnAdaptItem.cpp.

◆ addValue() [2/2]

void ArnAdaptItem::addValue ( ARNREAL  value)

AtomicOp adds an ARNREAL to an Arn Data Object

Operation is done atomicly. If bidir, it can also be done remotely by an AtomicOpProvider

Parameters
[in]valueto be added to this Arn Data Object
See also
setAtomicOpProvider()

Definition at line 652 of file ArnAdaptItem.cpp.

◆ arnEventCallback()

ArnAdaptItem::ArnEventCB ArnAdaptItem::arnEventCallback ( ) const

Get the event callback of this ArnAdaptItem.

Returns
the event callback
See also
setArnEventCallback()
thread()

Definition at line 714 of file ArnAdaptItem.cpp.

◆ arnExport()

QByteArray ArnAdaptItem::arnExport ( ) const
Returns
A data blob representing the Arn Data Object
See also
arnImport()

Definition at line 345 of file ArnAdaptItem.cpp.

◆ arnImport()

void ArnAdaptItem::arnImport ( const QByteArray &  data,
int  ignoreSame = Arn::SameValue::DefaultAction 
)

Import data to an Arn Data Object

Data blob from a previos arnExport() can be imported. This is essentially assigning the Arn Data Object with same as exported.

Parameters
[in]datais the data blob
[in]ignoreSamecan override default ignoreSameValue setting.
See also
arnExport()
setIgnoreSameValue()

Definition at line 337 of file ArnAdaptItem.cpp.

◆ ChangedCallback()

ArnAdaptItem::ChangedCB ArnAdaptItem::ChangedCallback ( ) const

Get the changed-callback of this ArnAdaptItem.

Returns
the changed-callback
See also
setChangedCallback()
thread()

Definition at line 682 of file ArnAdaptItem.cpp.

◆ close()

void ArnAdaptItem::close ( )

Close the handle.

Definition at line 92 of file ArnAdaptItem.cpp.

◆ destroyLink()

void ArnAdaptItem::destroyLink ( bool  isGlobal = true)

Destroy the Arn Data Object

The link (Arn Data Object) will be removed locally and optionally from server and all connected clients. Server is allways forcing global destroy.

Parameters
[in]isGlobalIf true, removes from server and all connected clients, otherwise only local link.
See also
destroyLinkLocal()

Definition at line 100 of file ArnAdaptItem.cpp.

◆ destroyLinkLocal()

void ArnAdaptItem::destroyLinkLocal ( )
inline

Destroy the local Arn Data Object

The link (Arn Data Object) will be removed locally. Server is allways forcing global destroy.

See also
destroyLink()

Definition at line 172 of file ArnAdaptItem.hpp.

◆ getMode()

Arn::ObjectMode ArnAdaptItem::getMode ( ) const
Returns
The general mode of the Arn Data Object
See also
addMode()
Modes

Definition at line 229 of file ArnAdaptItem.cpp.

◆ isAutoDestroy()

bool ArnAdaptItem::isAutoDestroy ( ) const
Return values
trueif AutoDestroy mode
See also
setAutoDestroy()

Definition at line 328 of file ArnAdaptItem.cpp.

◆ isBiDirMode()

bool ArnAdaptItem::isBiDirMode ( ) const
Return values
trueif Bidirectional
See also
setBiDirMode()
Modes
Bidirectional Arn Data Objects

Definition at line 256 of file ArnAdaptItem.cpp.

◆ isFolder()

bool ArnAdaptItem::isFolder ( ) const
Return values
trueif this ArnItem is a folder

Definition at line 177 of file ArnAdaptItem.cpp.

◆ isIgnoreSameValue()

bool ArnAdaptItem::isIgnoreSameValue ( ) const
Return values
trueif skipping equal values
See also
setIgnoreSameValue()

Definition at line 212 of file ArnAdaptItem.cpp.

◆ isMaster()

bool ArnAdaptItem::isMaster ( ) const
Return values
trueif Master mode
See also
setMaster()
Modes

Definition at line 310 of file ArnAdaptItem.cpp.

◆ isOpen()

bool ArnAdaptItem::isOpen ( ) const

State of the handle.

Return values
trueif this ArnItem is open

Definition at line 108 of file ArnAdaptItem.cpp.

◆ isPipeMode()

bool ArnAdaptItem::isPipeMode ( ) const
Return values
trueif Pipe mode
See also
setPipeMode()
Modes
Pipe Arn Data Objects

Definition at line 274 of file ArnAdaptItem.cpp.

◆ isProvider()

bool ArnAdaptItem::isProvider ( ) const
Return values
trueif this ArnItem is a provider
See also
setBiDirMode()
Modes

Definition at line 186 of file ArnAdaptItem.cpp.

◆ isSaveMode()

bool ArnAdaptItem::isSaveMode ( ) const
Return values
trueif Save mode
See also
setSaveMode()
Modes
Persistent Arn Data Objects

Definition at line 292 of file ArnAdaptItem.cpp.

◆ isUncrossed()

bool ArnAdaptItem::isUncrossed ( ) const

Get the Uncrossed state of an object.

Return values
trueif Uncrossed is set or Arn Data Object is not in Bidirectional mode.
See also
setUncrossed()
setBiDirMode()
Modes
Bidirectional Arn Data Objects

Definition at line 730 of file ArnAdaptItem.cpp.

◆ itemId()

uint ArnAdaptItem::itemId ( ) const

Get the id for this ArnItem.

The ArnItem id is unique within its running program. Even if 2 ArnItems are pointing to the same Arn Data Object, they have different item id.

Returns
id for this ArnItem
See also
linkId()

Definition at line 150 of file ArnAdaptItem.cpp.

◆ linkDestroyedCallback()

ArnAdaptItem::LinkDestroyedCB ArnAdaptItem::linkDestroyedCallback ( ) const

Get the link-destroyed-callback of this ArnAdaptItem.

Returns
the link-destroyed-callback
See also
setLinkDestroyedCallback()
thread()

Definition at line 698 of file ArnAdaptItem.cpp.

◆ linkId()

uint ArnAdaptItem::linkId ( ) const

Get the id for this Arn Data Object

The link (Arn Data Object) id is unique within its running program. If 2 ArnItems are pointing to the same Arn Data Object, they have same link id.

Returns
Id for the Arn Data Object, 0 if closed
See also
itemId()

Definition at line 159 of file ArnAdaptItem.cpp.

◆ mutex()

ARN_RecursiveMutex & ArnAdaptItem::mutex ( ) const

Get the mutex of this ArnAdaptItem.

This can be used for atomic operations etc on the item. The item it self is thread safe without the application code is using this mutex. Also this mutex is using QMutex::Recursive.

Returns
the items mutex

Definition at line 660 of file ArnAdaptItem.cpp.

◆ name()

QString ArnAdaptItem::name ( Arn::NameF  nameF) const

Name of the Arn Data Object

Parameters
[in]nameFThe format of the returned name
Returns
The object name

Definition at line 125 of file ArnAdaptItem.cpp.

◆ open()

bool ArnAdaptItem::open ( const QString &  path)

Open a handle to an Arn Data Object

Parameters
[in]pathThe Arn Data Object path e.g. "//Measure/Water/Level/value"
Return values
falseif error

Definition at line 82 of file ArnAdaptItem.cpp.

◆ operator+=() [1/2]

ArnAdaptItem & ArnAdaptItem::operator+= ( int  val)

Definition at line 530 of file ArnAdaptItem.cpp.

◆ operator+=() [2/2]

ArnAdaptItem & ArnAdaptItem::operator+= ( ARNREAL  val)

Definition at line 539 of file ArnAdaptItem.cpp.

◆ operator=() [1/10]

ArnAdaptItem & ArnAdaptItem::operator= ( const ArnAdaptItem other)

Definition at line 440 of file ArnAdaptItem.cpp.

◆ operator=() [2/10]

ArnAdaptItem & ArnAdaptItem::operator= ( int  val)

Definition at line 449 of file ArnAdaptItem.cpp.

◆ operator=() [3/10]

ArnAdaptItem & ArnAdaptItem::operator= ( ARNREAL  val)

Definition at line 458 of file ArnAdaptItem.cpp.

◆ operator=() [4/10]

ArnAdaptItem & ArnAdaptItem::operator= ( const QString &  val)

Definition at line 467 of file ArnAdaptItem.cpp.

◆ operator=() [5/10]

ArnAdaptItem & ArnAdaptItem::operator= ( const QByteArray &  val)

Definition at line 476 of file ArnAdaptItem.cpp.

◆ operator=() [6/10]

ArnAdaptItem & ArnAdaptItem::operator= ( const QVariant &  val)

Definition at line 485 of file ArnAdaptItem.cpp.

◆ operator=() [7/10]

ArnAdaptItem & ArnAdaptItem::operator= ( const char *  val)

Definition at line 494 of file ArnAdaptItem.cpp.

◆ operator=() [8/10]

ArnAdaptItem & ArnAdaptItem::operator= ( uint  val)

Definition at line 503 of file ArnAdaptItem.cpp.

◆ operator=() [9/10]

ArnAdaptItem & ArnAdaptItem::operator= ( qint64  val)

Definition at line 512 of file ArnAdaptItem.cpp.

◆ operator=() [10/10]

ArnAdaptItem & ArnAdaptItem::operator= ( quint64  val)

Definition at line 521 of file ArnAdaptItem.cpp.

◆ path()

QString ArnAdaptItem::path ( Arn::NameF  nameF = Arn::NameF::EmptyOk) const

Path of the Arn Data Object

Parameters
[in]nameFThe format of the returned path
Returns
The object path

Definition at line 117 of file ArnAdaptItem.cpp.

◆ refCount()

int ArnAdaptItem::refCount ( ) const

Get the number of refs to this Arn Data Object

Returns
The number of refs for the Arn Data Object, -1 if closed

Definition at line 168 of file ArnAdaptItem.cpp.

◆ reference()

void * ArnAdaptItem::reference ( ) const

Get the stored external reference.

Returns
The associated external reference
See also
setReference()

Definition at line 141 of file ArnAdaptItem.cpp.

◆ setArnEventCallback()

void ArnAdaptItem::setArnEventCallback ( ArnEventCB  evCB)

Set event callback for this ArnAdaptItem.

Use e.g prototype: void myArnEventCB( QEvent* ev, int arnEvIdx); The event callback function must be threadsafe as it can be called from any thread.

Parameters
[in]evCBcallback to be assigned
See also
arnEventCallback()
thread()

Definition at line 706 of file ArnAdaptItem.cpp.

◆ setAutoDestroy()

ArnAdaptItem & ArnAdaptItem::setAutoDestroy ( )

Set client session sync mode as AutoDestroy for this ArnItem.

This ArnItem at client side is setup for auto destruction.

Precondition
This must be set before open().

Definition at line 319 of file ArnAdaptItem.cpp.

◆ setBiDirMode()

ArnAdaptItem & ArnAdaptItem::setBiDirMode ( )

Set general mode as Bidirectional for this Arn Data Object

A two way object, typically for validation or pipe

See also
Modes
Bidirectional Arn Data Objects

Definition at line 247 of file ArnAdaptItem.cpp.

◆ setBits()

void ArnAdaptItem::setBits ( int  mask,
int  value,
int  ignoreSame = Arn::SameValue::DefaultAction 
)

AtomicOp assign an integer to specified bits in an Arn Data Object

Operation is done atomicly. If bidir, it can also be done remotely by an AtomicOpProvider

Parameters
[in]maskto specify bits that is affected
[in]valueto be assigned to affected bits
[in]ignoreSamecan override default ignoreSameValue setting.
See also
setAtomicOpProvider()
setIgnoreSameValue()

Definition at line 636 of file ArnAdaptItem.cpp.

◆ setChangedCallback()

void ArnAdaptItem::setChangedCallback ( ArnAdaptItem::ChangedCB  changedCB)

Set changed-callback for this ArnAdaptItem.

The callback is called when data in Arn Data Object is changed. Use e.g prototype: void myChangeCB( ArnAdaptItem& target, const QByteArray& value); The changed-callback function must be threadsafe as it can be called from any thread.

Parameters
[in]changedCBcallback to be assigned
See also
changedCallback()
thread()

Definition at line 674 of file ArnAdaptItem.cpp.

◆ setIgnoreSameValue()

void ArnAdaptItem::setIgnoreSameValue ( bool  isIgnore = true)

Set skipping of equal value.

Parameters
[in]isIgnoreIf true, assignment of equal value don't give a changed signal.

Definition at line 204 of file ArnAdaptItem.cpp.

◆ setLinkDestroyedCallback()

void ArnAdaptItem::setLinkDestroyedCallback ( ArnAdaptItem::LinkDestroyedCB  linkDestroyedCB)

Set link-destroyed-callback for this ArnAdaptItem.

The callback is called when the Arn Data Object is destroyed. Use e.g prototype: void myLinkDestroyedCB( ArnAdaptItem& target); The link-destroyed-callback function must be threadsafe as it can be called from any thread.

Parameters
[in]linkDestroyedCBcallback to be assigned
See also
linkDestroyedCallback()
thread()

Definition at line 690 of file ArnAdaptItem.cpp.

◆ setMaster()

ArnAdaptItem & ArnAdaptItem::setMaster ( )

Set client session sync mode as Master for this ArnItem.

This ArnItem at client side is set as default generator of data.

Precondition
This must be set before open().
See also
Modes

Definition at line 301 of file ArnAdaptItem.cpp.

◆ setPipeMode()

ArnAdaptItem & ArnAdaptItem::setPipeMode ( )

Set general mode as Pipe for this Arn Data Object

Implies Bidir.

See also
Modes
Pipe Arn Data Objects

Definition at line 265 of file ArnAdaptItem.cpp.

◆ setReference()

void ArnAdaptItem::setReference ( void *  reference)

Set an associated external reference.

This is typically used when having many ArnItems changed signal connected to a common slot. The slot can then discover the signalling ArnItem:s associated structure for further processing.

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

Definition at line 133 of file ArnAdaptItem.cpp.

◆ setSaveMode()

ArnAdaptItem & ArnAdaptItem::setSaveMode ( )

Set general mode as Save for this Arn Data Object

Data is persistent and will be saved

Precondition
The persistent service must be started at the server.
See also
Modes
Persistent Arn Data Objects

Definition at line 283 of file ArnAdaptItem.cpp.

◆ setUncrossed()

void ArnAdaptItem::setUncrossed ( bool  isUncrossed = true)

Set a Bidirectional item as Uncrossed.

The two way object is not twisted at writes, i.e. exactly the same object is read and written. This has no effect on an Arn Data Object that not is in Bidirectional mode.

See also
isUncrossed()
Modes
Bidirectional Arn Data Objects

Definition at line 722 of file ArnAdaptItem.cpp.

◆ setValue() [1/11]

void ArnAdaptItem::setValue ( const ArnAdaptItem other,
int  ignoreSame = Arn::SameValue::DefaultAction 
)

Definition at line 548 of file ArnAdaptItem.cpp.

◆ setValue() [2/11]

void ArnAdaptItem::setValue ( int  value,
int  ignoreSame = Arn::SameValue::DefaultAction 
)

Assign an integer to an Arn Data Object

Parameters
[in]valueto be assigned
[in]ignoreSamecan override default ignoreSameValue setting.
See also
setIgnoreSameValue()

Definition at line 556 of file ArnAdaptItem.cpp.

◆ setValue() [3/11]

void ArnAdaptItem::setValue ( ARNREAL  value,
int  ignoreSame = Arn::SameValue::DefaultAction 
)

Assign an ARNREAL to an Arn Data Object

Parameters
[in]valueto be assigned
[in]ignoreSamecan override default ignoreSameValue setting.
See also
setIgnoreSameValue()

Definition at line 564 of file ArnAdaptItem.cpp.

◆ setValue() [4/11]

void ArnAdaptItem::setValue ( bool  value,
int  ignoreSame = Arn::SameValue::DefaultAction 
)

Assign a bool to an Arn Data Object

Parameters
[in]valueto be assigned
[in]ignoreSamecan override default ignoreSameValue setting.
See also
setIgnoreSameValue()

Definition at line 572 of file ArnAdaptItem.cpp.

◆ setValue() [5/11]

void ArnAdaptItem::setValue ( const QString &  value,
int  ignoreSame = Arn::SameValue::DefaultAction 
)

Assign a QString to an Arn Data Object

Parameters
[in]valueto be assigned
[in]ignoreSamecan override default ignoreSameValue setting.
See also
setIgnoreSameValue()

Definition at line 580 of file ArnAdaptItem.cpp.

◆ setValue() [6/11]

void ArnAdaptItem::setValue ( const QByteArray &  value,
int  ignoreSame = Arn::SameValue::DefaultAction 
)

Assign a QByteArray to an Arn Data Object

Parameters
[in]valueto be assigned
[in]ignoreSamecan override default ignoreSameValue setting.
See also
setIgnoreSameValue()

Definition at line 588 of file ArnAdaptItem.cpp.

◆ setValue() [7/11]

void ArnAdaptItem::setValue ( const QVariant &  value,
int  ignoreSame = Arn::SameValue::DefaultAction 
)

Assign a QVariant to an Arn Data Object

Parameters
[in]valueto be assigned
[in]ignoreSamecan override default ignoreSameValue setting.
See also
setIgnoreSameValue()

Definition at line 596 of file ArnAdaptItem.cpp.

◆ setValue() [8/11]

void ArnAdaptItem::setValue ( const char *  value,
int  ignoreSame = Arn::SameValue::DefaultAction 
)

Assign a char* to an Arn Data Object

Parameters
[in]valueto be assigned
[in]ignoreSamecan override default ignoreSameValue setting.
See also
setIgnoreSameValue()

Definition at line 604 of file ArnAdaptItem.cpp.

◆ setValue() [9/11]

void ArnAdaptItem::setValue ( uint  value,
int  ignoreSame = Arn::SameValue::DefaultAction 
)

Assign an unsigned int to an Arn Data Object

Parameters
[in]valueto be assigned
[in]ignoreSamecan override default ignoreSameValue setting.
See also
setIgnoreSameValue()
Note
Not native ARN datatype. ByteArray is assigned.

Definition at line 612 of file ArnAdaptItem.cpp.

◆ setValue() [10/11]

void ArnAdaptItem::setValue ( qint64  value,
int  ignoreSame = Arn::SameValue::DefaultAction 
)

Assign an int 64 bit to an Arn Data Object

Parameters
[in]valueto be assigned
[in]ignoreSamecan override default ignoreSameValue setting.
See also
setIgnoreSameValue()
Note
Not native ARN datatype. ByteArray is assigned.

Definition at line 620 of file ArnAdaptItem.cpp.

◆ setValue() [11/11]

void ArnAdaptItem::setValue ( quint64  value,
int  ignoreSame = Arn::SameValue::DefaultAction 
)

Assign an unsigned int 64 bit to an Arn Data Object

Parameters
[in]valueto be assigned
[in]ignoreSamecan override default ignoreSameValue setting.
See also
setIgnoreSameValue()
Note
Not native ARN datatype. ByteArray is assigned.

Definition at line 628 of file ArnAdaptItem.cpp.

◆ syncMode()

Arn::ObjectSyncMode ArnAdaptItem::syncMode ( ) const
Returns
The client session sync mode of an Arn Data Object
See also
Modes

Definition at line 238 of file ArnAdaptItem.cpp.

◆ thread()

QThread * ArnAdaptItem::thread ( ) const

Get the thread affinity of this ArnAdaptItem.

The affinity is allways the same as the caller thread.

Returns
the thread affinity (caller thread)
See also
setArnEventCallback()

Definition at line 668 of file ArnAdaptItem.cpp.

◆ toBool()

bool ArnAdaptItem::toBool ( bool *  isOk = arnNullptr) const
Returns
Convert Arn Data Object to a bool
Parameters
[out]isOkIf not 0 when a conversion error occurs, *isOk is set to false, otherwise *isOk is set to true.
Note
Not native ARN datatype. It's converted from Int.

Definition at line 404 of file ArnAdaptItem.cpp.

◆ toByteArray()

QByteArray ArnAdaptItem::toByteArray ( bool *  isOk = arnNullptr) const
Returns
Convert Arn Data Object to a QByteArray
Parameters
[out]isOkIf not 0 when a conversion error occurs, *isOk is set to false, otherwise *isOk is set to true.

Definition at line 388 of file ArnAdaptItem.cpp.

◆ toDouble()

double ArnAdaptItem::toDouble ( bool *  isOk = arnNullptr) const
Returns
Convert Arn Data Object to a double
Parameters
[out]isOkIf not 0 when a conversion error occurs, *isOk is set to false, otherwise *isOk is set to true.

Definition at line 362 of file ArnAdaptItem.cpp.

◆ toInt()

int ArnAdaptItem::toInt ( bool *  isOk = arnNullptr) const
Returns
Convert Arn Data Object to an integer
Parameters
[out]isOkIf not 0 when a conversion error occurs, *isOk is set to false, otherwise *isOk is set to true.

Definition at line 353 of file ArnAdaptItem.cpp.

◆ toInt64()

qint64 ArnAdaptItem::toInt64 ( bool *  isOk = arnNullptr) const
Returns
Convert Arn Data Object to an int 64 bit
Parameters
[out]isOkIf not 0 when a conversion error occurs, *isOk is set to false, otherwise *isOk is set to true.
Note
Not native ARN datatype. It's converted from ByteArray.

Definition at line 422 of file ArnAdaptItem.cpp.

◆ toReal()

ARNREAL ArnAdaptItem::toReal ( bool *  isOk = arnNullptr) const
Returns
Convert Arn Data Object to an ARNREAL
Parameters
[out]isOkIf not 0 when a conversion error occurs, *isOk is set to false, otherwise *isOk is set to true.

Definition at line 371 of file ArnAdaptItem.cpp.

◆ toString()

QString ArnAdaptItem::toString ( bool *  isOk = arnNullptr) const
Returns
Convert Arn Data Object to a QString
Parameters
[out]isOkIf not 0 when a conversion error occurs, *isOk is set to false, otherwise *isOk is set to true.

Definition at line 380 of file ArnAdaptItem.cpp.

◆ toUInt()

uint ArnAdaptItem::toUInt ( bool *  isOk = arnNullptr) const
Returns
Convert Arn Data Object to an unsigned int
Parameters
[out]isOkIf not 0 when a conversion error occurs, *isOk is set to false, otherwise *isOk is set to true.
Note
Not native ARN datatype. It's converted from ByteArray.

Definition at line 413 of file ArnAdaptItem.cpp.

◆ toUInt64()

quint64 ArnAdaptItem::toUInt64 ( bool *  isOk = arnNullptr) const
Returns
Convert Arn Data Object to an unsigned int 64 bit
Parameters
[out]isOkIf not 0 when a conversion error occurs, *isOk is set to false, otherwise *isOk is set to true.
Note
Not native ARN datatype. It's converted from ByteArray.

Definition at line 431 of file ArnAdaptItem.cpp.

◆ toVariant()

QVariant ArnAdaptItem::toVariant ( bool *  isOk = arnNullptr) const
Returns
Convert Arn Data Object to a QVariant
Parameters
[out]isOkIf not 0 when a conversion error occurs, *isOk is set to false, otherwise *isOk is set to true.

Definition at line 396 of file ArnAdaptItem.cpp.

◆ type()

Arn::DataType ArnAdaptItem::type ( ) const

The type stored in the Arn Data Object

Returns
The type stored

Definition at line 195 of file ArnAdaptItem.cpp.


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