Soprano  2.8.0
Public Types | Public Member Functions
Soprano::Util::MutexModel Class Reference

Protect a Model for multiple calls in multi-threaded applications. More...

#include <Soprano/Util/MutexModel>

+ Inheritance diagram for Soprano::Util::MutexModel:

List of all members.

Public Types

enum  ProtectionMode { PlainMultiThreading, ReadWriteMultiThreading, ReadWriteSingleThreading }

Public Member Functions

 MutexModel (ProtectionMode mode, Model *parent=0)
 ~MutexModel ()
Error::ErrorCode addStatement (const Statement &statement)
Error::ErrorCode removeStatement (const Statement &statement)
Error::ErrorCode removeAllStatements (const Statement &statement)
StatementIterator listStatements (const Statement &partial) const
NodeIterator listContexts () const
QueryResultIterator executeQuery (const QString &query, Query::QueryLanguage language, const QString &userQueryLanguage=QString()) const
bool containsStatement (const Statement &statement) const
bool containsAnyStatement (const Statement &statement) const
bool isEmpty () const
int statementCount () const

Detailed Description

Protect a Model for multiple calls in multi-threaded applications.

In most cases one does not need to use this FilterModel since Models created by Soprano::createModel and Soprano::Backend::createModel are thread-safe. It may, however, come in handy for custom models.

Author:
Sebastian Trueg trueg.nosp@m.@kde.nosp@m..org

Definition at line 44 of file mutexmodel.h.


Member Enumeration Documentation

Enumerator:
PlainMultiThreading 

In PlainMultiThreading mode only one action can be performed at the same time. Calls block until the previous call is done.

Warning:
In this mode nesting iterators will result in a deadlock.
ReadWriteMultiThreading 

In ReadWriteMultiThreading mode multiple read operations can be performed at the same time but only one write operation.

In general write operations take precedence over read operations when locking. However, the same thread can perform nested read locks an arbitrary number of times.

ReadWriteSingleThreading 
Deprecated:
This was a buggy mode which was impossible to fix. Use Soprano::Util::AsyncModel instead.

Definition at line 49 of file mutexmodel.h.


Constructor & Destructor Documentation

Create a new MutexModel.

Parameters:
modeThe mode to use.
parentThe parent Model to forward the actual calls to.

Destructor.


Member Function Documentation

Default implementation simply pipes the call through to the parent model.

Reimplemented from Soprano::FilterModel.

Default implementation simply pipes the call through to the parent model.

Reimplemented from Soprano::FilterModel.

Default implementation simply pipes the call through to the parent model.

Reimplemented from Soprano::FilterModel.

Default implementation simply pipes the call through to the parent model.

Reimplemented from Soprano::FilterModel.

Default implementation simply pipes the call through to the parent model.

Reimplemented from Soprano::FilterModel.

QueryResultIterator Soprano::Util::MutexModel::executeQuery ( const QString query,
Query::QueryLanguage  language,
const QString userQueryLanguage = QString() 
) const [virtual]

Default implementation simply pipes the call through to the parent model. Default implementation simply pipes the call through to the parent model.

Reimplemented from Soprano::FilterModel.

bool Soprano::Util::MutexModel::containsStatement ( const Statement statement) const [virtual]

Default implementation simply pipes the call through to the parent model.

Reimplemented from Soprano::FilterModel.

bool Soprano::Util::MutexModel::containsAnyStatement ( const Statement statement) const [virtual]

Default implementation simply pipes the call through to the parent model.

Reimplemented from Soprano::FilterModel.

bool Soprano::Util::MutexModel::isEmpty ( ) const [virtual]

Default implementation simply pipes the call through to the parent model.

Reimplemented from Soprano::FilterModel.

Default implementation simply pipes the call through to the parent model.

Reimplemented from Soprano::FilterModel.


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