generateHeaderStart() . << #include #include namespace dpp { EOT; } /** * @inheritDoc */ public function checkForChanges(): bool { /* Check if we need to re-generate by comparing modification times */ $us = file_exists('include/dpp/cluster_sync_calls.h') ? filemtime('include/dpp/cluster_sync_calls.h') : 0; $them = filemtime('include/dpp/cluster.h'); if ($them <= $us) { echo "-- No change required.\n"; return false; } echo "-- Autogenerating include/dpp/cluster_sync_calls.h\n"; echo "-- Autogenerating src/dpp/cluster_sync_calls.cpp\n"; return true; } /** * @inheritDoc */ public function generateHeaderDef(string $returnType, string $currentFunction, string $parameters, string $noDefaults, string $parameterNames): string { return "$returnType {$currentFunction}_sync($parameters);\n\n"; } /** * @inheritDoc */ public function generateCppDef(string $returnType, string $currentFunction, string $parameters, string $noDefaults, string $parameterNames): string { return "$returnType cluster::{$currentFunction}_sync($noDefaults) {\n\treturn dpp::sync<$returnType>(this, &cluster::$currentFunction$parameterNames);\n}\n\n"; } /** * @inheritDoc */ public function getCommentArray(): array { return [ " * \memberof dpp::cluster", " * @throw dpp::rest_exception upon failure to execute REST function", " * @warning This function is a blocking (synchronous) call and should only be used from within a separate thread.", " * Avoid direct use of this function inside an event handler.", ]; } /** * @inheritDoc */ public function saveHeader(string $content): void { file_put_contents('include/dpp/cluster_sync_calls.h', $content); } /** * @inheritDoc */ public function saveCpp(string $cppcontent): void { file_put_contents('src/dpp/cluster_sync_calls.cpp', $cppcontent); } }