IOSS 2.0
Loading...
Searching...
No Matches
Ioss_NamedSuffixVariableType.h
Go to the documentation of this file.
1/*
2 * Copyright(C) 1999-2020, 2022, 2024 National Technology & Engineering Solutions
3 * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
4 * NTESS, the U.S. Government retains certain rights in this software.
5 *
6 * See packages/seacas/LICENSE for details
7 */
8#pragma once
9
10#include "ioss_export.h"
11
12#include "Ioss_CodeTypes.h"
13#include <string>
14
15#include "Ioss_VariableType.h"
16
17namespace Ioss {
18 class IOSS_EXPORT NamedSuffixVariableType : public VariableType
19 {
20 public:
21 // 'which' is 1-based
22 IOSS_NODISCARD std::string label(int which, const char /* suffix_sep */) const override
23 {
24 return suffixList[which - 1];
25 }
26
27 NamedSuffixVariableType(const std::string &my_name, int number_components, bool delete_me)
28 : Ioss::VariableType(my_name, number_components, delete_me)
29 {
30 suffixList.resize(number_components);
31 suffixList.assign(number_components, "UNSET");
32 }
34
35 //! Define the suffix list for this field.
36 // 'which' is 1-based to conform to the 'label' function usage.
37 // If user doesn't add suffices, then 'label' will return "UNSET"
38 void add_suffix(size_t which, const std::string &suffix) { suffixList[which - 1] = suffix; }
39
40 private:
41 std::vector<std::string> suffixList{};
42 };
43} // namespace Ioss
#define IOSS_NODISCARD
Definition Ioss_CodeTypes.h:54
Definition Ioss_NamedSuffixVariableType.h:19
void add_suffix(size_t which, const std::string &suffix)
Define the suffix list for this field.
Definition Ioss_NamedSuffixVariableType.h:38
NamedSuffixVariableType(const NamedSuffixVariableType &)=delete
NamedSuffixVariableType(const std::string &my_name, int number_components, bool delete_me)
Definition Ioss_NamedSuffixVariableType.h:27
IOSS_NODISCARD std::string label(int which, const char) const override
Definition Ioss_NamedSuffixVariableType.h:22
A generic variable type.
Definition Ioss_VariableType.h:66
The main namespace for the Ioss library.
Definition Ioad_DatabaseIO.C:40