NGen
Loading...
Searching...
No Matches
path_tokens.hpp
1
/*
2
Author: Nels Frazier
3
Copyright (C) 2025 Lynker
4
------------------------------------------------------------------------
5
Licensed under the Apache License, Version 2.0 (the "License");
6
you may not use this file except in compliance with the License.
7
You may obtain a copy of the License at
8
9
http://www.apache.org/licenses/LICENSE-2.0
10
11
Unless required by applicable law or agreed to in writing, software
12
distributed under the License is distributed on an "AS IS" BASIS,
13
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
See the License for the specific language governing permissions and
15
limitations under the License.
16
------------------------------------------------------------------------
17
Path-template token resolver.
18
19
The BMI serialization protocol is intentionally MPI-agnostic: the
20
protocol itself knows nothing about ranks, hosts, or processes, and
21
will happily write multiple instances to the same file without
22
coordination. When a caller *does* want per-rank (or per-pid, or
23
per-host, or per-date) file naming to sidestep coordination, they
24
bake the discriminator into the configured path via these tokens and
25
let the engine/realization layer resolve them before handing the
26
path to the protocol.
27
28
Recognized tokens (double-braced, exactly — no whitespace inside):
29
{{rank}} MPI rank (0 for non-MPI or uninitialized), decimal.
30
{{pid}} POSIX process id, decimal.
31
{{host}} Host name (first label, truncated at 63 chars; empty if
32
lookup fails).
33
{{date}} Calendar date at call time formatted YYYYMMDD (local
34
time; not suitable as a cryptographic nonce).
35
36
Unknown tokens — anything else matching `{{...}}` — are left intact so
37
that a future addition doesn't silently swallow a typo. The caller is
38
expected to validate the final string however they see fit.
39
40
Keep this header free of MPI includes (guarded behind NGEN_WITH_MPI in
41
the .cpp). Callers include the header; link pulls in whichever MPI
42
state is available at build time.
43
*/
44
#pragma once
45
46
#include <string>
47
48
namespace
utilities
{
49
57
std::string
resolve_path_tokens
(
const
std::string& path);
58
59
}
// namespace utilities
utilities
Definition
path_tokens.hpp:48
utilities::resolve_path_tokens
std::string resolve_path_tokens(const std::string &path)
Expand {{rank}}, {{pid}}, {{host}}, {{date}} tokens in path and return the resolved string.
Definition
path_tokens.cpp:102
include
utilities
path_tokens.hpp
Generated on Tue Oct 27 2026 21:29:56 for NGen by
1.12.0