Gobject tutorial 六

Instantiatable classed types Initialization and destruction

类型的实例化是通过函数g_tpye_create_instance()实现的。这个函数首先会查找与类型相关的GTypeInfo结构体,之后,查询结构体中的instance_size和 instance policy即 n_preallocs(在 2.10版本后废弃)。

如果正在创建的实例时此对象的第一个实例,类型系统必须为对象类结构体分配空间并进行初始化。在初始化时,类结构体的第一部分数据是通过复制此类的父类的结构体。类结构体的其余数据赋值为0.如果对象的类无父类,则对象的类结构体初始化为0.之后,类型系统从最顶端的基础对象开始,根据继承关系,直到现在正在实例化的对象为止,顺序调用base_init,接着,调用对象的class_init来完成类结构的初始化,最后初始化接口。

一旦类型系统初始化完成一个类结构,它就会将实例化的对象的类指针指向这个完成初始化的类结构。这就实现了多个实例化对象共用一个初始化类结构体。之后,会调用对象的instance_init函数,调用顺序是从最顶端的基础对象开始,根据继承关系,直到正在实例化的对象。

对象实例化的销毁,是通过函数g_type_free_instance()实现的。它的功能很简单:它会将实例结构体返还到实例池(这是池是根据n_preallocs分配的)。如果这个实例是一个对象的最后一个实例,那么,当实例销毁时,此对象的类初始化结构体也会被销毁。

类的销毁过程与类结构体初始化过程是对称的。即,先销毁接口,接着调用对象的class_finalize,最后,按照与调用class_init相反的顺序调用base_finalize。

过程如下图所示:

Non-instantiatable classed types: interfaces

interface与抽象类相似,只不过,interface中定义的通用API能被没有继承关系的类使用。它定义了一组方法,在Glib中,我们称这组方法为虚函数,这些方法是由实现接口的类来实现的。不同的类可以有相同的接口方法集。比如,CD播放器、MP3等设备上都有播放、暂停和停止按钮。此时,我们可以认为播放、暂停和停止属于接口中的方法集。

那么,接口是怎么定义以及使用的呢?下面我们举例说明,值得注意的是,接口的定义只需要一个数据结构,而不像对象,需要定义实例和类这两个数据结构,且我们定义的接口的数据结构第一个成员必须为GTypeInterface。GTypeInterface是所有接口的基类。其他成员还有接口函数指针。

我们实现的接口名为TComparable, 接口中方法为cmp。

/*tcomparable.h*/
#pragma once

#include <glib-object.h>

#define T_TYPE_COMPARABLE  (t_comparable_get_type ())
/*G_DECLARE_INTERFACE (TComparable, t_comparable, T, COMPARABLE, GObject)*/
GType t_comparable_get_type (void);
typedef struct _TComparable TComparable;
typedef struct _TComparableInterface TComparableInterface;
#define T_COMPARABLE(instance)           (G_TYPE_CHECK_INSTANCE_CAST(instance, T_TYPE_COMPARABLE, TComparable))
#define T_IS_COMPARABLE(instance)        (G_TYPE_CHECK_INSTANCE_TYPE(instance, T_TYPE_COMPARABLE))
#define T_COMPARABLE_GET_IFACE(instance) (G_TYPE_INSTANCE_GET_INTERFACE((instance), T_TYPE_COMPARABLE, TComparableInterface))  

struct _TComparableInterface {
  GTypeInterface parent;
  /* signal */
  void (*arg_error) (TComparable *self);
  /* virtual function 将由实现接口的类的方法来覆盖*/
  int (*cmp) (TComparable *self, TComparable *other);
};

/* t_comparable_cmp */
/* if self > other, then returns 1 */
/* if self = other, then returns 0 */
/* if self < other, then returns -1 */
/* if error happens, then returns -2 */

int
t_comparable_cmp (TComparable *self, TComparable *other);

gboolean
t_comparable_eq (TComparable *self, TComparable *other);

gboolean
t_comparable_gt (TComparable *self, TComparable *other);

gboolean
t_comparable_lt (TComparable *self, TComparable *other);

gboolean
t_comparable_ge (TComparable *self, TComparable *other);

gboolean
t_comparable_le (TComparable *self, TComparable *other);
/*tcomparable.c*/
#include "tcomparable.h"

static guint t_comparable_signal;

static void
t_comparable_default_init (TComparableInterface *iface);
GType
t_comparable_get_type (void) {
  static GType type = 0;
  GTypeInfo info;

  if (type == 0) {
    info.class_size = sizeof (TComparableInterface);
    info.base_init = NULL;
    info.base_finalize = NULL;
    info.class_init = (GClassInitFunc)  t_comparable_default_init;
    info.class_finalize = NULL;
    info.class_data = NULL;
    info.instance_size = 0;
    info.n_preallocs = 0;
    info.instance_init = NULL;
    info.value_table = NULL;
    type = g_type_register_static (G_TYPE_INTERFACE, "TComparable", &info, 0);
  }
  return type;
}

static void
arg_error_default_cb (TComparable *self) {
  g_printerr ("\nTComparable: argument error.\n");
}

static void
t_comparable_default_init (TComparableInterface *iface) {
  /* virtual function */
  iface->cmp = NULL;
  /* argument error signal */
  iface->arg_error = arg_error_default_cb;
  t_comparable_signal =
  g_signal_new ("arg-error",
                T_TYPE_COMPARABLE,
                G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS,
                G_STRUCT_OFFSET (TComparableInterface, arg_error),
                NULL /* accumulator */,
                NULL /* accumulator data */,
                NULL /* C marshaller */,
                G_TYPE_NONE /* return_type */,
                0     /* n_params */,
                NULL  /* param_types */);
}

int
t_comparable_cmp (TComparable *self, TComparable *other) {
  g_return_val_if_fail (T_IS_COMPARABLE (self), -2);

  TComparableInterface *iface = T_COMPARABLE_GET_IFACE (self);

  return (iface->cmp == NULL ? -2 : iface->cmp (self, other));
}

gboolean
t_comparable_eq (TComparable *self, TComparable *other) {
  return (t_comparable_cmp (self, other) == 0);
}

gboolean
t_comparable_gt (TComparable *self, TComparable *other) {
  return (t_comparable_cmp (self, other) == 1);
}

gboolean
t_comparable_lt (TComparable *self, TComparable *other) {
  return (t_comparable_cmp (self, other) == -1);
}

gboolean
t_comparable_ge (TComparable *self, TComparable *other) {
  int result = t_comparable_cmp (self, other);
  return (result == 1 || result == 0);
}

gboolean
t_comparable_le (TComparable *self, TComparable *other) {
  int result = t_comparable_cmp (self, other);
  return (result == -1 || result == 0);
}

 到此,我们完成了对接口TComparable的定义。下面,我们来说明如何在各个类中使用,以及接口的虚拟函数是如何被各个类的函数覆盖的。

/*tint.c*/
#include "../tnumber/tnumber.h"
#include "../tnumber/tint.h"
#include "../tnumber/tdouble.h"
#include "tcomparable_without_macro.h"

enum {
  PROP_0,
  PROP_INT,
  N_PROPERTIES
};

static GParamSpec *int_properties[N_PROPERTIES] = {NULL, };

struct _TInt {
  TNumber parent;
  int value;
};

static void t_comparable_interface_init (TComparableInterface *iface);

static void
t_int_class_init (TIntClass *class);
static void
t_int_init (TInt *self);

GType 
t_int_get_type (void)
{
  static GType type = 0;
  if (type == 0) {
    const GTypeInfo info = {
      sizeof (TIntClass),
      NULL,   /* base_init */
      NULL,   /* base_finalize */
      (GClassInitFunc) t_int_class_init,   /* class_init */
      NULL,   /* class_finalize */
      NULL,   /* class_data */
      sizeof (TInt),
      0,      /* n_preallocs */
      (GInstanceInitFunc) t_int_init,    /* instance_init */
      NULL /* value table */
    };
    const GInterfaceInfo comparable_info = {
      (GInterfaceInitFunc) t_comparable_interface_init,  /* interface_init */
      NULL,   /* interface_finalize */
      NULL    /* interface_data */
    };
    type = g_type_register_static (T_TYPE_NUMBER, "TInt", &info, 0);
    g_type_add_interface_static (type, T_TYPE_COMPARABLE, &comparable_info);
  }
  return type;
}

static int
t_int_comparable_cmp (TComparable *self, TComparable *other) {
  if (! T_IS_NUMBER (other)) {
    g_signal_emit_by_name (self, "arg-error");
    return -2;
  }

  int i;
  double s, o;

  s = (double) T_INT (self)->value;
  if (T_IS_INT (other)) {
    g_object_get (other, "value", &i, NULL);
    o = (double) i;
  } else
    g_object_get (other, "value", &o, NULL);
  if (s > o)
    return 1;
  else if (s == o)
    return 0;
  else if (s < o)
    return -1;
  else /* This can't happen. */
    return -2;
}

static void
t_comparable_interface_init (TComparableInterface *iface) {
  iface->cmp = t_int_comparable_cmp;
}

static void
t_int_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) {
  TInt *self = T_INT (object);

  if (property_id == PROP_INT)
    self->value = g_value_get_int (value);
  else
    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}

static void
t_int_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) {
  TInt *self = T_INT (object);

  if (property_id == PROP_INT)
    g_value_set_int (value, self->value);
  else
    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}

static void
t_int_init (TInt *self) {
}

/* arithmetic operator */
/* These operators create a new instance and return a pointer to it. */
#define t_int_binary_op(op) \
  int i; \
  double d; \
  if (T_IS_INT (other)) { \
    g_object_get (T_INT (other), "value", &i, NULL); \
    return  T_NUMBER (t_int_new_with_value (T_INT(self)->value op i)); \
  } else { \
    g_object_get (T_DOUBLE (other), "value", &d, NULL); \
    return  T_NUMBER (t_int_new_with_value (T_INT(self)->value op (int) d)); \
  }

static TNumber *
t_int_add (TNumber *self, TNumber *other) {
  g_return_val_if_fail (T_IS_INT (self), NULL);

  t_int_binary_op (+)
}

static TNumber *
t_int_sub (TNumber *self, TNumber *other) {
  g_return_val_if_fail (T_IS_INT (self), NULL);

  t_int_binary_op (-)
}

static TNumber *
t_int_mul (TNumber *self, TNumber *other) {
  g_return_val_if_fail (T_IS_INT (self), NULL);

  t_int_binary_op (*)
}

static TNumber *
t_int_div (TNumber *self, TNumber *other) {
  g_return_val_if_fail (T_IS_INT (self), NULL);

  int i;
  double d;

  if (T_IS_INT (other)) {
    g_object_get (T_INT (other), "value", &i, NULL);
    if (i == 0) {
      g_signal_emit_by_name (self, "div-by-zero");
      return NULL;
    } else
      return  T_NUMBER (t_int_new_with_value (T_INT(self)->value / i));
  } else {
    g_object_get (T_DOUBLE (other), "value", &d, NULL);
    if (d == 0) {
      g_signal_emit_by_name (self, "div-by-zero");
      return NULL;
    } else
      return  T_NUMBER (t_int_new_with_value (T_INT(self)->value / (int)  d));
  }
}

static TNumber *
t_int_uminus (TNumber *self) {
  g_return_val_if_fail (T_IS_INT (self), NULL);

  return T_NUMBER (t_int_new_with_value (- T_INT(self)->value));
}

static char *
t_int_to_s (TNumber *self) {
  g_return_val_if_fail (T_IS_INT (self), NULL);

  int i;

  g_object_get (T_INT (self), "value", &i, NULL); 
  return g_strdup_printf ("%d", i);
}

static void
t_int_class_init (TIntClass *class) {
  TNumberClass *tnumber_class = T_NUMBER_CLASS (class);
  GObjectClass *gobject_class = G_OBJECT_CLASS (class);

  /* override virtual functions */
  tnumber_class->add = t_int_add;
  tnumber_class->sub = t_int_sub;
  tnumber_class->mul = t_int_mul;
  tnumber_class->div = t_int_div;
  tnumber_class->uminus = t_int_uminus;
  tnumber_class->to_s = t_int_to_s;

  gobject_class->set_property = t_int_set_property;
  gobject_class->get_property = t_int_get_property;
  int_properties[PROP_INT] = g_param_spec_int ("value", "val", "Integer value", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE);
  g_object_class_install_properties (gobject_class, N_PROPERTIES, int_properties);
}

TInt *
t_int_new_with_value (int value) {
  TInt *i;

  i = g_object_new (T_TYPE_INT, "value", value, NULL);
  return i;
}

TInt *
t_int_new (void) {
  TInt *i;

  i = g_object_new (T_TYPE_INT, NULL);
  return i;
}

tstr.c、tdouble.c与tint.c使用Tcompararble的方式相同。到此,数据类型都定义完成,接下来说明,在应用程序中如何使用TComparable。

#include <glib-object.h>
#include "tcomparable_without_macro.h"
#include "../tnumber/tnumber.h"
#include "../tnumber/tint.h"
#include "../tnumber/tdouble.h"
#include "../tstr/tstr.h"

static void
t_print (const char *cmp, TComparable *c1, TComparable *c2) {
  char *s1, *s2;
  TStr *ts1, *ts2, *ts3;

  ts1 = t_str_new_with_string("\"");
  if (T_IS_NUMBER (c1))
    s1 = t_number_to_s (T_NUMBER (c1));
  else if (T_IS_STR (c1)) {
    ts2 = t_str_concat (ts1, T_STR (c1));
    ts3 = t_str_concat (ts2, ts1);
    s1 = t_str_get_string (T_STR (ts3));
    g_object_unref (ts2);
    g_object_unref (ts3);
  } else {
    g_print ("c1 isn't TInt, TDouble nor TStr.\n");
    return;
  }
  if (T_IS_NUMBER (c2))
    s2 = t_number_to_s (T_NUMBER (c2));
  else if (T_IS_STR (c2)) {
    ts2 = t_str_concat (ts1, T_STR (c2));
    ts3 = t_str_concat (ts2, ts1);
    s2 = t_str_get_string (T_STR (ts3));
    g_object_unref (ts2);
    g_object_unref (ts3);
  } else {
    g_print ("c2 isn't TInt, TDouble nor TStr.\n");
    return;
  }
  g_print ("%s %s %s.\n", s1, cmp, s2);
  g_object_unref (ts1);
  g_free (s1);
  g_free (s2);
}    

static void
compare (TComparable *c1, TComparable *c2) {
  if (t_comparable_eq (c1, c2))
    t_print ("equals", c1, c2);
  else if (t_comparable_gt (c1, c2))
    t_print ("is greater than", c1, c2);
  else if (t_comparable_lt (c1, c2))
    t_print ("is less than", c1, c2);
  else if (t_comparable_ge (c1, c2))
    t_print ("is greater than or equal to", c1, c2);
  else if (t_comparable_le (c1, c2))
    t_print ("is less than or equal to", c1, c2);
  else
    t_print ("can't compare to", c1, c2);
}

int
main (int argc, char **argv) {
  const char *one = "one";
  const char *two = "two";
  const char *three = "three";
  TInt *i;
  TDouble *d;
  TStr *str1, *str2, *str3;

  i = t_int_new_with_value (124);
  d = t_double_new_with_value (123.45);
  str1 = t_str_new_with_string (one);
  str2 = t_str_new_with_string (two);
  str3 = t_str_new_with_string (three);

  compare (T_COMPARABLE (i), T_COMPARABLE (d));
  compare (T_COMPARABLE (str1), T_COMPARABLE (str2));
  compare (T_COMPARABLE (str2), T_COMPARABLE (str3));
  compare (T_COMPARABLE (i), T_COMPARABLE (str1));

  g_object_unref (i);
  g_object_unref (d);
  g_object_unref (str1);
  g_object_unref (str2);
  g_object_unref (str3);

  return 0;
}

Interface initialization

与abstract class类似,初始化时,会为接口结构分配空间,之后将父接口结构复制进来,如果没有父接口结构,则新分配的结构会被初始化为0。之后将g_type设置为正在初始化的接口类型,g_instance_type 设置为此正在实现此接口的对象类型。接着调用接口结构中base_init、default_init(class_int)、接口实现时所在类型的interface_init(例如Tint中的 t_compare_interface_init).如果同一个接口在很多类型中都存在实现(例如,Tcomparable在Tint,Tstr中都有实现),那么,接口实现所在的每个类型在初始化过程中,当轮到接口初始化时,接口中的base_init、interface_init都要执行一次,然而,default_init却只执行一次。因此,对接口的初始化一般放在default_init中,就如上例中的t_comparable_default_init中设置信号那样。

过程及说明如下表所示:

 Interface Destruction

当接口实现所在类型的最后一个实例化(如TInt的实例化)销毁时,与此类型相关的接口的实现也会销毁。

在销毁接口的实现时,类型系统GType会首先调用接口实现的interface_finalize之后调用接口的base_finalize。同样的每个接口实现所在类型在销毁时,这两个函数都被被调用一次。当所有接口实现所在类的实例都被销毁时,接口类型才会被销毁。

过程及说明如下表所示:

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

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

相关文章

陶建辉入选 2023 年度“中国物联网行业卓越人物榜”

在这个技术飞速发展的时代&#xff0c;物联网行业作为推动社会进步的重要力量&#xff0c;正在不断地演化和革新。近日&#xff0c;中国智联网生态大会暨“2023 物联之星”年度榜单颁奖典礼在上海浦东举行。现场公布了拥有物联网行业奥斯卡奖之称的 ——“物联之星 2023 中国物…

深度 | OpenAI COO闭门访谈:大模型已至,企业如何落地?

图片来源&#xff1a;OpenAI Z Highlights&#xff1a; 仅仅允许公司单一部门使用互联网非常可笑。类似地&#xff0c;给所有员工开放AI权限将会是最大的催化剂。当前阶段的AI企业级部署&#xff0c;要让员工熟悉AI工具的使用方式&#xff0c;让他们将工作流程与模型的功能紧密…

九、数据结构(并查集)

文章目录 1.并查集操作的简单实现2.解决问题3. 并查集优化3.1 合并的优化3.2查询优化3.3查询优化2 通常用“帮派”的例子来说明并查集的应用背景&#xff1a;在一个城市中有 n ( n < 1 0 6 ) n(n < 10^6) n(n<106)个人&#xff0c;他们分成不同的帮派&#xff0c;给出…

[算法刷题积累] 两数之和以及进阶引用

两数之和很经典&#xff0c;通常对于首先想到的就是暴力的求解&#xff0c;当然这没有问题&#xff0c;但是我们如果想要追求更优秀算法&#xff0c;就需要去实现更加简便的复杂度。 这里就要提到我们的哈希表法: 我们可以使用unordered_map去实现&#xff0c;也可以根据题目&a…

【Linux】线程(二:线程控制)

本篇文章主要围绕线程控制来进行展开。 主题思路是以create与join两个接口展开。 目录 pthread_create 与 pthread_join:pthread_create:pthread_join: 代码&#xff1a;问题一&#xff1a;主线程与新线程谁先退出&#xff1f;问题二&#xff1a;哪个线程应该最后退出&#xf…

【关键点检测和描述】SuperPoint

一、引言 论文&#xff1a; SuperPoint: Self-Supervised Interest Point Detection and Description 作者&#xff1a; Magic Leap 代码&#xff1a; SuperPoint 特点&#xff1a; 提出Homographic Adaptation策略&#xff0c;提升模型从虚拟数据迁移到真实数据的表现&#x…

邻氯苯甲酰氯在医药、农药等领域应用广泛 市场需求稳定且有增长趋势

邻氯苯甲酰氯在医药、农药等领域应用广泛 市场需求稳定且有增长趋势 邻氯苯甲酰氯又称为2-氯苯甲酰氯、氯化邻氯苯甲酰&#xff0c;化学式为C7H4Cl2O&#xff0c;是一种化学物质&#xff0c;外观为黄色液体&#xff0c;不溶于水&#xff0c;溶于醇、醚、丙酮&#xff0c;有强烈…

第100+12步 ChatGPT学习:R实现KNN分类

基于R 4.2.2版本演示 一、写在前面 有不少大佬问做机器学习分类能不能用R语言&#xff0c;不想学Python咯。 答曰&#xff1a;可&#xff01;用GPT或者Kimi转一下就得了呗。 加上最近也没啥内容写了&#xff0c;就帮各位搬运一下吧。 二、R代码实现KNN分类 &#xff08;1&a…

API 设计技巧:基础知识与实践的方法

在这篇深入探讨中&#xff0c;我们将从基础开始&#xff0c;逐步介绍 API 设计&#xff0c;并探讨定义卓越API的最佳实践。 作为一名开发者&#xff0c;你可能已经熟悉了许多这些概念&#xff0c;但我将提供详细解释&#xff0c;以加深你的理解。 API 设计&#xff1a;电子商…

图纸管理最佳实践:从混乱到有序的转变

图纸管理最佳实践&#xff1a;从混乱到有序的转变 在工程项目中&#xff0c;图纸是不可或缺的重要资料&#xff0c;它们承载着设计者的智慧与心血。然而&#xff0c;随着项目的推进和时间的推移&#xff0c;图纸管理往往变得混乱不堪&#xff0c;给项目的顺利进行带来诸多不便。…

ROS(四)

write in advance 实验四&#xff0c;在经历了实验三的失败后&#xff0c;卷土重来。 幸运的是&#xff0c;此次实验很简单&#xff0c;很快就能搞定。 Part one 使用指令查看自己摄像头的设备号&#xff0c;如果报错&#xff0c;且你为虚拟机&#xff0c;可能是未在虚拟机处…

Java学习 (二)关键字、标识符、数组

一、关键字 我们第一章案例中有很多关键字&#xff0c;比如class、public、static、void等&#xff0c;这些关键字依旧被java定义好了&#xff0c;可以拿来用&#xff0c;不需要死记硬背&#xff0c;按照官方文档查询即可 #官方文档 https://docs.oracle.com/javase/tutorial/j…

docker-compose设置永久启动、自动重启

步骤一 找到 docker-compose.yml 文件 步骤二 vim 打开文件 找到 image: PS&#xff1a;就是为了对齐格式 步骤三 在其下方添加&#xff1a; restart: always而后保存即可

打开nginx连接的php页面报错502

目录 问题描述&#xff1a; 原因&#xff1a; 1. 使用 Unix 域套接字&#xff08;Unix Socket&#xff09; 区别和优势&#xff1a; 2. 使用 TCP/IP 套接字 区别和优势&#xff1a; 如何选择 扩展&#xff1a;Rocky_Linux9.4安装PHP的步骤&#xff1a; 使用Remi存储库…

Wifi通信协议:WEP,WPA,WPA2,WPA3,WPS

前言 无线安全性是保护互联网安全的重要因素。连接到安全性低的无线网络可能会带来安全风险&#xff0c;包括数据泄露、账号被盗以及恶意软件的安装。因此&#xff0c;利用合适的Wi-Fi安全措施是非常重要的&#xff0c;了解WEP、WPA、WPA2和WPA3等各种无线加密标准的区别也是至…

通过防抖动代码解决ResizeObserver loop completed with undelivered notifications.

通过防抖动代码解决ResizeObserver loop completed with undelivered notifications. 一、报错内容二、解决方案解释&#xff1a; 一、报错内容 我通过el-tabs下的el-tab-pane切换到el-table出现的报错&#xff0c;大致是渲染宽度出现了问题 二、解决方案 扩展原生的 Resiz…

Android 应用加固与重签名—使用AndroidStudio自带工具 apksigner

由 AndroidStudio 生成的release版本的app有自己的签名&#xff0c;但当应用加固后会删除原签名&#xff0c;需要重新签名。 一、加固方式&#xff1a; 使用基础版的腾讯云&#xff08;乐固&#xff09;进行免费加固&#xff0c;上传软件后等待在线加固完成后下载 apk 即可。…

vue3+ts+vite集成eslint

项目中安装eslint yarn add eslint -Deslint初始化 npx eslint --init按照下方操作即可 安装typescript-eslint/parser yarn add typescript-eslint/parser -D安装vite-plugin-eslint2 yarn add vite-plugin-eslint2 -D配置vite-plugin-eslint2 // vite.config.ts import …

钡铼技术BL104在环境监测站多协议采集保障数据全面准确

随着工业化和城市化进程的加快&#xff0c;环境污染问题日益严重&#xff0c;环境监测站在保护生态环境、保障公众健康中的作用变得越来越重要。钡铼技术PLC物联网关BL104&#xff0c;为环境监测站提供了一种高效、可靠的多协议数据采集解决方案&#xff0c;保障了监测数据的全…

如何实现对文件发送全生命周期的外发管理?

在日常工作中&#xff0c;我们需要经常和企业外部的机构或者个人&#xff0c;发送一些企业内部的文档或者图纸等资料。但企业在文件外发管理上&#xff0c;仍存在一定漏洞&#xff0c;有些员工会通过一些手段&#xff0c;将重要核心文件数据发过去&#xff0c;包括但不仅限于以…