Skip to content

File wfm_path.h

FileList > inc > wfm > wfm_path.h

Go to the source code of this file

Sibling-path construction shared by the wfm reader and writer. More...

  • #include <stdio.h>
  • #include <string.h>

Public Static Functions

Type Name
void wfm_meta_path (const char * path, char * out, size_t cap)
Name the .sigmf-meta sidecar belonging to the capture atpath .
void wfm_swap_ext (const char * path, const char * ext, char * out, size_t cap)
Swap path's final extension forext .

Detailed Description

Several file types come in pairs — a BLUE detached capture is <base>.hdr + <base>.det, a SigMF one is <base>.sigmf-data + <base>.sigmf-meta — so both halves of the library have to derive one member's name from the other's. Reader and writer MUST agree on that derivation, or the writer emits a sidecar at a name the reader will not look for; one definition here is what makes that impossible.

Public Static Functions Documentation

function wfm_meta_path

Name the .sigmf-meta sidecar belonging to the capture atpath .

static inline void wfm_meta_path (
    const char * path,
    char * out,
    size_t cap
) 

Two derivations, because two different things are being named:

  • "cap.sigmf-data""cap.sigmf-meta" (SWAP). Not a choice: SigMF defines a capture as the <base>.sigmf-data + <base>.sigmf-meta pair, and conformant tools find the second half by exactly that name.
  • "cap.raw""cap.raw.sigmf-meta" (APPEND). Anything else is not a SigMF capture, so no external tool looks for its metadata under any name, which leaves the derivation free — and a free choice should be the one that cannot collide. Swapping would give cap.raw and a genuine cap.sigmf-data in one directory the SAME sidecar name, so writing one capture would silently overwrite the other's metadata. Appending keeps the sidecar 1:1 with the file it describes, which is also what makes it safe to read back by exact name: wfm_reader_create deliberately does NOT sniff for <base>.sigmf-meta beside an arbitrary file, because a shared base name hijacked two unrelated files the first time that was tried.

Parameters:

  • path capture (data) path.
  • out destination buffer; always NUL-terminated, truncated if cap is too small.
  • cap bytes available at out.

function wfm_swap_ext

Swap path's final extension forext .

static inline void wfm_swap_ext (
    const char * path,
    const char * ext,
    char * out,
    size_t cap
) 

"foo/cap.prm" + ".det""foo/cap.det". A path whose basename carries no dot simply gains the extension, so "cap""cap.det".

The dot must be in the BASENAME: a dotted directory ("../cap", "v1.2/cap") is not an extension, and treating it as one would write the sibling into the wrong place entirely.

Parameters:

  • path source path.
  • ext replacement extension, leading dot included.
  • out destination buffer; always NUL-terminated, truncated if cap is too small.
  • cap bytes available at out.


The documentation for this class was generated from the following file native/inc/wfm/wfm_path.h