Skip to content

Commit

Permalink
Merge pull request #4606 from jrw972/value-dispatcher-pointers
Browse files Browse the repository at this point in the history
ValueDispatcher assumes pointer is KeyOnly
  • Loading branch information
jrw972 committed Apr 29, 2024
2 parents 33e4af6 + 3aa1b06 commit 3afd105
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions dds/DCPS/ValueDispatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace DCPS {
struct OpenDDS_Dcps_Export ValueDispatcher {
virtual ~ValueDispatcher() {}

// The void* is assumed to point to a value of type T (see template below).
virtual void* new_value() const = 0;
virtual void delete_value(void* data) const = 0;

Expand Down Expand Up @@ -55,7 +56,7 @@ struct ValueDispatcher_T : public virtual ValueDispatcher {
case Sample::Full:
return vread(value_reader, *static_cast<T*>(data));
case Sample::KeyOnly:
return vread(value_reader, *static_cast<const KeyOnly<T>*>(data));
return vread(value_reader, KeyOnly<T>(*static_cast<T*>(data)));
default:
if (log_level >= LogLevel::Notice) {
ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: ValueDispatcher_T<%C>::read:"
Expand All @@ -71,7 +72,7 @@ struct ValueDispatcher_T : public virtual ValueDispatcher {
case Sample::Full:
return vwrite(value_writer, *static_cast<const T*>(data));
case Sample::KeyOnly:
return vwrite(value_writer, *static_cast<const KeyOnly<const T>*>(data));
return vwrite(value_writer, KeyOnly<const T>(*static_cast<const T*>(data)));
default:
if (log_level >= LogLevel::Notice) {
ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: ValueDispatcher_T<%C>::write:"
Expand Down

0 comments on commit 3afd105

Please sign in to comment.