IOSS 2.0
Loading...
Searching...
No Matches
Ios3_PropertySerialization.h
Go to the documentation of this file.
1// Copyright(C) 2025 National Technology & Engineering Solutions
2// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
3// NTESS, the U.S. Government retains certain rights in this software.
4//
5// See packages/seacas/LICENSE for details
6
7#pragma once
8
9#include "ios3_export.h"
10
11#include "Ios3_Utils.h"
12#include "Ioss_Field.h"
13#include "Ioss_GroupingEntity.h"
14#include "Ioss_Property.h"
15
16#include <string>
17#include <vector>
18
19namespace Ios3 {
20
21 IOS3_EXPORT size_t data_size(const Ioss::Property &p);
22
23 // Caller should write their own version of this PropertyFunction
24 // should return a function or a lamba that matches the signature
25 // below. The function it returns may or may not capture variables
26 // that are given to the user-defined function. Some examples are
27 // given in this file and are also useful
28 //
29 using PropertyFunction = std::function<int(const Ioss::Region &, const Ioss::GroupingEntity &,
30 const Ioss::Property &)>;
31
32 using PackedBytes = std::vector<unsigned char>;
33
34 // Applies PropertyFunction 'op' to all properties encountered in
35 // the Ioss::Region and it's various Ioss::GroupingEntities
36 //
37 IOS3_EXPORT int map_properties(const Ioss::Region &region, PropertyFunction op);
38
39 // Applies PropertyFunction 'op' to all properties encountered in
40 // the Ioss::GroupingEntity
41 //
42 IOS3_EXPORT int map_properties(const Ioss::Region &region,
43 const Ioss::GroupingEntity &grouping_entity, PropertyFunction op);
44
45 IOS3_EXPORT PackedBytes pack_property(const Ioss::Region &region,
46 const Ioss::GroupingEntity &entity,
47 const Ioss::Property &property);
48
49 struct IOS3_EXPORT property_entry_t
50 {
52 bool is_implicit{false};
53 bool is_valid{false};
54 value_entry_t name; // offset from data[0]
55 value_entry_t value; // offset from data[0]
56
57 size_t data_size{0}; // Total size of data stored in data[0] ptr
58
59 char data[0];
60
61 explicit property_entry_t(const Ioss::Property &property, const size_t start = 0);
62 };
63
64 IOS3_EXPORT int64_t property_get_int(PackedBytes &p);
65 IOS3_EXPORT std::string property_get_string(PackedBytes &p);
66
67} // namespace Ios3
Base class for all 'grouping' entities. The following derived classes are typical:
Definition Ioss_GroupingEntity.h:67
A named value that has a known type.
Definition Ioss_Property.h:27
BasicType
Definition Ioss_Property.h:29
A grouping entity that contains other grouping entities.
Definition Ioss_Region.h:93
Definition Ios3_AwsHelpers.C:58
int map_properties(const Ioss::Region &region, const Ioss::GroupingEntity &entity, PropertyFunction op)
Definition Ios3_PropertySerialization.C:52
size_t data_size(const Ioss::Field &f)
Definition Ios3_FieldSerialization.C:12
std::string property_get_string(PackedBytes &p)
Definition Ios3_PropertySerialization.C:164
std::function< int(const Ioss::Region &, const Ioss::GroupingEntity &, const Ioss::Property &)> PropertyFunction
Definition Ios3_PropertySerialization.h:29
int64_t property_get_int(PackedBytes &p)
Definition Ios3_PropertySerialization.C:157
std::vector< unsigned char > PackedBytes
Definition Ios3_FieldSerialization.h:51
PackedBytes pack_property(const Ioss::Region &, const Ioss::GroupingEntity &, const Ioss::Property &property)
Definition Ios3_PropertySerialization.C:118
property_entry_t(const Ioss::Property &property, const size_t start=0)
Definition Ios3_PropertySerialization.C:111
size_t data_size
Definition Ios3_PropertySerialization.h:57
Ioss::Property::BasicType basic_type
Definition Ios3_PropertySerialization.h:51
value_entry_t name
Definition Ios3_PropertySerialization.h:54
value_entry_t value
Definition Ios3_PropertySerialization.h:55
bool is_implicit
Definition Ios3_PropertySerialization.h:52
char data[0]
Definition Ios3_PropertySerialization.h:59
bool is_valid
Definition Ios3_PropertySerialization.h:53
Definition Ios3_Utils.h:24