示例#1
0
        private void ParseCpi(byte[] buffer)
        {
            MemoryStream ms     = new MemoryStream(buffer, false);
            ushort       mask16 = ms.ReadUInt16BE();

            CPI      = new CPI();
            CPI.Type = mask16 & 0x0f;

            int mapPos = (int)ms.Position;

            ms.Position++;
            CPI.NumStreamPids = ms.ReadInt8();
            CPI.Entries       = new EpMapEntry[CPI.NumStreamPids];
            for (int i = 0; i < CPI.NumStreamPids; i++)
            {
                ulong mask64 = ms.ReadUInt64BE();
                CPI.Entries[i]     = new EpMapEntry();
                CPI.Entries[i].PID = (ushort)((mask64 & 0xFFFF000000000000) >> 48);
                ulong reserved = ((mask64 & 0x0000FFC000000000) >> 38);
                CPI.Entries[i].EpStreamType        = (byte)((mask64 & 0x0000003C00000000) >> 34);
                CPI.Entries[i].NumEpCoarse         = (ushort)((mask64 & 0x00000003FFFC0000) >> 18);
                CPI.Entries[i].NumEpFine           = (uint)((mask64 & 0x000000000003FFFF));
                CPI.Entries[i].EpMapStreamStarAddr = ms.ReadUInt32BE() + (uint)mapPos;
            }

            for (int i = 0; i < CPI.NumStreamPids; i++)
            {
                ms.Position = CPI.Entries[i].EpMapStreamStarAddr;
                uint fineStart = ms.ReadUInt32BE();

                CPI.Entries[i].EpCoarse = new EpCoarse[CPI.Entries[i].NumEpCoarse];
                for (int j = 0; j < CPI.Entries[i].NumEpCoarse; j++)
                {
                    CPI.Entries[i].EpCoarse[j] = new EpCoarse();
                    uint mask32 = ms.ReadUInt32BE();
                    CPI.Entries[i].EpCoarse[j].RefEpFineId = (uint)((mask32 & 0xFFFFC000) >> 14);
                    CPI.Entries[i].EpCoarse[j].PtsEp       = (ushort)((mask32 & 0x00003FFF));
                    CPI.Entries[i].EpCoarse[j].SpnEp       = ms.ReadUInt32BE();
                }

                ms.Position           = CPI.Entries[i].EpMapStreamStarAddr + fineStart;
                CPI.Entries[i].EpFine = new EpFine[CPI.Entries[i].NumEpFine];
                for (int j = 0; j < CPI.Entries[i].NumEpFine; j++)
                {
                    CPI.Entries[i].EpFine[j] = new EpFine();
                    uint mask32 = ms.ReadUInt32BE();
                    CPI.Entries[i].EpFine[j].IsAngleChangePoint = ((mask32 & 0x80000000) >> 31) != 0;
                    CPI.Entries[i].EpFine[j].IEndPositionOffset = (byte)((mask32 & 0x70000000) >> 28);
                    CPI.Entries[i].EpFine[j].PtsEp = (ushort)((mask32 & 0x0FFE0000) >> 17);
                    CPI.Entries[i].EpFine[j].SpnEp = (uint)((mask32 & 0x0001FFFF));
                }
            }
        }
示例#2
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CPI obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
示例#3
0
文件: CPIBond.cs 项目: minikie/test
 public CPIBond(uint settlementDays, double faceAmount, bool growthOnly, double baseCPI, Period observationLag, ZeroInflationIndex cpiIndex, CPI.InterpolationType observationInterpolation, Schedule schedule, DoubleVector coupons, DayCounter accrualDayCounter) : this(NQuantLibcPINVOKE.new_CPIBond__SWIG_7(settlementDays, faceAmount, growthOnly, baseCPI, Period.getCPtr(observationLag), ZeroInflationIndex.getCPtr(cpiIndex), (int)observationInterpolation, Schedule.getCPtr(schedule), DoubleVector.getCPtr(coupons), DayCounter.getCPtr(accrualDayCounter)), true) {
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
 }
示例#4
0
文件: CPI.cs 项目: minikie/test
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CPI obj) {
   return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
 }
示例#5
0
文件: CPIBond.cs 项目: minikie/test
 public CPIBond(uint settlementDays, double faceAmount, bool growthOnly, double baseCPI, Period observationLag, ZeroInflationIndex cpiIndex, CPI.InterpolationType observationInterpolation, Schedule schedule, DoubleVector coupons, DayCounter accrualDayCounter, BusinessDayConvention paymentConvention, Date issueDate, Calendar paymentCalendar, Period exCouponPeriod, Calendar exCouponCalendar) : this(NQuantLibcPINVOKE.new_CPIBond__SWIG_2(settlementDays, faceAmount, growthOnly, baseCPI, Period.getCPtr(observationLag), ZeroInflationIndex.getCPtr(cpiIndex), (int)observationInterpolation, Schedule.getCPtr(schedule), DoubleVector.getCPtr(coupons), DayCounter.getCPtr(accrualDayCounter), (int)paymentConvention, Date.getCPtr(issueDate), Calendar.getCPtr(paymentCalendar), Period.getCPtr(exCouponPeriod), Calendar.getCPtr(exCouponCalendar)), true) {
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
 }