【九】【QT开发应用】WebRTC的sigslot源码和使用WebRTC的sigslot使用编写信号槽

WebRTC(Web Real-Time Communication) 是一个开源项目,提供实时通信能力,广泛应用于视频、音频和数据传输。在WebRTC的实现中,sigslot库用于信号和槽机制,以实现事件驱动的编程模型。

WebRTC的sigslot部分主要实现了信号和槽的机制,用于简化组件之间的通信和事件处理。WebRTC使用sigslot库来处理事件,例如网络状态变化、媒体流事件等。

我们可以利用其sigslot部分编写信号槽.

sigslot文档

sigslot源码

sigslot.h

/*最原始的sigslot.h已经不在适合如今的C++标准,直接使用webrtc的sigslot.h即可*/// sigslot.h: Signal/Slot classes
//
// Written by Sarah Thompson (sarah@telergy.com) 2002.
//
// License: Public domain. You are free to use this code however you like, with
// the proviso that the author takes on no responsibility or liability for any
// use.
//
// QUICK DOCUMENTATION
//
//        (see also the full documentation at http://sigslot.sourceforge.net/)
//
//    #define switches
//      SIGSLOT_PURE_ISO:
//        Define this to force ISO C++ compliance. This also disables all of
//        the thread safety support on platforms where it is available.
//
//      SIGSLOT_USE_POSIX_THREADS:
//        Force use of Posix threads when using a C++ compiler other than gcc
//        on a platform that supports Posix threads. (When using gcc, this is
//        the default - use SIGSLOT_PURE_ISO to disable this if necessary)
//
//      SIGSLOT_DEFAULT_MT_POLICY:
//        Where thread support is enabled, this defaults to
//        multi_threaded_global. Otherwise, the default is single_threaded.
//        #define this yourself to override the default. In pure ISO mode,
//        anything other than single_threaded will cause a compiler error.
//
//    PLATFORM NOTES
//
//      Win32:
//        On Win32, the WEBRTC_WIN symbol must be #defined. Most mainstream
//        compilers do this by default, but you may need to define it yourself
//        if your build environment is less standard. This causes the Win32
//        thread support to be compiled in and used automatically.
//
//      Unix/Linux/BSD, etc.:
//        If you're using gcc, it is assumed that you have Posix threads
//        available, so they are used automatically. You can override this (as
//        under Windows) with the SIGSLOT_PURE_ISO switch. If you're using
//        something other than gcc but still want to use Posix threads, you
//        need to #define SIGSLOT_USE_POSIX_THREADS.
//
//      ISO C++:
//        If none of the supported platforms are detected, or if
//        SIGSLOT_PURE_ISO is defined, all multithreading support is turned
//        off, along with any code that might cause a pure ISO C++ environment
//        to complain. Before you ask, gcc -ansi -pedantic won't compile this
//        library, but gcc -ansi is fine. Pedantic mode seems to throw a lot of
//        errors that aren't really there. If you feel like investigating this,
//        please contact the author.
//
//
//    THREADING MODES
//
//      single_threaded:
//        Your program is assumed to be single threaded from the point of view
//        of signal/slot usage (i.e. all objects using signals and slots are
//        created and destroyed from a single thread). Behaviour if objects are
//        destroyed concurrently is undefined (i.e. you'll get the occasional
//        segmentation fault/memory exception).
//
//      multi_threaded_global:
//        Your program is assumed to be multi threaded. Objects using signals
//        and slots can be safely created and destroyed from any thread, even
//        when connections exist. In multi_threaded_global mode, this is
//        achieved by a single global mutex (actually a critical section on
//        Windows because they are faster). This option uses less OS resources,
//        but results in more opportunities for contention, possibly resulting
//        in more context switches than are strictly necessary.
//
//      multi_threaded_local:
//        Behaviour in this mode is essentially the same as
//        multi_threaded_global, except that each signal, and each object that
//        inherits has_slots, all have their own mutex/critical section. In
//        practice, this means that mutex collisions (and hence context
//        switches) only happen if they are absolutely essential. However, on
//        some platforms, creating a lot of mutexes can slow down the whole OS,
//        so use this option with care.
//
//    USING THE LIBRARY
//
//      See the full documentation at http://sigslot.sourceforge.net/
//
// Libjingle specific:
//
// This file has been modified such that has_slots and signalx do not have to be
// using the same threading requirements. E.g. it is possible to connect a
// has_slots<single_threaded> and signal0<multi_threaded_local> or
// has_slots<multi_threaded_local> and signal0<single_threaded>.
// If has_slots is single threaded the user must ensure that it is not trying
// to connect or disconnect to signalx concurrently or data race may occur.
// If signalx is single threaded the user must ensure that disconnect, connect
// or signal is not happening concurrently or data race may occur.#ifndef RTC_BASE_THIRD_PARTY_SIGSLOT_SIGSLOT_H_
#define RTC_BASE_THIRD_PARTY_SIGSLOT_SIGSLOT_H_#include <cstring>
#include <list>
#include <set>// On our copy of sigslot.h, we set single threading as default.
#define SIGSLOT_DEFAULT_MT_POLICY single_threaded#if defined(SIGSLOT_PURE_ISO) ||                   \(!defined(WEBRTC_WIN) && !defined(__GNUG__) && \!defined(SIGSLOT_USE_POSIX_THREADS))
#define _SIGSLOT_SINGLE_THREADED
#elif defined(WEBRTC_WIN)
#define _SIGSLOT_HAS_WIN32_THREADS
#include "windows.h"
#elif defined(__GNUG__) || defined(SIGSLOT_USE_POSIX_THREADS)
#define _SIGSLOT_HAS_POSIX_THREADS
#include <pthread.h>
#else
#define _SIGSLOT_SINGLE_THREADED
#endif#ifndef SIGSLOT_DEFAULT_MT_POLICY
#ifdef _SIGSLOT_SINGLE_THREADED
#define SIGSLOT_DEFAULT_MT_POLICY single_threaded
#else
#define SIGSLOT_DEFAULT_MT_POLICY multi_threaded_local
#endif
#endif// TODO: change this namespace to rtc?
namespace sigslot {class single_threaded {public:void lock() {}void unlock() {}
};#ifdef _SIGSLOT_HAS_WIN32_THREADS
// The multi threading policies only get compiled in if they are enabled.
class multi_threaded_global {public:multi_threaded_global() {static bool isinitialised = false;if (!isinitialised) {InitializeCriticalSection(get_critsec());isinitialised = true;}}void lock() { EnterCriticalSection(get_critsec()); }void unlock() { LeaveCriticalSection(get_critsec()); }private:CRITICAL_SECTION* get_critsec() {static CRITICAL_SECTION g_critsec;return &g_critsec;}
};class multi_threaded_local {public:multi_threaded_local() { InitializeCriticalSection(&m_critsec); }multi_threaded_local(const multi_threaded_local&) {InitializeCriticalSection(&m_critsec);}~multi_threaded_local() { DeleteCriticalSection(&m_critsec); }void lock() { EnterCriticalSection(&m_critsec); }void unlock() { LeaveCriticalSection(&m_critsec); }private:CRITICAL_SECTION m_critsec;
};
#endif  // _SIGSLOT_HAS_WIN32_THREADS#ifdef _SIGSLOT_HAS_POSIX_THREADS
// The multi threading policies only get compiled in if they are enabled.
class multi_threaded_global {public:void lock() { pthread_mutex_lock(get_mutex()); }void unlock() { pthread_mutex_unlock(get_mutex()); }private:static pthread_mutex_t* get_mutex();
};class multi_threaded_local {public:multi_threaded_local() { pthread_mutex_init(&m_mutex, nullptr); }multi_threaded_local(const multi_threaded_local&) {pthread_mutex_init(&m_mutex, nullptr);}~multi_threaded_local() { pthread_mutex_destroy(&m_mutex); }void lock() { pthread_mutex_lock(&m_mutex); }void unlock() { pthread_mutex_unlock(&m_mutex); }private:pthread_mutex_t m_mutex;
};
#endif  // _SIGSLOT_HAS_POSIX_THREADStemplate <class mt_policy>
class lock_block {public:mt_policy* m_mutex;lock_block(mt_policy* mtx) : m_mutex(mtx) { m_mutex->lock(); }~lock_block() { m_mutex->unlock(); }
};class _signal_base_interface;class has_slots_interface {private:typedef void (*signal_connect_t)(has_slots_interface* self,_signal_base_interface* sender);typedef void (*signal_disconnect_t)(has_slots_interface* self,_signal_base_interface* sender);typedef void (*disconnect_all_t)(has_slots_interface* self);const signal_connect_t m_signal_connect;const signal_disconnect_t m_signal_disconnect;const disconnect_all_t m_disconnect_all;protected:has_slots_interface(signal_connect_t conn,signal_disconnect_t disc,disconnect_all_t disc_all): m_signal_connect(conn),m_signal_disconnect(disc),m_disconnect_all(disc_all) {}// Doesn't really need to be virtual, but is for backwards compatibility// (it was virtual in a previous version of sigslot).virtual ~has_slots_interface() {}public:void signal_connect(_signal_base_interface* sender) {m_signal_connect(this, sender);}void signal_disconnect(_signal_base_interface* sender) {m_signal_disconnect(this, sender);}void disconnect_all() { m_disconnect_all(this); }
};class _signal_base_interface {private:typedef void (*slot_disconnect_t)(_signal_base_interface* self,has_slots_interface* pslot);typedef void (*slot_duplicate_t)(_signal_base_interface* self,const has_slots_interface* poldslot,has_slots_interface* pnewslot);const slot_disconnect_t m_slot_disconnect;const slot_duplicate_t m_slot_duplicate;protected:_signal_base_interface(slot_disconnect_t disc, slot_duplicate_t dupl): m_slot_disconnect(disc), m_slot_duplicate(dupl) {}~_signal_base_interface() {}public:void slot_disconnect(has_slots_interface* pslot) {m_slot_disconnect(this, pslot);}void slot_duplicate(const has_slots_interface* poldslot,has_slots_interface* pnewslot) {m_slot_duplicate(this, poldslot, pnewslot);}
};class _opaque_connection {private:typedef void (*emit_t)(const _opaque_connection*);template <typename FromT, typename ToT>union union_caster {FromT from;ToT to;};emit_t pemit;has_slots_interface* pdest;// Pointers to member functions may be up to 16 bytes for virtual classes,// so make sure we have enough space to store it.unsigned char pmethod[16];public:template <typename DestT, typename... Args>_opaque_connection(DestT* pd, void (DestT::*pm)(Args...)) : pdest(pd) {typedef void (DestT::*pm_t)(Args...);static_assert(sizeof(pm_t) <= sizeof(pmethod),"Size of slot function pointer too large.");std::memcpy(pmethod, &pm, sizeof(pm_t));typedef void (*em_t)(const _opaque_connection* self, Args...);union_caster<em_t, emit_t> caster2;caster2.from = &_opaque_connection::emitter<DestT, Args...>;pemit = caster2.to;}has_slots_interface* getdest() const { return pdest; }_opaque_connection duplicate(has_slots_interface* newtarget) const {_opaque_connection res = *this;res.pdest = newtarget;return res;}// Just calls the stored "emitter" function pointer stored at construction// time.template <typename... Args>void emit(Args... args) const {typedef void (*em_t)(const _opaque_connection*, Args...);union_caster<emit_t, em_t> caster;caster.from = pemit;(caster.to)(this, args...);}private:template <typename DestT, typename... Args>static void emitter(const _opaque_connection* self, Args... args) {typedef void (DestT::*pm_t)(Args...);pm_t pm;std::memcpy(&pm, self->pmethod, sizeof(pm_t));(static_cast<DestT*>(self->pdest)->*(pm))(args...);}
};template <class mt_policy>
class _signal_base : public _signal_base_interface, public mt_policy {protected:typedef std::list<_opaque_connection> connections_list;_signal_base(): _signal_base_interface(&_signal_base::do_slot_disconnect,&_signal_base::do_slot_duplicate),m_current_iterator(m_connected_slots.end()) {}~_signal_base() { disconnect_all(); }private:_signal_base& operator=(_signal_base const& that);public:_signal_base(const _signal_base& o): _signal_base_interface(&_signal_base::do_slot_disconnect,&_signal_base::do_slot_duplicate),m_current_iterator(m_connected_slots.end()) {lock_block<mt_policy> lock(this);for (const auto& connection : o.m_connected_slots) {connection.getdest()->signal_connect(this);m_connected_slots.push_back(connection);}}bool is_empty() {lock_block<mt_policy> lock(this);return m_connected_slots.empty();}void disconnect_all() {lock_block<mt_policy> lock(this);while (!m_connected_slots.empty()) {has_slots_interface* pdest = m_connected_slots.front().getdest();m_connected_slots.pop_front();pdest->signal_disconnect(static_cast<_signal_base_interface*>(this));}// If disconnect_all is called while the signal is firing, advance the// current slot iterator to the end to avoid an invalidated iterator from// being dereferenced.m_current_iterator = m_connected_slots.end();}#if !defined(NDEBUG)bool connected(has_slots_interface* pclass) {lock_block<mt_policy> lock(this);connections_list::const_iterator it = m_connected_slots.begin();connections_list::const_iterator itEnd = m_connected_slots.end();while (it != itEnd) {if (it->getdest() == pclass)return true;++it;}return false;}
#endifvoid disconnect(has_slots_interface* pclass) {lock_block<mt_policy> lock(this);connections_list::iterator it = m_connected_slots.begin();connections_list::iterator itEnd = m_connected_slots.end();while (it != itEnd) {if (it->getdest() == pclass) {// If we're currently using this iterator because the signal is firing,// advance it to avoid it being invalidated.if (m_current_iterator == it) {m_current_iterator = m_connected_slots.erase(it);} else {m_connected_slots.erase(it);}pclass->signal_disconnect(static_cast<_signal_base_interface*>(this));return;}++it;}}private:static void do_slot_disconnect(_signal_base_interface* p,has_slots_interface* pslot) {_signal_base* const self = static_cast<_signal_base*>(p);lock_block<mt_policy> lock(self);connections_list::iterator it = self->m_connected_slots.begin();connections_list::iterator itEnd = self->m_connected_slots.end();while (it != itEnd) {connections_list::iterator itNext = it;++itNext;if (it->getdest() == pslot) {// If we're currently using this iterator because the signal is firing,// advance it to avoid it being invalidated.if (self->m_current_iterator == it) {self->m_current_iterator = self->m_connected_slots.erase(it);} else {self->m_connected_slots.erase(it);}}it = itNext;}}static void do_slot_duplicate(_signal_base_interface* p,const has_slots_interface* oldtarget,has_slots_interface* newtarget) {_signal_base* const self = static_cast<_signal_base*>(p);lock_block<mt_policy> lock(self);connections_list::iterator it = self->m_connected_slots.begin();connections_list::iterator itEnd = self->m_connected_slots.end();while (it != itEnd) {if (it->getdest() == oldtarget) {self->m_connected_slots.push_back(it->duplicate(newtarget));}++it;}}protected:connections_list m_connected_slots;// Used to handle a slot being disconnected while a signal is// firing (iterating m_connected_slots).connections_list::iterator m_current_iterator;bool m_erase_current_iterator = false;
};template <class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
class has_slots : public has_slots_interface, public mt_policy {private:typedef std::set<_signal_base_interface*> sender_set;typedef sender_set::const_iterator const_iterator;public:has_slots(): has_slots_interface(&has_slots::do_signal_connect,&has_slots::do_signal_disconnect,&has_slots::do_disconnect_all) {}has_slots(has_slots const& o): has_slots_interface(&has_slots::do_signal_connect,&has_slots::do_signal_disconnect,&has_slots::do_disconnect_all) {lock_block<mt_policy> lock(this);for (auto* sender : o.m_senders) {sender->slot_duplicate(&o, this);m_senders.insert(sender);}}~has_slots() { this->disconnect_all(); }private:has_slots& operator=(has_slots const&);static void do_signal_connect(has_slots_interface* p,_signal_base_interface* sender) {has_slots* const self = static_cast<has_slots*>(p);lock_block<mt_policy> lock(self);self->m_senders.insert(sender);}static void do_signal_disconnect(has_slots_interface* p,_signal_base_interface* sender) {has_slots* const self = static_cast<has_slots*>(p);lock_block<mt_policy> lock(self);self->m_senders.erase(sender);}static void do_disconnect_all(has_slots_interface* p) {has_slots* const self = static_cast<has_slots*>(p);lock_block<mt_policy> lock(self);while (!self->m_senders.empty()) {std::set<_signal_base_interface*> senders;senders.swap(self->m_senders);const_iterator it = senders.begin();const_iterator itEnd = senders.end();while (it != itEnd) {_signal_base_interface* s = *it;++it;s->slot_disconnect(p);}}}private:sender_set m_senders;
};template <class mt_policy, typename... Args>
class signal_with_thread_policy : public _signal_base<mt_policy> {private:typedef _signal_base<mt_policy> base;protected:typedef typename base::connections_list connections_list;public:signal_with_thread_policy() {}template <class desttype>void connect(desttype* pclass, void (desttype::*pmemfun)(Args...)) {lock_block<mt_policy> lock(this);this->m_connected_slots.push_back(_opaque_connection(pclass, pmemfun));pclass->signal_connect(static_cast<_signal_base_interface*>(this));}void emit(Args... args) {lock_block<mt_policy> lock(this);this->m_current_iterator = this->m_connected_slots.begin();while (this->m_current_iterator != this->m_connected_slots.end()) {_opaque_connection const& conn = *this->m_current_iterator;++(this->m_current_iterator);conn.emit<Args...>(args...);}}void operator()(Args... args) { emit(args...); }
};// Alias with default thread policy. Needed because both default arguments
// and variadic template arguments must go at the end of the list, so we
// can't have both at once.
template <typename... Args>
using signal = signal_with_thread_policy<SIGSLOT_DEFAULT_MT_POLICY, Args...>;// The previous verion of sigslot didn't use variadic templates, so you would
// need to write "sigslot::signal2<Arg1, Arg2>", for example.
// Now you can just write "sigslot::signal<Arg1, Arg2>", but these aliases
// exist for backwards compatibility.
template <typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
using signal0 = signal_with_thread_policy<mt_policy>;template <typename A1, typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
using signal1 = signal_with_thread_policy<mt_policy, A1>;template <typename A1,typename A2,typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
using signal2 = signal_with_thread_policy<mt_policy, A1, A2>;template <typename A1,typename A2,typename A3,typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
using signal3 = signal_with_thread_policy<mt_policy, A1, A2, A3>;template <typename A1,typename A2,typename A3,typename A4,typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
using signal4 = signal_with_thread_policy<mt_policy, A1, A2, A3, A4>;template <typename A1,typename A2,typename A3,typename A4,typename A5,typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
using signal5 = signal_with_thread_policy<mt_policy, A1, A2, A3, A4, A5>;template <typename A1,typename A2,typename A3,typename A4,typename A5,typename A6,typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
using signal6 = signal_with_thread_policy<mt_policy, A1, A2, A3, A4, A5, A6>;template <typename A1,typename A2,typename A3,typename A4,typename A5,typename A6,typename A7,typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
using signal7 =signal_with_thread_policy<mt_policy, A1, A2, A3, A4, A5, A6, A7>;template <typename A1,typename A2,typename A3,typename A4,typename A5,typename A6,typename A7,typename A8,typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
using signal8 =signal_with_thread_policy<mt_policy, A1, A2, A3, A4, A5, A6, A7, A8>;}  // namespace sigslot#endif /* RTC_BASE_THIRD_PARTY_SIGSLOT_SIGSLOT_H_ */

sigslot.cc

// sigslot.h: Signal/Slot classes
//
// Written by Sarah Thompson (sarah@telergy.com) 2002.
//
// License: Public domain. You are free to use this code however you like, with
// the proviso that the author takes on no responsibility or liability for any
// use.#include "sigslot.h"namespace sigslot {#ifdef _SIGSLOT_HAS_POSIX_THREADSpthread_mutex_t* multi_threaded_global::get_mutex() {static pthread_mutex_t g_mutex = PTHREAD_MUTEX_INITIALIZER;return &g_mutex;
}#endif  // _SIGSLOT_HAS_POSIX_THREADS}  // namespace sigslot

使用sigslot写信号槽

添加文件

在这里插入图片描述

编写信号槽代码

#include<iostream>
#include "sigslot.h"using namespace std;
using namespace sigslot;class Window {
public:signal0<>sig_LButtonClicked;signal1<int>sig_paint;};class WindowHandler :public has_slots<> {
public:void onLButtonClicked() {cout << "L Button clicked" << endl;}void onPaint(int value) {cout << "value = " << value << endl;}
};
int main() {Window w;WindowHandler handler;w.sig_LButtonClicked.connect(&handler, &WindowHandler::onLButtonClicked);w.sig_paint.connect(&handler, &WindowHandler::onPaint);w.sig_LButtonClicked();w.sig_paint(123);return 0;}

复盘

代码解析

#include<iostream>  // 包含标准输入输出流库
#include "sigslot.h"  // 包含sigslot信号槽库using namespace std;  // 使用标准命名空间
using namespace sigslot;  // 使用sigslot命名空间// 定义一个Window类
class Window {
public:signal0<>sig_LButtonClicked;  // 定义一个无参数的信号sig_LButtonClickedsignal1<int>sig_paint;  // 定义一个带一个int参数的信号sig_paint
};// 定义一个继承于has_slots<>的WindowHandler类
class WindowHandler :public has_slots<> {
public:// 定义一个处理LButtonClicked信号的槽函数void onLButtonClicked() {cout << "L Button clicked" << endl;  // 打印"L Button clicked"}// 定义一个处理paint信号的槽函数,带一个int类型参数void onPaint(int value) {cout << "value = " << value << endl;  // 打印"value = "加上参数值}
};int main() {Window w;  // 创建一个Window对象wWindowHandler handler;  // 创建一个WindowHandler对象handler// 连接w的sig_LButtonClicked信号到handler的onLButtonClicked槽函数w.sig_LButtonClicked.connect(&handler, &WindowHandler::onLButtonClicked);// 连接w的sig_paint信号到handler的onPaint槽函数w.sig_paint.connect(&handler, &WindowHandler::onPaint);// 触发sig_LButtonClicked信号,调用handler的onLButtonClicked槽函数w.sig_LButtonClicked();// 触发sig_paint信号并传递参数123,调用handler的onPaint槽函数w.sig_paint(123);return 0;  // 返回0,表示程序正常结束
}

    signal0<>sig_LButtonClicked;  // 定义一个无参数的信号sig_LButtonClickedsignal1<int>sig_paint;  // 定义一个带一个int参数的信号sig_paint

编写信号时,数据类型写在<>里面.

// 定义一个继承于has_slots<>的WindowHandler类
class WindowHandler :public has_slots<> {
public:// 定义一个处理LButtonClicked信号的槽函数void onLButtonClicked() {cout << "L Button clicked" << endl;  // 打印"L Button clicked"}// 定义一个处理paint信号的槽函数,带一个int类型参数void onPaint(int value) {cout << "value = " << value << endl;  // 打印"value = "加上参数值}
};

编写槽函数的时候,需要继承public has_slots<>这个类.

    // 连接w的sig_LButtonClicked信号到handler的onLButtonClicked槽函数w.sig_LButtonClicked.connect(&handler, &WindowHandler::onLButtonClicked);// 连接w的sig_paint信号到handler的onPaint槽函数w.sig_paint.connect(&handler, &WindowHandler::onPaint);

连接的规则是信号对象调用connect,连接接收信号者和槽函数.

结尾

最后,感谢您阅读我的文章,希望这些内容能够对您有所启发和帮助。如果您有任何问题或想要分享您的观点,请随时在评论区留言。
同时,不要忘记订阅我的博客以获取更多有趣的内容。在未来的文章中,我将继续探讨这个话题的不同方面,为您呈现更多深度和见解。
谢谢您的支持,期待与您在下一篇文章中再次相遇!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/bicheng/34069.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

泰迪智能科技大数据人工智能实训室优势特色介绍

泰迪智能科技大数据人工智能实训室是面向人工智能技术应用、大数据技术、软件技术专业&#xff0c;是一个教、学、培训认证统一的实训平台&#xff0c;集教学、实训、培训认证功能于一体&#xff0c;围绕人工智能主题&#xff0c;同时兼顾当前IT流行技术的发展趋势&#xff0c;…

Linux tcpdump抓包必备知识

author: 放牛娃学编程 moto: 分享与热爱&#xff0c;不是大爱我不说 放牛娃每日一语: 除了你自己&#xff0c;没有人可以说你不行 别急着划开&#xff0c;这篇笔记一定能够给你带来收获 因为这里你能学到AI永远也给不了你的知识 Linux tcpdump抓包必备知识 文章目录 Linux tcp…

Softing “Ethernet-APL现场交换机”亮相ACHEMA 2024

Softing工业在ACHEMA 2024上展示了新的“aplSwitch Field”。作为一个先进的16端口以太网高级物理层&#xff08;Ethernet-APL&#xff09;现场交换机&#xff0c;它配有可选的PROFIBUS Process Automation&#xff08;PA&#xff09;代理&#xff0c;适用于Zone 2环境&#xf…

JavaWeb系列二十: jQuery的DOM操作 下

jQuery的DOM操作 CSS-DOM操作多选框案例页面加载完毕触发方法作业布置jQuery获取选中复选框的值jQuery控制checkbox被选中jQuery控制(全选/全不选/反选)jQuery动态添加删除用户 CSS-DOM操作 获取和设置元素的样式属性: css()获取和设置元素透明度: opacity属性获取和设置元素高…

数字化营销与传统营销的完美协奏曲!

在这个数字化的时代&#xff0c;营销的世界正在发生着巨大的变革&#xff01;数字化营销如火箭般崛起&#xff0c;但传统营销也并未过时。那么&#xff0c;如何让它们携手共进&#xff0c;创造出无与伦比的营销效果呢&#xff1f;今天&#xff0c;就让我们讲述一下蚓链数字化营…

拼多多面试总结

文章目录 一面自我介绍提问算法反问结果 二面提问算法反问结果 主管面主管面试准备算法题其他个人提问准备 提问数据库普通索引和覆盖索引的区别索引是什么&#xff1f;索引怎么加快数据库查询的&#xff1f;索引具体怎么实现的&#xff1f;以B树为例&#xff0c;节点放了什么&…

自动预约申购 i茅台工具完善

自动预约申购茅台工具 概述新的改变界面预览 概述 今天刷到一个windows自动刷茅台的工具&#xff0c;是用wpf实现的&#xff0c;看到作者最后是2023年更新的&#xff0c;评论中有好多人提出一些需求&#xff0c;刚才在学习wpf&#xff0c;就试着完善了一下。 工具下载&#x…

【C++】文件处理(IO流)

文章目录 C IO流1. C语言IO2. CIO2.1 C标准IO流2.2 C文件IO流2.3 C IO 文件常用函数总结表2.4 C stringstream C IO流 回顾一下&#xff0c;C语言中IO输入输出的 1. C语言IO C语言中常用的输入输出函数有如下几种&#xff1a;前者是格式化标准输入输出&#xff0c;后者是格式化…

windows和linux下清空Redis

前言 在本文中&#xff0c;我们将详尽阐述在Windows与Linux操作系统中有效清除Redis缓存的实践方法&#xff0c;旨在为您提供清晰、高效的指导流程&#xff0c;确保数据管理的灵活性与效率。 windows下推荐两款可视化工具 Another Redis Desktop Manager 这是我用的最多也是最…

数据库原理与安全复习笔记(未完待续)

1 概念 产生与发展&#xff1a;人工管理阶段 → \to → 文件系统阶段 → \to → 数据库系统阶段。 数据库系统特点&#xff1a;数据的管理者&#xff08;DBMS&#xff09;&#xff1b;数据结构化&#xff1b;数据共享性高&#xff0c;冗余度低&#xff0c;易于扩充&#xff…

ROS话题通信流程自定义数据格式

ROS话题通信流程自定义数据格式 需求流程实现步骤定义msg文件编辑配置文件编译 在 ROS 通信协议中&#xff0c;数据载体是一个较为重要组成部分&#xff0c;ROS 中通过 std_msgs 封装了一些原生的数据类型,比如:String、Int32、Int64、Char、Bool、Empty… 但是&#xff0c;这些…

从移动切换到电信IP:详细介绍两种方法

在当前的互联网环境中&#xff0c;用户可能会因为各种原因需要切换网络服务提供商&#xff0c;比如从移动切换到电信。这种切换不仅涉及到网络服务的变更&#xff0c;还可能意味着IP地址的改变。那么&#xff0c;移动的怎么切换成电信的IP&#xff1f;下面一起来了解一下吧。 方…

测试内容初步认知

测试流程 了解需求--需求评审--编写测试用例--测试用例评审(产品、开发、测试)--提测测试--bug管理(devops)--集成--集成回归--发布灰度包测试(灰度周期一周)----编写测试报告--发布上线 测试岗位划分 功能测试 负责编写测试用例&#xff0c;执行手动测试&#xff0c;记录并…

麦肯锡:量子传感究竟在何处可以发光发热

量子传感技术已经提供价值&#xff0c;潜在的应用案例可以塑造多个行业。有四种核心技术具有应用前景&#xff1a;固态自旋、中性原子、超导电路和离子阱&#xff0c;它们具有在广泛的物理属性上的传感能力&#xff0c;包括磁场、电场、旋转、温度、重力、时间和压力。选择哪种…

Python自动化(6)——图像模块

本文所述的方法都是基于前几章的后台点击&#xff0c;因此同样需要绑定窗口句柄。 Python自动化(6)——图像模块 识色 定点比色 def cv2CompareColorOneMatch(self, x, y, hexColor, _similar0, borderNone):startX 0startY 0similar _similar self.colorOffsetif bord…

基于Java协同过滤算法的电影推荐系统设计和实现(源码+LW+调试文档+讲解等)

&#x1f497;博主介绍&#xff1a;✌全网粉丝10W,CSDN作者、博客专家、全栈领域优质创作者&#xff0c;博客之星、平台优质作者、专注于Java、小程序技术领域和毕业项目实战✌&#x1f497; &#x1f31f;文末获取源码数据库&#x1f31f; 感兴趣的可以先收藏起来&#xff0c;…

Kotlin 中的解构

解构声明是 Kotlin 语言的一个特性&#xff0c;它允许我们从一个数据结构中提取多个变量&#xff0c;这样可以让我们的代码更加简洁易读&#xff0c;同时也提高了代码的可维护性。 在 Kotlin 中&#xff0c;解构可以用于多种数据类型&#xff0c;例如&#xff0c;列表&#xf…

几何内核开发-实现自己的NURBS曲线生成API

我去年有一篇帖子&#xff0c;介绍了NURBS曲线生成与显示的实现代码。 https://blog.csdn.net/stonewu/article/details/133387469?spm1001.2014.3001.5501文章浏览阅读323次&#xff0c;点赞4次&#xff0c;收藏2次。搞3D几何内核算法研究&#xff0c;必须学习NURBS样条曲线…

动手学深度学习(Pytorch版)代码实践 -卷积神经网络-25使用块的网络VGG

25使用块的网络VGG import torch from torch import nn import liliPytorch as lp import matplotlib.pyplot as plt# 定义VGG块 # num_convs: 卷积层的数量 # in_channels: 输入通道的数量 # out_channels: 输出通道的数量 def vgg_block(num_convs, in_channels, out_channel…

基于Springboot + vue 的抗疫物质管理系统的设计与实现

目录 &#x1f4da; 前言 &#x1f4d1;摘要 &#x1f4d1;系统流程 &#x1f4da; 系统架构设计 &#x1f4da; 数据库设计 &#x1f4da; 系统功能的具体实现 &#x1f4ac; 系统登录注册 系统登录 登录界面 用户添加 &#x1f4ac; 抗疫列表展示模块 区域信息管理 …