ArnLib  4.0.x
Active Registry Network
ArnPipe Class Reference

ArnItem specialized as a pipe. More...

#include <ArnPipe.hpp>

Inheritance diagram for ArnPipe:
Collaboration diagram for ArnPipe:

Public Slots

void setValue (const QByteArray &value)
 Assign a QByteArray to a Pipe More...
 

Signals

void changed (const QByteArray &value)
 Signal emitted when Pipe has received data. More...
 
void outOfSequence ()
 Signal emitted when the received sequence numbers are "out of sequence". More...
 
- Signals inherited from ArnItemB
void arnLinkDestroyed ()
 Signal emitted when the Arn Data Object is destroyed. More...
 

Public Member Functions

 ArnPipe (QObject *parent=arnNullptr)
 Standard constructor of a closed handle. More...
 
 ArnPipe (const QString &path, QObject *parent=arnNullptr)
 Construction of a pipe handle to a path More...
 
virtual ~ArnPipe ()
 
bool openUuid (const QString &path)
 Open a handle to an Arn Pipe Object with a unique uuid name. More...
 
ArnPipesetMaster ()
 Set client session sync mode as Master for this ArnItem. More...
 
bool isMaster () const
 
ArnPipesetAutoDestroy ()
 Set client session sync mode as AutoDestroy for this ArnItem. More...
 
bool isAutoDestroy () const
 
ArnPipeoperator= (const QByteArray &value)
 
void setValueOverwrite (const QByteArray &value, const ARN_RegExp &rx)
 Assign a QByteArray to a Pipe by using Anti congest logic. More...
 
bool isSendSeq () const
 Returns true if sending sequence numbers. More...
 
void setSendSeq (bool useSendSeq)
 Change usage of sending sequence numbers. More...
 
bool isCheckSeq () const
 Returns true if checking received sequence numbers. More...
 
void setCheckSeq (bool useCheckSeq)
 Change usage of checking received sequence numbers. 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

ArnItem specialized as a pipe.

About Pipes

This class is not thread-safe, but the Arn Data object is, so each thread should have it's own handles i.e ArnPipe instances.

Example usage

// In class declare
ArnPipe _arnPipe;
// In class code
_arnPipe.open("//Pipes/Pipe/value");
_arnPipe.setSendSeq( true);
_arnPipe.setCheckSeq( true);
connect( &_arnPipe., SIGNAL(outOfSequence()), this, SLOT(doOutOfSequence()));
connect( &_arnPipe, SIGNAL(changed(QByteArray)), this, SLOT(doPipeInput(QByteArray)));
ARN_RegExp rx("^ping\\b");
_arnPipe.setValueOverwrite( "ping new", rx);

Definition at line 64 of file ArnPipe.hpp.

Constructor & Destructor Documentation

◆ ArnPipe() [1/2]

ArnPipe::ArnPipe ( QObject *  parent = arnNullptr)

Standard constructor of a closed handle.

Parameters
[in]parent

Definition at line 58 of file ArnPipe.cpp.

◆ ArnPipe() [2/2]

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

Construction of a pipe handle to a path

The mode for this handle is set to Arn::ObjectMode::Pipe.

Parameters
[in]pathThe Arn Data Object path e.g. "//Pipes/myPipe/value"
[in]parent
See also
open()

Definition at line 65 of file ArnPipe.cpp.

◆ ~ArnPipe()

ArnPipe::~ArnPipe ( )
virtual

Definition at line 79 of file ArnPipe.cpp.

Member Function Documentation

◆ changed

void ArnPipe::changed ( const QByteArray &  value)
signal

Signal emitted when Pipe has received data.

This is implied by the Arn Data Object is changed.

Parameters
[in]valueis the received bytes

◆ isAutoDestroy()

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

Definition at line 118 of file ArnPipe.hpp.

◆ isCheckSeq()

bool ArnPipe::isCheckSeq ( ) const

Returns true if checking received sequence numbers.

Return values
trueif checking received sequence numbers
See also
setCheckSeq()

Definition at line 146 of file ArnPipe.cpp.

◆ isMaster()

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

Definition at line 105 of file ArnPipe.hpp.

◆ isSendSeq()

bool ArnPipe::isSendSeq ( ) const

Returns true if sending sequence numbers.

Return values
trueif sending sequence numbers
See also
setSendSeq()

Definition at line 130 of file ArnPipe.cpp.

◆ openUuid()

bool ArnPipe::openUuid ( const QString &  path)
inline

Open a handle to an Arn Pipe Object with a unique uuid name.

If path is marked as provider, the "!" marker will be moved to after uuid.

Parameters
[in]pathThe prefix for Arn uuid pipe path e.g. "//Pipes/pipe"
Return values
falseif error

Definition at line 90 of file ArnPipe.hpp.

◆ operator=()

ArnPipe & ArnPipe::operator= ( const QByteArray &  value)

Definition at line 98 of file ArnPipe.cpp.

◆ outOfSequence

void ArnPipe::outOfSequence ( )
signal

Signal emitted when the received sequence numbers are "out of sequence".

See also
setCheckSeq()
setSendSeq()
Pipe sequence check

◆ setAutoDestroy()

ArnPipe& ArnPipe::setAutoDestroy ( )
inline

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 112 of file ArnPipe.hpp.

◆ setCheckSeq()

void ArnPipe::setCheckSeq ( bool  useCheckSeq)

Change usage of checking received sequence numbers.

Parameters
[in]useCheckSeqis true for activation
See also
isCheckSeq()
setSendSeq()
outOfSequence()
Pipe sequence check

Definition at line 154 of file ArnPipe.cpp.

◆ setMaster()

ArnPipe& ArnPipe::setMaster ( )
inline

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 98 of file ArnPipe.hpp.

◆ setSendSeq()

void ArnPipe::setSendSeq ( bool  useSendSeq)

Change usage of sending sequence numbers.

Parameters
[in]useSendSeqis true for activation
See also
isSendSeq()
setCheckSeq()
outOfSequence()
Pipe sequence check

Definition at line 138 of file ArnPipe.cpp.

◆ setValue

void ArnPipe::setValue ( const QByteArray &  value)
slot

Assign a QByteArray to a Pipe

Parameters
[in]valueto be assigned

Definition at line 84 of file ArnPipe.cpp.

◆ setValueOverwrite()

void ArnPipe::setValueOverwrite ( const QByteArray &  value,
const ARN_RegExp rx 
)

Assign a QByteArray to a Pipe by using Anti congest logic.

This is used to limit the filling of sendqueue with recuring messages during some kind of client disconnection. Matched message in sendqueue is overwritten by the new message value. Unmatched message is added to send queue as usual.

Example:

// Messages starts with a function name
// We want message with equal function name to overwrite
ARN_RegExp rx("^" + funcName + "\\b");
_pipe->setValueOverwrite( message, rx);

Parameters
[in]valueto be assigned
[in]rxis regexp to be matched with items in send queue.
See also
Pipe anti congest

Definition at line 105 of file ArnPipe.cpp.


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