Getting started

Native example

CORE is used through small include-level utilities. This example formats a number with explicit settings and constructs a structured diagnostic:

#include <iostream>
#include <snt/core/diagnostic.h>
#include <snt/core/string_format.h>

int main() {
    snt::core::StringFormatType format;
    format.specifier = 'f';
    format.valuePrecision = 2;
    std::cout << snt::core::number_to_string(12.3456, format) << "\n";

    snt::core::Diagnostic diagnostic;
    diagnostic.severity = snt::core::DiagnosticSeverity::Warning;
    diagnostic.code = "app.config";
    diagnostic.message = "Using the default configuration";
    std::cout << diagnostic.message << "\n";
    return 0;
}

The output is ordinary text; CORE does not choose how an application presents diagnostics. A CLI, service, or library can serialize the same fields in its own format.

Build and run

Install the C++ package using Installation with the CORE module enabled. Save the example above as main.cpp and create this CMakeLists.txt in the same directory:

cmake_minimum_required(VERSION 3.22)
project(snt_core_example LANGUAGES C CXX)

find_package(snt CONFIG REQUIRED)
add_executable(application main.cpp)
target_compile_features(application PRIVATE cxx_std_17)
target_link_libraries(application PRIVATE snt-core)

Configure with the installed package prefix, build, and run:

cmake -S . -B build -DCMAKE_PREFIX_PATH=/path/to/snt
cmake --build build
./build/application

Expected output:

12.35
Using the default configuration

Replace /path/to/snt with the installation prefix; omit that option if CMake already finds SNT. C is enabled for discovery of HDF5 in packages built with DIP support. See Using SciNumTools from CMake for package discovery details.

Continue with Workflows for exceptions, data-type flags, and process execution. The generated API is documented in the C++ API reference.