예제 #1
0
파일: nothreads.cs 프로젝트: konryd/thesis
 public void count()
 {
     IntWrapper i = new IntWrapper(2000000);
     while(i.i > 0) {
         i = new IntWrapper(i.i - 1);
     }
 }
예제 #2
0
        private void testUnsorted3(IntegerCODEC codec)
        {
            int[] data = new int[128];
            data[127] = -1;
            int[]      compressed   = new int[1024];
            IntWrapper inputoffset  = new IntWrapper(0);
            IntWrapper outputoffset = new IntWrapper(0);

            codec.compress(data, inputoffset, data.Length, compressed, outputoffset);
            // we can repack the data: (optional)
            compressed = Arrays.copyOf(compressed, outputoffset.intValue());

            int[]      recovered = new int[128];
            IntWrapper recoffset = new IntWrapper(0);

            codec.uncompress(compressed, new IntWrapper(0), compressed.Length,
                             recovered, recoffset);
            Assert2.assertArrayEquals(data, recovered);
        }
예제 #3
0
        public void unsortedExample()
        {
            const int N = 1333333;

            int[] data = new int[N];
            // initialize the data (most will be small
            for (int k = 0; k < N; k += 1)
            {
                data[k] = 3;
            }
            // throw some larger values
            for (int k = 0; k < N; k += 5)
            {
                data[k] = 100;
            }
            for (int k = 0; k < N; k += 533)
            {
                data[k] = 10000;
            }
            int[]        compressed = new int[N + 1024];// could need more
            IntegerCODEC codec      = new Composition(new FastPFOR(), new VariableByte());
            // compressing
            IntWrapper inputoffset  = new IntWrapper(0);
            IntWrapper outputoffset = new IntWrapper(0);

            codec.compress(data, inputoffset, data.Length, compressed, outputoffset);
            _testOutputHelper.WriteLine("compressed unsorted integers from " + data.Length * 4 / 1024 + "KB to " + outputoffset.intValue() * 4 / 1024 + "KB");
            // we can repack the data: (optional)
            compressed = Arrays.copyOf(compressed, outputoffset.intValue());

            int[]      recovered = new int[N];
            IntWrapper recoffset = new IntWrapper(0);

            codec.uncompress(compressed, new IntWrapper(0), compressed.Length, recovered, recoffset);
            if (Arrays.equals(data, recovered))
            {
                _testOutputHelper.WriteLine("data is recovered without loss");
            }
            else
            {
                throw new Exception("bug"); // could use assert
            }
        }
예제 #4
0
        private void encodePage(int[] @in, IntWrapper inpos, int thissize, int[] @out, IntWrapper outpos)
        {
            int        tmpoutpos  = outpos.get();
            int        tmpinpos   = inpos.get();
            IntWrapper bestb      = new IntWrapper();
            IntWrapper bestexcept = new IntWrapper();

            for (int finalinpos = tmpinpos + thissize; tmpinpos + BLOCK_SIZE <= finalinpos; tmpinpos += BLOCK_SIZE)
            {
                getBestBFromData(@in, tmpinpos, bestb, bestexcept);
                int tmpbestb   = bestb.get();
                int nbrexcept  = bestexcept.get();
                int exceptsize = 0;
                int remember   = tmpoutpos;
                tmpoutpos++;
                if (nbrexcept > 0)
                {
                    int c = 0;
                    for (int i = 0; i < BLOCK_SIZE; ++i)
                    {
                        if ((int)((uint)@in[tmpinpos + i] >> bits[tmpbestb]) != 0)
                        {
                            exceptbuffer[c + nbrexcept] = i;
                            exceptbuffer[c]             = (int)((uint)@in[tmpinpos + i] >> bits[tmpbestb]);
                            ++c;
                        }
                    }
                    exceptsize = S16.compress(exceptbuffer, 0,
                                              2 * nbrexcept, @out, tmpoutpos);
                    tmpoutpos += exceptsize;
                }
                @out[remember] = tmpbestb | (nbrexcept << 8)
                                 | (exceptsize << 16);
                for (int k = 0; k < BLOCK_SIZE; k += 32)
                {
                    BitPacking.fastpack(@in, tmpinpos + k, @out,
                                        tmpoutpos, bits[tmpbestb]);
                    tmpoutpos += bits[tmpbestb];
                }
            }
            inpos.set(tmpinpos);
            outpos.set(tmpoutpos);
        }
        public void FindMToLastTest()
        {
            var list = new MthSingleLinkedList <IntWrapper>();

            for (int i = 0; i < 10; i++)
            {
                list.AddToFront(new IntWrapper(i));
            }

            list.Print();

            IntWrapper t = list.FindMToLast(10);

            Assert.AreEqual(9, t.Value);
            t = list.FindMToLast(7);
            Assert.AreEqual(6, t.Value);
            t = list.FindMToLast(5);
            Assert.AreEqual(4, t.Value);
        }
예제 #6
0
        public void consistentTest()
        {
            const int N = 4096;

            int[] data = new int[N];
            int[] rev  = new int[N];
            for (int k = 0; k < N; ++k)
            {
                data[k] = k % 128;
            }
            foreach (SkippableIntegerCODEC c in codecs)
            {
                _testOutputHelper.WriteLine("[SkippeableBasicTest.consistentTest] codec = " + c);
                int[] outBuf = new int[N + 1024];
                for (int n = 0; n <= N; ++n)
                {
                    IntWrapper inPos  = new IntWrapper();
                    IntWrapper outPos = new IntWrapper();
                    c.headlessCompress(data, inPos, n, outBuf, outPos);

                    IntWrapper inPoso  = new IntWrapper();
                    IntWrapper outPoso = new IntWrapper();
                    c.headlessUncompress(outBuf, inPoso, outPos.get(), rev,
                                         outPoso, n);
                    if (outPoso.get() != n)
                    {
                        throw new Exception("bug " + n);
                    }
                    if (inPoso.get() != outPos.get())
                    {
                        throw new Exception("bug " + n + " " + inPoso.get() + " " + outPos.get());
                    }
                    for (int j = 0; j < n; ++j)
                    {
                        if (data[j] != rev[j])
                        {
                            throw new Exception("bug");
                        }
                    }
                }
            }
        }
예제 #7
0
        /// <inheritdoc />
        /// <summary>
        /// Set the payment method to use for a subscription May send null to use floating default. &lt;br&gt;&lt;br&gt;&lt;b&gt;Permissions Needed:&lt;/b&gt; USERS_SUBSCRIPTIONS_ADMIN or owner
        /// </summary>
        /// <param name="userId">The id of the user</param>
        /// <param name="inventoryId">The id of the user&#39;s inventory</param>
        /// <param name="paymentMethodId">The id of the payment method</param>
        public void SetSubscriptionPaymentMethod(int?userId, int?inventoryId, IntWrapper paymentMethodId)
        {
            // verify the required parameter 'userId' is set
            if (userId == null)
            {
                throw new KnetikException(400, "Missing required parameter 'userId' when calling SetSubscriptionPaymentMethod");
            }
            // verify the required parameter 'inventoryId' is set
            if (inventoryId == null)
            {
                throw new KnetikException(400, "Missing required parameter 'inventoryId' when calling SetSubscriptionPaymentMethod");
            }

            mWebCallEvent.WebPath = "/users/{user_id}/subscriptions/{inventory_id}/payment-method";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }
            mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "user_id" + "}", KnetikClient.ParameterToString(userId));
            mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "inventory_id" + "}", KnetikClient.ParameterToString(inventoryId));

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            mWebCallEvent.PostBody = KnetikClient.Serialize(paymentMethodId); // http body (model) parameter

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mSetSubscriptionPaymentMethodStartTime = DateTime.Now;
            mWebCallEvent.Context     = mSetSubscriptionPaymentMethodResponseContext;
            mWebCallEvent.RequestType = KnetikRequestType.PUT;

            KnetikLogger.LogRequest(mSetSubscriptionPaymentMethodStartTime, "SetSubscriptionPaymentMethod", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
        /// <inheritdoc />
        /// <summary>
        /// Update or create a leveling progress record for a user If no progress record yet exists for the user, it will be created. Otherwise the provided value will be added to it. May be negative. If progress meets or exceeds the level&#39;s max_value it will be marked as earned and a BRE event will be triggered for the &lt;code&gt;BreAchievementEarnedTrigger&lt;/code&gt;. &lt;br&gt;&lt;br&gt;&lt;b&gt;Permissions Needed:&lt;/b&gt; LEVELING_ADMIN
        /// </summary>
        /// <param name="userId">The id of the user</param>
        /// <param name="name">The level schema name</param>
        /// <param name="progress">The amount of progress to add</param>
        public void IncrementProgress(int?userId, string name, IntWrapper progress)
        {
            // verify the required parameter 'userId' is set
            if (userId == null)
            {
                throw new KnetikException(400, "Missing required parameter 'userId' when calling IncrementProgress");
            }
            // verify the required parameter 'name' is set
            if (name == null)
            {
                throw new KnetikException(400, "Missing required parameter 'name' when calling IncrementProgress");
            }

            mWebCallEvent.WebPath = "/users/{user_id}/leveling/{name}/progress";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }
            mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "user_id" + "}", KnetikClient.ParameterToString(userId));
            mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "name" + "}", KnetikClient.ParameterToString(name));

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            mWebCallEvent.PostBody = KnetikClient.Serialize(progress); // http body (model) parameter

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mIncrementProgressStartTime = DateTime.Now;
            mWebCallEvent.Context       = mIncrementProgressResponseContext;
            mWebCallEvent.RequestType   = KnetikRequestType.POST;

            KnetikLogger.LogRequest(mIncrementProgressStartTime, "IncrementProgress", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
예제 #9
0
    static IntWrapper GetObj(int i)
    {
        int result = 0;

        try  // To disable inlining
        {
            if (i == 0)
            {
                throw new Exception();
            }
        }
        finally
        {
            result = i;
        }
        IntWrapper res = new IntWrapper();

        res.value = i;
        return(res);
    }
예제 #10
0
        public void headlessCompress(int[] @in, IntWrapper inpos, int inlength, int[] @out, IntWrapper outpos)
        {
            inlength = Util.greatestMultiple(inlength, BLOCK_SIZE);
            int tmpoutpos = outpos.get();
            int s         = inpos.get();

            for (; s + BLOCK_SIZE * 4 - 1 < inpos.get() + inlength; s += BLOCK_SIZE * 4)
            {
                int mbits1 = Util.maxbits(@in, s, BLOCK_SIZE);

                int mbits2 = Util.maxbits(@in, s + BLOCK_SIZE, BLOCK_SIZE);

                int mbits3 = Util.maxbits(@in, s + 2 * BLOCK_SIZE, BLOCK_SIZE);

                int mbits4 = Util.maxbits(@in, s + 3 * BLOCK_SIZE, BLOCK_SIZE);
                @out[tmpoutpos++] = (mbits1 << 24) | (mbits2 << 16)
                                    | (mbits3 << 8) | (mbits4);
                BitPacking.fastpackwithoutmask(@in, s, @out, tmpoutpos,
                                               mbits1);
                tmpoutpos += mbits1;
                BitPacking.fastpackwithoutmask(@in, s + BLOCK_SIZE, @out,
                                               tmpoutpos, mbits2);
                tmpoutpos += mbits2;
                BitPacking.fastpackwithoutmask(@in, s + 2 * BLOCK_SIZE, @out,
                                               tmpoutpos, mbits3);
                tmpoutpos += mbits3;
                BitPacking.fastpackwithoutmask(@in, s + 3 * BLOCK_SIZE, @out,
                                               tmpoutpos, mbits4);
                tmpoutpos += mbits4;
            }
            for (; s < inpos.get() + inlength; s += BLOCK_SIZE)
            {
                int mbits = Util.maxbits(@in, s, BLOCK_SIZE);
                @out[tmpoutpos++] = mbits;
                BitPacking.fastpackwithoutmask(@in, s, @out, tmpoutpos,
                                               mbits);
                tmpoutpos += mbits;
            }
            inpos.add(inlength);
            outpos.set(tmpoutpos);
        }
예제 #11
0
        public void uncompress(int[] inBuf, IntWrapper inPos, int inLen, int[] outBuf, IntWrapper outPos)
        {
            if (inLen == 0)
            {
                return;
            }

            int outLen = inBuf[inPos.get()];

            inPos.increment();

            int context = 0;

            int[] work = new int[32];

            int ip         = inPos.get();
            int op         = outPos.get();
            int outPosLast = op + outLen;

            for (; op < outPosLast; op += BLOCK_LENGTH)
            {
                int bits1 = (int)((uint)inBuf[ip] >> 24);
                int bits2 = (int)((uint)inBuf[ip] >> 16) & 0xFF;
                int bits3 = (int)((uint)inBuf[ip] >> 8) & 0xFF;
                int bits4 = (int)((uint)inBuf[ip] >> 0) & 0xFF;
                ++ip;
                ip += xorUnpack(inBuf, ip, outBuf, op + 0, bits1,
                                context, work);
                ip += xorUnpack(inBuf, ip, outBuf, op + 32, bits2,
                                outBuf[op + 31], work);
                ip += xorUnpack(inBuf, ip, outBuf, op + 64, bits3,
                                outBuf[op + 63], work);
                ip += xorUnpack(inBuf, ip, outBuf, op + 96, bits4,
                                outBuf[op + 95], work);
                context = outBuf[op + 127];
            }

            outPos.add(outLen);
            inPos.set(ip);
        }
        public void uncompress(sbyte[] @in, IntWrapper inpos, int inlength, int[] @out, IntWrapper outpos)
        {
            int p          = inpos.get();
            int initoffset = 0;
            int finalp     = inpos.get() + inlength;
            int tmpoutpos  = outpos.get();

            for (int v = 0; p < finalp; @out[tmpoutpos++] = (initoffset = initoffset + v))
            {
                v = @in[p] & 0x7F;
                if (@in[p] < 0)
                {
                    p += 1;
                    continue;
                }
                v = ((@in[p + 1] & 0x7F) << 7) | v;
                if (@in[p + 1] < 0)
                {
                    p += 2;
                    continue;
                }
                v = ((@in[p + 2] & 0x7F) << 14) | v;
                if (@in[p + 2] < 0)
                {
                    p += 3;
                    continue;
                }
                v = ((@in[p + 3] & 0x7F) << 21) | v;
                if (@in[p + 3] < 0)
                {
                    p += 4;
                    continue;
                }
                v  = ((@in[p + 4] & 0x7F) << 28) | v;
                p += 5;
            }
            outpos.set(tmpoutpos);
            inpos.add(p);
        }
예제 #13
0
    static void Main(string[] args)
    {
        var valueType     = 100;
        var referenceType = new IntWrapper(100);
        var stopWatch     = Stopwatch.StartNew();
        int assignee;

        for (int i = 0; i < 500000000; i++)
        {
            assignee = valueType;
        }
        stopWatch.Stop();
        Console.WriteLine("Accessed valueType 500m times in {0}ms", stopWatch.ElapsedMilliseconds);
        stopWatch.Restart();
        for (int i = 0; i < 500000000; i++)
        {
            assignee = referenceType.IntAccessor;
        }
        stopWatch.Stop();
        Console.WriteLine("Accessed referenceType 500m times in {0}ms", stopWatch.ElapsedMilliseconds);
        Console.ReadLine();
    }
예제 #14
0
        public void headlessUncompress(int[] @in, IntWrapper inpos, int inlength, int[] @out, IntWrapper outpos, int num)
        {
            int outlength = Util.greatestMultiple(num, BLOCK_SIZE);
            int tmpinpos  = inpos.get();
            int s         = outpos.get();

            for (; s + BLOCK_SIZE * 4 - 1 < outpos.get() + outlength; s += BLOCK_SIZE * 4)
            {
                int mbits1 = (int)((uint)@in[tmpinpos] >> 24);

                int mbits2 = (int)((uint)@in[tmpinpos] >> 16) & 0xFF;

                int mbits3 = (int)((uint)@in[tmpinpos] >> 8) & 0xFF;

                int mbits4 = (int)((uint)@in[tmpinpos]) & 0xFF;
                ++tmpinpos;
                BitPacking.fastunpack(@in, tmpinpos, @out, s, mbits1);
                tmpinpos += mbits1;
                BitPacking
                .fastunpack(@in, tmpinpos, @out, s + BLOCK_SIZE, mbits2);
                tmpinpos += mbits2;
                BitPacking.fastunpack(@in, tmpinpos, @out, s + 2 * BLOCK_SIZE,
                                      mbits3);
                tmpinpos += mbits3;
                BitPacking.fastunpack(@in, tmpinpos, @out, s + 3 * BLOCK_SIZE,
                                      mbits4);
                tmpinpos += mbits4;
            }
            for (; s < outpos.get() + outlength; s += BLOCK_SIZE)
            {
                int mbits = @in[tmpinpos];
                ++tmpinpos;
                BitPacking.fastunpack(@in, tmpinpos, @out, s, mbits);
                tmpinpos += mbits;
            }
            outpos.add(outlength);
            inpos.set(tmpinpos);
        }
예제 #15
0
        public async Task TestShortCircuiting()
        {
            var router = new Router <BasicRoutingContext <IntWrapper> >()
            {
                new Router <BasicRoutingContext <IntWrapper> >()
                {
                    new IncrementRoute(),    // hit
                    new ShortCircuitRoute(), // break, jump all 3 lines below
                    new IncrementRoute(),
                    new IncrementRoute(),
                    new IncrementRoute(),
                },
                new IncrementRoute() // here
            };

            var wrapper = new IntWrapper()
            {
                Int = 0
            };
            await router.RouteAsync(new BasicRoutingContext <IntWrapper>(wrapper));

            Assert.Equal(2, wrapper.Int);
        }
예제 #16
0
파일: b608066.cs 프로젝트: CheneyWu/coreclr
 static IntWrapper Add35(int ecx, int edx, IntWrapper o3,
                                                    int i4, int i5, int i6,
                                           int i7, int i8, int i9, int i10,
                                           int i11, int i12, int i13, int i14,
                                           int i15, int i16, int i17, int i18,
                                           int i19, int i20, int i21, int i22,
                                           int i23, int i24, int i25, int i26,
                                           int i27, int i28, int i29, int i30,
                                           int i31, int i32, int i33, int i34,
                                           int i35)
 {
     int result_int = 0;
     IntWrapper result_obj = new IntWrapper();
     try  // To disable inlining
     {
         result_int = o3.value;
     }
     finally
     {
         result_obj.value = result_int;
     }
     return result_obj;
 }
예제 #17
0
        public void testUnsorted(IntegerCODEC codec)
        {
            int[] lengths = { 133, 1026, 1333333 };
            foreach (int N in lengths)
            {
                int[] data = new int[N];
                // initialize the data (most will be small)
                for (int k = 0; k < N; k += 1)
                {
                    data[k] = 3;
                }
                // throw some larger values
                for (int k = 0; k < N; k += 5)
                {
                    data[k] = 100;
                }
                for (int k = 0; k < N; k += 533)
                {
                    data[k] = 10000;
                }
                data[5] = -311;
                // could need more compressing
                int[]      compressed   = new int[(int)Math.Ceiling(N * 1.01) + 1024];
                IntWrapper inputoffset  = new IntWrapper(0);
                IntWrapper outputoffset = new IntWrapper(0);
                codec.compress(data, inputoffset, data.Length, compressed,
                               outputoffset);
                // we can repack the data: (optional)
                compressed = Arrays.copyOf(compressed, outputoffset.intValue());

                int[]      recovered = new int[N];
                IntWrapper recoffset = new IntWrapper(0);
                codec.uncompress(compressed, new IntWrapper(0), compressed.Length,
                                 recovered, recoffset);
                Assert2.assertArrayEquals(data, recovered);
            }
        }
예제 #18
0
        public void compress(int[] inBuf, IntWrapper inPos, int inLen, int[] outBuf, IntWrapper outPos)
        {
            inLen = inLen - inLen % BLOCK_LENGTH;
            if (inLen == 0)
            {
                return;
            }

            outBuf[outPos.get()] = inLen;
            outPos.increment();

            DeltaZigzagEncoding.Encoder ctx = new DeltaZigzagEncoding.Encoder(0);
            int[] work = new int[BLOCK_LENGTH];

            int op        = outPos.get();
            int ip        = inPos.get();
            int inPosLast = ip + inLen;

            for (; ip < inPosLast; ip += BLOCK_LENGTH)
            {
                ctx.encodeArray(inBuf, ip, BLOCK_LENGTH, work);
                int bits1 = Util.maxbits32(work, 0);
                int bits2 = Util.maxbits32(work, 32);
                int bits3 = Util.maxbits32(work, 64);
                int bits4 = Util.maxbits32(work, 96);
                outBuf[op++] = (bits1 << 24) | (bits2 << 16)
                               | (bits3 << 8) | (bits4 << 0);
                op += pack(work, 0, outBuf, op, bits1);
                op += pack(work, 32, outBuf, op, bits2);
                op += pack(work, 64, outBuf, op, bits3);
                op += pack(work, 96, outBuf, op, bits4);
            }

            inPos.add(inLen);
            outPos.set(op);
        }
예제 #19
0
        private static int compressWithSkipTable(object c, int[] data, int[] output, IntWrapper outpos, int[] metadata, int blocksize)
        {
            int metapos = 0;

            metadata[metapos++] = data.Length;
            IntWrapper inpos     = new IntWrapper();
            int        initvalue = 0;
            IntWrapper ival      = new IntWrapper(initvalue);

            while (inpos.get() < data.Length)
            {
                metadata[metapos++] = outpos.get();
                metadata[metapos++] = initvalue;
                if (c is SkippableIntegerCODEC)
                {
                    int size = blocksize > data.Length - inpos.get() ? data.Length
                               - inpos.get() : blocksize;
                    initvalue = Delta.delta(data, inpos.get(), size, initvalue);

                    ((SkippableIntegerCODEC)c).headlessCompress(data, inpos,
                                                                blocksize, output, outpos);
                }
                else if (c is SkippableIntegratedIntegerCODEC)
                {
                    ival.set(initvalue);
                    ((SkippableIntegratedIntegerCODEC)c).headlessCompress(data,
                                                                          inpos, blocksize, output, outpos, ival);
                    initvalue = ival.get();
                }
                else
                {
                    throw new Exception("Unrecognized codec " + c);
                }
            }
            return(metapos);
        }
        /// <inheritdoc />
        /// <summary>
        /// Sets the owner of a cart if none is set already &lt;b&gt;Permissions Needed:&lt;/b&gt; SHOPPING_CARTS_ADMIN or owner
        /// </summary>
        /// <param name="id">The id of the cart</param>
        /// <param name="userId">The id of the user</param>
        public void SetCartOwner(string id, IntWrapper userId)
        {
            // verify the required parameter 'id' is set
            if (id == null)
            {
                throw new KnetikException(400, "Missing required parameter 'id' when calling SetCartOwner");
            }

            mWebCallEvent.WebPath = "/carts/{id}/owner";
            if (!string.IsNullOrEmpty(mWebCallEvent.WebPath))
            {
                mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json");
            }
            mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "id" + "}", KnetikClient.ParameterToString(id));

            mWebCallEvent.HeaderParams.Clear();
            mWebCallEvent.QueryParams.Clear();
            mWebCallEvent.AuthSettings.Clear();
            mWebCallEvent.PostBody = null;

            mWebCallEvent.PostBody = KnetikClient.Serialize(userId); // http body (model) parameter

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant");

            // authentication settings
            mWebCallEvent.AuthSettings.Add("oauth2_password_grant");

            // make the HTTP request
            mSetCartOwnerStartTime    = DateTime.Now;
            mWebCallEvent.Context     = mSetCartOwnerResponseContext;
            mWebCallEvent.RequestType = KnetikRequestType.PUT;

            KnetikLogger.LogRequest(mSetCartOwnerStartTime, "SetCartOwner", "Sending server request...");
            KnetikGlobalEventSystem.Publish(mWebCallEvent);
        }
예제 #21
0
    static IntWrapper Add35(int ecx, int edx, IntWrapper o3,
                            int i4, int i5, int i6,
                            int i7, int i8, int i9, int i10,
                            int i11, int i12, int i13, int i14,
                            int i15, int i16, int i17, int i18,
                            int i19, int i20, int i21, int i22,
                            int i23, int i24, int i25, int i26,
                            int i27, int i28, int i29, int i30,
                            int i31, int i32, int i33, int i34,
                            int i35)
    {
        int        result_int = 0;
        IntWrapper result_obj = new IntWrapper();

        try  // To disable inlining
        {
            result_int = o3.value;
        }
        finally
        {
            result_obj.value = result_int;
        }
        return(result_obj);
    }
예제 #22
0
 public void headlessCompress(int[] @in, IntWrapper inpos, int inlength, int[] @out, IntWrapper outpos)
 {
     inlength = Util.greatestMultiple(inlength, BLOCK_SIZE);
     if (inlength == 0)
     {
         return;
     }
     encodePage(@in, inpos, inlength, @out, outpos);
 }
예제 #23
0
        public void uncompress(int[] @in, IntWrapper inpos, int inlength, int[] @out, IntWrapper outpos)
        {
            if (inlength == 0)
            {
                return;
            }
            int outlength = @in[inpos.get()];

            inpos.increment();
            headlessUncompress(@in, inpos, inlength, @out, outpos, outlength);
        }
예제 #24
0
 public void headlessUncompress(int[] @in, IntWrapper inpos, int inlength, int[] @out, IntWrapper outpos, int mynvalue)
 {
     if (inlength == 0)
     {
         return;
     }
     mynvalue = Util.greatestMultiple(mynvalue, BLOCK_SIZE);
     decodePage(@in, inpos, @out, outpos, mynvalue);
 }
 /// <summary>
 /// Put complex types with integer properties
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='complexBody'>
 /// Please put -1 and 2
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task PutIntAsync(this IPrimitiveOperations operations, IntWrapper complexBody, CancellationToken cancellationToken = default(CancellationToken))
 {
     await operations.PutIntWithHttpMessagesAsync(complexBody, null, cancellationToken).ConfigureAwait(false);
 }
예제 #26
0
        public void headlessUncompress(int[] @in, IntWrapper inpos, int inlength, int[] @out, IntWrapper outpos, int num)
        {
            int init = inpos.get();

            F1.headlessUncompress(@in, inpos, inlength, @out, outpos, num);
            inlength -= inpos.get() - init;
            num      -= outpos.get();
            F2.headlessUncompress(@in, inpos, inlength, @out, outpos, num);
        }
        /// <summary>
        /// Test explicitly required integer. Please put a valid int-wrapper with
        /// 'value' = null and the client library should throw before the request is
        /// sent.
        /// </summary>
        /// <param name='operations'>
        /// The operations group for this extension method.
        /// </param>
        /// <param name='bodyParameter'>
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        public static async Task <Error> PostRequiredIntegerPropertyAsync(this IExplicitModel operations, IntWrapper bodyParameter, CancellationToken cancellationToken = default(CancellationToken))
        {
            HttpOperationResponse <Error> result = await operations.PostRequiredIntegerPropertyWithHttpMessagesAsync(bodyParameter, null, cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }
 /// <summary>
 /// Test explicitly required integer. Please put a valid int-wrapper with
 /// 'value' = null and the client library should throw before the request is
 /// sent.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='bodyParameter'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task<Error> PostRequiredIntegerPropertyAsync( this IExplicitModel operations, IntWrapper bodyParameter, CancellationToken cancellationToken = default(CancellationToken))
 {
     HttpOperationResponse<Error> result = await operations.PostRequiredIntegerPropertyWithHttpMessagesAsync(bodyParameter, null, cancellationToken).ConfigureAwait(false);
     return result.Body;
 }
예제 #29
0
 /// <summary>
 /// Put complex types with integer properties
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='complexBody'>
 /// Please put -1 and 2
 /// </param>
 public static void PutInt(this IPrimitive operations, IntWrapper complexBody)
 {
     operations.PutIntAsync(complexBody).GetAwaiter().GetResult();
 }
예제 #30
0
파일: b608066.cs 프로젝트: CheneyWu/coreclr
 static IntWrapper GetObj(int i)
 {
     int result = 0;
     try  // To disable inlining
     {
         if (i == 0)
             throw new Exception();
     }
     finally
     {
         result = i;
     }
     IntWrapper res = new IntWrapper();
     res.value = i;
     return res;
 }
 public static void testInstanceCallingStatic()
 {
     var intW = new IntWrapper(3).intWrapper2Static();
 }
예제 #32
0
파일: b608066.cs 프로젝트: CheneyWu/coreclr
    static bool Bug(int which)
    {

        IntWrapper enreg1 = new IntWrapper();
        IntWrapper enreg2 = new IntWrapper();

        enreg1.value = 0;
        enreg2.value = 0;
        bool passgcHole = false;
        bool passAssert = false;

        if ((which == 1) || (which == 0))
        {
            IntWrapper gcHoleFailure = Add36(1, 2,
                                              3, 4, 5, 6,
                                              7, 8, 9, 10,
                                              11, 12, 13, 14,
                                              15, 16, 17, 18,
                                              19, 20, 21, 22,
                                              23, 24, 25, 26,
                                              27, 28, 29, 30,
                                              31, 32,
                                              GetObj(ident(33)),
                                              ident(ident(34)),
                                              ident(ident(35)),
                                              ident(ident(36)));
            Console.WriteLine(gcHoleFailure.value);
            if (gcHoleFailure.value == 33) passgcHole = true;
        }


        if ((which == 2) || (which == 0))
        {
            IntWrapper assertFailure = Add35(1, 2,
                                              GetObj(3),
                                              4, 5, 6,
                                              7, 8, 9, 10,
                                              11, 12, 13, 14,
                                              15, 16, 17, 18,
                                              19, 20, 21, 22,
                                              23, 24, 25, 26,
                                              27, 28, 29, 30,
                                              31, 32,
                                              ident(33),
                                              ident(34),
                                              ident(30) + ident(5));
            Console.WriteLine(assertFailure.value);
            if (assertFailure.value == 3) passAssert = true;
        }

        for (int i = 0; i < 100; i++)
        {
            enreg1.value += i;
            enreg2.value += i;
        }

        if (passgcHole && passAssert)
        {
            return true;
        }
        else
        {
            return false;
        }

    }
예제 #33
0
 /// <summary>
 /// Put complex types with integer properties
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='complexBody'>
 /// Please put -1 and 2
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task PutIntAsync(this IPrimitive operations, IntWrapper complexBody, CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.PutIntWithHttpMessagesAsync(complexBody, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
 public static void testInstanceNonGeneric()
 {
     var intW = new IntWrapper(3);
 }
 /// <summary>
 /// Test explicitly required integer. Please put a valid int-wrapper with
 /// 'value' = null and the client library should throw before the request is
 /// sent.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='bodyParameter'>
 /// </param>
 public static Error PostRequiredIntegerProperty(this IExplicitModel operations, IntWrapper bodyParameter)
 {
     return Task.Factory.StartNew(s => ((IExplicitModel)s).PostRequiredIntegerPropertyAsync(bodyParameter), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
예제 #36
0
 /// <summary>
 /// Put complex types with integer properties
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='complexBody'>
 /// Please put -1 and 2
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async System.Threading.Tasks.Task PutIntAsync(this IPrimitive operations, IntWrapper complexBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
 {
     await operations.PutIntWithHttpMessagesAsync(complexBody, null, cancellationToken).ConfigureAwait(false);
 }
 /// <summary>
 /// Test explicitly required integer. Please put a valid int-wrapper with
 /// 'value' = null and the client library should throw before the request is
 /// sent.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='bodyParameter'>
 /// </param>
 public static Error PostRequiredIntegerProperty(this IExplicitModel operations, IntWrapper bodyParameter)
 {
     return(Task.Factory.StartNew(s => ((IExplicitModel)s).PostRequiredIntegerPropertyAsync(bodyParameter), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
 public static void testInstanceNonGenericChained()
 {
     var intW = new IntWrapper(3).intWrapper2();
 }
예제 #39
0
    static bool Bug(int which)
    {
        IntWrapper enreg1 = new IntWrapper();
        IntWrapper enreg2 = new IntWrapper();

        enreg1.value = 0;
        enreg2.value = 0;
        bool passgcHole = false;
        bool passAssert = false;

        if ((which == 1) || (which == 0))
        {
            IntWrapper gcHoleFailure = Add36(1, 2,
                                             3, 4, 5, 6,
                                             7, 8, 9, 10,
                                             11, 12, 13, 14,
                                             15, 16, 17, 18,
                                             19, 20, 21, 22,
                                             23, 24, 25, 26,
                                             27, 28, 29, 30,
                                             31, 32,
                                             GetObj(ident(33)),
                                             ident(ident(34)),
                                             ident(ident(35)),
                                             ident(ident(36)));
            Console.WriteLine(gcHoleFailure.value);
            if (gcHoleFailure.value == 33)
            {
                passgcHole = true;
            }
        }


        if ((which == 2) || (which == 0))
        {
            IntWrapper assertFailure = Add35(1, 2,
                                             GetObj(3),
                                             4, 5, 6,
                                             7, 8, 9, 10,
                                             11, 12, 13, 14,
                                             15, 16, 17, 18,
                                             19, 20, 21, 22,
                                             23, 24, 25, 26,
                                             27, 28, 29, 30,
                                             31, 32,
                                             ident(33),
                                             ident(34),
                                             ident(30) + ident(5));
            Console.WriteLine(assertFailure.value);
            if (assertFailure.value == 3)
            {
                passAssert = true;
            }
        }

        for (int i = 0; i < 100; i++)
        {
            enreg1.value += i;
            enreg2.value += i;
        }

        if (passgcHole && passAssert)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
 /// <summary>
 /// Put complex types with integer properties
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='complexBody'>
 /// Please put -1 and 2
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async System.Threading.Tasks.Task PutIntAsync(this IPrimitiveOperations operations, IntWrapper complexBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
 {
     await operations.PutIntWithHttpMessagesAsync(complexBody, null, cancellationToken).ConfigureAwait(false);
 }
예제 #41
0
 public static partial IntWrapper DoubleIntRef(IntWrapper pInt);
 /// <summary>
 /// Put complex types with integer properties
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='complexBody'>
 /// Please put -1 and 2
 /// </param>
 public static void PutInt(this IPrimitiveOperations operations, IntWrapper complexBody)
 {
     Task.Factory.StartNew(s => ((IPrimitiveOperations)s).PutIntAsync(complexBody), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }