ArnLib  4.0.x
Active Registry Network
ArnItemValve Class Reference

Valve for controlling stream to/from an ArnItemB. More...

#include <ArnItemValve.hpp>

Inheritance diagram for ArnItemValve:
Collaboration diagram for ArnItemValve:

Classes

struct  SwitchMode
 

Public Slots

void setValue (bool value)
 Assign a bool to an Arn Data Object More...
 

Signals

void changed (int value)
 
- Signals inherited from ArnItemB
void arnLinkDestroyed ()
 Signal emitted when the Arn Data Object is destroyed. More...
 

Public Member Functions

 ArnItemValve (QObject *parent=arnNullptr)
 
bool setTarget (ArnItemB *targetItem, SwitchMode mode=SwitchMode::InOutStream)
 
SwitchMode switchMode () const
 
ArnItemValvesetSaveMode ()
 Set general mode as Save for this Arn Data Object More...
 
bool isSaveMode () const
 
ArnItemValvesetMaster ()
 Set client session sync mode as Master for this ArnItem. More...
 
bool isMaster () const
 
ArnItemValvesetAutoDestroy ()
 Set client session sync mode as AutoDestroy for this ArnItem. More...
 
bool isAutoDestroy () const
 
bool toBool () const
 
ArnItemValveoperator= (bool value)
 
- 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

Valve for controlling stream to/from an ArnItemB.

About Arn Data Object

This valve class can control data stream to/from any ArnItemB derived class. The class itself is derived from ArnItemB, so it could also be controlled by another ArnItemValve. But most importent, it has a subset of ArnItem's methods to make it shareable in the ARN tree.

ArnItemValve can be used "standalone", i.e. not beeing opened to the ARN tree. In this case it is used by its setValue method and locally emits its changed() signal.

When opened to the ARN tree it can be used by its setValue method and it can also be remote controlled as any other ArnItem. If locally set, this will as usual be reflected in the ARN tree.

It's possible to use one ArnItemValve for controling InStream and another for controlling OutStream. The valve for each stream direction can then be set independently. The default is using one valve for both stream directions.

This class is not thread-safe, but the Arn Data object is, so this valve can be remote controlled by an ArnItem.

Example usage

// In class code
_commonSapi = new ChatSapi( this);
_commonSapi->open("//Chat/Pipes/pipeCommon", ArnSapi::Mode::Provider);
_commonSapi->batchConnectTo( this, "sapi");
// Control message flow to and from service api _commonSapi
ArnItemValve* arnValve = new ArnItemValve( this);
arnValve->setTarget( _commonSapi->pipe());
arnValve->open("//Chat/Valves/pipeCommon");
*arnValve = true; // Set valve open for message flow

Definition at line 77 of file ArnItemValve.hpp.

Constructor & Destructor Documentation

◆ ArnItemValve()

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

Definition at line 48 of file ArnItemValve.cpp.

Member Function Documentation

◆ changed

void ArnItemValve::changed ( int  value)
signal

Signals emitted when data in Arn Data Object is changed.

◆ isAutoDestroy()

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

Definition at line 143 of file ArnItemValve.hpp.

◆ isMaster()

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

Definition at line 130 of file ArnItemValve.hpp.

◆ isSaveMode()

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

Definition at line 115 of file ArnItemValve.hpp.

◆ operator=()

ArnItemValve & ArnItemValve::operator= ( bool  value)

Definition at line 91 of file ArnItemValve.cpp.

◆ setAutoDestroy()

ArnItemValve& ArnItemValve::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 137 of file ArnItemValve.hpp.

◆ setMaster()

ArnItemValve& ArnItemValve::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 123 of file ArnItemValve.hpp.

◆ setSaveMode()

ArnItemValve& ArnItemValve::setSaveMode ( )
inline

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 107 of file ArnItemValve.hpp.

◆ setTarget()

bool ArnItemValve::setTarget ( ArnItemB targetItem,
ArnItemValve::SwitchMode  mode = SwitchMode::InOutStream 
)

Definition at line 60 of file ArnItemValve.cpp.

◆ setValue

void ArnItemValve::setValue ( bool  value)
slot

Assign a bool to an Arn Data Object

Parameters
[in]valueto be assigned

Definition at line 98 of file ArnItemValve.cpp.

◆ switchMode()

ArnItemValve::SwitchMode ArnItemValve::switchMode ( ) const

Definition at line 72 of file ArnItemValve.cpp.

◆ toBool()

bool ArnItemValve::toBool ( ) const
Returns
state of this valve 1 = Enabled selected stream(s)

Definition at line 80 of file ArnItemValve.cpp.


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