#ifndef IDLPP_DDS_DCPS_IDL
#define IDLPP_DDS_DCPS_IDL

#define DOMAINID_TYPE_NATIVE            string
#define HANDLE_TYPE_NATIVE              long long
#define HANDLE_NIL_NATIVE               0
#define BUILTIN_TOPIC_KEY_TYPE_NATIVE   long

#define TheParticipantFactory
#define PARTICIPANT_QOS_DEFAULT
#define TOPIC_QOS_DEFAULT
#define PUBLISHER_QOS_DEFAULT
#define SUBSCRIBER_QOS_DEFAULT
#define DATAWRITER_QOS_DEFAULT
#define DATAREADER_QOS_DEFAULT
#define DATAWRITER_QOS_USE_TOPIC_QOS
#define DATAREADER_QOS_USE_TOPIC_QOS

module DDS {

    typedef DOMAINID_TYPE_NATIVE DomainId_t;
    typedef HANDLE_TYPE_NATIVE InstanceHandle_t;
    typedef BUILTIN_TOPIC_KEY_TYPE_NATIVE BuiltinTopicKey_t[3];

    typedef sequence<InstanceHandle_t> InstanceHandleSeq;

    typedef long ReturnCode_t;
    typedef long ErrorCode_t;
    typedef long QosPolicyId_t;

    typedef sequence<string> StringSeq;

    struct Duration_t {
        long sec;
        unsigned long nanosec;
    };

    struct Time_t {
	long sec;
	unsigned long nanosec;
    };

    // ----------------------------------------------------------------------
    // Pre-defined values
    // ----------------------------------------------------------------------
    const InstanceHandle_t HANDLE_NIL			= HANDLE_NIL_NATIVE;
    const long LENGTH_UNLIMITED				= -1;
    const long DURATION_INFINITE_SEC			= 0x7fffffff;
    const unsigned long DURATION_INFINITE_NSEC		= 0x7fffffff;
    const long DURATION_ZERO_SEC			= 0;
    const unsigned long DURATION_ZERO_NSEC		= 0;
    const long TIMESTAMP_INVALID_SEC			= -1;
    const unsigned long TIMESTAMP_INVALID_NSEC		= 0xffffffff;

    // ----------------------------------------------------------------------
    // Return codes
    // ----------------------------------------------------------------------
    const ReturnCode_t RETCODE_OK			= 0;
    const ReturnCode_t RETCODE_ERROR			= 1;
    const ReturnCode_t RETCODE_UNSUPPORTED		= 2;
    const ReturnCode_t RETCODE_BAD_PARAMETER		= 3;
    const ReturnCode_t RETCODE_PRECONDITION_NOT_MET	= 4;
    const ReturnCode_t RETCODE_OUT_OF_RESOURCES		= 5;
    const ReturnCode_t RETCODE_NOT_ENABLED		= 6;
    const ReturnCode_t RETCODE_IMMUTABLE_POLICY		= 7;
    const ReturnCode_t RETCODE_INCONSISTENT_POLICY	= 8;
    const ReturnCode_t RETCODE_ALREADY_DELETED		= 9;
    const ReturnCode_t RETCODE_TIMEOUT			= 10;
    const ReturnCode_t RETCODE_NO_DATA			= 11;
    const ReturnCode_t RETCODE_ILLEGAL_OPERATION        = 12;

    // ----------------------------------------------------------------------
    // Error codes
    // ----------------------------------------------------------------------
    const ErrorCode_t ERRORCODE_UNDEFINED  	                = 0;
    const ErrorCode_t ERRORCODE_ERROR			        = 1;
    const ErrorCode_t ERRORCODE_OUT_OF_RESOURCES	        = 2;
    const ErrorCode_t ERRORCODE_CREATION_KERNEL_ENTITY_FAILED	= 3;
    const ErrorCode_t ERRORCODE_INVALID_VALUE           	= 4;
    const ErrorCode_t ERRORCODE_INVALID_DURATION		= 5;
    const ErrorCode_t ERRORCODE_INVALID_TIME    		= 6;
    const ErrorCode_t ERRORCODE_ENTITY_INUSE            	= 7;
    const ErrorCode_t ERRORCODE_CONTAINS_ENTITIES               = 8;
    const ErrorCode_t ERRORCODE_ENTITY_UNKNOWN  		= 9;
    const ErrorCode_t ERRORCODE_HANDLE_NOT_REGISTERED   	= 10;
    const ErrorCode_t ERRORCODE_HANDLE_NOT_MATCH		= 11;
    const ErrorCode_t ERRORCODE_HANDLE_INVALID                  = 12;
    const ErrorCode_t ERRORCODE_INVALID_SEQUENCE                = 13;
    const ErrorCode_t ERRORCODE_UNSUPPORTED_VALUE               = 14;
    const ErrorCode_t ERRORCODE_INCONSISTENT_VALUE              = 15;
    const ErrorCode_t ERRORCODE_IMMUTABLE_QOS_POLICY            = 16;
    const ErrorCode_t ERRORCODE_INCONSISTENT_QOS                = 17;
    const ErrorCode_t ERRORCODE_UNSUPPORTED_QOS_POLICY          = 18;
    const ErrorCode_t ERRORCODE_CONTAINS_CONDITIONS             = 19;
    const ErrorCode_t ERRORCODE_CONTAINS_LOANS                  = 20;
    const ErrorCode_t ERRORCODE_INCONSISTENT_TOPIC              = 21;

    // ----------------------------------------------------------------------
    // Status to support listeners and conditions
    // ----------------------------------------------------------------------

    typedef unsigned long StatusKind;
    typedef unsigned long StatusMask; // bit-mask StatusKind

    const StatusKind INCONSISTENT_TOPIC_STATUS		= 0x0001 << 0;
    const StatusKind OFFERED_DEADLINE_MISSED_STATUS	= 0x0001 << 1;
    const StatusKind REQUESTED_DEADLINE_MISSED_STATUS	= 0x0001 << 2;
    const StatusKind OFFERED_INCOMPATIBLE_QOS_STATUS	= 0x0001 << 5;
    const StatusKind REQUESTED_INCOMPATIBLE_QOS_STATUS	= 0x0001 << 6;
    const StatusKind SAMPLE_LOST_STATUS			= 0x0001 << 7;
    const StatusKind SAMPLE_REJECTED_STATUS		= 0x0001 << 8;
    const StatusKind DATA_ON_READERS_STATUS		= 0x0001 << 9;
    const StatusKind DATA_AVAILABLE_STATUS		= 0x0001 << 10;
    const StatusKind LIVELINESS_LOST_STATUS		= 0x0001 << 11;
    const StatusKind LIVELINESS_CHANGED_STATUS		= 0x0001 << 12;
    const StatusKind PUBLICATION_MATCHED_STATUS		= 0x0001 << 13;
    const StatusKind SUBSCRIPTION_MATCHED_STATUS	= 0x0001 << 14;

    struct InconsistentTopicStatus {
	long total_count;
	long total_count_change;
    };

    struct SampleLostStatus {
	long total_count;
	long total_count_change;
    };

    enum SampleRejectedStatusKind {
	REJECTED_BY_INSTANCE_LIMIT,
	REJECTED_BY_TOPIC_LIMIT
    };

    struct SampleRejectedStatus {
	long total_count;
	long total_count_change;
	SampleRejectedStatusKind last_reason;
	InstanceHandle_t last_instance_handle;
    };

    struct LivelinessLostStatus {
	long total_count;
	long total_count_change;
    };

    struct LivelinessChangedStatus {
	long alive_count;
	long not_alive_count;
	long alive_count_change;
	long not_alive_count_change;
	InstanceHandle_t last_publication_handle;
    };

    struct OfferedDeadlineMissedStatus {
	long total_count;
	long total_count_change;
	InstanceHandle_t last_instance_handle;
    };

    struct RequestedDeadlineMissedStatus {
	long total_count;
	long total_count_change;
	InstanceHandle_t last_instance_handle;
    };

    struct QosPolicyCount {
	QosPolicyId_t policy_id;
	long count;
    };

    typedef sequence<QosPolicyCount> QosPolicyCountSeq;

    struct OfferedIncompatibleQosStatus {
	long total_count;
	long total_count_change;
	QosPolicyId_t last_policy_id;
	QosPolicyCountSeq policies;
    };

    struct RequestedIncompatibleQosStatus {
	long total_count;
	long total_count_change;
	QosPolicyId_t last_policy_id;
	QosPolicyCountSeq policies;
    };

    struct PublicationMatchedStatus {
	long total_count;
	long total_count_change;
	long current_count;
	long current_count_change;
	InstanceHandle_t last_subscription_handle;
    };

    struct SubscriptionMatchedStatus {
	long total_count;
	long total_count_change;
	long current_count;
	long current_count_change;
	InstanceHandle_t last_publication_handle;
    };

    // ----------------------------------------------------------------------
    // Listeners
    // ----------------------------------------------------------------------
    local interface Listener;
    local interface Entity;
    local interface TopicDescription;
    local interface Topic;
    local interface ContentFilteredTopic;
    local interface MultiTopic;
    local interface DataWriter;
    local interface DataReader;
    local interface Subscriber;
    local interface Publisher;

    typedef sequence<Topic> TopicSeq;
    typedef sequence<DataReader> DataReaderSeq;

    local interface Listener {
    };

    local interface TopicListener : Listener {
	void
	on_inconsistent_topic(
	    in Topic the_topic,
	    in InconsistentTopicStatus status);
    };

    local interface ExtTopicListener : TopicListener {
    void
    on_all_data_disposed ();
    };

    local interface DataWriterListener : Listener {
	void
	on_offered_deadline_missed(
	    in DataWriter writer,
	    in OfferedDeadlineMissedStatus status);

	void
	on_offered_incompatible_qos(
	    in DataWriter writer,
	    in OfferedIncompatibleQosStatus status);

	void
	on_liveliness_lost(
	    in DataWriter writer,
	    in LivelinessLostStatus status);

	void
	on_publication_matched(
	    in DataWriter writer,
	    in PublicationMatchedStatus status);
    };

    local interface PublisherListener : DataWriterListener {
    };

    local interface DataReaderListener : Listener {
	void
	on_requested_deadline_missed(
	    in DataReader reader,
	    in RequestedDeadlineMissedStatus status);

	void
	on_requested_incompatible_qos(
	    in DataReader reader,
	    in RequestedIncompatibleQosStatus status);

	void
	on_sample_rejected(
	    in DataReader reader,
	    in SampleRejectedStatus status);

	void
	on_liveliness_changed(
	    in DataReader reader,
	    in LivelinessChangedStatus status);

	void
	on_data_available(
	    in DataReader reader);

	void
	on_subscription_matched(
	    in DataReader reader,
	    in SubscriptionMatchedStatus status);

	void
	on_sample_lost(
	    in DataReader reader,
	    in SampleLostStatus status);
    };

    local interface SubscriberListener : DataReaderListener {
	void
	on_data_on_readers(
	    in Subscriber subs);
    };

    local interface DomainParticipantListener : TopicListener, PublisherListener, SubscriberListener {
    };

    // ----------------------------------------------------------------------
    // Conditions
    // ----------------------------------------------------------------------
    local interface Condition {
	boolean
	get_trigger_value();
    };

    typedef sequence<Condition> ConditionSeq;

    local interface WaitSetInterface {
	ReturnCode_t
	wait(
	    inout ConditionSeq active_conditions,
	    in Duration_t timeout);

	ReturnCode_t
	attach_condition(
	    in Condition cond);

	ReturnCode_t
	detach_condition(
	    in Condition cond);

	ReturnCode_t
	get_conditions(
	    inout ConditionSeq attached_conditions);
    };

    local interface GuardConditionInterface : Condition {
	ReturnCode_t
	set_trigger_value(
	    in boolean value);
    };

    local interface StatusCondition : Condition {
	StatusMask
	get_enabled_statuses();

	ReturnCode_t
	set_enabled_statuses(
	    in StatusMask mask);

	Entity
	get_entity();
    };

    // Sample states to support reads
    typedef unsigned long SampleStateKind;
    typedef sequence <SampleStateKind> SampleStateSeq;

    const SampleStateKind READ_SAMPLE_STATE			= 0x0001 << 0;
    const SampleStateKind NOT_READ_SAMPLE_STATE			= 0x0001 << 1;

    // This is a bit-mask SampleStateKind
    typedef unsigned long SampleStateMask;

    const SampleStateMask ANY_SAMPLE_STATE			= 0xffff;

    // View states to support reads
    typedef unsigned long ViewStateKind;
    typedef sequence<ViewStateKind> ViewStateSeq;

    const ViewStateKind NEW_VIEW_STATE				= 0x0001 << 0;
    const ViewStateKind NOT_NEW_VIEW_STATE			= 0x0001 << 1;

    // This is a bit-mask ViewStateKind
    typedef unsigned long ViewStateMask;

    const ViewStateMask ANY_VIEW_STATE				= 0xffff;

    // Instance states to support reads
    typedef unsigned long InstanceStateKind;
    typedef sequence<InstanceStateKind> InstanceStateSeq;

    const InstanceStateKind ALIVE_INSTANCE_STATE		= 0x0001 << 0;
    const InstanceStateKind NOT_ALIVE_DISPOSED_INSTANCE_STATE	= 0x0001 << 1;
    const InstanceStateKind NOT_ALIVE_NO_WRITERS_INSTANCE_STATE	= 0x0001 << 2;

    // This is a bit-mask InstanceStateKind
    typedef unsigned long InstanceStateMask;

    const InstanceStateMask ANY_INSTANCE_STATE			= 0xffff;
    const InstanceStateMask NOT_ALIVE_INSTANCE_STATE		= 0x006;

    local interface ReadCondition : Condition {
	SampleStateMask
	get_sample_state_mask();

	ViewStateMask
	get_view_state_mask();

	InstanceStateMask
	get_instance_state_mask();

	DataReader
	get_datareader();
    };

    local interface QueryCondition : ReadCondition {
	string
	get_query_expression();

	ReturnCode_t
	get_query_parameters(
	    inout StringSeq query_parameters);

	ReturnCode_t
	set_query_parameters(
	    in StringSeq query_parameters);
    };

    // ----------------------------------------------------------------------
    // Qos
    // ----------------------------------------------------------------------
    const string USERDATA_QOS_POLICY_NAME		= "UserData";
    const string DURABILITY_QOS_POLICY_NAME		= "Durability";
    const string PRESENTATION_QOS_POLICY_NAME		= "Presentation";
    const string DEADLINE_QOS_POLICY_NAME		= "Deadline";
    const string LATENCYBUDGET_QOS_POLICY_NAME		= "LatencyBudget";
    const string OWNERSHIP_QOS_POLICY_NAME		= "Ownership";
    const string OWNERSHIPSTRENGTH_QOS_POLICY_NAME	= "OwnershipStrength";
    const string LIVELINESS_QOS_POLICY_NAME		= "Liveliness";
    const string TIMEBASEDFILTER_QOS_POLICY_NAME	= "TimeBasedFilter";
    const string PARTITION_QOS_POLICY_NAME		= "Partition";
    const string RELIABILITY_QOS_POLICY_NAME		= "Reliability";
    const string DESTINATIONORDER_QOS_POLICY_NAME	= "DestinationOrder";
    const string HISTORY_QOS_POLICY_NAME		= "History";
    const string RESOURCELIMITS_QOS_POLICY_NAME		= "ResourceLimits";
    const string ENTITYFACTORY_QOS_POLICY_NAME		= "EntityFactory";
    const string WRITERDATALIFECYCLE_QOS_POLICY_NAME	= "WriterDataLifecycle";
    const string READERDATALIFECYCLE_QOS_POLICY_NAME	= "ReaderDataLifecycle";
    const string TOPICDATA_QOS_POLICY_NAME		= "TopicData";
    const string GROUPDATA_QOS_POLICY_NAME		= "GroupData";
    const string TRANSPORTPRIORITY_QOS_POLICY_NAME	= "TransportPriority";
    const string LIFESPAN_QOS_POLICY_NAME		= "Lifespan";
    const string DURABILITYSERVICE_QOS_POLICY_NAME      = "DurabilityService";
    const string SCHEDULING_QOS_POLICY_NAME             = "Scheduling";

    const QosPolicyId_t INVALID_QOS_POLICY_ID 			= 0;
    const QosPolicyId_t USERDATA_QOS_POLICY_ID			= 1;
    const QosPolicyId_t DURABILITY_QOS_POLICY_ID		= 2;
    const QosPolicyId_t PRESENTATION_QOS_POLICY_ID		= 3;
    const QosPolicyId_t DEADLINE_QOS_POLICY_ID			= 4;
    const QosPolicyId_t LATENCYBUDGET_QOS_POLICY_ID		= 5;
    const QosPolicyId_t OWNERSHIP_QOS_POLICY_ID			= 6;
    const QosPolicyId_t OWNERSHIPSTRENGTH_QOS_POLICY_ID		= 7;
    const QosPolicyId_t LIVELINESS_QOS_POLICY_ID		= 8;
    const QosPolicyId_t TIMEBASEDFILTER_QOS_POLICY_ID		= 9;
    const QosPolicyId_t PARTITION_QOS_POLICY_ID			= 10;
    const QosPolicyId_t RELIABILITY_QOS_POLICY_ID		= 11;
    const QosPolicyId_t DESTINATIONORDER_QOS_POLICY_ID		= 12;
    const QosPolicyId_t HISTORY_QOS_POLICY_ID			= 13;
    const QosPolicyId_t RESOURCELIMITS_QOS_POLICY_ID		= 14;
    const QosPolicyId_t ENTITYFACTORY_QOS_POLICY_ID		= 15;
    const QosPolicyId_t WRITERDATALIFECYCLE_QOS_POLICY_ID	= 16;
    const QosPolicyId_t READERDATALIFECYCLE_QOS_POLICY_ID	= 17;
    const QosPolicyId_t TOPICDATA_QOS_POLICY_ID			= 18;
    const QosPolicyId_t GROUPDATA_QOS_POLICY_ID			= 19;
    const QosPolicyId_t TRANSPORTPRIORITY_QOS_POLICY_ID		= 20;
    const QosPolicyId_t LIFESPAN_QOS_POLICY_ID			= 21;
    const QosPolicyId_t DURABILITYSERVICE_QOS_POLICY_ID		= 22;
    const QosPolicyId_t SCHEDULING_QOS_POLICY_ID		= 27;

    typedef sequence<octet> octSeq;
    struct UserDataQosPolicy {
        octSeq value;
    };

    struct TopicDataQosPolicy {
        octSeq value;
    };

    struct GroupDataQosPolicy {
        octSeq value;
    };

    struct TransportPriorityQosPolicy {
        long value;
    };

    struct LifespanQosPolicy {
        Duration_t duration;
    };

    enum DurabilityQosPolicyKind {
        VOLATILE_DURABILITY_QOS,
        TRANSIENT_LOCAL_DURABILITY_QOS,
        TRANSIENT_DURABILITY_QOS,
        PERSISTENT_DURABILITY_QOS
    };

    struct DurabilityQosPolicy {
        DurabilityQosPolicyKind kind;
    };

    enum PresentationQosPolicyAccessScopeKind {
        INSTANCE_PRESENTATION_QOS,
        TOPIC_PRESENTATION_QOS,
        GROUP_PRESENTATION_QOS
    };

    struct PresentationQosPolicy {
        PresentationQosPolicyAccessScopeKind access_scope;
        boolean coherent_access;
        boolean ordered_access;
    };

    struct DeadlineQosPolicy {
        Duration_t period;
    };

    struct LatencyBudgetQosPolicy {
        Duration_t duration;
    };

    enum OwnershipQosPolicyKind {
        SHARED_OWNERSHIP_QOS,
        EXCLUSIVE_OWNERSHIP_QOS
    };

    struct OwnershipQosPolicy {
        OwnershipQosPolicyKind kind;
    };

    struct OwnershipStrengthQosPolicy {
        long value;
    };

    enum LivelinessQosPolicyKind {
        AUTOMATIC_LIVELINESS_QOS,
        MANUAL_BY_PARTICIPANT_LIVELINESS_QOS,
        MANUAL_BY_TOPIC_LIVELINESS_QOS
    };

    struct LivelinessQosPolicy {
        LivelinessQosPolicyKind kind;
        Duration_t lease_duration;
    };

    struct TimeBasedFilterQosPolicy {
        Duration_t minimum_separation;
    };

    struct PartitionQosPolicy {
        StringSeq name;
    };

    enum ReliabilityQosPolicyKind {
        BEST_EFFORT_RELIABILITY_QOS,
        RELIABLE_RELIABILITY_QOS
    };

    struct ReliabilityQosPolicy {
        ReliabilityQosPolicyKind kind;
        Duration_t max_blocking_time;
        boolean synchronous;
    };

    enum DestinationOrderQosPolicyKind {
        BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS,
        BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS
    };

    struct DestinationOrderQosPolicy {
        DestinationOrderQosPolicyKind kind;
    };

    enum HistoryQosPolicyKind {
        KEEP_LAST_HISTORY_QOS,
        KEEP_ALL_HISTORY_QOS
    };

    struct HistoryQosPolicy {
        HistoryQosPolicyKind kind;
        long depth;
    };

    struct ResourceLimitsQosPolicy {
        long max_samples;
        long max_instances;
        long max_samples_per_instance;
    };

    struct EntityFactoryQosPolicy {
        boolean autoenable_created_entities;
    };

    struct WriterDataLifecycleQosPolicy {
        boolean autodispose_unregistered_instances;
    };

    struct ReaderDataLifecycleQosPolicy {
        Duration_t autopurge_nowriter_samples_delay;
        Duration_t autopurge_disposed_samples_delay;
    };

    struct DurabilityServiceQosPolicy {
	Duration_t service_cleanup_delay;
	HistoryQosPolicyKind history_kind;
        long history_depth;
        long max_samples;
        long max_instances;
        long max_samples_per_instance;
    };

    enum SchedulingClassQosPolicyKind {
        SCHEDULE_DEFAULT,
        SCHEDULE_TIMESHARING,
        SCHEDULE_REALTIME
    };

    struct SchedulingClassQosPolicy {
        SchedulingClassQosPolicyKind kind;
    };

    enum SchedulingPriorityQosPolicyKind {
        PRIORITY_RELATIVE,
        PRIORITY_ABSOLUTE
    };

    struct SchedulingPriorityQosPolicy {
        SchedulingPriorityQosPolicyKind kind;
    };

    struct SchedulingQosPolicy {
        SchedulingClassQosPolicy scheduling_class;
        SchedulingPriorityQosPolicy scheduling_priority_kind;
        long scheduling_priority;
    };

    struct DomainParticipantFactoryQos {
        EntityFactoryQosPolicy entity_factory;
    };

    struct DomainParticipantQos {
        UserDataQosPolicy user_data;
        EntityFactoryQosPolicy entity_factory;
        SchedulingQosPolicy watchdog_scheduling;
        SchedulingQosPolicy listener_scheduling;
    };

    struct TopicQos {
        TopicDataQosPolicy topic_data;
        DurabilityQosPolicy durability;
	DurabilityServiceQosPolicy durability_service;
        DeadlineQosPolicy deadline;
        LatencyBudgetQosPolicy latency_budget;
        LivelinessQosPolicy liveliness;
        ReliabilityQosPolicy reliability;
        DestinationOrderQosPolicy destination_order;
        HistoryQosPolicy history;
        ResourceLimitsQosPolicy resource_limits;
        TransportPriorityQosPolicy transport_priority;
        LifespanQosPolicy lifespan;
        OwnershipQosPolicy ownership;
    };

    struct DataWriterQos {
        DurabilityQosPolicy durability;
        DeadlineQosPolicy deadline;
        LatencyBudgetQosPolicy latency_budget;
        LivelinessQosPolicy liveliness;
        ReliabilityQosPolicy reliability;
        DestinationOrderQosPolicy destination_order;
        HistoryQosPolicy history;
        ResourceLimitsQosPolicy resource_limits;
        TransportPriorityQosPolicy transport_priority;
        LifespanQosPolicy lifespan;
        UserDataQosPolicy user_data;
        OwnershipStrengthQosPolicy ownership_strength;
        WriterDataLifecycleQosPolicy writer_data_lifecycle;
    };

    struct PublisherQos {
        PresentationQosPolicy presentation;
        PartitionQosPolicy partition;
        GroupDataQosPolicy group_data;
        EntityFactoryQosPolicy entity_factory;
    };

    struct DataReaderQos {
        DurabilityQosPolicy durability;
        DeadlineQosPolicy deadline;
        LatencyBudgetQosPolicy latency_budget;
        LivelinessQosPolicy liveliness;
        ReliabilityQosPolicy reliability;
        DestinationOrderQosPolicy destination_order;
        HistoryQosPolicy history;
        ResourceLimitsQosPolicy resource_limits;
        UserDataQosPolicy user_data;
        TimeBasedFilterQosPolicy time_based_filter;
        ReaderDataLifecycleQosPolicy reader_data_lifecycle;
    };

    struct SubscriberQos {
        PresentationQosPolicy presentation;
        PartitionQosPolicy partition;
        GroupDataQosPolicy group_data;
        EntityFactoryQosPolicy entity_factory;
    };

    // ----------------------------------------------------------------------

/***********************************************************************************
 * The definition of the Builtin Topics has been moved to a separate IDL file
 * (dds_dcps_builtintopics.idl) for the purpose of the generation of the corresponding
 * TypeSupports and Builtin Readers by the Splice pre-processor.
 ***********************************************************************************/
    struct ParticipantBuiltinTopicData {
        BuiltinTopicKey_t key;
        UserDataQosPolicy user_data;
    };

    struct TopicBuiltinTopicData {
        BuiltinTopicKey_t key;
        string name;
        string type_name;
        DurabilityQosPolicy durability;
        DurabilityServiceQosPolicy durability_service;
        DeadlineQosPolicy deadline;
        LatencyBudgetQosPolicy latency_budget;
        LivelinessQosPolicy liveliness;
        ReliabilityQosPolicy reliability;
        TransportPriorityQosPolicy transport_priority;
        LifespanQosPolicy lifespan;
        DestinationOrderQosPolicy destination_order;
        HistoryQosPolicy history;
        ResourceLimitsQosPolicy resource_limits;
        OwnershipQosPolicy ownership;
        TopicDataQosPolicy topic_data;
    };

    struct PublicationBuiltinTopicData {
        BuiltinTopicKey_t key;
        BuiltinTopicKey_t participant_key;
        string topic_name;
        string type_name;
        DurabilityQosPolicy durability;
        DeadlineQosPolicy deadline;
        LatencyBudgetQosPolicy latency_budget;
        LivelinessQosPolicy liveliness;
        ReliabilityQosPolicy reliability;
        LifespanQosPolicy lifespan;
        UserDataQosPolicy user_data;
        OwnershipStrengthQosPolicy ownership_strength;
        PresentationQosPolicy presentation;
        PartitionQosPolicy partition;
        TopicDataQosPolicy topic_data;
        GroupDataQosPolicy group_data;
    };

    struct SubscriptionBuiltinTopicData {
        BuiltinTopicKey_t key;
        BuiltinTopicKey_t participant_key;
        string topic_name;
        string type_name;
        DurabilityQosPolicy durability;
        DeadlineQosPolicy deadline;
        LatencyBudgetQosPolicy latency_budget;
        LivelinessQosPolicy liveliness;
        ReliabilityQosPolicy reliability;
        DestinationOrderQosPolicy destination_order;
        UserDataQosPolicy user_data;
        TimeBasedFilterQosPolicy time_based_filter;
        PresentationQosPolicy presentation;
        PartitionQosPolicy partition;
        TopicDataQosPolicy topic_data;
        GroupDataQosPolicy group_data;
    };

    // ----------------------------------------------------------------------
    local interface Entity {
    //  ReturnCode_t
    //  set_qos(
    //      in EntityQos qos);
    //
    //  ReturnCode_t
    //  get_qos(
    //      inout EntityQos qos);
    //
    //  ReturnCode_t
    //  set_listener(
    //      in Listener l,
    //      in StatusMask mask);
    //
    //  Listener
    //  get_listener();

	ReturnCode_t
	enable();

	StatusCondition
	get_statuscondition();

	StatusMask
	get_status_changes();
    };

    // ----------------------------------------------------------------------
    local interface DomainParticipant : Entity {
        // Factory interfaces
	Publisher
	create_publisher(
	    in PublisherQos qos,
	    in PublisherListener a_listener,
            in StatusMask mask);

	ReturnCode_t
	delete_publisher(
	    in Publisher p);

	Subscriber
	create_subscriber(
	    in SubscriberQos qos,
	    in SubscriberListener a_listener,
            in StatusMask mask);

	ReturnCode_t
	delete_subscriber(
	    in Subscriber s);

	Subscriber
	get_builtin_subscriber();

	Topic
	create_topic(
	    in string topic_name,
	    in string type_name,
	    in TopicQos qos,
	    in TopicListener a_listener,
            in StatusMask mask);

	ReturnCode_t
	delete_topic(
	    in Topic a_topic);

	Topic
	find_topic(
	    in string topic_name,
	    in Duration_t timeout);

	TopicDescription
	lookup_topicdescription(
	    in string name);

	ContentFilteredTopic
	create_contentfilteredtopic(
	    in string name,
	    in Topic related_topic,
	    in string filter_expression,
	    in StringSeq expression_parameters);

	ReturnCode_t
	delete_contentfilteredtopic(
	    in ContentFilteredTopic a_contentfilteredtopic);

	MultiTopic
	create_multitopic(
	    in string name,
	    in string type_name,
	    in string subscription_expression,
	    in StringSeq expression_parameters);

	ReturnCode_t
	delete_multitopic(
	    in MultiTopic a_multitopic);

	ReturnCode_t
	delete_contained_entities();

	ReturnCode_t
	set_qos(
	    in DomainParticipantQos qos);

	ReturnCode_t
	get_qos(
	    inout DomainParticipantQos qos);

	ReturnCode_t
	set_listener(
	    in DomainParticipantListener a_listener,
	    in StatusMask mask);

	DomainParticipantListener
	get_listener();

	ReturnCode_t
	ignore_participant(
	    in InstanceHandle_t handle);

	ReturnCode_t
	ignore_topic(
	    in InstanceHandle_t handle);

	ReturnCode_t
	ignore_publication(
	    in InstanceHandle_t handle);

	ReturnCode_t
	ignore_subscription(
	    in InstanceHandle_t handle);

	DomainId_t
	get_domain_id();

	ReturnCode_t
	assert_liveliness();

	ReturnCode_t
	set_default_publisher_qos(
	    in PublisherQos qos);

	ReturnCode_t
	get_default_publisher_qos(
	    inout PublisherQos qos);

	ReturnCode_t
	set_default_subscriber_qos(
	    in SubscriberQos qos);

	ReturnCode_t
	get_default_subscriber_qos(
	    inout SubscriberQos qos);

	ReturnCode_t
	set_default_topic_qos(
	    in TopicQos qos);

	ReturnCode_t
	get_default_topic_qos(
	    inout TopicQos qos);
    };

    local interface DomainParticipantFactoryInterface {
        DomainParticipant
        create_participant(
            in DomainId_t domainId,
            in DomainParticipantQos qos,
            in DomainParticipantListener a_listener,
            in StatusMask mask);

        ReturnCode_t
        delete_participant(
            in DomainParticipant a_participant);

        DomainParticipant
        lookup_participant(
            in DomainId_t domainId);

        ReturnCode_t
        set_default_participant_qos(
            in DomainParticipantQos qos);

        ReturnCode_t
        get_default_participant_qos(
            inout DomainParticipantQos qos);

        ReturnCode_t set_qos(
            in DomainParticipantFactoryQos qos);
        ReturnCode_t get_qos(
            inout DomainParticipantFactoryQos qos);
    };

    local interface TypeSupport {
        ReturnCode_t
        register_type(
            in DomainParticipant domain,
            in string type_name);
        string
        get_type_name();
    };

    // ----------------------------------------------------------------------
    local interface TopicDescription {
	string
	get_type_name();

	string
	get_name();

	DomainParticipant
	get_participant();
    };

    local interface Topic : Entity, TopicDescription {
	// Access the status
	ReturnCode_t
	get_inconsistent_topic_status(inout InconsistentTopicStatus a_status);

	ReturnCode_t
	get_qos(inout TopicQos qos);

	ReturnCode_t
	set_qos(in TopicQos qos);

	TopicListener
	get_listener();

	ReturnCode_t
	set_listener(in TopicListener a_listener, in StatusMask mask);
    };

    local interface ContentFilteredTopic : TopicDescription {
        string
        get_filter_expression();

        ReturnCode_t
        get_expression_parameters(
            inout StringSeq expression_parameters);

        ReturnCode_t
        set_expression_parameters(
            in StringSeq expression_parameters);

        Topic
        get_related_topic();
    };

    local interface MultiTopic : TopicDescription {
        string
        get_subscription_expression();

        ReturnCode_t
        get_expression_parameters(
            inout StringSeq expression_parameters);

        ReturnCode_t
        set_expression_parameters(
            in StringSeq expression_parameters);
    };

    // ----------------------------------------------------------------------
    local interface Publisher : Entity {
        DataWriter
        create_datawriter(
            in Topic a_topic,
            in DataWriterQos qos,
            in DataWriterListener a_listener,
            in StatusMask mask);

        ReturnCode_t
        delete_datawriter(
            in DataWriter a_datawriter);

        DataWriter
        lookup_datawriter(
            in string topic_name);

        ReturnCode_t
        delete_contained_entities();

        ReturnCode_t
        set_qos(
            in PublisherQos qos);

        ReturnCode_t
        get_qos(
            inout PublisherQos qos);

        ReturnCode_t
        set_listener(
            in PublisherListener a_listener,
            in StatusMask mask);

        PublisherListener
        get_listener();

        ReturnCode_t
        suspend_publications();

        ReturnCode_t
        resume_publications();

        ReturnCode_t
        begin_coherent_changes();

        ReturnCode_t
        end_coherent_changes();

        ReturnCode_t
        wait_for_acknowledgments(
            in Duration_t max_wait);

        DomainParticipant
        get_participant();

        ReturnCode_t
        set_default_datawriter_qos(
            in DataWriterQos qos);

        ReturnCode_t
        get_default_datawriter_qos(
            inout DataWriterQos qos);

        ReturnCode_t
        copy_from_topic_qos(
            inout DataWriterQos a_datawriter_qos,
            in TopicQos a_topic_qos);
    };

    local interface DataWriter : Entity {
    //  InstanceHandle_t
    //  register_instance(
    //      in Data instance_data);
    //
    //  InstanceHandle_t
    //  register_instance_w_timestamp(
    //      in Data instance_data,
    //      in Time_t source_timestamp);
    //
    //  ReturnCode_t
    //  unregister_instance(
    //      in Data instance_data,
    //      in InstanceHandle_t handle);
    //
    //  ReturnCode_t
    //  unregister_instance_w_timestamp(
    //      in Data instance_data,
    //      in InstanceHandle_t handle,
    //      in Time_t source_timestamp);
    //
    //  ReturnCode_t
    //  write(
    //      in Data instance_data,
    //      in InstanceHandle_t handle);
    //
    //  ReturnCode_t
    //  write_w_timestamp(
    //      in Data instance_data,
    //      in InstanceHandle_t handle,
    //      in Time_t source_timestamp);
    //
    //  ReturnCode_t
    //  dispose(
    //      in Data instance_data,
    //      in InstanceHandle_t instance_handle);
    //
    //  ReturnCode_t
    //  dispose_w_timestamp(
    //      in Data instance_data,
    //      in InstanceHandle_t instance_handle,
    //      in Time_t source_timestamp);
    //
    //  ReturnCode_t
    //  get_key_value(
    //      inout Data key_holder,
    //      in InstanceHandle_t handle);
    //
    //  InstanceHandle_t lookup_instance(
    //      in Data instance_data);

        ReturnCode_t
        set_qos(
            in DataWriterQos qos);

        ReturnCode_t
        get_qos(
            inout DataWriterQos qos);

        ReturnCode_t
        set_listener(
            in DataWriterListener a_listener,
            in StatusMask mask);

        DataWriterListener
        get_listener();

        Topic
        get_topic();

        Publisher
        get_publisher();

        ReturnCode_t wait_for_acknowledgments(
            in Duration_t max_wait);

        // Access the status
        ReturnCode_t
        get_liveliness_lost_status(inout LivelinessLostStatus status);

        ReturnCode_t
        get_offered_deadline_missed_status(inout OfferedDeadlineMissedStatus status);

        ReturnCode_t
        get_offered_incompatible_qos_status(inout OfferedIncompatibleQosStatus status);

        ReturnCode_t
        get_publication_matched_status(inout PublicationMatchedStatus status);

        ReturnCode_t
        assert_liveliness();

        ReturnCode_t
        get_matched_subscriptions(
            inout InstanceHandleSeq subscription_handles);

        ReturnCode_t
        get_matched_subscription_data(
            inout SubscriptionBuiltinTopicData subscription_data,
            in InstanceHandle_t subscription_handle);
    };

    // ----------------------------------------------------------------------
    local interface Subscriber : Entity {
	DataReader
	create_datareader(
	    in TopicDescription a_topic,
	    in DataReaderQos qos,
	    in DataReaderListener a_listener,
            in StatusMask mask);

	ReturnCode_t
	delete_datareader(
	    in DataReader a_datareader);

	ReturnCode_t
	delete_contained_entities();

	DataReader
	lookup_datareader(
	    in string topic_name);

	ReturnCode_t
	get_datareaders(
	    out DataReaderSeq readers,
	    in SampleStateMask sample_states,
	    in ViewStateMask view_states,
	    in InstanceStateMask instance_states);

	ReturnCode_t
	notify_datareaders();

	ReturnCode_t
	set_qos(
	    in SubscriberQos qos);

	ReturnCode_t
	get_qos(
	    inout SubscriberQos qos);

	ReturnCode_t
	set_listener(
	    in SubscriberListener a_listener,
	    in StatusMask mask);

	SubscriberListener
	get_listener();

	ReturnCode_t
	begin_access();

	ReturnCode_t
	end_access();

	DomainParticipant
	get_participant();

	ReturnCode_t
	set_default_datareader_qos(
	    in DataReaderQos qos);

	ReturnCode_t
	get_default_datareader_qos(
	    inout DataReaderQos qos);

	ReturnCode_t
	copy_from_topic_qos(
	    inout DataReaderQos a_datareader_qos,
	    in TopicQos a_topic_qos);
    };

    local interface DataReader : Entity {
    //  ReturnCode_t
    //  read(
    //      inout DataSeq data_values,
    //      inout SampleInfoSeq info_seq,
    //      in long max_samples,
    //      in SampleStateMask sample_states,
    //      in ViewStateMask view_states,
    //      in InstanceStateMask instance_states);
    //
    //  ReturnCode_t
    //  take(
    //      inout DataSeq data_values,
    //      inout SampleInfoSeq info_seq,
    //      in long max_samples,
    //      in SampleStateMask sample_states,
    //      in ViewStateMask view_states,
    //      in InstanceStateMask instance_states);
    //
    //  ReturnCode_t
    //  read_w_condition(
    //      inout DataSeq data_values,
    //      inout SampleInfoSeq info_seq,
    //      in long max_samples,
    //      in ReadCondition a_condition);
    //
    //  ReturnCode_t
    //  take_w_condition(
    //      inout DataSeq data_values,
    //      inout SampleInfoSeq info_seq,
    //      in long max_samples,
    //      in ReadCondition a_condition);
    //
    //  ReturnCode_t
    //  read_next_sample(
    //      inout Data data_values,
    //      inout SampleInfo sample_info);
    //
    //  ReturnCode_t
    //  take_next_sample(
    //      inout Data data_values,
    //      inout SampleInfo sample_info);
    //
    //  ReturnCode_t
    //  read_instance(
    //      inout DataSeq data_values,
    //      inout SampleInfoSeq info_seq,
    //      in long max_samples,
    //      in InstanceHandle_t a_handle,
    //      in SampleStateMask sample_states,
    //      in ViewStateMask view_states,
    //      in InstanceStateMask instance_states);
    //
    //  ReturnCode_t
    //  take_instance(
    //      inout DataSeq data_values,
    //      inout SampleInfoSeq info_seq,
    //      in long max_samples,
    //      in InstanceHandle_t a_handle,
    //      in SampleStateMask sample_states,
    //      in ViewStateMask view_states,
    //      in InstanceStateMask instance_states);
    //
    //  ReturnCode_t
    //  read_next_instance(
    //      inout DataSeq data_values,
    //      inout SampleInfoSeq info_seq,
    //      in long max_samples,
    //      in InstanceHandle_t a_handle,
    //      in SampleStateMask sample_states,
    //      in ViewStateMask view_states,
    //      in InstanceStateMask instance_states);
    //
    //  ReturnCode_t
    //  take_next_instance(
    //      inout DataSeq data_values,
    //      inout SampleInfoSeq info_seq,
    //      in long max_samples,
    //      in InstanceHandle_t a_handle,
    //      in SampleStateMask sample_states,
    //      in ViewStateMask view_states,
    //      in InstanceStateMask instance_states);
    //
    //  ReturnCode_t
    //  read_next_instance_w_condition(
    //      inout DataSeq data_values,
    //      inout SampleInfoSeq info_seq,
    //      in long max_samples,
    //      in InstanceHandle_t a_handle,
    //      in ReadCondition a_condition);
    //
    //  ReturnCode_t
    //  take_next_instance_w_condition(
    //      inout DataSeq data_values,
    //      inout SampleInfoSeq info_seq,
    //      in long max_samples,
    //      in InstanceHandle_t a_handle,
    //      in ReadCondition a_condition);
    //
    //  ReturnCode_t
    //  return_loan(
    //      inout DataSeq data_values,
    //      inout SampleInfoSeq info_seq);
    //
    //  ReturnCode_t
    //  get_key_value(
    //      inout Data key_holder,
    //      in InstanceHandle_t handle);
    //
    //  InstanceHandle_t
    //  lookup_instance(
    //      in Data instance);

	ReadCondition
	create_readcondition(
	    in SampleStateMask sample_states,
	    in ViewStateMask view_states,
	    in InstanceStateMask instance_states);

	QueryCondition
	create_querycondition(
	    in SampleStateMask sample_states,
	    in ViewStateMask view_states,
	    in InstanceStateMask instance_states,
	    in string query_expression,
	    in StringSeq query_parameters);

	ReturnCode_t
	delete_readcondition(
	    in ReadCondition a_condition);

	ReturnCode_t
	delete_contained_entities();

	ReturnCode_t
	set_qos(
	    in DataReaderQos qos);

	ReturnCode_t
	get_qos(
	    inout DataReaderQos qos);

	ReturnCode_t
	set_listener(
	    in DataReaderListener a_listener,
	    in StatusMask mask);

	DataReaderListener
	get_listener();

	TopicDescription
	get_topicdescription();

	Subscriber
	get_subscriber();

	ReturnCode_t
	get_sample_rejected_status(inout SampleRejectedStatus status);

	ReturnCode_t
	get_liveliness_changed_status(inout LivelinessChangedStatus status);

	ReturnCode_t
	get_requested_deadline_missed_status(inout RequestedDeadlineMissedStatus status);

	ReturnCode_t
	get_requested_incompatible_qos_status(inout RequestedIncompatibleQosStatus status);

	ReturnCode_t
	get_subscription_matched_status(inout SubscriptionMatchedStatus status);

	ReturnCode_t
	get_sample_lost_status(inout SampleLostStatus status);

	ReturnCode_t
	wait_for_historical_data(
	    in Duration_t max_wait);

	ReturnCode_t get_matched_publications(
	inout InstanceHandleSeq publication_handles);

	ReturnCode_t
	get_matched_publication_data(
	    inout PublicationBuiltinTopicData publication_data,
	    in InstanceHandle_t publication_handle);
    };

    struct SampleInfo {
	SampleStateKind sample_state;
	ViewStateKind view_state;
	InstanceStateKind instance_state;
	Time_t source_timestamp;
	InstanceHandle_t instance_handle;
        InstanceHandle_t publication_handle;
	long disposed_generation_count;
	long no_writers_generation_count;
	long sample_rank;
	long generation_rank;
	long absolute_generation_rank;
	boolean valid_data;
    };

    typedef sequence<SampleInfo> SampleInfoSeq;

    local interface ErrorInfoInterface {
        ReturnCode_t
        update();

        ReturnCode_t
        get_code(
            inout ErrorCode_t code);

        ReturnCode_t
        get_message(
            inout string message);

        ReturnCode_t
        get_location(
            inout string location);

        ReturnCode_t
        get_source_line(
            inout string source_line);

        ReturnCode_t
        get_stack_trace(
            inout string stack_trace);
    };
};
#endif
