7. Handwritten Vector (imitating STL-vector) (only encapsulation idea)

Handwritten Vector (imitating STL-vector) (only encapsulation idea) /********************************************** *************************** > File Name: vector.cpp > Author:Xiao Yuheng > Mail:[email protected] > Created Time: Wed Nov 1 07:04:57 2023 *************************************************** ************************/ ? #include <iostream> #include <cstring> ? using namespace std; ? int *allocate(int n) { return new int[n]; } void destroy(int *data) { delete[] data; } ? class […]

Uncovering the mystery of multi-threaded out-of-order encapsulation

classmates! It’s class~ Table of Contents Preface The concept of concurrency and parallelism Multithreading Main thread and sub-thread setDaemon() method join() method setName() and getName() methods Multi-threaded disorder and encapsulation disorder encapsulation Foreword In today’s era of information explosion, efficient concurrent processing has become a challenge faced by many applications. Multi-threaded programming is a powerful […]

A Log library based on Log4cpp encapsulation

Log.h #ifndef _LOG_H_ #define _LOG_H_ #include “log_global.h” #include <QObject> #include “singleton.h” class LogPrivate; class LOG_EXPORT Log :public Singleton<Log> {<!– –> DEFINE_CONSTRUCT(Log) public: void initLogPath(const QString & amp; logPath); void warn(const char * msg, const char *filename = __FILE__, int line = __LINE__, const char *function = “warn”); void info(const char * msg, const char *filename […]

[Audio and Video | Ogg] RFC3533: The Ogg Encapsulation Format Version 0 (The Ogg Encapsulation Format Version 0)

Blog homepage:https://blog.csdn.net/wkd_007 Blog content:Embedded development, Linux, C language, C++, data structure, audio and video Content of this article:Introduction to Ogg packaging format Golden sentence sharing:Confucius said: A gentleman is magnanimous, but a villain has long-term relationships. –“The Analects of Confucius·Shuerpian”. It means that a gentleman is open-minded and calm; a villain is preoccupied and worried […]

vue2+ant-design-vue a-form-model component secondary encapsulation (form form component) FormModel form

1. Renderings 2. Parameter configuration 1. Code example <t-antd-form :ref-obj.sync=”formOpts.ref” :formOpts=”formOpts” :widthSize=”1″ :labelCol=”{ span:2}” :wrapperCol=”{ span:22}” @handleEvent=”handleEvent” /> 2. Configuration parameters inherit all properties of FormModel Parameter Description Type Default value refObj form form validation rule method (you can refer to validate in the antd FormModel form method) obj – className Custom class name String […]

ts simple encapsulation of axios, unified API

Article directory Why encapsulation Target File structure Encapsulate common request methods Get type hints http method File Upload Usage example Instantiate post request type hints File Upload Summarize Complete code: Why encapsulation axios itself is already very easy to use, and the seemingly multiple encapsulation is to decouple axios from the project.For example, if you […]

Encapsulation of socket communication classes (including error handling, read and write processing, communication processing, TCP sticking problem)

1. Encapsulation based on C language TCP-based socket communication is divided into two parts: server-side communication and client-side communication. As long as we master the communication process, it is easy to encapsulate the corresponding functions. Let’s review the communication process first: Service-Terminal Create a listening socket Bind the listening socket to the local IP and […]

JDBC database operation encapsulation class

DB.properties database configuration file driver=com.mysql.cj.jdbc.Driver url=jdbc:mysql:///orcHr user=root password=root JdbcUtils.java JDBC database operation encapsulation class package cn.demo01.utils; import java.io.FileReader; import java.io.IOException; import java.sql.*; import java.util.*; /** * @Author Jiafang Wen * @Date 2023-10-28 12:04 * @Version 1.0 */ public class JdbcUtils<T> {<!– –> private static String driver; private static String url; private static String user; private […]

Simple encapsulation of websocket order module (contract version)

Simple encapsulation of websocket order module Compared with traditional REST API, WebSocket V4 API shows lower transaction latency. According to monitoring data, WebSocket V4 reduces spot transaction delays by 30% and contract transaction delays by 40%. This significant improvement will make your trading significantly more efficient. The following is a simple module encapsulated using the […]

Python mysql encapsulation backup

# -*- coding:utf-8 -*- “”” @File: my_mysql.py @Time: 2022/9/3 17:32 “”” importpymysql class MySql: def __init__(self, operate_tablename:str,my_sqldb_config_param:dict): assert isinstance(my_sqldb_config_param,dict),”Please pass it in in dictionary type format!” self._operate_tablename = operate_tablename try: self._conn = pymysql.connect(**my_sqldb_config_param) # Connect to the database and configure parameters self._cursor = self._conn.cursor() # Create a cursor to execute queries self._get_field() # Get the […]