public IDomainParticipant CreateParticipant(
            DomainId domainId,
            IDomainParticipantListener listener,
            StatusKind mask)
        {
            IDomainParticipant participant = null;
            string className = null;

             
            if (listener != null)
            {
                OpenSplice.Gapi.gapi_domainParticipantListener gapiListener;
                DomainParticipantListenerHelper listenerHelper = new DomainParticipantListenerHelper();
                listenerHelper.Listener = listener;
                listenerHelper.CreateListener(out gapiListener);
                using (DomainParticipantListenerMarshaler listenerMarshaler = 
                        new DomainParticipantListenerMarshaler(ref gapiListener))
                {
                    // Invoke the corresponding gapi function.
                    IntPtr gapiParticipant = OpenSplice.Gapi.DomainParticipantFactory.create_participant(
                            GapiPeer,
                            domainId,
                            OpenSplice.Gapi.NativeConstants.GapiParticipantQosDefault,
                            listenerMarshaler.GapiPtr,
                            mask,
                            IntPtr.Zero,
                            IntPtr.Zero,
                            IntPtr.Zero,
                            className);
                    if (gapiParticipant != IntPtr.Zero)
                    {
                        participant = new OpenSplice.DomainParticipant(gapiParticipant, listenerHelper);
                    }
                }
            }
            else
            {
                // Invoke the corresponding gapi function.
                IntPtr gapiParticipant = OpenSplice.Gapi.DomainParticipantFactory.create_participant(
                    GapiPeer,
                    domainId,
                    OpenSplice.Gapi.NativeConstants.GapiParticipantQosDefault,
                    IntPtr.Zero,
                    mask,
                    IntPtr.Zero,
                    IntPtr.Zero,
                    IntPtr.Zero,
                    className);

                if (gapiParticipant != IntPtr.Zero)
                {
                    participant = new OpenSplice.DomainParticipant(gapiParticipant);
                }
            }
            
            if (participant != null)
            {
                DomainParticipantFactoryQos dpfQos = null;
                ReturnCode result = GetQos(ref dpfQos);
                if (result == ReturnCode.Ok)
                {
                    if (dpfQos.EntityFactory.AutoenableCreatedEntities)
                    {
                        participant.Enable();
                    }
                }
            }       
                
            return participant;
        }
 public IDomainParticipant LookupParticipant(DomainId domainId)
 {
     IntPtr gapiDP = OpenSplice.Gapi.DomainParticipantFactory.lookup_participant(GapiPeer, domainId);
     IDomainParticipant participant = (IDomainParticipant)SacsSuperClass.fromUserData(gapiDP);
     return participant;
 }
 public IDomainParticipant CreateParticipant(
     DomainId domainId)
 {
     return CreateParticipant(domainId, null, 0);
 }
 public IDomainParticipant CreateParticipant(
     DomainId domainId,
     DomainParticipantQos qos)
 {
     return CreateParticipant(domainId, qos, null, 0);
 }