当前位置: 首页 > news >正文

【Qt】: QPointer详解

考古: 《Qt智能指针之QScopedPointer》

QPointer是Qt框架中的一个智能指针类,用于安全地管理QObject派生对象的指针。它的主要功能是自动将指针置为nullptr,当它所指向的QObject对象被销毁时。这在Qt应用程序中非常有用,因为QObject对象通常会在其父对象被销毁时自动销毁。

一、QPointer的特性和用法

  1. 自动置空

    • QPointer会在其指向的QObject对象被销毁时自动将自身置为nullptr。这可以防止悬空指针(dangling pointer)问题。
  2. 使用场景

    • 适用于需要在多个地方引用同一个QObject对象的场景,尤其是当对象的生命周期不由你直接控制时。
    • 常用于Qt信号和槽机制中,确保槽函数中使用的对象在信号发出时仍然有效。
  3. QSharedPointerQScopedPointer的区别

    • QPointer不负责对象的内存管理,它只是一个观察者。
    • QSharedPointerQScopedPointer负责对象的生命周期管理,前者通过引用计数,后者通过作用域。

二、示例代码

以下是一个简单的示例,展示如何使用QPointer

#include <QCoreApplication>
#include <QObject>
#include <QPointer>
#include <QDebug>class MyObject : public QObject {Q_OBJECT
public:MyObject() { qDebug() << "MyObject created"; }~MyObject() { qDebug() << "MyObject destroyed"; }
};int main(int argc, char *argv[]) {QCoreApplication a(argc, argv);MyObject* obj = new MyObject();QPointer<MyObject> ptr(obj);qDebug() << "Pointer is valid:" << !ptr.isNull();delete obj;  // Manually delete the objectqDebug() << "Pointer is valid after deletion:" << !ptr.isNull();return a.exec();
}
    1. 创建对象
      MyObject* obj = new MyObject();:动态分配一个MyObject实例。
    1. 使用QPointer
      -QPointer<MyObject> ptr(obj);:创建一个QPointer,指向obj
    1. 检查指针有效性
      ptr.isNull():检查QPointer是否为空。
    1. 删除对象
      delete obj;:手动删除obj,此时ptr会自动变为nullptr
    1. 输出结果
      在对象被删除后,ptr.isNull()返回true,表明指针已被置空。

关键点

  • 安全性QPointer提供了一种安全的方式来引用QObject对象,避免悬空指针。
  • 非所有权QPointer不负责对象的内存管理,只是一个观察者。
  • 适用性:适用于需要在多个地方引用同一个QObject对象的场景,尤其是在信号和槽机制中。

三、QPointer 源码赏析

/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/#ifndef QPOINTER_H
#define QPOINTER_H#include <QtCore/qsharedpointer.h>
#include <QtCore/qtypeinfo.h>#ifndef QT_NO_QOBJECTQT_BEGIN_NAMESPACEclass QVariant;template <class T>
class QPointer
{Q_STATIC_ASSERT_X(!std::is_pointer<T>::value, "QPointer's template type must not be a pointer type");template<typename U>struct TypeSelector{typedef QObject Type;};template<typename U>struct TypeSelector<const U>{typedef const QObject Type;};typedef typename TypeSelector<T>::Type QObjectType;QWeakPointer<QObjectType> wp;
public:inline QPointer() { }inline QPointer(T *p) : wp(p, true) { }// compiler-generated copy/move ctor/assignment operators are fine!// compiler-generated dtor is fine!#ifdef Q_QDOC// Stop qdoc from complaining about missing function~QPointer();
#endifinline void swap(QPointer &other) { wp.swap(other.wp); }inline QPointer<T> &operator=(T* p){ wp.assign(static_cast<QObjectType*>(p)); return *this; }inline T* data() const{ return static_cast<T*>( wp.data()); }inline T* operator->() const{ return data(); }inline T& operator*() const{ return *data(); }inline operator T*() const{ return data(); }inline bool isNull() const{ return wp.isNull(); }inline void clear(){ wp.clear(); }
};
template <class T> Q_DECLARE_TYPEINFO_BODY(QPointer<T>, Q_MOVABLE_TYPE);template <class T>
inline bool operator==(const T *o, const QPointer<T> &p)
{ return o == p.operator->(); }template<class T>
inline bool operator==(const QPointer<T> &p, const T *o)
{ return p.operator->() == o; }template <class T>
inline bool operator==(T *o, const QPointer<T> &p)
{ return o == p.operator->(); }template<class T>
inline bool operator==(const QPointer<T> &p, T *o)
{ return p.operator->() == o; }template<class T>
inline bool operator==(const QPointer<T> &p1, const QPointer<T> &p2)
{ return p1.operator->() == p2.operator->(); }template <class T>
inline bool operator!=(const T *o, const QPointer<T> &p)
{ return o != p.operator->(); }template<class T>
inline bool operator!= (const QPointer<T> &p, const T *o)
{ return p.operator->() != o; }template <class T>
inline bool operator!=(T *o, const QPointer<T> &p)
{ return o != p.operator->(); }template<class T>
inline bool operator!= (const QPointer<T> &p, T *o)
{ return p.operator->() != o; }template<class T>
inline bool operator!= (const QPointer<T> &p1, const QPointer<T> &p2)
{ return p1.operator->() != p2.operator->() ; }template<typename T>
QPointer<T>
qPointerFromVariant(const QVariant &variant)
{return QPointer<T>(qobject_cast<T*>(QtSharedPointer::weakPointerFromVariant_internal(variant).data()));
}QT_END_NAMESPACE#endif // QT_NO_QOBJECT#endif // QPOINTER_H

QPointer 只有一个成员变量 QWeakPointer<QObjectType> wp; 几乎所有成员函数的操作都是对wp成员变量的操作。其他,比较简单,不过多赘述。

四、QWeakPointer

/****************************************************************************template <class T>
class QWeakPointer
{typedef T *QWeakPointer:: *RestrictedBool;typedef QtSharedPointer::ExternalRefCountData Data;public:typedef T element_type;typedef T value_type;typedef value_type *pointer;typedef const value_type *const_pointer;typedef value_type &reference;typedef const value_type &const_reference;typedef qptrdiff difference_type;bool isNull() const Q_DECL_NOTHROW { return d == nullptr || d->strongref.load() == 0 || value == nullptr; }operator RestrictedBool() const Q_DECL_NOTHROW { return isNull() ? nullptr : &QWeakPointer::value; }bool operator !() const Q_DECL_NOTHROW { return isNull(); }T *data() const Q_DECL_NOTHROW { return d == nullptr || d->strongref.load() == 0 ? nullptr : value; }inline QWeakPointer() Q_DECL_NOTHROW : d(nullptr), value(nullptr) { }inline ~QWeakPointer() { if (d && !d->weakref.deref()) delete d; }#ifndef QT_NO_QOBJECT// special constructor that is enabled only if X derives from QObject
#if QT_DEPRECATED_SINCE(5, 0)template <class X>QT_DEPRECATED inline QWeakPointer(X *ptr) : d(ptr ? Data::getAndRef(ptr) : nullptr), value(ptr){ }
#endif
#endif#if QT_DEPRECATED_SINCE(5, 0)template <class X>QT_DEPRECATED inline QWeakPointer &operator=(X *ptr){ return *this = QWeakPointer(ptr); }
#endifQWeakPointer(const QWeakPointer &other) Q_DECL_NOTHROW : d(other.d), value(other.value){ if (d) d->weakref.ref(); }
#ifdef Q_COMPILER_RVALUE_REFSQWeakPointer(QWeakPointer &&other) Q_DECL_NOTHROW: d(other.d), value(other.value){other.d = nullptr;other.value = nullptr;}QWeakPointer &operator=(QWeakPointer &&other) Q_DECL_NOTHROW{ QWeakPointer moved(std::move(other)); swap(moved); return *this; }
#endifQWeakPointer &operator=(const QWeakPointer &other) Q_DECL_NOTHROW{QWeakPointer copy(other);swap(copy);return *this;}void swap(QWeakPointer &other) Q_DECL_NOTHROW{qSwap(this->d, other.d);qSwap(this->value, other.value);}inline QWeakPointer(const QSharedPointer<T> &o) : d(o.d), value(o.data()){ if (d) d->weakref.ref();}inline QWeakPointer &operator=(const QSharedPointer<T> &o){internalSet(o.d, o.value);return *this;}template <class X>inline QWeakPointer(const QWeakPointer<X> &o) : d(nullptr), value(nullptr){ *this = o; }template <class X>inline QWeakPointer &operator=(const QWeakPointer<X> &o){// conversion between X and T could require access to the virtual table// so force the operation to go through QSharedPointer*this = o.toStrongRef();return *this;}template <class X>bool operator==(const QWeakPointer<X> &o) const Q_DECL_NOTHROW{ return d == o.d && value == static_cast<const T *>(o.value); }template <class X>bool operator!=(const QWeakPointer<X> &o) const Q_DECL_NOTHROW{ return !(*this == o); }template <class X>inline QWeakPointer(const QSharedPointer<X> &o) : d(nullptr), value(nullptr){ *this = o; }template <class X>inline QWeakPointer &operator=(const QSharedPointer<X> &o){QSHAREDPOINTER_VERIFY_AUTO_CAST(T, X); // if you get an error in this line, the cast is invalidinternalSet(o.d, o.data());return *this;}template <class X>bool operator==(const QSharedPointer<X> &o) const Q_DECL_NOTHROW{ return d == o.d; }template <class X>bool operator!=(const QSharedPointer<X> &o) const Q_DECL_NOTHROW{ return !(*this == o); }inline void clear() { *this = QWeakPointer(); }inline QSharedPointer<T> toStrongRef() const { return QSharedPointer<T>(*this); }// std::weak_ptr compatibility:inline QSharedPointer<T> lock() const { return toStrongRef(); }#if defined(QWEAKPOINTER_ENABLE_ARROW)inline T *operator->() const { return data(); }
#endifprivate:#if defined(Q_NO_TEMPLATE_FRIENDS)
public:
#elsetemplate <class X> friend class QSharedPointer;template <class X> friend class QPointer;
#endiftemplate <class X>inline QWeakPointer &assign(X *ptr){ return *this = QWeakPointer<X>(ptr, true); }#ifndef QT_NO_QOBJECTtemplate <class X>inline QWeakPointer(X *ptr, bool) : d(ptr ? Data::getAndRef(ptr) : nullptr), value(ptr){ }
#endifinline void internalSet(Data *o, T *actual){if (d == o) return;if (o)o->weakref.ref();if (d && !d->weakref.deref())delete d;d = o;value = actual;}Data *d;T *value;
};

QWeakPointer有两个成员变量,
Data *d; T *value;
它自身在构造函数中只是接收指针变量,并赋值給成员函数,因此他也是也是观察者。其他比较简单,不过多赘述。关于Qt中的引用计数原理和实现,后续另外进行介绍。

相关文章:

【Qt】: QPointer详解

考古&#xff1a; 《Qt智能指针之QScopedPointer》 QPointer是Qt框架中的一个智能指针类&#xff0c;用于安全地管理QObject派生对象的指针。它的主要功能是自动将指针置为nullptr&#xff0c;当它所指向的QObject对象被销毁时。这在Qt应用程序中非常有用&#xff0c;因为QObj…...

15_业务系统基类

创建脚本 SystemRoot.cs 因为 业务系统基类的子类 会涉及资源加载服务层ResSvc.cs 和 音乐播放服务层AudioSvc.cs 所以在业务系统基类 提取引用资源加载服务层ResSvc.cs 和 音乐播放服务层AudioSvc.cs 并调用单例初始化 using UnityEngine; // 功能 : 业务系统基类 public c…...

C++中explicit关键字的介绍和使用详解

某一天突然发现Qt自动生成的类文件的构造函数前边都有explicit关键字&#xff0c;但是explicit关键字什么意思呐&#xff1f; 在C中&#xff0c;explicit是一个关键字&#xff0c;主要用于修饰构造函数或转换运算符&#xff0c;其作用是防止隐式类型转换或隐式构造行为。 下面…...

动态内存管理

本章重点 1.为什么存在动态内存分配 2.动态内存函数的介绍 3.malloc free calloc realloc 4.常见的动态内存错误 一.为什么存在动态内存分配 二.动态内存函数的介绍 #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> #include &…...

Java 中的各种锁详解

&#x1f9d1; 博主简介&#xff1a;CSDN博客专家&#xff0c;历代文学网&#xff08;PC端可以访问&#xff1a;https://literature.sinhy.com/#/literature?__c1000&#xff0c;移动端可微信小程序搜索“历代文学”&#xff09;总架构师&#xff0c;15年工作经验&#xff0c;…...

进制之间转换

「 一、十进制 二进制 」 1.十进制转二进制&#xff1a;一直除以2直到商为0&#xff0c;再反向取余数。 例&#xff1a;13&#xff08;十进制&#xff09;转1101&#xff08;二进制&#xff09; 2.二进制转十进制:最后一位数开始是2^0&#xff0c;然后一直按照指数递增的方式…...

微信小程序获取位置服务

wx.getLocation({type: gcj02,success(res) {wx.log(定位成功);},fail(err) {wx.log(定位失败, err);wx.showModal({content: 请打开手机和小程序中的定位服务,success: (modRes) > {if (modRes.confirm) {wx.openSetting({success(setRes) {if (setRes.authSetting[scope.u…...

数据结构——实验八·学生管理系统

嗨~~欢迎来到Tubishu的博客&#x1f338;如果你也是一名在校大学生&#xff0c;正在寻找各种编程资源&#xff0c;那么你就来对地方啦&#x1f31f; Tubishu是一名计算机本科生&#xff0c;会不定期整理和分享学习中的优质资源&#xff0c;希望能为你的编程之路添砖加瓦⭐&…...

Linux应用编程(五)USB应用开发-libusb库

一、基础知识 1. USB接口是什么&#xff1f; USB接口&#xff08;Universal Serial Bus&#xff09;是一种通用串行总线&#xff0c;广泛使用的接口标准&#xff0c;主要用于连接计算机与外围设备&#xff08;如键盘、鼠标、打印机、存储设备等&#xff09;之间的数据传输和电…...

Swift语言探索:Sequence与Collection的详细解读

在Swift编程语言中&#xff0c;Sequence和Collection是两个非常重要的协议&#xff0c;它们定义了遍历和访问元素集合的方式。理解这两个协议不仅有助于我们更好地掌握Swift的集合类型&#xff0c;还能让我们在编写代码时更加灵活和高效。本文将详细解读Sequence与Collection&a…...

解锁C# EF/EF Core:从入门到进阶的技术飞跃

一、EF/EF Core 初相识 在.NET 开发的广阔天地中&#xff0c;Entity Framework (EF) 及其轻量级、可扩展、跨平台的版本 Entity Framework Core (EF Core)&#xff0c;犹如两颗璀璨的明星&#xff0c;照亮了数据访问层开发的道路。它们是开源的对象关系映射器&#xff08;ORM&…...

大模型搜广推?对算法工作的影响

大模型与传统应用结合的性质 长期看是一种范式革新。算力和模型定义的边界发生变化&#xff0c;选择生成式AI或大模型发展方向时&#xff0c;会不断发现新的增长曲线&#xff0c;目前在不断被验证。 现阶段大模型确实带来了增量信息&#xff0c;但推荐过程仍在原有流程基础上…...

【教程】最好的pytorch教程

文章目录 Materials for the Learn PyTorch for Deep Learning: Zero to Mastery course from: https://github.com/mrdbourke/pytorch-deep-learning/blob/main/01_pytorch_workflow.ipynb...

基于java线程池和EasyExcel实现异步导出

基于java线程池和EasyExcel实现异步导出 1.controller层 GetMapping("export") public void exportExcel(HttpServletResponse response) throws IOException, InterruptedException {exportService.exportExcel(response); }2. service public void exportExcel(H…...

vue3组件传值具体使用

问&#xff1a; left.vue文件调用接口获取了后端返回的urlLink字段&#xff0c;我该怎么传递给总的父组件index.vue中&#xff0c;我需要点击父组件的一个按钮来触发跳转&#xff1f; 回答&#xff1a; 在 Vue 3 中使用 TypeScript 和 setup 语法糖时&#xff0c;可以通过 e…...

《CPython Internals》阅读笔记:p336-p352

《CPython Internals》学习第 17天&#xff0c;p336-p352 总结&#xff0c;总计 17 页。 一、技术总结 1.GDB GDB 是 GNU Dbugger 的缩写。 (1)安装 sudo apt install gdb(2)创建 .gdbinit 文件 touch ~/.gdbinitvim ~/.gdbinit(3)配置 .gdbinit 文件 add-auto-load-saf…...

WPF基础 | WPF 常用控件实战:Button、TextBox 等的基础应用

WPF基础 | WPF 常用控件实战&#xff1a;Button、TextBox 等的基础应用 一、前言二、Button 控件基础2.1 Button 的基本定义与显示2.2 按钮样式设置2.3 按钮大小与布局 三、Button 的交互功能3.1 点击事件处理3.2 鼠标悬停与离开效果3.3 按钮禁用与启用 四、TextBox 控件基础4.…...

Langchain+讯飞星火大模型Spark Max调用

1、安装langchain #安装langchain环境 pip install langchain0.3.3 openai -i https://mirrors.aliyun.com/pypi/simple #灵积模型服务 pip install dashscope -i https://mirrors.aliyun.com/pypi/simple #安装第三方集成,就是各种大语言模型 pip install langchain-comm…...

2025年华为云一键快速部署幻兽帕鲁联机服务器教程

华为云如何快速部署幻兽帕鲁联机服务器&#xff1f;为了方便新手玩家搭建专属游戏联机服务器&#xff0c;华为云推出了云游戏专场&#xff0c;无需专业技术&#xff0c;新手小白也能一键快速部署幻兽帕鲁联机服务器&#xff01; 华为云快速部署幻兽帕鲁联机服务器教程如下&…...

Langchain+文心一言调用

import osfrom langchain_community.llms import QianfanLLMEndpointos.environ["QIANFAN_AK"] "" os.environ["QIANFAN_SK"] ""llm_wenxin QianfanLLMEndpoint()res llm_wenxin.invoke("中国国庆日是哪一天?") print(…...

C++AVL树(一)详解

文章目录 AVL树概念AVL树的插入平衡因子的更新旋转的规则左单旋右单旋抽象的情况h0h1h 2h 3 AVL树 概念 AVL树是一棵平衡二叉查找树&#xff0c;AVL树是空树&#xff0c;保证左右子树都是AVL树&#xff0c;AVL树要求高度差的绝对值不超过1&#xff0c;因为最好情况是1&#…...

ceph新增节点,OSD设备,标签管理(二)

一、访问客户端集群方式 方式一: 使用cephadm shell交互式配置 [rootceph141 ~]# cephadm shell # 注意&#xff0c;此命令会启动一个新的容器&#xff0c;运行玩后会退出&#xff01; Inferring fsid c153209c-d8a0-11ef-a0ed-bdb84668ed01 Inferring config /var/lib/ce…...

c++学习第七天

创作过程中难免有不足&#xff0c;若您发现本文内容有误&#xff0c;恳请不吝赐教。 提示&#xff1a;以下是本篇文章正文内容&#xff0c;下面案例可供参考。 一、const成员函数 //Date.h#pragma once#include<iostream> using namespace std;class Date { public:Date…...

F/V/F/I频率脉冲信号转换器

F/V/F/I频率脉冲信号转换器 概述&#xff1a;捷晟达科技的JSD TFA-1001系列是一进一出频率脉冲信号转换器(F/V转换器),该频率转换器是将频率脉冲信号(方波、正弦波、锯齿波)转换成国际标准的模拟量电压(电流)信号,并远距离无失真传送到控制室(如:PLC,DCS,AD,PC采集系统)产品的输…...

SQLServer中DBCC INPUTBUFFER显示从客户端发送到 SQL Server 实例的最后一个语句

SQLServer中DBCC INPUTBUFFER显示从客户端发送到 SQL Server 实例的最后一个语句 1、本文内容 语法参数结果集权限示例 适用于&#xff1a; SQL ServerAzure SQL 数据库Azure SQL 托管实例 显示从客户端发送到 SQL Server 实例的最后一个语句。 2、语法 DBCC INPUTBUFFE…...

Mysql面试题----MySQL中CHAR和VARCHAR的区别

存储方式 CHAR&#xff1a;是一种固定长度的字符串类型。它会按照定义的长度来分配存储空间&#xff0c;无论实际存储的字符串长度是多少。例如&#xff0c;定义一个 CHAR (10) 的列&#xff0c;如果存储的值是 ‘ab’&#xff0c;那么它仍然会占用 10 个字符的存储空间&#…...

github汉化

本文主要讲述了github如何汉化的方法。 目录 问题描述汉化步骤1.打开github&#xff0c;搜索github-chinese2.打开项目&#xff0c;打开README.md3.下载安装脚本管理器3.1 在README.md中往下滑动&#xff0c;找到浏览器与脚本管理器3.2 选择浏览器对应的脚本管理器3.2.1 点击去…...

探索JavaScript前端开发:开启交互之门的神奇钥匙(二)

目录 引言 四、事件处理 4.1 事件类型 4.2 事件监听器 五、实战案例&#xff1a;打造简易待办事项列表 5.1 HTML 结构搭建 5.2 JavaScript 功能实现 六、进阶拓展&#xff1a;异步编程与 Ajax 6.1 异步编程概念 6.2 Ajax 原理与使用 七、前沿框架&#xff1a;Vue.js …...

什么是网络爬虫?Python爬虫到底怎么学?

最近我在研究 Python 网络爬虫&#xff0c;发现这玩意儿真是有趣&#xff0c;干脆和大家聊聊我的心得吧&#xff01;咱们都知道&#xff0c;网络上的信息多得就像大海里的水&#xff0c;而网络爬虫就像一个勤劳的小矿工&#xff0c;能帮我们从这片浩瀚的信息海洋中挖掘出需要的…...

React 中hooks之 React.memo 和 useMemo用法总结

1. React.memo 基础 React.memo 是一个高阶组件&#xff08;HOC&#xff09;&#xff0c;用于优化函数组件的性能&#xff0c;通过记忆组件渲染结果来避免不必要的重新渲染。 1.1 基本用法 const MemoizedComponent React.memo(function MyComponent(props) {/* 渲染逻辑 *…...

springboot基于微信小程序的手机银行系统

Spring Boot基于微信小程序的手机银行系统是一种结合现代Web技术和移动应用优势的创新金融服务平台。 一、系统背景与意义 随着信息技术的快速发展和用户对便捷金融服务需求的日益增长&#xff0c;传统手机银行系统的人工管理方法已逐渐显露出效率低下、安全性低以及信息传输…...

Kafka后台启动命令

#保存日志 nohup ./kafka-server-start.sh ../config/server.properties > /path/to/logfile.log 2>&1 &#不保存日志 nohup ./kafka-server-start.sh ../config/server.properties >/dev/null 2>&1 & nohup: 是一个Unix/Linux命令&#xff0c;用于…...

面试题目1

文章目录 C语言函数调用详细过程C语言中const与C中const的区别关系运算符有哪些互斥锁与读写锁的区别gcc的编译过程 C语言函数调用详细过程 调用函数&#xff1a;当程序执行到函数调用语句时&#xff0c;会将当前函数的返回地址、参数列表等信息压入栈中&#xff0c;然后跳转到…...

Android AutoMotive --CarService

1、AAOS概述 Android AutoMotive OS是谷歌针对车机使用场景打造的操作系统&#xff0c;它是基于现有Android系统的基础上增加了新特性&#xff0c;最主要的就是增加了CarService&#xff08;汽车服务&#xff09;模块。我们很容易把Android AutoMotive和Android Auto搞混&…...

CSDN 博客之星 2024:默语的技术进阶与社区耕耘之旅

CSDN 博客之星 2024&#xff1a;默语的技术进阶与社区耕耘之旅 &#x1f31f; 默语&#xff0c;是一位在技术分享与社区建设中坚持深耕的博客作者。今年&#xff0c;我有幸再次入围成为 CSDN 博客之星TOP300 的一员&#xff0c;这既是对过往努力的肯定&#xff0c;也是对未来探…...

【Vim Masterclass 笔记24】S10L43 + L44:同步练习10 —— 基于 Vim 缓冲区的各类基础操作练习(含点评课)

文章目录 S10L43 Exercise 12 - Vim Buffers1 训练目标2 操作指令2.1. 打开 buf* 文件2.2. 查看缓冲区 View the buffers2.3. 切换缓冲区 Switch buffers2.4. 同时编辑多个缓冲区 Edit multiple buffers at once2.5. 缓冲区的增删操作 Add and delete buffers2.6. 练习 Vim 内置…...

python如何使得pdf加水印后的大小尽可能小

在 Python 中为 PDF 添加水印并尽可能减少文件大小&#xff0c;可以采取以下优化策略&#xff1a; 1. 使用合适的库 常用的 PDF 处理库&#xff1a; PyMuPDF&#xff08;fitz&#xff09;&#xff1a;高效且优化的 PDF 处理reportlab pdfrw&#xff1a;可实现水印合并&#…...

Leetcode 3429. Paint House IV

Leetcode 3429. Paint House IV 1. 解题思路2. 代码实现 题目链接&#xff1a;3429. Paint House IV 1. 解题思路 这一题解法上就是一个动态规划的思路&#xff0c;由于题目有两个限制条件&#xff0c;即相邻不可以同色&#xff0c;以及前后同位置不可以同色&#xff0c;因此…...

ASP.NET Core 实战:JWT 身份验证

一、引言 在当今数字化时代&#xff0c;Web 应用的安全性至关重要。ASP.NET Core 作为一种广泛应用的开发框架&#xff0c;为开发者提供了强大的工具来构建安全可靠的应用程序。而 JWT&#xff08;JSON Web Token&#xff09;身份验证则是保障应用安全的关键环节之一。 JWT 身…...

【学习笔记15】如何在非root服务器中,安装属于自己的redis

一、下载安装包 官网下载黑马程序员给的安装包&#xff08;redis-6.2.6&#xff09; 二、将安装包上传至服务器 我将安装包上传在我的文件夹/home/XXX&#xff0c;指定路径中/src/local/redis/&#xff0c;绝对路径为/home/XXX/src/local/redis/解压安装包 XXXomega:~$ cd …...

基于深度学习的微出血自动检测及解剖尺度定位|文献速递-视觉大模型医疗图像应用

Title 题目 Toward automated detection of microbleeds with anatomical scale localization using deep learning 基于深度学习的微出血自动检测及解剖尺度定位 01 文献速递介绍 基于深度学习的脑微出血&#xff08;CMBs&#xff09;检测与解剖定位 脑微出血&#xff…...

Couchbase UI: Dashboard

以下是 Couchbase UI Dashboard 页面详细介绍&#xff0c;包括页面布局和功能说明&#xff0c;帮助你更好地理解和使用。 1. 首页&#xff08;Overview&#xff09; 功能&#xff1a;提供集群的整体健康状态和性能摘要 集群状态 节点健康状况&#xff1a;绿色&#xff08;正…...

Python

1 变量 1.1 定义 变量&#xff1a;为快速定义目标&#xff0c;将数据在内存占据的存储空间分配的一个名称。 定义&#xff1a;变量名 数据值 作用&#xff1a;临时存储数据 message "hello" print(message)#输出&#xff1a;hello message "hello Pytho…...

一个软件分发和下载的网站源码,带多套模板

PHP游戏应用市场APP软件下载平台网站源码手机版 可自行打包APP&#xff0c;带下载统计&#xff0c;带多套模板&#xff0c;带图文教程 代码下载&#xff1a;百度网盘...

war包 | Docker部署flowable-ui

文章目录 引言I war包部署flowable-ui下载war包配置Tomcat访问 flowable-uiII Docker启动flowable-ui并修改配置Docker启动flowable-ui修改配置访问Flowable UI界面。III 知识扩展加速源docker run -i -t -d 参数引言 Flowable 支持 BPMN 2.0 行业标准,同时提供了一些 Flowab…...

07_游戏加载窗口

隐藏动态提示窗口 创建空节点 命名为 LoadingWnd 意为加载窗口 并设置全屏 在子级下创建Image作为加载背景 也设置成全屏 将以下资源放进Art文件夹中 设置好精灵模式后拖拽至 Image的Source Image框选 创建文本作为提示内容 增加描边组件OutLine可以美化字体 创建Image作为加载…...

proxyman抓包Java中feign请求以及断点请求响应内容修改或流转到本地

proxyman抓包Java中feign请求以及断点请求响应内容修改或流转到本地 配置流程第一步: 借助arthas配置请求代理第二步: 借助proxyman配置远程映射第三步: 借助SwitchHosts配置hosts域名最后: 借助ssh的LocalForward功能, 打通网络(这步网络不通才需要) 最近在修bug的过程中, 因为…...

PyTorch使用教程(10)-torchinfo.summary网络结构可视化详细说明

1、基本介绍 torchinfo是一个为PyTorch用户量身定做的开源工具&#xff0c;其核心功能之一是summary函数。这个函数旨在简化模型的开发与调试流程&#xff0c;让模型架构一目了然。通过torchinfo的summary函数&#xff0c;用户可以快速获取模型的详细结构和统计信息&#xff0…...

centos9编译安装opensips 二【进阶篇-定制目录+模块】推荐

环境&#xff1a;centos9 last opensips -V version: opensips 3.6.0-dev (x86_64/linux) flags: STATS: On, DISABLE_NAGLE, USE_MCAST, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, HP_MALLOC, DBG_MALLOC, CC_O0, FAST_LOCK-ADAPTIVE_WAIT ADAPTIVE_WAIT_LOOPS1024, MAX_RE…...

MongoDB 备份与恢复综述

目录 一、基本概述 二、逻辑备份 1、全量备份 2、增量备份 3、恢复 三、物理备份 1、cp/tar/fsync 2、WiredTiger 热备份 3、恢复 四、快照备份 一、基本概述 MongoDB 是一种流行的 NoSQL 数据库&#xff0c;它使用文档存储数据&#xff0c;支持丰富的查询语言和索引…...