Skip to content

Commit

Permalink
sample list buffer moved from class member to local function scope
Browse files Browse the repository at this point in the history
  • Loading branch information
rex-schilasky committed Jul 26, 2024
1 parent 0d361d0 commit 025e9ca
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,13 @@ bool eCAL::CRegistrationSenderSHM::SendSampleList(const Registration::SampleList
{
bool return_value{true};
// serialize whole sample list
if (SerializeToBuffer(sample_list, m_sample_list_buffer))
std::vector<char> sample_list_buffer;
if (SerializeToBuffer(sample_list, sample_list_buffer))
{
if (!m_sample_list_buffer.empty())
if (!sample_list_buffer.empty())
{
// broadcast sample list over shm
return_value &= m_memfile_broadcast_writer.Write(m_sample_list_buffer.data(), m_sample_list_buffer.size());
return_value &= m_memfile_broadcast_writer.Write(sample_list_buffer.data(), sample_list_buffer.size());
}
}
return return_value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ namespace eCAL
bool SendSampleList(const Registration::SampleList& sample_list) override;

private:
std::vector<char> m_sample_list_buffer;
CMemoryFileBroadcast m_memfile_broadcast;
CMemoryFileBroadcastWriter m_memfile_broadcast_writer;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,11 @@ namespace eCAL
bool CRegistrationSenderUDP::SendSample(const Registration::Sample& sample_)
{
// serialize single sample
if (SerializeToBuffer(sample_, m_sample_buffer))
std::vector<char> sample_buffer;
if (SerializeToBuffer(sample_, sample_buffer))
{
// send single sample over udp
return m_reg_sample_snd.Send("reg_sample", m_sample_buffer) != 0;
return m_reg_sample_snd.Send("reg_sample", sample_buffer) != 0;
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,5 @@ namespace eCAL
bool SendSample(const Registration::Sample& sample_);

UDP::CSampleSender m_reg_sample_snd;
std::vector<char> m_sample_buffer;
};
}

0 comments on commit 025e9ca

Please sign in to comment.