CatalogsDB::AsyncDBManager

Search for usage in LXR

CatalogsDB::AsyncDBManager Class Reference

#include <catalogsdb.h>

Inheritance diagram for CatalogsDB::AsyncDBManager:

Public Types

template<typename... Args>
using DBManagerMethod = CatalogObjectList (DBManager::*)(Args...)
 
- Public Types inherited from QObject
typedef  QObjectList
 

Signals

void resultReady (void)
 
void threadReady (void)
 

Public Slots

void find_objects_by_name (const QString &name, const int limit=-1)
 
void find_objects_by_name_exact (const QString &name)
 
void init ()
 
std::unique_ptr< CatalogObjectList > result ()
 

Public Member Functions

template<typename... Args>
 AsyncDBManager (Args... args)
 
void _find_objects_by_name (const QString &name, const int limit, const bool exactMatchOnly)
 
template<typename... Args>
void execute (DBManagerMethod< Args... > dbManagerMethod, Args... args)
 
template<typename... Args>
void init (Args &&... args)
 
std::shared_ptr< DBManagermanager ()
 
std::shared_ptr< QThreadthread ()
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
QBindable< QStringbindableObjectName ()
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo () const const
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isQuickItemType () const const
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_GADGET_EXPORT (EXPORT_MACRO)
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_MOC_INCLUDE Q_MOC_INCLUDE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setObjectName (QAnyStringView name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool setProperty (const char *name, QVariant &&value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds interval, Qt::TimerType timerType)
 
QThreadthread () const const
 

Additional Inherited Members

- Properties inherited from QObject
 objectName
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Detailed Description

A concurrent wrapper around.

See also
CatalogsDB::DBManager

This wrapper can be instantiated from the main thread. It spawns its own thread and moves itself to the thread, allowing the main thread to call DB operations without blocking the user interface. It provides a generic wrapper interface,

See also
AsyncDBManager::execute(), to call the methods of DBManager.

Since it is hard to use signal-slot communication with a generic wrapper like

See also
AsyncDBManager::execute(), a wrapper is provided for the two most likely overloads of
DBManager::find_objects_by_name, which are time-consuming and frequently used, and these can be directly invoked from QMetaObject::invokeMethod or an appropriate signal

The void override of

See also
AsyncDBManager::init() does the most commonly done thing, which is to open the DSO database

Definition at line 745 of file catalogsdb.h.

Member Typedef Documentation

◆ DBManagerMethod

template<typename... Args>
using CatalogsDB::AsyncDBManager::DBManagerMethod = CatalogObjectList (DBManager::*)(Args...)

Definition at line 758 of file catalogsdb.h.

Constructor & Destructor Documentation

◆ AsyncDBManager()

template<typename... Args>
CatalogsDB::AsyncDBManager::AsyncDBManager ( Args... args)
inline

Constructor, does nothing.

Call init() to do the actual setup after the QThread stars

Definition at line 764 of file catalogsdb.h.

◆ ~AsyncDBManager()

CatalogsDB::AsyncDBManager::~AsyncDBManager ( )
inline

Definition at line 786 of file catalogsdb.h.

Member Function Documentation

◆ _find_objects_by_name()

void CatalogsDB::AsyncDBManager::_find_objects_by_name ( const QString & name,
const int limit,
const bool exactMatchOnly )
inline

execute(), but specialized to find_objects_by_name

@fixme Code duplication needed to support older compilers

Definition at line 840 of file catalogsdb.h.

◆ execute()

template<typename... Args>
void CatalogsDB::AsyncDBManager::execute ( DBManagerMethod< Args... > dbManagerMethod,
Args... args )
inline

A generic wrapper to call any method on DBManager that returns a CatalogObjectList.

For practical use examples, see

See also
AsyncDBManager::find_objects_by_name below which uses this wrapper

Definition at line 820 of file catalogsdb.h.

◆ find_objects_by_name

void CatalogsDB::AsyncDBManager::find_objects_by_name ( const QString & name,
const int limit = -1 )
inlineslot

Calls the given DBManager method, storing the result for later retrieval.

dbManagerMethod method to execute (must return a CatalogObjectList) args arguments to supply to the method

Definition at line 870 of file catalogsdb.h.

◆ find_objects_by_name_exact

void CatalogsDB::AsyncDBManager::find_objects_by_name_exact ( const QString & name)
inlineslot

Definition at line 884 of file catalogsdb.h.

◆ init [1/2]

void CatalogsDB::AsyncDBManager::init ( )
inlineslot

Definition at line 858 of file catalogsdb.h.

◆ init() [2/2]

template<typename... Args>
void CatalogsDB::AsyncDBManager::init ( Args &&... args)
inline

Construct the DBManager object.

Should be done in the thread corresponding to this object

Definition at line 807 of file catalogsdb.h.

◆ manager()

std::shared_ptr< DBManager > CatalogsDB::AsyncDBManager::manager ( )
inline

Return a pointer to the DBManager, for non-DB functionalities.

Definition at line 795 of file catalogsdb.h.

◆ result

std::unique_ptr< CatalogObjectList > CatalogsDB::AsyncDBManager::result ( )
inlineslot

Returns the result of the previous call, or a nullptr if none exists.

Definition at line 898 of file catalogsdb.h.

◆ thread()

std::shared_ptr< QThread > CatalogsDB::AsyncDBManager::thread ( )
inline

Return a pointer to the QThread object.

Definition at line 800 of file catalogsdb.h.


The documentation for this class was generated from the following file:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:57:50 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.