🌐 Select Language: English | 中文 | Tiếng Việt
This library provides a generic FIFO queue implementation using a Ring Buffer, optimized for Entity-Component-System (ECS) architectures, written in Wave 0.1.9-pre-beta (running on Fedora Linux 43 Container Image with LLVM 21.1.8 backend). It serves as a supporting code library for Raylib development workflows, though not an official release or documented version.
- Ring Buffer Implementation: Circular buffer design for optimal memory usage and O(1) operations
- Generic Implementation: Works with any element type using runtime element size information
- ECS-Optimized: Designed specifically for ECS architectures with performance in mind
- Memory Efficient: Geometric growth strategy (×2) for amortized O(1) enqueue operations
- Fast Operations: Dequeue operations in O(1) time with proper head/tail tracking
- Memory Management: Proper allocation, deallocation, and capacity management
- Advanced Utilities: Clone, shrink-to-fit, and comprehensive utility functions
queue_new<T>(): Create a new queue on the stackqueue_new_heap<T>(): Create a new queue on the heapqueue_enqueue<T>(): Add an element to the back (amortized O(1))queue_dequeue<T>(): Remove and return the front element (O(1))queue_peek<T>(): Get a pointer to the front element without removing it (O(1))queue_clone<T>(): Create a deep copy of the queuequeue_shrink_to_fit<T>(): Reduce capacity to match length
Examples are located in the examples/ directory:
01_basic_operations.wave: Basic queue creation, access, and operations02_heap_allocation_cloning.wave: Heap allocation and deep cloning operations03_capacity_management.wave: Capacity expansion and shrinking operations04_clear_edge_cases.wave: Clear operations and edge case handling05_ring_buffer_wrapping.wave: Ring buffer wrap-around behavior demonstration
- Wave 0.1.9-pre-beta
- Fedora Linux 43 (Container Image)
- LLVM 21.1.8 backend
- Docker-based build system
此库提供了基于环形缓冲区的通用 FIFO 队列实现,专为实体-组件-系统(ECS)架构优化,使用 Wave 0.1.9-pre-beta 编写(在 Fedora Linux 43 容器镜像上运行,LLVM 21.1.8 后端)。它作为 Raylib 开发工作流程的支持代码库,但不是正式发布版本或文档化版本。
- 环形缓冲区实现:循环缓冲区设计,实现最佳内存使用和 O(1) 操作
- 泛型实现:使用运行时元素大小信息支持任何元素类型
- ECS 优化:专门为 ECS 架构设计,注重性能
- 内存高效:几何增长策略(×2)实现摊销 O(1) 入队操作
- 快速操作:出队操作在 O(1) 时间内完成,具有适当的头/尾跟踪
- 内存管理:适当的分配、释放和容量管理
- 高级工具:克隆、缩小至适合大小和全面的实用功能
queue_new<T>():在栈上创建新队列queue_new_heap<T>():在堆上创建新队列queue_enqueue<T>():在末尾添加元素(摊销 O(1))queue_dequeue<T>():删除并返回前端元素(O(1))queue_peek<T>():获取前端元素的指针而不删除它(O(1))queue_clone<T>():创建队列的深拷贝queue_shrink_to_fit<T>():减少容量以匹配长度
示例位于 examples/ 目录:
01_basic_operations.wave:基本队列创建、访问和操作02_heap_allocation_cloning.wave:堆分配和深度克隆操作03_capacity_management.wave:容量扩展和缩小操作04_clear_edge_cases.wave:清除操作和边缘情况处理05_ring_buffer_wrapping.wave:环形缓冲区环绕行为演示
- Wave 0.1.9-pre-beta
- Fedora Linux 43(容器镜像)
- LLVM 21.1.8 后端
- 基于 Docker 的构建系统
Thư viện này cung cấp triển khai hàng đợi FIFO tổng quát sử dụng Ring Buffer được tối ưu hóa cho kiến trúc Entity-Component-System (ECS), viết bằng Wave 0.1.9-pre-beta (chạy trên Fedora Linux 43 Container Image với backend LLVM 21.1.8). Thư viện đóng vai trò là thư viện mã nguồn hỗ trợ trong quá trình phát triển với Raylib, mặc dù đây không phải là phiên bản chính thức hay được tài liệu hóa đầy đủ.
- Triển Khai Ring Buffer: Thiết kế bộ đệm vòng tròn cho việc sử dụng bộ nhớ tối ưu và các thao tác O(1)
- Triển Khai Tổng Quát: Làm việc với bất kỳ kiểu phần tử nào bằng cách sử dụng thông tin kích thước phần tử tại runtime
- Tối Ưu ECS: Được thiết kế đặc biệt cho kiến trúc ECS với hiệu suất là yếu tố quan trọng
- Hiệu Quả Bộ Nhớ: Chiến lược tăng trưởng hình học (×2) cho thao tác enqueue có độ phức tạp trung bình O(1)
- Thao Tác Nhanh: Thao tác dequeue trong thời gian O(1) với việc theo dõi head/tail đúng cách
- Quản Lý Bộ Nhớ: Phân bổ, giải phóng và quản lý dung lượng phù hợp
- Tiện Ích Nâng Cao: Sao chép, thu nhỏ vừa vặn và các hàm tiện ích toàn diện
queue_new<T>(): Tạo một hàng đợi mới trên ngăn xếpqueue_new_heap<T>(): Tạo một hàng đợi mới trên vùng nhớ đệmqueue_enqueue<T>(): Thêm phần tử vào cuối (trung bình O(1))queue_dequeue<T>(): Xóa và trả về phần tử phía trước (O(1))queue_peek<T>(): Lấy con trỏ đến phần tử phía trước mà không xóa nó (O(1))queue_clone<T>(): Tạo bản sao sâu của hàng đợiqueue_shrink_to_fit<T>(): Giảm dung lượng để phù hợp với độ dài
Các ví dụ nằm trong thư mục examples/:
01_basic_operations.wave: Tạo, truy cập và thao tác hàng đợi cơ bản02_heap_allocation_cloning.wave: Các thao tác phân bổ trên heap và sao chép sâu03_capacity_management.wave: Các thao tác mở rộng và thu nhỏ dung lượng04_clear_edge_cases.wave: Các thao tác xóa và xử lý trường hợp đặc biệt05_ring_buffer_wrapping.wave: Minh họa hành vi bao quanh của ring buffer
- Wave 0.1.9-pre-beta
- Fedora Linux 43 (Container Image)
- Backend LLVM 21.1.8
- Hệ thống xây dựng dựa trên Docker