Skip to content

Commit e8a1b48

Browse files
steven-vargasteven varga
authored andcommitted
[#282]:svarga:docs, flatten reports tree + curated I/O+TOPICS axis + top-level REPORTS nav + v1.12.6 accuracy pass
Reorganises the Doxygen documentation tree into a 4-axis structure (I/O / TOPICS / COOKBOOK / USABILITY) with REPORTS as a fifth top-level tab, and reconciles every architecture / inventory / taxonomy report against h5cpp v1.12.6's actual implementation state. Layout (doxy/DoxygenLayout.xml): - I/O axis: FILE (h5::create, h5::open) / DATASET / ATTRIBUTES / GROUPS - TOPICS axis: PROPERTIES / LINEAR ALGEBRA / STL / REFLECTION / FILTERS / MPI / ERROR / TYPESYSTEM / CDASH (no longer carries REPORTS as a child) - COOKBOOK: 28 example READMEs unchanged - USABILITY: top-level link at reports_usability_evaluation - REPORTS: new top-level tab, links to reports_index Reports tree flattened (docs/reports/{architecture,compatibility,inventories, project,surveys,taxonomies}/ -> docs/reports/). 15 files renamed via git rename detection; the 6 subdirectory index.md files removed. New docs/reports/index.md groups the 18 reports thematically: Architecture & Design / Inventories & Guides / Compiler Attribute Taxonomies / Surveys & Comparisons / Project Assessment. Doxyfile (doxy/Doxyfile): - USE_MDFILE_AS_MAINPAGE: ../README.md -> ../docs/index.md - INPUT: drop ../README.md, add ../docs/index.md + ../docs/curated - EXCLUDE_SYMBOLS: add h5::impl::*, h5::error::*, h5::pod, h5::strlen, h5::has_scatter, h5::gorilla, h5::uniform, h5::normal, h5::exponential, h5::bernoulli — keeps the error-leaf hierarchy out of the nav tree Curated tree (docs/curated/) — new: - io-api/{index,file,dataset,attributes,groups}.md + io-api/file/{create,open}.md - topics/{index,properties,linalg,stl,reflection,filters,mpi,error, typesystem,cdash,architecture}.md - Reflection page carries the fully-decorated [[h5::*]] worked example + the generated H5T_COMPOUND / scatter / gather code expansion Front page (docs/index.md): purpose-built Doxygen landing distinct from README.md — hero pitch + 10-line snippet, comparison table vs direct HDF5 in C/C++, 3-axis nav, capability matrix, single combined install table with H5CPP + COMPILER columns and reference-style links, project status with badges, acknowledgements, project info. v1.12.6 accuracy pass — reviewed and updated against actual code: - h5cpp-type-system-map.md: complex<T> gate is HDF5 >= 2.0 (not 1.16); enum support qualified as H5CPP_REGISTER_DATATYPE-only; compiler attribute list reduced to what h5cpp-compiler actually parses ([[h5::alias]] and [[h5::version]] removed — not implemented today). Fixed smart-quote-inside-backtick rendering bug in section 16 (was breaking the entire Unsupported-by-design table). - h5cpp-type-system-architecture-notes.md: reframed from "prototype working-tree bank as of 2026-05-26" to "v1.12.6 (released)"; storage_representation enum extended with Winston-model additions (array_element / array_dataset / fls_dataset / fixed_length_string); "current bank" / "current session" temporal markers replaced. - h5cpp-handle-inventory.md: "14 property-list variants" -> 16; async typedef range 353-359 -> 353-358; "remaining 8" -> 10; ROS3 build break documented as resolved via H5FD_CURR_ROS3_FAPL_T_VERSION gate. - h5cpp-compiler-multi-backend-architecture.md: rewritten — was speculative ("tier-2 on AI roadmap"), now reflects 11 backends shipped (hdf5/protobuf/json/msgpack/cbor/bson/avro/rlp/sql ×3 dialects). Attribute namespaces corrected to flat top-level ([[pb::*]] / [[json::*]] / etc, NOT nested h5::proto::* / h5::json::*). CMake helper documented as supporting hdf5 | protocol-buffers only. - h5cpp-threaded-pipeline-sigma-queue-design.md: superseded-status banner — actual implementation shipped as pool_pipeline_t with std::future + std::async (no sigma queue dependency). - h5cpp-usability-evaluation.md: 84 yellow stars + 21 white stars replaced with monochrome ●/○ scorecard; complex<T> field names {re,im} -> {r,i}; enum class and opaque types corrected from not-supported to supported-via-H5CPP_REGISTER_DATATYPE. New report: h5cpp-multithreading-pipeline-state.md — current state of the filter pipeline at v1.12.6, covering both the h5::high_throughput DAPL path and the h5::append packet-table path through pt_t. Documents the three orthogonal pieces (FAPL worker pool / DAPL flag / pool_pipeline_t), the cross-path behaviour matrix, back-pressure policy, honest limitations list, and a profiling recipe.
1 parent e06a7c0 commit e8a1b48

68 files changed

Lines changed: 4580 additions & 8224 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/curated/io-api/attributes.md

Lines changed: 246 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
1+
@page curated_io_api_attributes ATTRIBUTES
2+
3+
@brief Templated attribute I/O on any HDF5 parent that can carry
4+
metadata — file, group, dataset, opaque object, committed datatype.
5+
6+
# Attribute operations
7+
8+
Attributes are small named metadata items attached to a parent HDF5
9+
object. They live in the parent's object header (not as standalone
10+
datasets), do not chunk, and do not support partial I/O — each
11+
attribute is read and written in a single shot.
12+
13+
Use attributes for things that **describe** the data (units, labels,
14+
provenance, schema versions, small calibration constants) — not for
15+
the data itself. If the value is large, changes over time, or needs
16+
slicing, use a dataset instead.
17+
18+
## At a glance
19+
20+
| Operation | Function / syntax | Returns |
21+
| :--------------------- | :--------------------------------------------------------------- | :------------- |
22+
| Allocate | `h5::create<T>(parent, name, args...)` | `h5::at_t` |
23+
| Open existing | `h5::open(parent, name, acpl?)` | `h5::at_t` |
24+
| Read into `T` | `h5::aread<T>(parent, name, acpl?)` | `T` |
25+
| Write a value | `h5::awrite(parent, name, value, acpl?)` | `h5::at_t` |
26+
| Write a brace-list | `h5::awrite(parent, name, {a, b, c}, acpl?)` | `h5::at_t` |
27+
| Delete by name | `h5::adelete(parent, name)` | `void` |
28+
| Bracket-syntax write | `parent["name"] = value` | `h5::at_t` |
29+
| Bracket-syntax read | `T v = parent["name"]` | `T` |
30+
31+
All free functions accept any parent satisfying
32+
`h5::impl::is_valid_attr<P>`: raw `::hid_t`, `h5::gr_t`, `h5::ds_t`,
33+
`h5::ob_t`, or `h5::dt_t<T>`. Typed `h5::fd_t` is **not** in the trait
34+
— pass `static_cast<::hid_t>(fd)` to attach to the file root.
35+
36+
The bracket-syntax forms live on `h5::ds_t`, `h5::gr_t`, and
37+
`h5::ob_t`.
38+
39+
---
40+
41+
@anchor curated_io_api_attributes_create
42+
## `h5::create<T>` — allocate a new attribute
43+
44+
```cpp
45+
template<class T, class HID_T, class... args_t>
46+
std::enable_if_t<h5::impl::is_valid_attr<HID_T>::value, h5::at_t>
47+
h5::create(const HID_T& parent, const std::string& path, args_t&&... args);
48+
```
49+
50+
Allocates the on-disk slot for an attribute of element type `T`. The
51+
value itself is later deposited with `h5::awrite` or read with
52+
`h5::aread<T>`. Most call sites skip `h5::create` and let `h5::awrite`
53+
create-on-demand; explicit `h5::create` is useful when the shape is
54+
non-default or the slot must exist before any value is written.
55+
56+
**Parameters**
57+
58+
| Name | Type | Description |
59+
| :---------------- | :---------------------------------------------------- | :--------------------------------------------------------------------------- |
60+
| `parent` | `::hid_t` / `gr_t` / `ds_t` / `ob_t` / `dt_t<T>` | Open parent handle (compile-time enforced via `is_valid_attr`). |
61+
| `path` | `const std::string&` | Attribute name (UTF-8). |
62+
| `args...` | variadic | `h5::current_dims` (shape; defaults to scalar) and/or `h5::acpl_t` (ACPL). |
63+
64+
**Returns** — `h5::at_t` RAII handle.
65+
66+
**Throws** — `h5::error::io::attribute::create` on `H5Acreate2`
67+
failure; `h5::error::property_list::misc` on invalid ACPL.
68+
69+
**Example**
70+
71+
```cpp
72+
h5::fd_t fd = h5::open("file.h5", H5F_ACC_RDWR);
73+
h5::ds_t ds = h5::open(fd, "/grid/data");
74+
75+
// rank-1 of 3 floats; deposit the value later
76+
h5::create<float>(ds, "spacing", h5::current_dims{3});
77+
78+
// scalar on file root — fd_t needs an explicit cast
79+
h5::create<double>(static_cast<::hid_t>(fd), "schema_version");
80+
```
81+
82+
---
83+
84+
@anchor curated_io_api_attributes_open
85+
## `h5::open` — open an existing attribute
86+
87+
```cpp
88+
template<class HID_T>
89+
std::enable_if_t<h5::impl::is_valid_attr<HID_T>::value, h5::at_t>
90+
h5::open(const HID_T& parent, const std::string& path,
91+
const h5::acpl_t& acpl = h5::default_acpl);
92+
```
93+
94+
Returns an RAII-managed `h5::at_t` suitable for passing to
95+
`h5::aread<T>` or the low-level `h5::awrite(at_t, T*)` form.
96+
97+
**Throws** — `h5::error::io::attribute::open` (not present, parent
98+
invalid, bad ACPL).
99+
100+
**Example**
101+
102+
```cpp
103+
h5::ds_t ds = h5::open(fd, "/grid/data");
104+
h5::at_t att = h5::open(ds, "spacing");
105+
```
106+
107+
---
108+
109+
@anchor curated_io_api_attributes_aread
110+
## `h5::aread<T>` — read attribute value as `T`
111+
112+
```cpp
113+
template <class T, class HID_T>
114+
std::enable_if_t<h5::impl::is_valid_attr<HID_T>::value, T>
115+
h5::aread(const HID_T& parent, const std::string& name,
116+
const h5::acpl_t& acpl = h5::default_acpl);
117+
```
118+
119+
`T` determines how the on-disk value is materialised — see
120+
@ref link_base_template_types "Supported Types". HDF5 has no
121+
fixed-length ↔ VLEN string conversion, so a fixed-length string
122+
attribute reads into `std::string` or `char[N]` but not into
123+
`std::vector<std::string>` unless the on-disk type is VLEN.
124+
125+
**Throws** — `h5::error::io::attribute::open` if the attribute is
126+
not present; `h5::error::io::attribute::read` on `H5Aread` failure.
127+
128+
**Example**
129+
130+
```cpp
131+
h5::ds_t ds = h5::open(fd, "/grid/data");
132+
133+
auto version = h5::aread<double>(ds, "schema_version"); // scalar
134+
auto spacing = h5::aread<std::vector<float>>(ds, "spacing"); // rank-1
135+
auto label = h5::aread<std::string>(ds, "label"); // VLEN string
136+
137+
// Bracket-syntax sugar — implicit conversion picks T from the LHS
138+
std::string label2 = ds["label"];
139+
```
140+
141+
---
142+
143+
@anchor curated_io_api_attributes_awrite
144+
## `h5::awrite` — write a value as an attribute
145+
146+
```cpp
147+
// Create-on-demand — creates the attribute if it doesn't exist.
148+
template <class T, class HID_T, class... args_t>
149+
std::enable_if_t<h5::impl::is_valid_attr<HID_T>::value, h5::at_t>
150+
h5::awrite(const HID_T& parent, const std::string& name,
151+
const T& ref, const h5::acpl_t& acpl = h5::default_acpl);
152+
153+
// Brace-list convenience.
154+
template<class T, class HID_T>
155+
std::enable_if_t<h5::impl::is_valid_attr<HID_T>::value, h5::at_t>
156+
h5::awrite(const HID_T& parent, const std::string& name,
157+
std::initializer_list<T> ref,
158+
const h5::acpl_t& acpl = h5::default_acpl);
159+
160+
// Low-level — operates on a pre-opened h5::at_t. Rarely called directly.
161+
template <class T>
162+
void h5::awrite(const h5::at_t& attr, const T* ptr);
163+
```
164+
165+
Shape is derived from `ref` via `access_traits_t<T>::size`. Attributes
166+
do not chunk and do not support partial I/O.
167+
168+
**Throws** — `h5::error::io::attribute::write` on `H5Awrite` failure;
169+
`h5::error::io::attribute::create` if create-on-demand failed.
170+
171+
**Example**
172+
173+
```cpp
174+
h5::ds_t ds = h5::open(fd, "/grid/data");
175+
176+
h5::awrite(ds, "schema_version", 1.4); // double
177+
h5::awrite(ds, "spacing", std::vector<float>{0.5f, 0.5f, 1.0f}); // 3 floats
178+
h5::awrite(ds, "label", std::string{"u32"}); // VLEN string
179+
ds["axes"] = {1, 2, 3}; // bracket sugar
180+
```
181+
182+
---
183+
184+
@anchor curated_io_api_attributes_adelete
185+
## `h5::adelete` — remove an attribute
186+
187+
```cpp
188+
template<class HID_T>
189+
std::enable_if_t<h5::impl::is_valid_attr<HID_T>::value, void>
190+
h5::adelete(const HID_T& parent, const std::string& name);
191+
```
192+
193+
Removes the named attribute from `parent`. The operation is final —
194+
there is no rollback once `H5Adelete` has succeeded.
195+
196+
**Throws** — `h5::error::io::attribute::delete_` on failure.
197+
198+
**Example**
199+
200+
```cpp
201+
h5::ds_t ds = h5::open(fd, "/grid/data");
202+
h5::adelete(ds, "stale_marker");
203+
```
204+
205+
---
206+
207+
@anchor curated_io_api_attributes_bracket
208+
## Bracket-syntax sugar — Python-dict-like API
209+
210+
`h5::ds_t`, `h5::gr_t`, and `h5::ob_t` expose
211+
`operator[](const char*)` returning a transient `h5::at_t` carrying
212+
the parent handle and attribute name. Combined with
213+
`at_t::operator=(V)` (write) and the templated
214+
`at_t::operator V() const` (read), this gives a compact dict-like API:
215+
216+
```cpp
217+
// Write
218+
gr["title"] = std::string{"hello"};
219+
gr["count"] = 42;
220+
gr["values"] = std::vector<double>{1.0, 2.0, 3.0};
221+
222+
// Read — implicit conversion picks T from the LHS
223+
std::string title = gr["title"];
224+
int count = gr["count"];
225+
```
226+
227+
**Caveats**
228+
229+
- `auto v = gr["x"]` deduces `at_t`, **not** the attribute value. The
230+
implicit conversion needs a concrete LHS type to fire.
231+
- The transient `at_t` carries only `ds` + `name`; if the parent
232+
handle is closed before the conversion runs, the read throws
233+
`h5::error::io::attribute::read`.
234+
235+
@see @ref handle_ref_indexer
236+
237+
---
238+
239+
## Cross-references
240+
241+
- @ref link_base_template_types "Supported Types" — element-type dispatch matrix
242+
- @ref link_handle_reference "Handles, Descriptors & Property Lists" — `h5::at_t`, parent handles, ACPL
243+
- @ref link_error_handler "Error Handling" — `h5::error::io::attribute::*` hierarchy
244+
- @ref curated_io_api_file "FILE" — `fd_t` is one of the valid parents (with cast)
245+
- @ref curated_io_api_dataset "DATASET" — `ds_t` is the most common attribute parent
246+
- @ref curated_io_api_groups "GROUPS" — `gr_t` is the other common attribute parent

0 commit comments

Comments
 (0)