use crate::command::flyweight::Flyweight;
use crate::concurrent::atomic_buffer::AtomicBuffer;
use crate::utils::types::Index;
#[repr(C, packed(4))]
#[derive(Copy, Clone)]
pub(crate) struct CorrelatedMessageDefn {
client_id: i64,
correlation_id: i64,
}
pub const CORRELATED_MESSAGE_LENGTH: Index = std::mem::size_of::<CorrelatedMessageDefn>() as Index;
pub(crate) struct CorrelatedMessageFlyweight {
pub flyweight: Flyweight<CorrelatedMessageDefn>,
}
impl CorrelatedMessageFlyweight {
pub fn new(buffer: AtomicBuffer, offset: Index) -> Self {
Self {
flyweight: Flyweight::new(buffer, offset),
}
}
#[cfg(test)]
pub fn correlation_id(&self) -> i64 {
unsafe { (*self.flyweight.m_struct).correlation_id }
}
#[inline]
pub fn set_client_id(&mut self, value: i64) {
unsafe {
(*self.flyweight.m_struct).client_id = value;
}
}
pub fn set_correlation_id(&mut self, value: i64) {
unsafe {
(*self.flyweight.m_struct).correlation_id = value;
}
}
}