reduce dependency on sertopic->status_cb_entity
Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
		
							parent
							
								
									7cb80e7851
								
							
						
					
					
						commit
						3e343d032a
					
				
					 8 changed files with 44 additions and 29 deletions
				
			
		| 
						 | 
				
			
			@ -653,7 +653,7 @@ static bool add_sample
 | 
			
		|||
    rhc->n_vsamples++;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  s->sample = ddsi_serdata_ref ((struct ddsi_serdata *) sample); /* drops const (tho refcount does change) */
 | 
			
		||||
  s->sample = ddsi_serdata_ref (sample); /* drops const (tho refcount does change) */
 | 
			
		||||
  s->wr_iid = pwr_info->iid;
 | 
			
		||||
  s->isread = false;
 | 
			
		||||
  s->disposed_gen = inst->disposed_gen;
 | 
			
		||||
| 
						 | 
				
			
			@ -663,19 +663,17 @@ static bool add_sample
 | 
			
		|||
  return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static bool content_filter_accepts (const struct ddsi_sertopic * sertopic, const struct ddsi_serdata *sample)
 | 
			
		||||
static bool content_filter_accepts (const struct ddsi_sertopic *sertopic, const struct ddsi_serdata *sample)
 | 
			
		||||
{
 | 
			
		||||
  bool ret = true;
 | 
			
		||||
  const struct dds_topic *tp = sertopic->status_cb_entity;
 | 
			
		||||
  if (tp->filter_fn)
 | 
			
		||||
  {
 | 
			
		||||
    const dds_topic_descriptor_t * desc = tp->m_descriptor;
 | 
			
		||||
    char *tmp = os_malloc (desc->m_size);
 | 
			
		||||
    memset (tmp, 0, desc->m_size);
 | 
			
		||||
    char *tmp = dds_alloc (desc->m_size);
 | 
			
		||||
    ddsi_serdata_to_sample (sample, tmp, NULL, NULL);
 | 
			
		||||
    ret = (tp->filter_fn) (tmp, tp->filter_ctx);
 | 
			
		||||
    dds_sample_free(tmp, desc, DDS_FREE_CONTENTS_BIT);
 | 
			
		||||
    os_free (tmp);
 | 
			
		||||
    ddsi_sertopic_free_sample (tp->m_stopic, tmp, DDS_FREE_ALL);
 | 
			
		||||
  }
 | 
			
		||||
  return ret;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1632,7 +1630,6 @@ static int dds_rhc_read_w_qminv
 | 
			
		|||
{
 | 
			
		||||
  bool trigger_waitsets = false;
 | 
			
		||||
  uint32_t n = 0;
 | 
			
		||||
  const struct dds_topic_descriptor * desc = rhc->topic->status_cb_entity->m_descriptor;
 | 
			
		||||
 | 
			
		||||
  if (lock)
 | 
			
		||||
  {
 | 
			
		||||
| 
						 | 
				
			
			@ -1691,7 +1688,7 @@ static int dds_rhc_read_w_qminv
 | 
			
		|||
                else
 | 
			
		||||
                {
 | 
			
		||||
                  /* The filter didn't match, so free the deserialised copy. */
 | 
			
		||||
                  dds_sample_free(values[n], desc, DDS_FREE_CONTENTS);
 | 
			
		||||
                  ddsi_sertopic_free_sample (rhc->topic, values[n], DDS_FREE_CONTENTS);
 | 
			
		||||
                }
 | 
			
		||||
              }
 | 
			
		||||
              sample = sample->next;
 | 
			
		||||
| 
						 | 
				
			
			@ -1760,7 +1757,6 @@ static int dds_rhc_take_w_qminv
 | 
			
		|||
  bool trigger_waitsets = false;
 | 
			
		||||
  uint64_t iid;
 | 
			
		||||
  uint32_t n = 0;
 | 
			
		||||
  const struct dds_topic_descriptor * desc = rhc->topic->status_cb_entity->m_descriptor;
 | 
			
		||||
 | 
			
		||||
  if (lock)
 | 
			
		||||
  {
 | 
			
		||||
| 
						 | 
				
			
			@ -1839,7 +1835,7 @@ static int dds_rhc_take_w_qminv
 | 
			
		|||
                else
 | 
			
		||||
                {
 | 
			
		||||
                  /* The filter didn't match, so free the deserialised copy. */
 | 
			
		||||
                  dds_sample_free(values[n], desc, DDS_FREE_CONTENTS);
 | 
			
		||||
                  ddsi_sertopic_free_sample (rhc->topic, values[n], DDS_FREE_CONTENTS);
 | 
			
		||||
                }
 | 
			
		||||
              }
 | 
			
		||||
              sample = sample1;
 | 
			
		||||
| 
						 | 
				
			
			@ -2256,7 +2252,7 @@ static bool update_conditions_locked
 | 
			
		|||
 | 
			
		||||
  if (tmp)
 | 
			
		||||
  {
 | 
			
		||||
    dds_sample_free (tmp, desc, DDS_FREE_CONTENTS_BIT);
 | 
			
		||||
    ddsi_sertopic_free_sample (rhc->topic, tmp, DDS_FREE_CONTENTS);
 | 
			
		||||
    os_free (tmp);
 | 
			
		||||
  }
 | 
			
		||||
  return trigger;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -380,7 +380,7 @@ void dds_stream_read_buffer (dds_stream_t * is, uint8_t * buffer, uint32_t len)
 | 
			
		|||
 | 
			
		||||
void dds_stream_read_sample (dds_stream_t * is, void * data, const struct ddsi_sertopic_default * topic)
 | 
			
		||||
{
 | 
			
		||||
  const struct dds_topic_descriptor * desc = (const struct dds_topic_descriptor *) topic->type;
 | 
			
		||||
  const struct dds_topic_descriptor * desc = topic->type;
 | 
			
		||||
  /* Check if can copy directly from stream buffer */
 | 
			
		||||
  if (topic->opt_size && DDS_IS_OK (is, desc->m_size) && (is->m_endian == DDS_ENDIAN))
 | 
			
		||||
  {
 | 
			
		||||
| 
						 | 
				
			
			@ -1171,7 +1171,7 @@ static void dds_stream_read (dds_stream_t * is, char * data, const uint32_t * op
 | 
			
		|||
 | 
			
		||||
void dds_stream_write_sample (dds_stream_t * os, const void * data, const struct ddsi_sertopic_default * topic)
 | 
			
		||||
{
 | 
			
		||||
  const struct dds_topic_descriptor * desc = (const struct dds_topic_descriptor *) topic->type;
 | 
			
		||||
  const struct dds_topic_descriptor * desc = topic->type;
 | 
			
		||||
 | 
			
		||||
  if (topic->opt_size && DDS_CDR_ALIGNED (os, desc->m_align))
 | 
			
		||||
  {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue