22 using System.Runtime.InteropServices;
23 using System.Collections.Generic;
25 using DDS.OpenSplice.OS;
26 using DDS.OpenSplice.CustomMarshalers;
27 using DDS.OpenSplice.Kernel;
43 private static readonly
object singleton_lock =
new object();
46 private List<DomainParticipant> participantList =
new List<DomainParticipant>();
70 if (singletonSelf == null)
72 if (
DDS.OpenSplice.User.u.userInitialise() == V_RESULT.OK)
76 ReportStack.Flush(null, singletonSelf == null);
77 if (singletonSelf != null) {
78 AppDomain.CurrentDomain.ProcessExit +=
new EventHandler(ProcessExit);
102 get {
return GetInstance(); }
110 DDS.ReturnCode result;
113 using (OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler marshaler =
114 new OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler())
116 result = marshaler.CopyIn(QosManager.defaultDomainParticipantQos);
119 marshaler.CopyOut(ref defaultParticipantQos);
310 DomainParticipant participant = null;
314 result = QosManager.checkQos(qos);
315 if (result ==
DDS.ReturnCode.Ok)
321 participant =
new OpenSplice.DomainParticipant();
322 result = participant.init(domainId, qos);
334 participantList.Add(participant);
337 result = participant.Enable();
344 ReportStack.Report(
DDS.ReturnCode.BadParameter,
345 "DomainParticipant is using an invalid domain identifier (" + domainId +
").");
349 if (result !=
ReturnCode.Ok && participant != null)
356 ReportStack.Flush(null, result !=
ReturnCode.Ok);
382 DomainParticipant participant = a_participant as DomainParticipant;
383 if (participant != null)
387 if (participantList.Remove(participant))
389 result = participant.wlReq_deinit();
390 if (result !=
DDS.ReturnCode.Ok)
392 participantList.Add(participant);
401 result =
DDS.ReturnCode.BadParameter;
402 ReportStack.Report(result,
"DomainParticipant was already deleted.");
409 ReportStack.Report(result,
"Participant parameter 'a_participant' is null.");
412 ReportStack.Flush(null, result !=
DDS.ReturnCode.Ok);
436 DomainParticipant participant;
439 domainId =
DDS.OpenSplice.User.u.GetDomainIdFromEnvUri();
443 participant = participantList.Find(
444 delegate (DomainParticipant a_participant)
446 return a_participant.DomainId == domainId;
479 result = QosManager.checkQos(qos);
480 if (result ==
DDS.ReturnCode.Ok) {
481 using (OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler marshaler =
482 new OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler())
484 result = marshaler.CopyIn(qos);
487 marshaler.CopyOut(ref defaultParticipantQos);
503 ReportStack.Flush(null, result !=
ReturnCode.Ok);
534 using (OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler marshaler =
535 new OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler())
540 result = marshaler.CopyIn(defaultParticipantQos);
543 marshaler.CopyOut(ref qos);
545 if (qos.ListenerScheduling.SchedulingClass == null)
550 if (qos.ListenerScheduling.SchedulingPriorityKind == null)
557 ReportStack.Flush(null, result !=
ReturnCode.Ok);
609 qos.EntityFactory.AutoenableCreatedEntities = myQos.
EntityFactory.AutoenableCreatedEntities;
646 foreach (DomainParticipant p
in participantList) {
647 result = p.DeleteContainedEntities();
648 if (result ==
DDS.ReturnCode.Ok)
652 if (result !=
DDS.ReturnCode.Ok)
659 if (result ==
DDS.ReturnCode.Ok)
661 participantList.Clear();
726 if (blockOperations) {
727 flags |=
DDS.OpenSplice.User.u.BLOCK_OPERATIONS;
729 if (deleteEntities) {
730 flags |=
DDS.OpenSplice.User.u.DELETE_ENTITIES;
733 return SacsSuperClass.uResultToReturnCode(
DDS.OpenSplice.User.u.userDetach(flags));
737 static void ProcessExit(
object sender, EventArgs args)
740 DDS.OpenSplice.User.u.userDetach(
DDS.OpenSplice.User.u.DELETE_ENTITIES);
741 }
catch (Exception e) {
742 Console.WriteLine(e.ToString());
ReturnCode DeleteContainedEntities()
This operation deletes all of the Entity objects that were created on the DomainParticipantFactory.
ReturnCode SetQos(DomainParticipantFactoryQos qos)
This operation replaces the existing set of QoS settings for the DomainParticipantFactory.
All the DCPS IEntity objects are attached to a IDomainParticipant. A IDomainParticipant represents th...
PlaceHolder for a domain ID.
SchedulingQosPolicy ListenerScheduling
Specifies the scheduling parameters used to create the listener thread.
static DomainParticipantFactory Instance
This property is used to get the DomainParticipantFactory singleton object.
The purpose of this class is to allow the creation and destruction of IDomainParticipant objects...
ReturnCode DetachAllDomains(bool blockOperations, bool deleteEntities)
This operation safely detaches the application from all domains it is currently participating in...
The scheduling policy which indicates if the scheduling priority is relative or absolute.
ReturnCode SetDefaultParticipantQos(DomainParticipantQos qos)
This operation sets the default DomainParticipantQos of the DomainParticipantFactory.
SchedulingClassQosPolicy SchedulingClass
ReturnCode GetDefaultParticipantQos(ref DomainParticipantQos qos)
This operation gets the default DomainParticipantQos of the DomainParticipantFactory ...
This class provides the basic mechanism for an application to specify Quality of Service attributes f...
static readonly DomainId Invalid
Representation of an invalid domain ID.
IDomainParticipant CreateParticipant(DomainId domainId, DomainParticipantQos qos, IDomainParticipantListener listener, StatusKind mask)
This operation creates a new IDomainParticipant which will join the domain identified by domainId...
ReturnCode
This is the enum that represents the various ReturnCode values that DDS operations return...
Since a DomainParticipant is an Entity, it has the ability to have a Listener associated with it...
EntityFactoryQosPolicy EntityFactory
Specifies whether a just created DomainParticipant should be enabled.
ReturnCode GetQos(ref DomainParticipantFactoryQos qos)
This operation obtains the QoS settings for the DomainParticipantFactory.
static readonly DomainId Default
Representation of the default domain ID.
SchedulingClassQosPolicyKind Kind
IDomainParticipant LookupParticipant(DomainId domainId)
This operation retrieves a previously created IDomainParticipant belonging to the specified domainId...
IDomainParticipant CreateParticipant(DomainId domainId)
This operation creates a new IDomainParticipant which will join the domain identified by domainId (or...
This class provides the basic mechanism for an application to specify Quality of Service attributes f...
SchedulingPriorityQosPolicy SchedulingPriorityKind
IDomainParticipant CreateParticipant(DomainId domainId, DomainParticipantQos qos)
This operation creates a new IDomainParticipant which will join the domain identified by domainId (or...
StatusKind
Each concrete Entity class has a set of Status attributes and for each attribute the Entity class pro...
IDomainParticipant CreateParticipant(DomainId domainId, IDomainParticipantListener listener, StatusKind mask)
This operation creates a new IDomainParticipant which will join the domain identified by domainId (or...
ReturnCode SetListener(IDomainParticipantListener listener, StatusKind mask)
This operation attaches a IDomainParticipantListener to the IDomainParticipant.
ReturnCode DeleteParticipant(IDomainParticipant a_participant)
This operation deletes an IDomainParticipant.
SchedulingPriorityQosPolicyKind Kind