public virtual ReturnCode ReturnLoan( ref T[] data, ref SampleInfo[] sampleInfos) { ReturnCode result = DDS.ReturnCode.AlreadyDeleted; ReportStack.Start(); lock (this) { if (this.rlReq_isAlive) { if (data != null && sampleInfos != null) { if (data.Length == sampleInfos.Length) { data = null; sampleInfos = null; result = DDS.ReturnCode.Ok; } else { result = DDS.ReturnCode.PreconditionNotMet; ReportStack.Report(result, "data and sampleInfo arrays have unequal length"); } } else { result = DDS.ReturnCode.PreconditionNotMet; ReportStack.Report(result, "data and/or sampleInfo arrays may not be null"); } } } ReportStack.Flush(this, result != ReturnCode.Ok); return(result); }
public ReturnCode GetMatchedSubscriptionData( ref SubscriptionBuiltinTopicData subscriptionData, InstanceHandle subscriptionHandle) { ReturnCode result = DDS.ReturnCode.BadParameter; ReportStack.Start(); if (this.rlReq_isAlive) { if (subscriptionHandle != InstanceHandle.Nil) { GCHandle dataGCHandle = GCHandle.Alloc(subscriptionData, GCHandleType.Normal); result = uResultToReturnCode( User.Writer.GetMatchedSubscriptionData( rlReq_UserPeer, subscriptionHandle, CopyMatchedSubscriptionData, GCHandle.ToIntPtr(dataGCHandle))); subscriptionData = dataGCHandle.Target as SubscriptionBuiltinTopicData; dataGCHandle.Free(); } else { result = ReturnCode.BadParameter; ReportStack.Report(result, "subscriptionHandle = DDS.InstanceHandle.Nil."); } } else { result = DDS.ReturnCode.AlreadyDeleted; } ReportStack.Flush(this, result != ReturnCode.Ok); return(result); }
public virtual ReturnCode TakeNextInstanceWithCondition( ref T[] data, ref SampleInfo[] sampleInfos, int maxSamples, InstanceHandle instanceHandle, IReadCondition condition) { ReturnCode result; ReadCondition rcObj = condition as ReadCondition; ReportStack.Start(); if (rcObj == null) { result = DDS.ReturnCode.BadParameter; ReportStack.Report(result, "condition is invalid (null), or not of type " + "DDS::OpenSplice::ReadCondition."); } else { IntPtr sampleList = Common.SampleList.New(0); if (sampleList == IntPtr.Zero) { result = DDS.ReturnCode.OutOfResources; ReportStack.Report(result, "Unable to allocate sampleList."); } else { lock (this) { if (this.rlReq_isAlive) { result = wlReq_CheckReaderPreConditions(data, sampleInfos, maxSamples, rcObj); if (result == DDS.ReturnCode.Ok) { int realMax = RealMaxSamples(data, maxSamples); Common.SampleList.Reset(sampleList, realMax); result = rcObj.TakeNextInstance(instanceHandle, sampleList); } } else { result = DDS.ReturnCode.AlreadyDeleted; } } if (result == DDS.ReturnCode.Ok || result == ReturnCode.NoData) { result = ReaderCopy(sampleList, ref data, ref sampleInfos); } Common.SampleList.Free(sampleList); } } ReportStack.Flush(this, (result != ReturnCode.Ok) && (result != ReturnCode.NoData)); return(result); }
public virtual ReturnCode TakeNextInstance( ref T[] data, ref SampleInfo[] sampleInfos, int maxSamples, InstanceHandle instanceHandle, SampleStateKind sampleStates, ViewStateKind viewStates, InstanceStateKind instanceStates) { ReturnCode result; ReportStack.Start(); IntPtr sampleList = Common.SampleList.New(0); if (sampleList == IntPtr.Zero) { result = DDS.ReturnCode.OutOfResources; ReportStack.Report(result, "Unable to allocate sampleList."); } else { lock (this) { if (this.rlReq_isAlive) { result = CheckReaderPreConditions(data, sampleInfos, maxSamples, sampleStates, viewStates, instanceStates); if (result == DDS.ReturnCode.Ok) { uint mask = StateMask(sampleStates, viewStates, instanceStates); int realMax = RealMaxSamples(data, maxSamples); Common.SampleList.Reset(sampleList, realMax); result = uResultToReturnCode( User.Reader.TakeNextInstance( rlReq_UserPeer, instanceHandle, mask, Common.SampleList.ReaderAction, sampleList, DDS.Duration.Zero.OsDuration)); } } else { result = DDS.ReturnCode.AlreadyDeleted; } } if (result == DDS.ReturnCode.Ok || result == ReturnCode.NoData) { result = ReaderCopy(sampleList, ref data, ref sampleInfos); } Common.SampleList.Free(sampleList); } ReportStack.Flush(this, (result != ReturnCode.Ok) && (result != ReturnCode.NoData)); return(result); }