(self)
| 483 | "self.cfunction is None: self.update() needs to be called.") |
| 484 | |
| 485 | def create_cfunction(self) -> None: |
| 486 | self.cfunction = CFunction(self.name) |
| 487 | # Add the return as a parameter |
| 488 | if self.returns: |
| 489 | self.returns.add_to_cfunction(self.cfunction) |
| 490 | # Add the input parameters |
| 491 | for param in self.params: |
| 492 | param.add_to_cfunction(self.cfunction) |
| 493 | f: Optional[str] = self.get_invoke() |
| 494 | # Write the assignments |
| 495 | assigns = [] |
| 496 | if self.returns: |
| 497 | result = f |
| 498 | if self.write_to_tmp_var() and f: |
| 499 | f = 'auto&& api_result = ' + f |
| 500 | result = 'api_result' |
| 501 | else: |
| 502 | f = None |
| 503 | assigns = self.returns.outputs(result) |
| 504 | if f: |
| 505 | self.cfunction.add_statement(f) |
| 506 | for assign in assigns: |
| 507 | self.cfunction.add_statement(assign) |
| 508 | |
| 509 | |
| 510 | cpp_class_template = Template(''' |
no test coverage detected