コード例 #1
0
        public void Test_buffer__multi_level()
        {
            CGD.buffer tempBufer = new CGD.buffer();

            tempBufer.alloc(200);

            TEST_C temp = new TEST_C();

            temp.x = 10;
            temp.y = new List <int> {
                1, 2, 3
            };
            temp.t   = new DateTime(1990, 12, 11, 10, 21, 11);
            temp.z.X = 10;
            temp.z.Y = "Tesfdsafdsafdsafdst";
            temp.z.Z = 100;
            temp.z.W = new List <int>        {
                10, 20, 30
            };


            string tempString;

            tempString = "Txxfasgfsgfdfx";


            tempBufer.append <int>(10);
            tempBufer.append <TEST_C>(temp);
            tempBufer.append <string>(tempString);

            var a1 = tempBufer.extract <int>();
            var a2 = tempBufer.extract <TEST_C>();
            var a3 = tempBufer.extract <string>();
        }
コード例 #2
0
        //----------------------------------------------------------------------------
        // Example 1) 다양한 형태의 생성 방법
        //
        //----------------------------------------------------------------------------
        static void Sample_simple_creation_copy()
        {
            // Case 1) 256 Byte의 메모리를 할당한다.
            CGD.buffer bufTemp1 = new CGD.buffer(256);

            // Case 2) 선언 후 할당하기
            CGD.buffer bufTemp2 = new CGD.buffer();

            bufTemp2.alloc(256);

            // Case 3) CGPool이 있을 경우
            //CGD.buffer buffer 3 = MEM_POOL.Alloc(256);

            // Case 4) 바이트 배열을 직접 할당해 넣기.
            CGD.buffer bufTemp3 = new CGD.buffer(new byte[256]);

            // Case 5) byte[]과 함께 Offset과 Length도 설정하기
            //         (offset:10, Count:100)
            CGD.buffer bufTemp4 = new CGD.buffer(new byte[256], 10, 100);

            // Case 6) 생성된 CGD.buffer에서 가져온다.(얕은 복사)
            CGD.buffer bufTemp5 = bufTemp1;

            // Case 7) 생성된 기본 버퍼에서 Offset을 10만큼 더한 후 가져오기
            CGD.buffer bufTemp6 = bufTemp2 + 10;


            // Case 8) 복사본을 만든다. (깊은 복사)
            CGD.buffer bufTemp7 = bufTemp1.clone();

            // 할당 해제
            bufTemp1.clear();
        }
コード例 #3
0
        public void TestMethod2()
        {
            CGD.buffer tempBufer = new CGD.buffer();

            tempBufer.alloc(200);


            TEST_B temp = new TEST_B();

            temp.X = 10;
            temp.Y = "Tesfdsafdsafdsafdst";
            temp.Z = 100;
            temp.W = new List <int>  {
                10, 20, 30
            };


            string tempString;


            tempString = "Txxfasgfsgfdfx";


            tempBufer.append <int>(10);
            tempBufer.append <TEST_B>(temp);
            tempBufer.append <string>(tempString);

            int    a1 = tempBufer.extract <int>();
            TEST_B a2 = tempBufer.extract <TEST_B>();
            string a3 = tempBufer.extract <string>();
        }
コード例 #4
0
        public void TestMethod1()
        {
            CGD.buffer tempBufer = new CGD.buffer();

            tempBufer.alloc(100);

            TEST temp = new TEST();

            temp.X = 10;
            temp.Y = 1.0f;
            temp.Z = 100;

            string tempString = "Txxx";


            tempBufer.append <int>(10);
            tempBufer.append <TEST>(temp);
            tempBufer.append <string>(tempString);

            int    a1 = tempBufer.extract <int>();
            TEST   a2 = tempBufer.extract <TEST>();
            string a3 = tempBufer.extract <string>();
        }
コード例 #5
0
        public void Test_buffer__multi_level()
        {
            CGD.buffer tempBufer = new CGD.buffer();

            tempBufer.alloc(200);

            TEST_C temp = new TEST_C();

            temp.x	 = 10;
            temp.y	 = new List<int> { 1, 2, 3};
            temp.t	 = new DateTime(1990, 12, 11, 10, 21, 11);
            temp.z.X = 10;
            temp.z.Y = "Tesfdsafdsafdsafdst";
            temp.z.Z = 100;
            temp.z.W = new List<int>	{ 10, 20, 30};

            string tempString;
            tempString = "Txxfasgfsgfdfx";

            tempBufer.append<int>(10);
            tempBufer.append<TEST_C>(temp);
            tempBufer.append<string>(tempString);

            var a1	 = tempBufer.extract<int>();
            var a2	 = tempBufer.extract<TEST_C>();
            var a3	 = tempBufer.extract<string>();
        }
コード例 #6
0
        public void TestMethod2()
        {
            CGD.buffer tempBufer = new CGD.buffer();

            tempBufer.alloc(200);

            TEST_B temp = new TEST_B();

            temp.X = 10;
            temp.Y = "Tesfdsafdsafdsafdst";
            temp.Z = 100;
            temp.W = new List<int>	{ 10, 20, 30};

            string tempString;

            tempString = "Txxfasgfsgfdfx";

            tempBufer.append<int>(10);
            tempBufer.append<TEST_B>(temp);
            tempBufer.append<string>(tempString);

            int a1		 = tempBufer.extract<int>();
            TEST_B a2	 = tempBufer.extract<TEST_B>();
            string a3	 = tempBufer.extract<string>();
        }
コード例 #7
0
        public void TestMethod1()
        {
            CGD.buffer tempBufer = new CGD.buffer();

            tempBufer.alloc(100);

            TEST temp = new TEST();

            temp.X   = 10;
            temp.Y   = 1.0f;
            temp.Z   = 100;

            string tempString = "Txxx";

            tempBufer.append<int>(10);
            tempBufer.append<TEST>(temp);
            tempBufer.append<string>(tempString);

            int     a1   = tempBufer.extract<int>();
            TEST    a2   = tempBufer.extract<TEST>();
            string  a3   = tempBufer.extract<string>();
        }
コード例 #8
0
ファイル: Program.cs プロジェクト: newkkd/CGDbuffer
        //----------------------------------------------------------------------------
        // Example 1) 다양한 형태의 생성 방법
        //
        //----------------------------------------------------------------------------
        static void Sample_simple_creation_copy()
        {
            // Case 1) 256 Byte의 메모리를 할당한다.
            CGD.buffer bufTemp1 = new CGD.buffer(256);

            // Case 2) 선언 후 할당하기
            CGD.buffer bufTemp2 = new CGD.buffer();

            bufTemp2.alloc(256);

            // Case 3) CGPool이 있을 경우
            //CGD.buffer buffer 3 = MEM_POOL.Alloc(256);

            // Case 4) 바이트 배열을 직접 할당해 넣기.
            CGD.buffer bufTemp3 = new CGD.buffer(new byte[256]);

            // Case 5) byte[]과 함께 Offset과 Length도 설정하기
            //         (offset:10, Count:100)
            CGD.buffer bufTemp4 = new CGD.buffer(new byte[256], 10, 100);

            // Case 6) 생성된 CGD.buffer에서 가져온다.(얕은 복사)
            CGD.buffer bufTemp5 = bufTemp1;

            // Case 7) 생성된 기본 버퍼에서 Offset을 10만큼 더한 후 가져오기
            CGD.buffer bufTemp6 = bufTemp2 + 10;

            // Case 8) 복사본을 만든다. (깊은 복사)
            CGD.buffer bufTemp7	 = bufTemp1.clone();

            // 할당 해제
            bufTemp1.clear();
        }