Added extra header file needed to work around an issue(see issue #74) when reading samples in c++
And updated dds_read_instance_mask and dds_take_instance_mask to work with DDS_READ_WITHOUT_LOCK Signed-off-by: Thijs Sassen <thijs.sassen@adlinktech.com>
This commit is contained in:
		
							parent
							
								
									231cb8c9f7
								
							
						
					
					
						commit
						60e51479c1
					
				
					 3 changed files with 47 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -51,6 +51,7 @@ PREPEND(hdrs_public_ddsc "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include/dd
 | 
			
		|||
    ddsc/dds_public_qosdefs.h
 | 
			
		||||
    ddsc/dds_public_status.h
 | 
			
		||||
    ddsc/dds_rhc.h
 | 
			
		||||
    ddsc/dds_internal_api.h
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
PREPEND(hdrs_private_ddsc "${CMAKE_CURRENT_LIST_DIR}/src"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										44
									
								
								src/core/ddsc/include/dds/ddsc/dds_internal_api.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								src/core/ddsc/include/dds/ddsc/dds_internal_api.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,44 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright(c) 2006 to 2020 ADLINK Technology Limited and others
 | 
			
		||||
 *
 | 
			
		||||
 * This program and the accompanying materials are made available under the
 | 
			
		||||
 * terms of the Eclipse Public License v. 2.0 which is available at
 | 
			
		||||
 * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
 | 
			
		||||
 * v. 1.0 which is available at
 | 
			
		||||
 * http://www.eclipse.org/org/documents/edl-v10.php.
 | 
			
		||||
 *
 | 
			
		||||
 * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/** @file
 | 
			
		||||
 * WARNING This file is only needed for the work around for https://github.com/eclipse-cyclonedds/cyclonedds/issues/74
 | 
			
		||||
 * Do not include this file in an application! Once issue #74 is solved this header file should be removed.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef DDS_INTERNAL_API_H
 | 
			
		||||
#define DDS_INTERNAL_API_H
 | 
			
		||||
 | 
			
		||||
#if defined (__cplusplus)
 | 
			
		||||
extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define DDS_READ_WITHOUT_LOCK (0xFFFFFFED)
 | 
			
		||||
/*
 | 
			
		||||
 * @private
 | 
			
		||||
 * dds_reader_lock_samples: Returns number of samples in read cache and locks the
 | 
			
		||||
 * reader cache to make sure that the samples content doesn't change.
 | 
			
		||||
 * Because the cache is locked, you should be able to read/take without having to
 | 
			
		||||
 * lock first. This is done by passing the DDS_READ_WITHOUT_LOCK value to the
 | 
			
		||||
 * read/take call as maxs. Then the read/take will not lock but still unlock.
 | 
			
		||||
 *
 | 
			
		||||
 * CycloneDDS doesn't support a read/take that just returns all
 | 
			
		||||
 * available samples issue #74. As a work around to support LENGTH_UNLIMITED in C++.
 | 
			
		||||
 * dds_reader_lock_samples() and DDS_READ_WITHOUT_LOCK are needed.
 | 
			
		||||
 */
 | 
			
		||||
DDS_EXPORT uint32_t
 | 
			
		||||
dds_reader_lock_samples (dds_entity_t entity);
 | 
			
		||||
 | 
			
		||||
#if defined (__cplusplus)
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -283,7 +283,7 @@ dds_return_t dds_read_instance_mask (dds_entity_t rd_or_cnd, void **buf, dds_sam
 | 
			
		|||
  {
 | 
			
		||||
    lock = false;
 | 
			
		||||
    /* FIXME: Fix the interface. */
 | 
			
		||||
    maxs = 100;
 | 
			
		||||
    maxs = (uint32_t)bufsz;
 | 
			
		||||
  }
 | 
			
		||||
  return dds_read_impl (false, rd_or_cnd, buf, bufsz, maxs, si, mask, handle, lock, false);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -422,7 +422,7 @@ dds_return_t dds_take_instance_mask (dds_entity_t rd_or_cnd, void **buf, dds_sam
 | 
			
		|||
  {
 | 
			
		||||
    lock = false;
 | 
			
		||||
    /* FIXME: Fix the interface. */
 | 
			
		||||
    maxs = 100;
 | 
			
		||||
    maxs = (uint32_t)bufsz;
 | 
			
		||||
  }
 | 
			
		||||
  return dds_read_impl(true, rd_or_cnd, buf, bufsz, maxs, si, mask, handle, lock, false);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue