Coverage Report

Created: 2025-07-11 06:33

/src/bag/api/bag_attributeinfo.cpp
Line
Count
Source (jump to first uncovered line)
1
2
#include "bag_attributeinfo.h"
3
#include "bag_exceptions.h"
4
#include "bag_private.h"
5
6
#include <H5Cpp.h>
7
8
9
namespace BAG {
10
11
//! Retrieve the attribute information about the specified layer type.
12
/*!
13
    This function retrieves the attribute information about the specified Simple
14
    Layer.  If the specified layer is not supported, an UnknownSimpleLayerType
15
    exception is thrown.
16
17
\param layerType
18
    The type of simple layer.
19
    Supported types: Elevation, Uncertainty, Hypothesis_Strength, Num_Hypotheses,
20
        Shoal_Elevation, Std_Dev, Num_Soundings, Average_Elevation, and
21
        Nominal_Elevation.
22
23
\return
24
    The attribute information about the specified simple layer.
25
*/
26
AttributeInfo getAttributeInfo(LayerType layerType)
27
34
{
28
34
    switch (layerType)
29
34
    {
30
21
    case Elevation:
31
21
        return AttributeInfo(MIN_ELEVATION_NAME, MAX_ELEVATION_NAME,
32
21
            ELEVATION_PATH, ::H5::PredType::NATIVE_FLOAT);
33
12
    case Uncertainty:
34
12
        return AttributeInfo(MIN_UNCERTAINTY_NAME, MAX_UNCERTAINTY_NAME,
35
12
            UNCERTAINTY_PATH, ::H5::PredType::NATIVE_FLOAT);
36
0
    case Hypothesis_Strength:
37
0
        return AttributeInfo(MIN_HYPOTHESIS_STRENGTH, MAX_HYPOTHESIS_STRENGTH,
38
0
            HYPOTHESIS_STRENGTH_PATH, ::H5::PredType::NATIVE_FLOAT);
39
0
    case Num_Hypotheses:
40
0
        return AttributeInfo(MIN_NUM_HYPOTHESES, MAX_NUM_HYPOTHESES,
41
0
            NUM_HYPOTHESES_PATH, ::H5::PredType::NATIVE_UINT32);
42
0
    case Shoal_Elevation:
43
0
        return AttributeInfo(MIN_SHOAL_ELEVATION, MAX_SHOAL_ELEVATION,
44
0
            SHOAL_ELEVATION_PATH, ::H5::PredType::NATIVE_FLOAT);
45
0
    case Std_Dev:
46
0
        return AttributeInfo(MIN_STANDARD_DEV_NAME, MAX_STANDARD_DEV_NAME,
47
0
            STANDARD_DEV_PATH, ::H5::PredType::NATIVE_FLOAT);
48
0
    case Num_Soundings:
49
0
        return AttributeInfo(MIN_NUM_SOUNDINGS, MAX_NUM_SOUNDINGS,
50
0
            NUM_SOUNDINGS_PATH, ::H5::PredType::NATIVE_UINT32);
51
0
    case Average_Elevation:
52
0
        return AttributeInfo(MIN_AVERAGE, MAX_AVERAGE, AVERAGE_PATH,
53
0
            ::H5::PredType::NATIVE_FLOAT);
54
1
    case Nominal_Elevation:
55
1
        return AttributeInfo(MIN_NOMINAL_ELEVATION, MAX_NOMINAL_ELEVATION,
56
1
            NOMINAL_ELEVATION_PATH, ::H5::PredType::NATIVE_FLOAT);
57
0
    default:
58
0
        throw UnsupportedSimpleLayerType{};
59
34
    }
60
34
}
61
62
}  // namespace BAG
63
64