33 #include "private/ArnAdaptItem_p.hpp" 37 #include <QMutexLocker> 40 #define MUTEX_CALL( funcCall ) \ 45 #define MUTEX_CALL_RET( funcCall ) \ 46 QMutexLocker mutexLocker( &d->_mutex); \ 50 ArnAdaptItemPrivate::ArnAdaptItemPrivate()
52 , _changedCB( arnNullptr)
53 , _linkDestroyedCB( arnNullptr)
54 , _arnEventCB( arnNullptr)
59 ArnAdaptItemPrivate::~ArnAdaptItemPrivate()
64 void ArnAdaptItem::init()
87 MUTEX_CALL(
bool r = openWithFlags(
path, Flags::CreateAllowed | Flags::Threaded))
670 return QThread::currentThread();
678 d->_changedCB = changedCB;
686 return d->_changedCB;
694 d->_linkDestroyedCB = linkDestroyedCB;
702 return d->_linkDestroyedCB;
710 d->_arnEventCB = evCB;
718 return d->_arnEventCB;
739 bool ArnAdaptItem::sendArnEventLink(
ArnEvent* ev)
743 MUTEX_CALL(
bool r = ArnBasicItem::sendArnEventLink( ev))
748 void ArnAdaptItem::sendArnEventItem(
ArnEvent* ev,
bool isAlienThread,
bool isLocked)
756 arnEvent( ev, isAlienThread);
764 void ArnAdaptItem::arnEvent( QEvent* ev,
bool isAlienThread)
766 Q_UNUSED(isAlienThread)
772 if (d->_arnEventCB) {
773 (*(d->_arnEventCB))( ev, evIdx);
779 if (!d->_changedCB)
return;
785 (*(d->_changedCB))( *target, val);
796 QMutexLocker mutexLocker( &target->
mutex());
813 QMutexLocker mutexLocker( &target->
mutex());
817 if (d->_linkDestroyedCB) {
818 (*(d->_linkDestroyedCB))( *target);
830 void ArnAdaptItem::errorLog(
const QString& errText,
ArnError err,
void* reference)
const Data type of an Arn Data Object
bool isUncrossed() const
Get the Uncrossed state of an object.
ArnAdaptItem & setSaveMode()
Set general mode as Save for this Arn Data Object
void addMode(Arn::ObjectMode mode)
Add general mode settings for this Arn Data Object
QString toString(bool *isOk=arnNullptr) const
void destroyLink(bool isGlobal=true)
Destroy the Arn Data Object
bool isAutoDestroy() const
ArnAdaptItem & setBiDirMode()
Set general mode as Bidirectional for this Arn Data Object
void setValue(const ArnBasicItem &other, int ignoreSame=Arn::SameValue::DefaultAction)
ArnBasicItem & setPipeMode()
Set general mode as Pipe for this Arn Data Object
Arn::ObjectMode getMode() const
uint itemId() const
Get the id for this ArnItem.
quint64 toUInt64(bool *isOk=arnNullptr) const
void addValue(int value)
AtomicOp adds an integer to an Arn Data Object
#define MUTEX_CALL_RET(funcCall)
const QByteArray * valueData() const
qint64 toInt64(bool *isOk=arnNullptr) const
Arn::ObjectSyncMode syncMode() const
void setArnEventCallback(ArnEventCB evCB)
Set event callback for this ArnAdaptItem.
bool toBool(bool *isOk=arnNullptr) const
void arnImport(const QByteArray &data, int ignoreSame=Arn::SameValue::DefaultAction)
Import data to an Arn Data Object
bool isOpen() const
State of the handle.
QByteArray arnExport() const
void close()
Close the handle.
void setReference(void *reference)
Set an associated external reference.
ArnBasicItem & setSaveMode()
Set general mode as Save for this Arn Data Object
void setUncrossed(bool isUncrossed=true)
Set a Bidirectional item as Uncrossed.
bool open(const QString &path)
Open a handle to an Arn Data Object
int refCount() const
Get the number of refs to this Arn Data Object
ArnAdaptItem & operator+=(int val)
int toInt(bool *isOk=arnNullptr) const
ArnAdaptItem & setPipeMode()
Set general mode as Pipe for this Arn Data Object
uint toUInt(bool *isOk=arnNullptr) const
void setReference(void *reference)
Set an associated external reference.
Implies BiDir and all data is preserved as a stream.
QString toString(bool *isOk=arnNullptr) const
! Non Qt and threadsafe handle for an Arn Data Object.
uint linkId() const
Get the id for this Arn Data Object
#define MUTEX_CALL(funcCall)
uint toUInt(bool *isOk=arnNullptr) const
bool toBool(bool *isOk=arnNullptr) const
QThread * thread() const
Get the thread affinity of this ArnAdaptItem.
void setIgnoreSameValue(bool isIgnore=true)
Set skipping of equal value.
void setUncrossed(bool isUncrossed=true)
Set a Bidirectional item as Uncrossed.
void(* ChangedCB)(ArnAdaptItem &target, const QByteArray &value)
Arn::ObjectMode getMode() const
Use with care, link must be "referenced" before use, otherwise it might have been deleted...
QByteArray toByteArray(bool *isOk=arnNullptr) const
Arn::ObjectSyncMode syncMode() const
int toInt(bool *isOk=arnNullptr) const
uint itemId() const
Get the id for this ArnItem.
void setValue(const ArnAdaptItem &other, int ignoreSame=Arn::SameValue::DefaultAction)
bool isIgnoreSameValue() const
ARN_RecursiveMutex & mutex() const
Get the mutex of this ArnAdaptItem.
ARNREAL toReal(bool *isOk=arnNullptr) const
#define ARN_ModeRecursiveMutex
void setIgnoreSameValue(bool isIgnore=true)
Set skipping of equal value.
Arn::ObjectMode mode() const
bool isUncrossed() const
Get the Uncrossed state of an object.
QByteArray toByteArray(bool *isOk=arnNullptr) const
Arn::DataType type() const
The type stored in the Arn Data Object
void setBits(int mask, int value, int ignoreSame=Arn::SameValue::DefaultAction)
AtomicOp assign an integer to specified bits in an Arn Data Object
void setLinkDestroyedCallback(LinkDestroyedCB linkDestroyedCB)
Set link-destroyed-callback for this ArnAdaptItem.
quint64 toUInt64(bool *isOk=arnNullptr) const
double toDouble(bool *isOk=arnNullptr) const
ARNREAL toReal(bool *isOk=arnNullptr) const
LinkDestroyedCB linkDestroyedCallback() const
Get the link-destroyed-callback of this ArnAdaptItem.
void addValue(int value)
AtomicOp adds an integer to an Arn Data Object
ArnAdaptItem & operator=(const ArnAdaptItem &other)
ArnAdaptItem()
Standard constructor of a closed handle.
void * reference() const
Get the stored external reference.
void setBits(int mask, int value, int ignoreSame=Arn::SameValue::DefaultAction)
AtomicOp assign an integer to specified bits in an Arn Data Object
void arnImport(const QByteArray &data, int ignoreSame=Arn::SameValue::DefaultAction)
Import data to an Arn Data Object
#define ARN_RecursiveMutex
void setChangedCallback(ChangedCB changedCB)
Set changed-callback for this ArnAdaptItem.
Link flags when accessing an Arn Data Object
QVariant toVariant(bool *isOk=arnNullptr) const
int refCount() const
Get the number of refs to this Arn Data Object
void * reference() const
Get the stored external reference.
bool isOpen() const
State of the handle.
QString path(Arn::NameF nameF=Arn::NameF::EmptyOk) const
Path of the Arn Data Object
ArnBasicItem & setBiDirMode()
Set general mode as Bidirectional for this Arn Data Object
void addMode(Arn::ObjectMode mode)
Add general mode settings for this Arn Data Object
Arn::DataType type() const
The type stored in the Arn Data Object
ArnAdaptItem & setMaster()
Set client session sync mode as Master for this ArnItem.
void(* ArnEventCB)(QEvent *ev, int arnEvIdx)
bool isAutoDestroy() const
ArnEventCB arnEventCallback() const
Get the event callback of this ArnAdaptItem.
ArnAdaptItem & setAutoDestroy()
Set client session sync mode as AutoDestroy for this ArnItem.
ArnBasicItem & setAutoDestroy()
Set client session sync mode as AutoDestroy for this ArnItem.
QString path(Arn::NameF nameF=Arn::NameF::EmptyOk) const
Path of the Arn Data Object
double toDouble(bool *isOk=arnNullptr) const
ChangedCB ChangedCallback() const
Get the changed-callback of this ArnAdaptItem.
QVariant toVariant(bool *isOk=arnNullptr) const
uint linkId() const
Get the id for this Arn Data Object
void destroyLink(bool isGlobal=true)
Destroy the Arn Data Object
void close()
Close the handle.
qint64 toInt64(bool *isOk=arnNullptr) const
bool isIgnoreSameValue() const
QString name(Arn::NameF nameF) const
Name of the Arn Data Object
void setTarget(void *target)
QString name(Arn::NameF nameF) const
Name of the Arn Data Object
QByteArray arnExport() const
ArnBasicItem & setMaster()
Set client session sync mode as Master for this ArnItem.
Base class handle for an Arn Data Object.
void(* LinkDestroyedCB)(ArnAdaptItem &target)