declare static method
Creates an advanced publisher on the given session and key expression.
This is called internally by Session.declareAdvancedPublisher.
Implementation
static AdvancedPublisher declare(
Pointer<Void> loanedSession,
Pointer<Void> loanedKe,
String keyExpr, {
bool enableCache = false,
int cacheMaxSamples = 0,
bool publisherDetection = false,
bool sampleMissDetection = false,
HeartbeatMode heartbeatMode = HeartbeatMode.none,
int heartbeatPeriodMs = 0,
}) {
final size = bindings.zd_advanced_publisher_sizeof();
final Pointer<Void> ptr = calloc.allocate(size);
final rc = bindings.zd_declare_advanced_publisher(
loanedSession.cast(),
ptr.cast(),
loanedKe.cast(),
enableCache,
cacheMaxSamples,
publisherDetection,
sampleMissDetection,
heartbeatMode.value,
heartbeatPeriodMs,
);
if (rc != 0) {
calloc.free(ptr);
throw ZenohException('Failed to declare advanced publisher', rc);
}
return AdvancedPublisher._(ptr, keyExpr);
}