3from .Attribute
import Attribute
11 qualifier=Attribute.Qualifier.NONE,
16 expose = qualifier == Attribute.Qualifier.CONSTEXPR
24 expose_in_header_file=expose,
31 def get_methods(self, _full_qualified_class_name, for_declaration=True):
38 getter = (
"get" + accessor_name +
"()",
"static bool")
41 getter = (
"get" + accessor_name +
"()",
"bool")
46 getter = (
"get" + accessor_name +
"()",
"static bool")
50 getter = (
"get" + accessor_name +
"()",
"bool")
53 getter = (
"get" + accessor_name +
"() const",
"const bool")
56 getter = (
"get" + accessor_name +
"() const",
"constexpr bool")
60 getter = (
"get" + accessor_name +
"() const",
"bool")
62 methods.append(getter)
66 methods.append((
"set" + accessor_name +
"(bool value)",
"void"))
72 namestring =
"_" + self.
_name
76 typestring =
"inline static bool"
78 namestring +=
" = " + str(self.
_initval)
81 typestring =
"inline const static bool"
82 namestring +=
" = " + str(self.
_initval)
85 typestring =
"const bool"
86 namestring +=
" = " + str(self.
_initval)
89 typestring =
"constexpr static bool"
90 namestring +=
" = " + str(self.
_initval)
97 if self.
_initval is not None and not for_constructor:
98 namestring +=
" = " + str(self.
_initval)
107 packstring =
"[[clang::pack]]"
108 return [(namestring, typestring, packstring)]
110 return [(namestring, typestring,
"")]
114 return " return _dataStore._" + self.
_name +
";\n"
116 return " return _" + self.
_name +
";\n"
118 return " _dataStore._" + self.
_name +
" = value;\n"
120 return " _" + self.
_name +
" = value;\n"
128 I originally wanted to map the booleans to MPI_CXX_BOOL. But
129 neither CXX_BOOL nor C_BOOL work for the Intel archtiectures.
130 All the datatypes that I use then seg fault. If I however map
131 the bool to an integer, then it seems to work.
135 return [(
"MPI_BYTE", 1)]
140 Return string representation of attribute.
144 return "_dataStore._" + self.
_name
146 return "_" + self.
_name
Represents one attribute.
get_accessor_name(self)
Generate the accessor name used throughout dastgen2 to create variables, function names,...
get_methods(self, _full_qualified_class_name, for_declaration=True)
Return sequence of methods that are defined for this attribute.
__init__(self, name, ifdefs=[], qualifier=Attribute.Qualifier.NONE, initval=None)
name: String This is a plain string which has to follow the C++ naming conventions,...
get_to_string(self)
Return string representation of attribute.
get_method_body(self, signature)
I hand in the method signature (see get_methods()) and wanna get the whole implementation.
get_native_MPI_type(self)
I originally wanted to map the booleans to MPI_CXX_BOOL.
get_plain_C_attributes(self, for_constructor=False)
Return list of n-tuples.