public override void InitEmbeddedMarshalers(IDomainParticipant participant)
 {
     if (attr1Marshaler == null)
     {
         attr1Marshaler = DatabaseMarshaler.GetMarshaler(participant, typeof(DM.__l_WGS84)) as DM.__l_WGS84Marshaler;
         if (attr1Marshaler == null)
         {
             attr1Marshaler = new DM.__l_WGS84Marshaler();
             DatabaseMarshaler.Add(participant, typeof(DM.__l_WGS84), attr1Marshaler);
             attr1Marshaler.InitEmbeddedMarshalers(participant);
         }
     }
     if (attr4Marshaler == null)
     {
         attr4Marshaler = DatabaseMarshaler.GetMarshaler(participant, typeof(DM.__EGI_Data)) as DM.__EGI_DataMarshaler;
         if (attr4Marshaler == null)
         {
             attr4Marshaler = new DM.__EGI_DataMarshaler();
             DatabaseMarshaler.Add(participant, typeof(DM.__EGI_Data), attr4Marshaler);
             attr4Marshaler.InitEmbeddedMarshalers(participant);
         }
     }
     if (attr5Marshaler == null)
     {
         attr5Marshaler = DatabaseMarshaler.GetMarshaler(participant, typeof(__Aircraft)) as __AircraftMarshaler;
         if (attr5Marshaler == null)
         {
             attr5Marshaler = new __AircraftMarshaler();
             DatabaseMarshaler.Add(participant, typeof(__Aircraft), attr5Marshaler);
             attr5Marshaler.InitEmbeddedMarshalers(participant);
         }
     }
 }
 public override void InitEmbeddedMarshalers(IDomainParticipant participant)
 {
     if (attr2Marshaler == null)
     {
         attr2Marshaler = DatabaseMarshaler.GetMarshaler(participant, typeof(DM.__l_WGS84)) as DM.__l_WGS84Marshaler;
         if (attr2Marshaler == null)
         {
             attr2Marshaler = new DM.__l_WGS84Marshaler();
             DatabaseMarshaler.Add(participant, typeof(DM.__l_WGS84), attr2Marshaler);
             attr2Marshaler.InitEmbeddedMarshalers(participant);
         }
     }
 }
Ejemplo n.º 3
0
        public IDataWriter CreateDataWriter(
            ITopic topic,
            DataWriterQos qos,
            IDataWriterListener listener,
            StatusKind mask)
        {
            ReturnCode result     = DDS.ReturnCode.AlreadyDeleted;
            DataWriter dataWriter = null;
            Topic      topicObj   = topic as Topic;

            ReportStack.Start();
            lock (this)
            {
                if (this.rlReq_isAlive)
                {
                    if (topicObj == null)
                    {
                        result = DDS.ReturnCode.BadParameter;
                        ReportStack.Report(result, "topic is invalid (null), or not of type " +
                                           "DDS::OpenSplice::Topic.");
                    }
                    else
                    {
                        result = QosManager.checkQos(qos);
                    }

                    if (result == DDS.ReturnCode.Ok)
                    {
                        lock (topicObj)
                        {
                            if (topicObj.rlReq_isAlive)
                            {
                                TypeSupport       ts        = (topicObj as ITopicDescriptionImpl).rlReq_TypeSupport;
                                DatabaseMarshaler marshaler = DatabaseMarshaler.GetMarshaler(participant, ts.TypeSpec);
                                dataWriter = ts.CreateDataWriter(marshaler);
                                result     = dataWriter.init(this, qos, topicObj, "writer <" + topicObj.Name + ">");
                                if (result == ReturnCode.Ok)
                                {
                                    dataWriter.wlReq_ListenerDispatcher = this.wlReq_ListenerDispatcher;
                                    result = dataWriter.SetListener(listener, mask);
                                }
                                else
                                {
                                    dataWriter = null;
                                }

                                if (result == DDS.ReturnCode.Ok)
                                {
                                    writerList.Add(dataWriter);
                                    if (rlReq_AutoEnableCreatedEntities)
                                    {
                                        result = dataWriter.Enable();
                                    }
                                }
                            }
                            else
                            {
                                // ALREADY_DELETED may only apply to the Publisher in this context,
                                // so for a deleted topic use BAD_PARAMETER instead.
                                result = DDS.ReturnCode.BadParameter;
                            }
                        }
                    }

                    if (result != ReturnCode.Ok && dataWriter != null)
                    {
                        // Ignore result because we prefer the original error.
                        DeleteDataWriter(dataWriter);
                        dataWriter = null;
                    }
                }
            }
            ReportStack.Flush(this, result != ReturnCode.Ok);

            return(dataWriter);
        }
Ejemplo n.º 4
0
        /**
         * Register the four builtin topics:
         *     "DDS::ParticipantBuiltinTopicData"
         *     "DDS::TopicBuiltinTopicData"
         *     "DDS::PublicationBuiltinTopicData"
         *     "DDS::SubscriptionBuiltinTopicData"
         */
        internal static ReturnCode BuiltinTopicRegisterTypeSupport(DomainParticipant participant)
        {
            ReturnCode result;

            DDS.ParticipantBuiltinTopicDataTypeSupport DDSParticipant =
                new DDS.ParticipantBuiltinTopicDataTypeSupport();
            result = DDSParticipant.RegisterType(participant, DDSParticipant.TypeName);
            if (result != ReturnCode.Ok)
            {
                DDS.OpenSplice.OS.Report(
                    DDS.OpenSplice.ReportType.OS_ERROR,
                    "DDS.OpenSplice.DomainParticipant.builtinTopicRegisterTypeSupport",
                    "DDS/OpenSplice/DomainParticipant.cs",
                    DDS.ErrorCode.Error,
                    "Failed to register builtin topic: DCPSParticipant");
            }
            else
            {
                participant.ParticipantDataMarshaler = DatabaseMarshaler.GetMarshaler(
                    participant, DDSParticipant.TypeSpec);
            }

            DDS.TopicBuiltinTopicDataTypeSupport DDSTopic =
                new DDS.TopicBuiltinTopicDataTypeSupport();
            result = DDSTopic.RegisterType(participant, DDSTopic.TypeName);
            if (result != ReturnCode.Ok)
            {
                DDS.OpenSplice.OS.Report(
                    DDS.OpenSplice.ReportType.OS_ERROR,
                    "DDS.OpenSplice.DomainParticipant.builtinTopicRegisterTypeSupport",
                    "DDS/OpenSplice/DomainParticipant.cs",
                    DDS.ErrorCode.Error,
                    "Failed to register builtin topic: DCPSTopic");
            }
            else
            {
                participant.TopicDataMarshaler = DatabaseMarshaler.GetMarshaler(
                    participant, DDSTopic.TypeSpec);
            }

            DDS.PublicationBuiltinTopicDataTypeSupport DDSPublication =
                new DDS.PublicationBuiltinTopicDataTypeSupport();
            result = DDSPublication.RegisterType(participant, DDSPublication.TypeName);
            if (result != ReturnCode.Ok)
            {
                DDS.OpenSplice.OS.Report(
                    DDS.OpenSplice.ReportType.OS_ERROR,
                    "DDS.OpenSplice.DomainParticipant.builtinTopicRegisterTypeSupport",
                    "DDS/OpenSplice/DomainParticipant.cs",
                    DDS.ErrorCode.Error,
                    "Failed to register builtin topic: DCPSPublication");
            }

            DDS.SubscriptionBuiltinTopicDataTypeSupport DDSSubscription =
                new DDS.SubscriptionBuiltinTopicDataTypeSupport();
            result = DDSSubscription.RegisterType(participant, DDSSubscription.TypeName);
            if (result != ReturnCode.Ok)
            {
                DDS.OpenSplice.OS.Report(
                    DDS.OpenSplice.ReportType.OS_ERROR,
                    "DDS.OpenSplice.DomainParticipant.builtinTopicRegisterTypeSupport",
                    "DDS/OpenSplice/DomainParticipant.cs",
                    DDS.ErrorCode.Error,
                    "Failed to register builtin topic: DCPSSubscription");
            }
            return(result);
        }