Skip to content

Commit 1cb7fdc

Browse files
committed
Cosim algo destroy
1 parent d32ebc4 commit 1cb7fdc

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

include/cosim.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,14 @@ int cosim_ecco_add_power_bond(
203203
*/
204204
cosim_algorithm* cosim_fixed_step_algorithm_create(cosim_duration stepSize);
205205

206+
/**
207+
* Destroys a co-simulation algorithm .
208+
*
209+
* \returns
210+
* 0 on success and -1 on error.
211+
*/
212+
int cosim_algorithm_destroy(cosim_algorithm* algorithm);
213+
206214
/**
207215
* Creates a new execution.
208216
*

src/cosim.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,19 @@ cosim_algorithm* cosim_fixed_step_algorithm_create(cosim_duration stepSize)
207207
}
208208
}
209209

210+
int cosim_algorithm_destroy(cosim_algorithm* algorithm)
211+
{
212+
try {
213+
if (!algorithm) return success;
214+
const auto owned = std::unique_ptr<cosim_algorithm>(algorithm);
215+
return success;
216+
} catch (...) {
217+
handle_current_exception();
218+
return failure;
219+
}
220+
}
221+
222+
210223
struct cosim_execution_s
211224
{
212225
std::unique_ptr<cosim::execution> cpp_execution;

0 commit comments

Comments
 (0)