예제 #1
0
        // TODO: This operation is currently not thread-safe.
        public virtual ReturnCode RegisterType(
            IDomainParticipant participant,
            string typeName,
            DatabaseMarshaler marshaler)
        {
            ReturnCode result = ReturnCode.BadParameter;

            if (participant != null && marshaler != null)
            {
                // Now that a marshaler is present,
                result = AttachMarshalerDelegates(GapiPeer, marshaler);
                if (result == ReturnCode.Ok)
                {
                    IntPtr domainObj = (participant as DomainParticipant).GapiPeer;
                    result = Gapi.FooTypeSupport.register_type(
                        GapiPeer,
                        domainObj,
                        typeName);

                    if (result == ReturnCode.Ok)
                    {
                        DatabaseMarshaler.Add(participant, dataType, marshaler);
                        marshaler.InitEmbeddedMarshalers(participant);
                    }
                }
            }

            return(result);
        }
예제 #2
0
        public virtual ReturnCode RegisterType(
            IDomainParticipant participant,
            string typeName,
            DatabaseMarshaler marshaler)
        {
            ReturnCode        result = ReturnCode.BadParameter;
            DomainParticipant dp;

            ReportStack.Start();
            if (participant == null)
            {
                ReportStack.Report(result, "domain '<NULL>' is invalid.");
            }
            else if (marshaler == null)
            {
                ReportStack.Report(result, "marshaler '<NULL>' is invalid.");
            }
            else
            {
                dp = participant as DomainParticipant;
                if (dp == null)
                {
                    ReportStack.Report(result, "domain is invalid, not of type " +
                                       "DDS::OpenSplice::DomainParticipant");
                }
                else
                {
                    if (typeName == null)
                    {
                        typeName = this.typeName;
                    }
                    result = dp.nlReq_LoadTypeSupport(this, typeName);
                    if (result == ReturnCode.AlreadyDeleted)
                    {
                        result = ReturnCode.BadParameter;
                    }
                    else
                    {
                        DatabaseMarshaler.Add(dp, dataType, marshaler);
                        marshaler.InitEmbeddedMarshalers(dp);
                    }
                }
            }
            ReportStack.Flush(null, result != ReturnCode.Ok);
            return(result);
        }