IOSS  2.0
Ioss_NamedSuffixVariableType.h
Go to the documentation of this file.
1 /*
2  * Copyright(C) 1999-2020 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 #ifndef IOSS_Ioss_NamedSuffixVariableType_h
9 #define IOSS_Ioss_NamedSuffixVariableType_h
10 
11 #include <Ioss_CodeTypes.h>
12 #include <string>
13 
14 #include <Ioss_VariableType.h>
15 
16 namespace Ioss {
18  {
19  public:
20  // 'which' is 1-based
21  std::string label(int which, const char /* suffix_sep */) const override
22  {
23  return suffixList[which - 1];
24  }
25 
26  NamedSuffixVariableType(const std::string &my_name, int number_components, bool delete_me)
27  : Ioss::VariableType(my_name, number_components, delete_me)
28  {
29  suffixList.resize(number_components);
30  suffixList.assign(number_components, "UNSET");
31  }
33 
34  //! Define the suffix list for this field.
35  // 'which' is 1-based to conform to the 'label' function usage.
36  // If user doesn't add suffices, then 'label' will return "UNSET"
37  void add_suffix(size_t which, const std::string &suffix) { suffixList[which - 1] = suffix; }
38 
39  private:
40  std::vector<std::string> suffixList{};
41  };
42 } // namespace Ioss
43 
44 #endif
Ioss::NamedSuffixVariableType::suffixList
std::vector< std::string > suffixList
Definition: Ioss_NamedSuffixVariableType.h:40
Ioss::VariableType
A generic variable type.
Definition: Ioss_VariableType.h:61
Ioss::NamedSuffixVariableType::label
std::string label(int which, const char) const override
Definition: Ioss_NamedSuffixVariableType.h:21
Ioss::NamedSuffixVariableType::NamedSuffixVariableType
NamedSuffixVariableType(const NamedSuffixVariableType &)=delete
Ioss::NamedSuffixVariableType::NamedSuffixVariableType
NamedSuffixVariableType(const std::string &my_name, int number_components, bool delete_me)
Definition: Ioss_NamedSuffixVariableType.h:26
Ioss
The main namespace for the Ioss library.
Definition: Ioad_DatabaseIO.C:40
Ioss::NamedSuffixVariableType::add_suffix
void add_suffix(size_t which, const std::string &suffix)
Define the suffix list for this field.
Definition: Ioss_NamedSuffixVariableType.h:37
Ioss::NamedSuffixVariableType
Definition: Ioss_NamedSuffixVariableType.h:18
Ioss_CodeTypes.h
Ioss_VariableType.h