make internal header files more C++ friendly
Generally one doesn't need to include any internal header files in an application, but the (unstable) interface for application-defined sample representation and serialization does require including some. It turns out a keyword clash had to be resolved (typename => type_name) and that a whole bunch of them were missing the #ifdef __cplusplus / extern "C" bit. It further turned out that one had to pull in nearly all of the type definitions, including some typedefs that are illegal in C++, e.g., typedef struct os_sockWaitset *os_sockWaitset; C++ is right to forbid this, but Cyclone's header files were wrong to force inclusion of so much irrelevant stuff. This commit leaves these typedefs in place, but eliminates a few header file inclusions to avoid the problem. Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
		
							parent
							
								
									d2ebbbc880
								
							
						
					
					
						commit
						b686ba858c
					
				
					 56 changed files with 345 additions and 60 deletions
				
			
		| 
						 | 
				
			
			@ -14,10 +14,18 @@
 | 
			
		|||
 | 
			
		||||
#include "dds__entity.h"
 | 
			
		||||
 | 
			
		||||
#if defined (__cplusplus)
 | 
			
		||||
extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
dds_guardcond*
 | 
			
		||||
dds_create_guardcond(
 | 
			
		||||
        dds_participant *pp);
 | 
			
		||||
 | 
			
		||||
DEFINE_ENTITY_LOCK_UNLOCK(inline, dds_guardcond, DDS_KIND_COND_GUARD)
 | 
			
		||||
 | 
			
		||||
#if defined (__cplusplus)
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,6 +14,10 @@
 | 
			
		|||
 | 
			
		||||
#include "dds__entity.h"
 | 
			
		||||
 | 
			
		||||
#if defined (__cplusplus)
 | 
			
		||||
extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
dds_readcond *
 | 
			
		||||
dds_create_readcond(
 | 
			
		||||
  dds_reader *rd,
 | 
			
		||||
| 
						 | 
				
			
			@ -21,4 +25,8 @@ dds_create_readcond(
 | 
			
		|||
  uint32_t mask,
 | 
			
		||||
  dds_querycondition_filter_fn filter);
 | 
			
		||||
 | 
			
		||||
#if defined (__cplusplus)
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,6 +16,10 @@
 | 
			
		|||
#include "dds/ddsi/ddsi_serdata.h"
 | 
			
		||||
#include "dds/ddsi/ddsi_sertopic.h"
 | 
			
		||||
 | 
			
		||||
#if defined (__cplusplus)
 | 
			
		||||
extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
struct ddsi_serdata_builtintopic {
 | 
			
		||||
  struct ddsi_serdata c;
 | 
			
		||||
  nn_guid_t key;
 | 
			
		||||
| 
						 | 
				
			
			@ -39,4 +43,8 @@ extern const struct ddsi_serdata_ops ddsi_serdata_ops_builtintopic;
 | 
			
		|||
 | 
			
		||||
struct ddsi_sertopic *new_sertopic_builtintopic (enum ddsi_sertopic_builtintopic_type type, const char *name, const char *typename);
 | 
			
		||||
 | 
			
		||||
#if defined (__cplusplus)
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -30,6 +30,7 @@
 | 
			
		|||
#include "dds/ddsi/q_entity.h"
 | 
			
		||||
#include "dds/ddsi/q_config.h"
 | 
			
		||||
#include "dds/ddsi/q_gc.h"
 | 
			
		||||
#include "dds/ddsi/q_globals.h"
 | 
			
		||||
#include "dds/version.h"
 | 
			
		||||
 | 
			
		||||
#define DOMAIN_ID_MIN 0
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,7 +22,7 @@
 | 
			
		|||
#include "dds/ddsi/ddsi_serdata.h"
 | 
			
		||||
#include "dds/ddsi/q_entity.h"
 | 
			
		||||
#include "dds/ddsi/q_thread.h"
 | 
			
		||||
 | 
			
		||||
#include "dds/ddsi/q_globals.h"
 | 
			
		||||
 | 
			
		||||
dds_return_t
 | 
			
		||||
dds_writedispose(
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,6 +19,7 @@
 | 
			
		|||
#include "dds/ddsi/q_thread.h"
 | 
			
		||||
#include "dds/ddsi/q_ephash.h"
 | 
			
		||||
#include "dds/ddsi/q_entity.h"
 | 
			
		||||
#include "dds/ddsi/q_globals.h"
 | 
			
		||||
#include "dds/ddsi/ddsi_sertopic.h"
 | 
			
		||||
 | 
			
		||||
static dds_retcode_t dds_read_lock (dds_entity_t hdl, dds_reader **reader, dds_readcond **condition, bool only_reader)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,6 +23,7 @@
 | 
			
		|||
#include "dds__topic.h"
 | 
			
		||||
#include "dds/ddsi/q_entity.h"
 | 
			
		||||
#include "dds/ddsi/q_thread.h"
 | 
			
		||||
#include "dds/ddsi/q_globals.h"
 | 
			
		||||
#include "dds__builtin.h"
 | 
			
		||||
#include "dds/ddsi/ddsi_sertopic.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -91,7 +91,7 @@ static void set_topic_type_from_sertopic (struct ddsi_serdata_builtintopic *d, c
 | 
			
		|||
  }
 | 
			
		||||
  if (!(d->xqos.present & QP_TYPE_NAME))
 | 
			
		||||
  {
 | 
			
		||||
    d->xqos.type_name = dds_string_dup (tp->typename);
 | 
			
		||||
    d->xqos.type_name = dds_string_dup (tp->type_name);
 | 
			
		||||
    d->xqos.present |= QP_TYPE_NAME;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,6 +21,7 @@
 | 
			
		|||
#include "dds/ddsi/q_config.h"
 | 
			
		||||
#include "dds/ddsi/q_freelist.h"
 | 
			
		||||
#include "dds/ddsi/ddsi_sertopic.h"
 | 
			
		||||
#include "dds/ddsi/ddsi_iid.h"
 | 
			
		||||
#include "dds__serdata_builtintopic.h"
 | 
			
		||||
 | 
			
		||||
/* FIXME: sertopic /= ddstopic so a lot of stuff needs to be moved here from dds_topic.c and the free function needs to be implemented properly */
 | 
			
		||||
| 
						 | 
				
			
			@ -30,10 +31,10 @@ struct ddsi_sertopic *new_sertopic_builtintopic (enum ddsi_sertopic_builtintopic
 | 
			
		|||
  struct ddsi_sertopic_builtintopic *tp = ddsrt_malloc (sizeof (*tp));
 | 
			
		||||
  tp->c.iid = ddsi_iid_gen();
 | 
			
		||||
  tp->c.name = dds_string_dup (name);
 | 
			
		||||
  tp->c.typename = dds_string_dup (typename);
 | 
			
		||||
  const size_t name_typename_size = strlen (tp->c.name) + 1 + strlen (tp->c.typename) + 1;
 | 
			
		||||
  tp->c.name_typename = dds_alloc (name_typename_size);
 | 
			
		||||
  snprintf (tp->c.name_typename, name_typename_size, "%s/%s", tp->c.name, tp->c.typename);
 | 
			
		||||
  tp->c.type_name = dds_string_dup (typename);
 | 
			
		||||
  const size_t name_typename_size = strlen (tp->c.name) + 1 + strlen (tp->c.type_name) + 1;
 | 
			
		||||
  tp->c.name_type_name = dds_alloc (name_typename_size);
 | 
			
		||||
  snprintf (tp->c.name_type_name, name_typename_size, "%s/%s", tp->c.name, tp->c.type_name);
 | 
			
		||||
  tp->c.ops = &ddsi_sertopic_ops_builtintopic;
 | 
			
		||||
  tp->c.serdata_ops = &ddsi_serdata_ops_builtintopic;
 | 
			
		||||
  tp->c.serdata_basehash = ddsi_sertopic_compute_serdata_basehash (tp->c.serdata_ops);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -35,7 +35,7 @@ DECL_ENTITY_LOCK_UNLOCK(extern inline, dds_topic)
 | 
			
		|||
const ddsrt_avl_treedef_t dds_topictree_def = DDSRT_AVL_TREEDEF_INITIALIZER_INDKEY
 | 
			
		||||
(
 | 
			
		||||
  offsetof (struct ddsi_sertopic, avlnode),
 | 
			
		||||
  offsetof (struct ddsi_sertopic, name_typename),
 | 
			
		||||
  offsetof (struct ddsi_sertopic, name_type_name),
 | 
			
		||||
  (int (*) (const void *, const void *)) strcmp,
 | 
			
		||||
  0
 | 
			
		||||
);
 | 
			
		||||
| 
						 | 
				
			
			@ -285,7 +285,7 @@ static bool dupdef_qos_ok(const dds_qos_t *qos, const struct ddsi_sertopic *st)
 | 
			
		|||
 | 
			
		||||
static bool sertopic_equivalent (const struct ddsi_sertopic *a, const struct ddsi_sertopic *b)
 | 
			
		||||
{
 | 
			
		||||
  if (strcmp (a->name_typename, b->name_typename) != 0)
 | 
			
		||||
  if (strcmp (a->name_type_name, b->name_type_name) != 0)
 | 
			
		||||
    return false;
 | 
			
		||||
  if (a->serdata_basehash != b->serdata_basehash)
 | 
			
		||||
    return false;
 | 
			
		||||
| 
						 | 
				
			
			@ -447,9 +447,9 @@ dds_create_topic(
 | 
			
		|||
    st->c.iid = ddsi_iid_gen ();
 | 
			
		||||
    st->c.status_cb = dds_topic_status_cb;
 | 
			
		||||
    st->c.status_cb_entity = NULL; /* set by dds_create_topic_arbitrary */
 | 
			
		||||
    st->c.name_typename = key;
 | 
			
		||||
    st->c.name_type_name = key;
 | 
			
		||||
    st->c.name = dds_string_dup (name);
 | 
			
		||||
    st->c.typename = dds_string_dup (typename);
 | 
			
		||||
    st->c.type_name = dds_string_dup (typename);
 | 
			
		||||
    st->c.ops = &ddsi_sertopic_ops_default;
 | 
			
		||||
    st->c.serdata_ops = desc->m_nkeys ? &ddsi_serdata_ops_cdr : &ddsi_serdata_ops_cdr_nokey;
 | 
			
		||||
    st->c.serdata_basehash = ddsi_sertopic_compute_serdata_basehash (st->c.serdata_ops);
 | 
			
		||||
| 
						 | 
				
			
			@ -471,7 +471,7 @@ dds_create_topic(
 | 
			
		|||
 | 
			
		||||
    /* Set Topic meta data (for SEDP publication) */
 | 
			
		||||
    plist.qos.topic_name = dds_string_dup (st->c.name);
 | 
			
		||||
    plist.qos.type_name = dds_string_dup (st->c.typename);
 | 
			
		||||
    plist.qos.type_name = dds_string_dup (st->c.type_name);
 | 
			
		||||
    plist.qos.present |= (QP_TOPIC_NAME | QP_TYPE_NAME);
 | 
			
		||||
    if (desc->m_meta) {
 | 
			
		||||
        plist.type_description = dds_string_dup (desc->m_meta);
 | 
			
		||||
| 
						 | 
				
			
			@ -643,7 +643,7 @@ dds_get_type_name(
 | 
			
		|||
        ret = DDS_ERRNO(rc);
 | 
			
		||||
        goto fail;
 | 
			
		||||
    }
 | 
			
		||||
    (void)snprintf(name, size, "%s", t->m_stopic->typename);
 | 
			
		||||
    (void)snprintf(name, size, "%s", t->m_stopic->type_name);
 | 
			
		||||
    dds_topic_unlock(t);
 | 
			
		||||
    ret = DDS_RETCODE_OK;
 | 
			
		||||
fail:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,6 +27,7 @@
 | 
			
		|||
#include "dds/ddsi/q_time.h"
 | 
			
		||||
#include "dds/ddsi/q_rtps.h"
 | 
			
		||||
#include "dds/ddsi/q_freelist.h"
 | 
			
		||||
#include "dds/ddsi/q_globals.h"
 | 
			
		||||
 | 
			
		||||
#define USE_EHH 0
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,6 +14,7 @@
 | 
			
		|||
#include "dds/dds.h"
 | 
			
		||||
#include "dds/version.h"
 | 
			
		||||
#include "dds/ddsi/q_config.h"
 | 
			
		||||
#include "dds/ddsi/q_globals.h"
 | 
			
		||||
#include "dds/ddsi/q_entity.h"
 | 
			
		||||
#include "dds/ddsi/q_thread.h"
 | 
			
		||||
#include "dds/ddsi/q_xmsg.h"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue