3from .Attribute
import Attribute
9 cardinality is a string (you can thus use symbols as well as long as
10 they will be defined at compile time). Pass None if you are working
18 valid_mantissa_bits=None,
20 qualifier=Attribute.Qualifier.NONE,
25 @Pawel Can you add some docu?
31 expose = qualifier == Attribute.Qualifier.CONSTEXPR
39 expose_in_header_file=expose,
45 def get_methods(self, _full_qualified_class_name, for_declaration=True):
52 getter = (
"get" + accessor_name +
"()",
"static double")
55 getter = (
"get" + accessor_name +
"()",
"double")
60 getter = (
"get" + accessor_name +
"()",
"static double")
64 getter = (
"get" + accessor_name +
"()",
"double")
67 getter = (
"get" + accessor_name +
"() const",
"const double")
70 getter = (
"get" + accessor_name +
"() const",
"constexpr double")
74 getter = (
"get" + accessor_name +
"() const",
"double")
76 methods.append(getter)
80 methods.append((
"set" + accessor_name +
"(double value)",
"void"))
86 namestring =
"_" + self.
_name
90 typestring =
"inline static double"
92 namestring +=
" = " + str(self.
_initval)
95 typestring =
"inline const static double"
96 namestring +=
" = " + str(self.
_initval)
99 typestring =
"const double"
100 namestring +=
" = " + str(self.
_initval)
103 typestring =
"constexpr static double"
104 namestring +=
" = " + str(self.
_initval)
111 if self.
_initval is not None and not for_constructor:
112 namestring +=
" = " + str(self.
_initval)
116 return [(namestring, typestring,
"")]
121 return [(namestring, typestring, mantissastring)]
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_DOUBLE", 1)]
142 Return string representation of attribute.
146 return "_dataStore._" + self.
_name
148 return "_" + self.
_name
154 @valid_mantissa_bits.setter
160 Pass in None, if you want to use the default accuracy.
163 assert value ==
None or value > 0
Represents one attribute.
get_accessor_name(self)
Generate the accessor name used throughout dastgen2 to create variables, function names,...
cardinality is a string (you can thus use symbols as well as long as they will be defined at compile ...
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.
valid_mantissa_bits(self)
get_plain_C_attributes(self, for_constructor=False)
Return list of n-tuples.
get_native_MPI_type(self)
Return native (built-in) MPI datatype.
__init__(self, name, valid_mantissa_bits=None, ifdefs=[], qualifier=Attribute.Qualifier.NONE, initval=None)
@Pawel Can you add some docu?
get_methods(self, _full_qualified_class_name, for_declaration=True)
Return sequence of methods that are defined for this attribute.