3from .Attribute
import Attribute
13 qualifier=Attribute.Qualifier.NONE,
18 min_value: None or integer value
19 Has to be smaller than max_value. Can also be a string if this string
20 is given by the precompiler.
26 expose = qualifier == Attribute.Qualifier.CONSTEXPR
34 expose_in_header_file=expose,
41 def get_methods(self, _full_qualified_class_name, for_declaration=True):
48 getter = (
"get" + accessor_name +
"()",
"static int")
51 getter = (
"get" + accessor_name +
"()",
"int")
56 getter = (
"get" + accessor_name +
"()",
"static int")
60 getter = (
"get" + accessor_name +
"()",
"int")
63 getter = (
"get" + accessor_name +
"() const",
"const int")
66 getter = (
"get" + accessor_name +
"() const",
"constexpr int")
70 getter = (
"get" + accessor_name +
"() const",
"int")
72 methods.append(getter)
76 methods.append((
"set" + accessor_name +
"(int value)",
"void"))
82 namestring =
"_" + self.
_name
86 typestring =
"inline static int"
88 namestring +=
" = " + str(self.
_initval)
91 typestring =
"inline const static int"
92 namestring +=
" = " + str(self.
_initval)
95 typestring =
"const int"
96 namestring +=
" = " + str(self.
_initval)
99 typestring =
"constexpr static int"
100 namestring +=
" = " + str(self.
_initval)
107 if self.
_initval is not None and not for_constructor:
108 namestring +=
" = " + str(self.
_initval)
112 return [(namestring, typestring,
"")]
115 "[[clang::pack_range("
121 return [(namestring, typestring, packstring)]
125 return " return _dataStore._" + self.
_name +
";\n"
127 return " return _" + self.
_name +
";\n"
129 return " _dataStore._" + self.
_name +
" = value;\n"
131 return " _" + self.
_name +
" = value;\n"
137 return [(
"MPI_INT", 1)]
142 Return string representation of attribute.
146 return "_dataStore._" + self.
_name
148 return "_" + self.
_name
Represents one attribute.
get_accessor_name(self)
Generate the accessor name used throughout dastgen2 to create variables, function names,...
get_native_MPI_type(self)
Return native (built-in) MPI datatype.
__init__(self, name, min_value=None, max_value=None, ifdefs=[], qualifier=Attribute.Qualifier.NONE, initval=None)
min_value: None or integer value Has to be smaller than max_value.
get_method_body(self, signature)
I hand in the method signature (see get_methods()) and wanna get the whole implementation.
get_to_string(self)
Return string representation of attribute.
get_methods(self, _full_qualified_class_name, for_declaration=True)
Return sequence of methods that are defined for this attribute.
get_plain_C_attributes(self, for_constructor=False)
Return list of n-tuples.