Veethree D7 SDK
Loading...
Searching...
No Matches
Utility library overview

Introduction

The D7 SDK Utils Library provides a collection of utility functions and wrappers that simplify common operations and enhance safety across the D7 SDK codebase. It includes memory-safe array operations, system call wrappers, and formatted output utilities.

Key Features

  • Safe array element access and size retrieval
  • System call wrappers that handle C++ linter requirements
  • Exception-safe formatted output
  • Type-safe formatting utilities

Architecture

The Utils Library is organized as a collection of standalone utility functions and templates designed to be included and used throughout the D7 SDK codebase. Each component provides specific functionality to address common programming needs.

Main Components

Array Utilities

The Array Utilities component provides template functions for safe array operations.

Key functions:

System Call Wrappers

The System Call Wrappers component provides wrapper functions for common system calls that handle C++ linter requirements and improve code safety.

Key functions:

Formatting Utilities

The Formatting Utilities component provides wrappers and extensions for the fmt library to enable safe and convenient formatted output.

Key functions:

File operations

The file operations utilities provide a simple API for the most common operations:

Best Practices

  • Use vsdk::utils::at() instead of direct array access when bounds checking is required
  • Use vsdk::utils::array_size() instead of sizeof tricks for determining array size
  • Prefer the system call wrappers over direct syscalls for better code maintainability
  • Use vsdk::utils::print() in situations where exceptions should not propagate
  • Remember to check return values from system call wrappers