【UE】UEC++委托代理

目录

【UE】UEC++委托代理 

一、委托的声明与定义

二、单播绑定与解绑

三、多播绑定与解绑

四、动态单播绑定与解绑

五、动态多播绑定与解绑

六、委托的调用

七、运行结果

1、运行开始

2、调用单播

3、调用多播

4、调用动态单播

5、调用动态多播

6、运行结束


【UE】UEC++委托代理 

一、委托的声明与定义

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/GameModeBase.h"
#include "DelegateGameMode.generated.h"

//
// Declare DECLARE_DELEGATE
//
DECLARE_DELEGATE(FDeclareDelegate_00);
DECLARE_DELEGATE_OneParam(FDeclareDelegate_01, bool);
DECLARE_DELEGATE_TwoParams(FDeclareDelegate_02, bool, int32);
DECLARE_DELEGATE_RetVal(bool, FDeclareDelegate_03);
DECLARE_DELEGATE_RetVal_OneParam(bool, FDeclareDelegate_04, bool);

//
// Declare DECLARE_MULTICAST_DELEGATE
//
DECLARE_MULTICAST_DELEGATE(FDeclareMulticastDelegate_00);
DECLARE_MULTICAST_DELEGATE_OneParam(FDeclareMulticastDelegate_01, int32);

//
// Declare DECLARE_DYNAMIC_DELEGATE
//
DECLARE_DYNAMIC_DELEGATE(FDeclareDynamicDelegate_00);
DECLARE_DYNAMIC_DELEGATE_OneParam(FDeclareDynamicDelegate_01, int32, iValue);
DECLARE_DYNAMIC_DELEGATE_RetVal(bool, FDeclareDynamicDelegate_02);
DECLARE_DYNAMIC_DELEGATE_RetVal_OneParam(bool, FDeclareDynamicDelegate_03, int32, iValue);

//
// Declare DECLARE_DYNAMIC_MULTICAST_DELEGATE
//
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FDeclareDynamicMulticastDelegate_00);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDeclareDynamicMulticastDelegate_01, int32, iValue);

UCLASS()
class DELEGATE_API ADelegateGameMode : public AGameModeBase
{
	GENERATED_BODY()
public:
	//
	// Define DECLARE_DELEGATE
	//
	FDeclareDelegate_00 DeclareDelegate_00;
	FDeclareDelegate_01 DeclareDelegate_01;
	FDeclareDelegate_02 DeclareDelegate_02;
	FDeclareDelegate_03 DeclareDelegate_03;
	FDeclareDelegate_04 DeclareDelegate_04;

	//
	// Define DECLARE_MULTICAST_DELEGATE
	//
	FDeclareMulticastDelegate_00 DeclareMulticastDelegate_00;
	FDeclareMulticastDelegate_01 DeclareMulticastDelegate_01;

	//
	// Define DECLARE_DYNAMIC_DELEGATE
	//
	FDeclareDynamicDelegate_00 DeclareDynamicDelegate_00;
	FDeclareDynamicDelegate_01 DeclareDynamicDelegate_01;
	FDeclareDynamicDelegate_02 DeclareDynamicDelegate_02;
	FDeclareDynamicDelegate_03 DeclareDynamicDelegate_03;

	//
	// Define DECLARE_DYNAMIC_MULTICAST_DELEGATE
	//
	FDeclareDynamicMulticastDelegate_00 DeclareDynamicMulticastDelegate_00;
	FDeclareDynamicMulticastDelegate_01 DeclareDynamicMulticastDelegate_01;
};

二、单播绑定与解绑

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "DeclareDelegate.generated.h"

UCLASS()
class DELEGATE_API ADeclareDelegate : public AActor
{
	GENERATED_BODY()
public:	
	ADeclareDelegate();
	virtual void Tick(float DeltaTime) override;
protected:
	virtual void BeginPlay() override;
	virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
public:
	UFUNCTION()
	void BindDelegate();
	UFUNCTION()
	void UnBindDelegate();
	
	UFUNCTION()
	void FunNoParam();
	UFUNCTION()
	void FunOneParam(bool bValue);
	UFUNCTION()
	void FunTwoParam(bool bValue, int32 iValue);
	UFUNCTION()
	bool FunRetValNoParam();
	UFUNCTION()
	bool FunRetValOneParam(bool bValue);
};
#include "DeclareDelegate.h"

#include "Delegate/GameMode/DelegateGameMode.h"
#include "Kismet/GameplayStatics.h"

ADeclareDelegate::ADeclareDelegate()
{
	PrimaryActorTick.bCanEverTick = false;
}

void ADeclareDelegate::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);
}

void ADeclareDelegate::BeginPlay()
{
	Super::BeginPlay();
	BindDelegate();
}

void ADeclareDelegate::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
	Super::EndPlay(EndPlayReason);
	UnBindDelegate();
}

void ADeclareDelegate::BindDelegate()
{
	UE_LOG(LogTemp,Log,TEXT("DeclareDelegateActor::BindDegelate"))
	if(GetWorld())
	{
		ADelegateGameMode* DelegateGameMode = Cast<ADelegateGameMode>(UGameplayStatics::GetGameMode(GetWorld()));

		DelegateGameMode->DeclareDelegate_00.BindUObject(this, &ThisClass::FunNoParam);
		DelegateGameMode->DeclareDelegate_01.BindUFunction(this, "FunOneParam");
		DelegateGameMode->DeclareDelegate_02.BindUObject(this, &ThisClass::FunTwoParam);
		DelegateGameMode->DeclareDelegate_03.BindUObject(this, &ThisClass::FunRetValNoParam);
		DelegateGameMode->DeclareDelegate_04.BindUFunction(this, "FunRetValOneParam");
	}
}

void ADeclareDelegate::UnBindDelegate()
{
	UE_LOG(LogTemp,Log,TEXT("DeclareDelegateActor::UnBindDegelate"))
	if(GetWorld())
	{
		ADelegateGameMode* DelegateGameMode = Cast<ADelegateGameMode>(UGameplayStatics::GetGameMode(GetWorld()));

		DelegateGameMode->DeclareDelegate_00.Unbind();
		DelegateGameMode->DeclareDelegate_01.Unbind();
		DelegateGameMode->DeclareDelegate_02.Unbind();
		DelegateGameMode->DeclareDelegate_03.Unbind();
		DelegateGameMode->DeclareDelegate_04.Unbind();
	}
}

void ADeclareDelegate::FunNoParam()
{
	UE_LOG(LogTemp,Log,TEXT("DeclareDelegateActor::FunNoParam"))
}

void ADeclareDelegate::FunOneParam(bool bValue)
{
	UE_LOG(LogTemp,Log,TEXT("DeclareDelegateActor::FunOneParam"))
}

void ADeclareDelegate::FunTwoParam(bool bValue, int32 iValue)
{
	UE_LOG(LogTemp,Log,TEXT("DeclareDelegateActor::FunTwoParam"))
}

bool ADeclareDelegate::FunRetValNoParam()
{
	UE_LOG(LogTemp,Log,TEXT("DeclareDelegateActor::FunRetValNoParam"))
	return false;
}

bool ADeclareDelegate::FunRetValOneParam(bool bValue)
{
	UE_LOG(LogTemp,Log,TEXT("DeclareDelegateActor::FunRetValOneParam"))
	return bValue;
}

三、多播绑定与解绑

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "DeclareMulticastDelegate.generated.h"

UCLASS()
class DELEGATE_API ADeclareMulticastDelegate : public AActor
{
	GENERATED_BODY()
	
public:	
	ADeclareMulticastDelegate();
	virtual void Tick(float DeltaTime) override;
protected:
	virtual void BeginPlay() override;
	virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
public:
	UFUNCTION()
	void BindDelegate();
	UFUNCTION()
	void UnBindDelegate();
		
	UFUNCTION()
	void FunNoParam_One();
	UFUNCTION()
	void FunNoParam_Two();
	UFUNCTION()
	void FunOneParam_One(int32 iValue);
	UFUNCTION()
	void FunOneParam_Two(int32 iValue);
private:
	FDelegateHandle DelegateHandle;
	TArray<FDelegateHandle> DelegateHandles;
};
#include "DeclareMulticastDelegate.h"

#include "Delegate/GameMode/DelegateGameMode.h"
#include "Kismet/GameplayStatics.h"

ADeclareMulticastDelegate::ADeclareMulticastDelegate()
{
	PrimaryActorTick.bCanEverTick = false;
}

void ADeclareMulticastDelegate::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);
}

void ADeclareMulticastDelegate::BeginPlay()
{
	Super::BeginPlay();
	BindDelegate();
}

void ADeclareMulticastDelegate::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
	Super::EndPlay(EndPlayReason);
	UnBindDelegate();
}

void ADeclareMulticastDelegate::BindDelegate()
{
	UE_LOG(LogTemp,Log,TEXT("DeclareMulticastDelegateActor::BindDegelate"))
	if(GetWorld())
	{
		ADelegateGameMode* DelegateGameMode = Cast<ADelegateGameMode>(UGameplayStatics::GetGameMode(GetWorld()));

		DelegateGameMode->DeclareMulticastDelegate_00.AddUObject(this, &ThisClass::FunNoParam_One);
		DelegateHandle = DelegateGameMode->DeclareMulticastDelegate_00.AddUFunction(this, "FunNoParam_Two");
		DelegateHandles.Add(DelegateGameMode->DeclareMulticastDelegate_01.AddUObject(this, &ThisClass::FunOneParam_One));
		DelegateHandles.Add(DelegateGameMode->DeclareMulticastDelegate_01.AddUFunction(this, "FunOneParam_Two"));
	}
}

void ADeclareMulticastDelegate::UnBindDelegate()
{
	UE_LOG(LogTemp,Log,TEXT("DeclareMulticastDelegateActor::UnBindDelegate"))
	if(GetWorld())
	{
		ADelegateGameMode* DelegateGameMode = Cast<ADelegateGameMode>(UGameplayStatics::GetGameMode(GetWorld()));

		DelegateGameMode->DeclareMulticastDelegate_00.RemoveAll(this);
		
		for(FDelegateHandle Handle : DelegateHandles)
		{
			DelegateGameMode->DeclareMulticastDelegate_01.Remove(Handle);
		}
	}
}

void ADeclareMulticastDelegate::FunNoParam_One()
{
	UE_LOG(LogTemp,Log,TEXT("DeclareMulticastDelegateActor::FunNoParam_One"))
}

void ADeclareMulticastDelegate::FunNoParam_Two()
{
	UE_LOG(LogTemp,Log,TEXT("DeclareMulticastDelegateActor::FunNoParam_Two"))
	
	if(GetWorld())
	{
		ADelegateGameMode* DelegateGameMode = Cast<ADelegateGameMode>(UGameplayStatics::GetGameMode(GetWorld()));
		DelegateGameMode->DeclareMulticastDelegate_00.Remove(DelegateHandle);
	}
}

void ADeclareMulticastDelegate::FunOneParam_One(int32 iValue)
{
	UE_LOG(LogTemp,Log,TEXT("DeclareMulticastDelegateActor::FunOneParam_One"))
}

void ADeclareMulticastDelegate::FunOneParam_Two(int32 iValue)
{
	UE_LOG(LogTemp,Log,TEXT("DeclareMulticastDelegateActor::FunOneParam_Two"))
}

四、动态单播绑定与解绑

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "DeclareDynamicDelegate.generated.h"

UCLASS()
class DELEGATE_API ADeclareDynamicDelegate : public AActor
{
	GENERATED_BODY()
public:	
	ADeclareDynamicDelegate();
	virtual void Tick(float DeltaTime) override;
protected:
	virtual void BeginPlay() override;
	virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
public:	
	UFUNCTION()
	void BindDelegate();
	UFUNCTION()
	void UnBindDelegate();

	UFUNCTION()
	void FunNoParam();
	UFUNCTION()
	void FunOneParam(int32 iValue);
	UFUNCTION()
	bool FunRetValNoParam();
	UFUNCTION()
	bool FunRetValOneParam(int32 iValue);
};
#include "DeclareDynamicDelegate.h"

#include "Delegate/GameMode/DelegateGameMode.h"
#include "Kismet/GameplayStatics.h"

ADeclareDynamicDelegate::ADeclareDynamicDelegate()
{
	PrimaryActorTick.bCanEverTick = false;
}

void ADeclareDynamicDelegate::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);
}

void ADeclareDynamicDelegate::BeginPlay()
{
	Super::BeginPlay();
	BindDelegate();
}

void ADeclareDynamicDelegate::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
	Super::EndPlay(EndPlayReason);
	UnBindDelegate();
}

void ADeclareDynamicDelegate::BindDelegate()
{
	UE_LOG(LogTemp,Log,TEXT("DeclareDynamicDelegate::BindDelegate"))
	if(GetWorld())
	{
		ADelegateGameMode* DelegateGameMode = Cast<ADelegateGameMode>(UGameplayStatics::GetGameMode(GetWorld()));

		DelegateGameMode->DeclareDynamicDelegate_00.BindDynamic(this, &ThisClass::FunNoParam);
		DelegateGameMode->DeclareDynamicDelegate_01.BindUFunction(this, "FunOneParam");
		DelegateGameMode->DeclareDynamicDelegate_02.BindDynamic(this, &ThisClass::FunRetValNoParam);
		DelegateGameMode->DeclareDynamicDelegate_03.BindUFunction(this, "FunRetValOneParam");
	}
}

void ADeclareDynamicDelegate::UnBindDelegate()
{
	UE_LOG(LogTemp,Log,TEXT("DeclareDynamicDelegate::UnBindDelegate"))
	if(GetWorld())
	{
		ADelegateGameMode* DelegateGameMode = Cast<ADelegateGameMode>(UGameplayStatics::GetGameMode(GetWorld()));

		DelegateGameMode->DeclareDynamicDelegate_00.Clear();
		DelegateGameMode->DeclareDynamicDelegate_01.Unbind();
		DelegateGameMode->DeclareDynamicDelegate_02.Clear();
		DelegateGameMode->DeclareDynamicDelegate_03.Unbind();
	}
}

void ADeclareDynamicDelegate::FunNoParam()
{
	UE_LOG(LogTemp,Log,TEXT("DeclareDynamicDelegate::FunNoParam"))
}

void ADeclareDynamicDelegate::FunOneParam(int32 iValue)
{
	UE_LOG(LogTemp,Log,TEXT("DeclareDynamicDelegate::FunOneParam"))
}

bool ADeclareDynamicDelegate::FunRetValNoParam()
{
	UE_LOG(LogTemp,Log,TEXT("DeclareDynamicDelegate::FunRetValNoParam"))
	return false;
}

bool ADeclareDynamicDelegate::FunRetValOneParam(int32 iValue)
{
	UE_LOG(LogTemp,Log,TEXT("DeclareDynamicDelegate::FunRetValOneParam"))
	return false;
}

五、动态多播绑定与解绑

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "DeclareDynamicMulticastDelegate.generated.h"

UCLASS()
class DELEGATE_API ADeclareDynamicMulticastDelegate : public AActor
{
	GENERATED_BODY()
public:	
	ADeclareDynamicMulticastDelegate();
	virtual void Tick(float DeltaTime) override;
protected:
	virtual void BeginPlay() override;
	virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
public:
	UFUNCTION()
	void BindDelegate();
	UFUNCTION()
	void UnBindDelegate();
	
	UFUNCTION()
	void FunNoParam_One();
	UFUNCTION()
	void FunNoParam_Two();
	UFUNCTION()
	void FunOneParam_One(int32 iValue);
	UFUNCTION()
	void FunOneParam_Two(int32 iValue);
};
#include "DeclareDynamicMulticastDelegate.h"

#include "Delegate/GameMode/DelegateGameMode.h"
#include "Kismet/GameplayStatics.h"

ADeclareDynamicMulticastDelegate::ADeclareDynamicMulticastDelegate()
{
	PrimaryActorTick.bCanEverTick = false;
}

void ADeclareDynamicMulticastDelegate::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);
}

void ADeclareDynamicMulticastDelegate::BeginPlay()
{
	Super::BeginPlay();
	BindDelegate();
}

void ADeclareDynamicMulticastDelegate::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
	Super::EndPlay(EndPlayReason);
	UnBindDelegate();
}

void ADeclareDynamicMulticastDelegate::BindDelegate()
{
	UE_LOG(LogTemp,Log,TEXT("DeclareDynamicMulticastDelegate::BindDelegate"))
	if(GetWorld())
	{
		ADelegateGameMode* DelegateGameMode = Cast<ADelegateGameMode>(UGameplayStatics::GetGameMode(GetWorld()));

		DelegateGameMode->DeclareDynamicMulticastDelegate_00.AddDynamic(this, &ThisClass::FunNoParam_One);
		DelegateGameMode->DeclareDynamicMulticastDelegate_00.AddUniqueDynamic(this, &ThisClass::FunNoParam_Two);
		DelegateGameMode->DeclareDynamicMulticastDelegate_01.AddDynamic(this, &ThisClass::FunOneParam_One);
		DelegateGameMode->DeclareDynamicMulticastDelegate_01.AddUniqueDynamic(this, &ThisClass::FunOneParam_Two);
	}
}

void ADeclareDynamicMulticastDelegate::UnBindDelegate()
{
	UE_LOG(LogTemp,Log,TEXT("DeclareDynamicMulticastDelegate::UnBindDelegate"))
	if(GetWorld())
	{
		ADelegateGameMode* DelegateGameMode = Cast<ADelegateGameMode>(UGameplayStatics::GetGameMode(GetWorld()));

		DelegateGameMode->DeclareDynamicMulticastDelegate_00.Remove(this, "FunNoParam_One");
		DelegateGameMode->DeclareDynamicMulticastDelegate_00.RemoveDynamic(this, &ThisClass::FunNoParam_Two);
		DelegateGameMode->DeclareDynamicMulticastDelegate_01.RemoveAll(this);
	}
}

void ADeclareDynamicMulticastDelegate::FunNoParam_One()
{
	UE_LOG(LogTemp,Log,TEXT("DeclareDynamicMulticastDelegate::FunNoParam_One"))
}

void ADeclareDynamicMulticastDelegate::FunNoParam_Two()
{
	UE_LOG(LogTemp,Log,TEXT("DeclareDynamicMulticastDelegate::FunNoParam_Two"))
}

void ADeclareDynamicMulticastDelegate::FunOneParam_One(int32 iValue)
{
	UE_LOG(LogTemp,Log,TEXT("DeclareDynamicMulticastDelegate::FunOneParam_One"))
}

void ADeclareDynamicMulticastDelegate::FunOneParam_Two(int32 iValue)
{
	UE_LOG(LogTemp,Log,TEXT("DeclareDynamicMulticastDelegate::FunOneParam_Two"))
}

六、委托的调用

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/PlayerController.h"
#include "DelegateController.generated.h"

UCLASS()
class DELEGATE_API ADelegateController : public APlayerController
{
	GENERATED_BODY()
public:
	virtual void SetupInputComponent() override;
	//
	//	Call Declare Delegate
	//
	UFUNCTION()
	void CallDeclareDelegate();
	//
	//	Call Declare Multicast Delegate
	//
	UFUNCTION()
	void CallDeclareMulticastDelegate();
	//
	//	Call Declare Dynamic Delegate
	//
	UFUNCTION()
	void CallDeclareDynamicDelegate();
	//
	//	Call Declare Dynamic Multicast Delegate
	//
	UFUNCTION()
	void CallDeclareDynamicMulticastDelegate();
};
#include "DelegateController.h"

#include "DelegateGameMode.h"
#include "Kismet/GameplayStatics.h"

void ADelegateController::SetupInputComponent()
{
	Super::SetupInputComponent();
	InputComponent->BindAction("DeclareDelegate", IE_Pressed, this, &ThisClass::CallDeclareDelegate);
	InputComponent->BindAction("DeclareMulticastDelegate", IE_Pressed, this, &ThisClass::CallDeclareMulticastDelegate);
	InputComponent->BindAction("DeclareDynamicDelegate", IE_Pressed, this, &ThisClass::CallDeclareDynamicDelegate);
	InputComponent->BindAction("DeclareDynamicMulticastDelegate", IE_Pressed, this, &ThisClass::CallDeclareDynamicMulticastDelegate);
}

void ADelegateController::CallDeclareDelegate()
{
	if(GetWorld() == nullptr) return;
	
	const ADelegateGameMode* DelegateGameMode = Cast<ADelegateGameMode>(UGameplayStatics::GetGameMode(GetWorld()));
	if(DelegateGameMode == nullptr) return;
	
	if(DelegateGameMode->DeclareDelegate_00.IsBound())
	{
		DelegateGameMode->DeclareDelegate_00.Execute();
	}
	DelegateGameMode->DeclareDelegate_01.ExecuteIfBound(true);
	DelegateGameMode->DeclareDelegate_02.ExecuteIfBound(true, 11);
	if(DelegateGameMode->DeclareDelegate_03.IsBound())
	{
		bool bValue = DelegateGameMode->DeclareDelegate_03.Execute();
	}
	if(DelegateGameMode->DeclareDelegate_04.IsBound())
	{
		bool bValue = DelegateGameMode->DeclareDelegate_04.Execute(true);
	}
}

void ADelegateController::CallDeclareMulticastDelegate()
{
	if(GetWorld() == nullptr) return;
	
	const ADelegateGameMode* DelegateGameMode = Cast<ADelegateGameMode>(UGameplayStatics::GetGameMode(GetWorld()));
	if(DelegateGameMode == nullptr) return;
	
	if(DelegateGameMode->DeclareMulticastDelegate_00.IsBound())
	{
		DelegateGameMode->DeclareMulticastDelegate_00.Broadcast();
	}
	if(DelegateGameMode->DeclareMulticastDelegate_01.IsBound())
	{
		DelegateGameMode->DeclareMulticastDelegate_01.Broadcast(11);
	}
}

void ADelegateController::CallDeclareDynamicDelegate()
{
	if(GetWorld() == nullptr) return;
	
	const ADelegateGameMode* DelegateGameMode = Cast<ADelegateGameMode>(UGameplayStatics::GetGameMode(GetWorld()));
	if(DelegateGameMode == nullptr) return;
	
	if(DelegateGameMode->DeclareDynamicDelegate_00.IsBound())
	{
		DelegateGameMode->DeclareDynamicDelegate_00.Execute();
	}
	DelegateGameMode->DeclareDynamicDelegate_01.ExecuteIfBound(11);
	if(DelegateGameMode->DeclareDynamicDelegate_02.IsBound())
	{
		bool bValue = DelegateGameMode->DeclareDynamicDelegate_02.Execute();
	}
	if(DelegateGameMode->DeclareDynamicDelegate_03.IsBound())
	{
		bool bValue = DelegateGameMode->DeclareDynamicDelegate_03.Execute(11);
	}
}

void ADelegateController::CallDeclareDynamicMulticastDelegate()
{
	if(GetWorld() == nullptr) return;
	
	const ADelegateGameMode* DelegateGameMode = Cast<ADelegateGameMode>(UGameplayStatics::GetGameMode(GetWorld()));
	if(DelegateGameMode == nullptr) return;
	
	if(DelegateGameMode->DeclareDynamicMulticastDelegate_00.IsBound())
	{
		DelegateGameMode->DeclareDynamicMulticastDelegate_00.Broadcast();
	}
	if(DelegateGameMode->DeclareDynamicMulticastDelegate_01.IsBound())
	{
		DelegateGameMode->DeclareDynamicMulticastDelegate_01.Broadcast(11);
	}
}

七、运行结果

1、运行开始

2、调用单播

3、调用多播

再次调用

4、调用动态单播

5、调用动态多播

6、运行结束

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

傻傻分不清楚的分区、分库、分表

一、分区 MySQL 在 5.1 时添加了对 分区&#xff08;即水平分区&#xff09; 的支持。MySQL 的物理数据存储在表空间文件&#xff08;.ibdata1和.ibd&#xff09;中&#xff0c;分区 的意思是指将同一表中不同行的记录分配到不同的物理文件中。有几个分区就有几个 .idb 文件。…

到手价价格监测如何实现

渠道中的低价数据是品牌非常头疼的问题&#xff0c;治理低价、乱价也是在治理窜货&#xff0c;品牌需要长期执行&#xff0c;并且要有监测渠道价格的能力&#xff0c;监测价格不能只对页面价进行输出&#xff0c;要监测链接中的到手价&#xff0c;这就包含对所有促销信息内容的…

Netty01-NIO与BIO

NIO 什么是NIO Java NIO 全称 java non-blocking IO&#xff0c;是指JDK 1.4 及以上版本提供的新API&#xff08;New IO&#xff09;。从 JDK1.4 开始&#xff0c;Java 提供了一系列改进的输入/输出的新特性&#xff0c;为所有的原始类型&#xff08;boolean类型除外&#xf…

Hive的metastore服务的两种运行模式

Hive的metastore服务的作用是为Hive CLI或者Hiveserver2提供元数据访问接口 1.metastore运行模式 metastore有两种运行模式&#xff0c;分别为嵌入式模式和独立服务模式。下面分别对两种模式进行说明&#xff1a; &#xff08;1&#xff09;嵌入式模式 &#xff08;2&#x…

基于springboot + vue在线考试系统

qq&#xff08;2829419543&#xff09;获取源码 开发语言&#xff1a;Java Java开发工具&#xff1a;JDK1.8 后端框架&#xff1a;springboot 前端&#xff1a;采用vue技术开发 数据库&#xff1a;MySQL5.7和Navicat管理工具结合 服务器&#xff1a;Tomcat8.5 开发软件&#xf…

【PID学习笔记 5 】控制系统的性能指标之一

写在前面 PID在实际工程中最重要的工作就是调参&#xff0c;那么首先就要了解控制系统的性能指标。上文最后简要介绍了控制系统的基本要求&#xff0c;本文开始将系统学习控制系统的性能指标&#xff0c;内容比较多&#xff0c;初步计划是分三节来讲解。本文重点介绍性能指标的…

Bishop新著 - 深度学习:基础与概念 - 前言

译者的话 十几年前&#xff0c;笔者在MSRA实习的时候&#xff0c;就接触到了Christopher M, Bishop的经典巨著《Pattern Recogition and Machine Learning》(一般大家简称为PRML)。Bishop大神是微软剑桥研究院实验室主任&#xff0c;物理出身&#xff0c;对机器学习的基本概念…

银行固定资产巡检管理盘点解决方案

随着金融业务的拓展&#xff0c;银行对办公设备、电子设备等固定资产的需求不断增加&#xff0c;因此&#xff0c;固定资产投入和资产生命周期的管理变得日益重要&#xff0c;由于管理体制、制度等因素不完全协调同步&#xff0c;银行在固定资产投入及管理方面面临诸多问题。 …

优雅草蜻蜓I即时通讯·水银版私有化部署之java服务端搭建教程-01

目录 前言1 1 安装 mongodb2 2 安装 redis3 3. 安装jdk3 4 解压 spring-boot-imapi3 5.开始安装 消息队列组件 rocket4 6. 安装推送服务5 7. 安装 message-push5 8. 安装uplooad 服务5 9&#xff1a; 安装nginx 服务7 1.不需要SSL7 2.需要SSL7 五&#xff1a;编译…

数字图像处理(实践篇)十八 人脸检测

目录 一 使用opencv进行人脸检测 二 使用face_recognition进行人脸检测 一 使用opencv进行人脸检测 1 haarcascade_frontalface_default.xml 方法① 下载 地址&#xff1a;https://github.com/opencv/opencv/tree/master/data/haarcascades 点击haarcascade_frontalface_d…

Java零基础——RocketMQ篇

1.RocketMQ简介 官网&#xff1a; http://rocketmq.apache.org/ RocketMQ是阿里巴巴2016年MQ中间件&#xff0c;使用Java语言开发&#xff0c;RocketMQ 是一款开源的分布式消息系统&#xff0c;基于高可用分布式集群技术&#xff0c;提供低延时的、高可靠的消息发布与订阅服…

Cyanine7-NHS ester荧光染料的化学结构、光谱性质和荧光特性

Cyanine7-NHS ester的结构包括一个靛菁环结构和一个NHS ester活性基团。NHS ester官能团是一种活化基团&#xff0c;用于将染料共价结合到含有游离氨基官能团的生物分子上。 **光谱性质&#xff1a;**Cyanine7-NHS ester的光谱性质通常包括&#xff1a; **激发波长&#xff08…

如何利用MES系统加强对仓库的管理

相比于ERP对库存数量的统计查看&#xff0c;MES系统对于仓库的管理则更加具体。在这个快速变革的时代&#xff0c;仓库管理对于企业的运营效率和客户满意度至关重要&#xff0c;单靠ERP系统已经很难应对新的挑战&#xff0c;所以为了提高仓库管理的效率和准确性&#xff0c;许多…

Twincat功能块使用经验总结

控制全局变量&#xff1a; //轴控制指令 bi_Power: BOOL; //使能 bi_Reset: BOOL; //复位 bi_Stop: BOOL; //停止 bi_JogForward: BOOL; //正向点动 bi_JogBackwards: BOOL; //反向点动 bi_MoveAdditive: BOOL; //增量位…

Java 数据结构篇-二叉树的深度优先遍历(实现:递归方式、非递归方式)

&#x1f525;博客主页&#xff1a; 【小扳_-CSDN博客】 ❤感谢大家点赞&#x1f44d;收藏⭐评论✍ 文章目录 1.0 二叉树的说明 1.1 二叉树的实现 2.0 二叉树的优先遍历说明 3.0 用递归方式实现二叉树遍历 3.1 用递归方式实现遍历 - 前序遍历 3.2 用递归方式实现遍历 - 中序遍…

RabbitMq整合Springboot超全实战案例+图文演示+源码自取

目录 介绍 简单整合 简单模式 定义 代码示例 work模式 定义 代码示例 pubsub模式 定义 代码示例 routing模式 定义 代码示例 top模式 定义 代码 下单付款加积分示例 介绍 代码 可靠性投递示例 介绍 代码 交换机投递确认回调 队列投递确认回调 ​延迟消…

创作涌动·CSDN·21天创作挑战赛·第三期,正式开启报名!

​ 文章目录 ⭐️ 活动介绍⭐️ 活动详情⭐️ 活动奖品⭐️ 活动流程⭐️ 评审规则⭐️ 报名&投稿事项⭐️ 关于活动组织 活动报名地址&#xff08;点击跳转&#xff09; 本次活动与官方活动及其他博主的创作型活动并不不冲突&#xff01; ⭐️ 活动介绍 亲爱的小伙伴们&a…

树莓派Python程序开机自启动(Linux下Python程序开机自启动)

前一阵子用python编写了一个驱动I2C程序读写屏幕&#xff0c;输出IP的小程序&#xff0c;程序编好后需要树莓派使能程序开机自启动。其实这些方法对任何Linux系统都适用。 方法一&#xff1a;此方法的缺点是不进入默认pi的账号&#xff0c;甚至不开hdmi开启桌面的话&#xff0…

连夜整理的6个开源项目,都很实用

偶然找到的这个宝藏网站&#xff0c;站内集齐了大量的开源项目。 推荐实用的项目 1、vueNextAdmin 基于 vue3.x CompositionAPI setup 语法糖 typescript vite element plus vue-router-next pinia 技术&#xff0c;适配手机、平板、pc 的后台开源免费模板&#xff0c;…

使用K-means把人群分类

1.前言 K-mean 是无监督的聚类算法 算法分类&#xff1a; 2.实现步骤 1.数据加工&#xff1a;把数据转为全数字&#xff08;比如性别男女&#xff0c;转换为0 和 1&#xff09; 2.模型训练 fit 3.预测 3.代码 原数据类似这样(source&#xff1a;http:img-blog.csdnimg.cn…