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 IOSS_NODISCARD VariableType::Type type() const override { return Type::NAMED_SUFFIX; }
36 IOSS_NODISCARD std::string type_string() const override { return "NamedSuffix"; }
37
38 //! Define the suffix list for this field.
39 // 'which' is 1-based to conform to the 'label' function usage.
40 // If user doesn't add suffices, then 'label' will return "UNSET"
41 void add_suffix(size_t which, const std::string &suffix) { suffixList[which - 1] = suffix; }
42
43 void print() const override final;
44
45 private:
46 Ioss::NameList suffixList{};
47 };
48} // namespace Ioss
#define IOSS_NODISCARD
Definition Ioss_CodeTypes.h:55
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:41
NamedSuffixVariableType(const NamedSuffixVariableType &)=delete
IOSS_NODISCARD VariableType::Type type() const override
Definition Ioss_NamedSuffixVariableType.h:35
NamedSuffixVariableType(const std::string &my_name, int number_components, bool delete_me)
Definition Ioss_NamedSuffixVariableType.h:27
IOSS_NODISCARD std::string type_string() const override
Definition Ioss_NamedSuffixVariableType.h:36
IOSS_NODISCARD std::string label(int which, const char) const override
Definition Ioss_NamedSuffixVariableType.h:22
A generic variable type.
Definition Ioss_VariableType.h:70
Type
Definition Ioss_VariableType.h:72
The main namespace for the Ioss library.
Definition Ioad_DatabaseIO.C:40
Ioss::NameList NameList
Definition Ioss_ChangeSetFactory.h:25