File indexing completed on 2025-03-09 03:55:01
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam 0004 * 0005 * Date : 2010-06-16 0006 * Description : The recognition wrapper 0007 * 0008 * SPDX-FileCopyrightText: 2010 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de> 0009 * SPDX-FileCopyrightText: 2010 by Aditya Bhatt <adityabhatt1991 at gmail dot com> 0010 * SPDX-FileCopyrightText: 2010-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0011 * SPDX-FileCopyrightText: 2020 by Nghia Duong <minhnghiaduong997 at gmail dot com> 0012 * 0013 * SPDX-License-Identifier: GPL-2.0-or-later 0014 * 0015 * ============================================================ */ 0016 0017 #include "facialrecognition_wrapper_p.h" 0018 0019 // Local include 0020 0021 #include "facedbaccess.h" 0022 #include "facedb.h" 0023 0024 namespace Digikam 0025 { 0026 FacialRecognitionWrapper::Private* FacialRecognitionWrapper::d = nullptr; 0027 0028 FacialRecognitionWrapper::FacialRecognitionWrapper() 0029 { 0030 if (!d) 0031 { 0032 d = new Private(); 0033 } 0034 else 0035 { 0036 ++(d->ref); 0037 } 0038 } 0039 0040 FacialRecognitionWrapper::FacialRecognitionWrapper(const FacialRecognitionWrapper& other) 0041 { 0042 Q_UNUSED(other) 0043 ++(d->ref); 0044 } 0045 0046 FacialRecognitionWrapper::~FacialRecognitionWrapper() 0047 { 0048 --(d->ref); 0049 0050 if (d->ref == 0) 0051 { 0052 delete d; 0053 } 0054 } 0055 0056 bool FacialRecognitionWrapper::integrityCheck() 0057 { 0058 if (!d || !d->dbAvailable) 0059 { 0060 return false; 0061 } 0062 0063 QMutexLocker lock(&d->mutex); 0064 0065 return FaceDbAccess().db()->integrityCheck(); 0066 } 0067 0068 void FacialRecognitionWrapper::vacuum() 0069 { 0070 if (!d || !d->dbAvailable) 0071 { 0072 return; 0073 } 0074 0075 QMutexLocker lock(&d->mutex); 0076 0077 FaceDbAccess().db()->vacuum(); 0078 } 0079 0080 } // namespace Digikam