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,
30 expose = qualifier == Attribute.Qualifier.CONSTEXPR
38 expose_in_header_file=expose,
44 def get_methods(self, _full_qualified_class_name, for_declaration=True):
51 getter = (
"get" + accessor_name +
"()",
"static double")
54 getter = (
"get" + accessor_name +
"()",
"double")
59 getter = (
"get" + accessor_name +
"()",
"static double")
63 getter = (
"get" + accessor_name +
"()",
"double")
66 getter = (
"get" + accessor_name +
"() const",
"const double")
69 getter = (
"get" + accessor_name +
"() const",
"constexpr double")
73 getter = (
"get" + accessor_name +
"() const",
"double")
75 methods.append(getter)
79 methods.append((
"set" + accessor_name +
"(double value)",
"void"))
85 namestring =
"_" + self.
_name
89 typestring =
"inline static double"
91 namestring +=
" = " + str(self.
_initval)
94 typestring =
"inline const static double"
95 namestring +=
" = " + str(self.
_initval)
98 typestring =
"const double"
99 namestring +=
" = " + str(self.
_initval)
102 typestring =
"constexpr static double"
103 namestring +=
" = " + str(self.
_initval)
110 if self.
_initval is not None and not for_constructor:
111 namestring +=
" = " + str(self.
_initval)
115 return [(namestring, typestring,
"")]
120 return [(namestring, typestring, mantissastring)]
124 return " return _dataStore._" + self.
_name +
";\n"
126 return " return _" + self.
_name +
";\n"
128 return " _dataStore._" + self.
_name +
" = value;\n"
130 return " _" + self.
_name +
" = value;\n"
136 return [(
"MPI_DOUBLE", 1)]
141 Return string representation of attribute.
145 return "_dataStore._" + self.
_name
147 return "_" + self.
_name
153 @valid_mantissa_bits.setter
159 Pass in None, if you want to use the default accuracy.
162 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)
name: String This is a plain string which has to follow the C++ naming conventions,...
get_methods(self, _full_qualified_class_name, for_declaration=True)
Return sequence of methods that are defined for this attribute.