| 1 | /**
|
|---|
| 2 | * (C) 2008 Schima
|
|---|
| 3 | * This code is licenced under the LGPL.
|
|---|
| 4 | */
|
|---|
| 5 |
|
|---|
| 6 | #pragma once
|
|---|
| 7 |
|
|---|
| 8 | #include "StdAfx.h"
|
|---|
| 9 |
|
|---|
| 10 | using namespace System;
|
|---|
| 11 | using namespace System::Runtime::InteropServices;
|
|---|
| 12 |
|
|---|
| 13 | namespace KwsmLab {
|
|---|
| 14 | namespace OpenCvSharp
|
|---|
| 15 | {
|
|---|
| 16 | /// <summary>
|
|---|
| 17 | /// int* ���悤�ɃA�N�Z�X�ł������ɂ��邽�߂̃��b�p�[�N���X
|
|---|
| 18 | /// </summary>
|
|---|
| 19 | public ref class PtrArraySingle
|
|---|
| 20 | {
|
|---|
| 21 | private:
|
|---|
| 22 | /// <summary>
|
|---|
| 23 | /// ���ŕێ�������|�C���^
|
|---|
| 24 | /// </summary>
|
|---|
| 25 | Single* ptr;
|
|---|
| 26 | /// <summary>
|
|---|
| 27 | /// �z�����
|
|---|
| 28 | /// </summary>
|
|---|
| 29 | Int32 length;
|
|---|
| 30 |
|
|---|
| 31 | internal:
|
|---|
| 32 | /// <summary>
|
|---|
| 33 | /// �|�C���^�ŏ��� /// </summary>
|
|---|
| 34 | /// <param name="ptr"></param>
|
|---|
| 35 | /// <param name="length"></param>
|
|---|
| 36 | PtrArraySingle(Single* ptr, Int32 length)
|
|---|
| 37 | {
|
|---|
| 38 | if(ptr == NULL){
|
|---|
| 39 | throw gcnew ArgumentNullException();
|
|---|
| 40 | }
|
|---|
| 41 | if(length < 1){
|
|---|
| 42 | throw gcnew ArgumentOutOfRangeException();
|
|---|
| 43 | }
|
|---|
| 44 | this->ptr = ptr;
|
|---|
| 45 | this->length = length;
|
|---|
| 46 | }
|
|---|
| 47 |
|
|---|
| 48 | public:
|
|---|
| 49 | /// <summary>
|
|---|
| 50 | /// ���ŕێ����Ă����C���^������� /// </summary>
|
|---|
| 51 | /// <returns>���ŕێ����Ă����C���^</returns>
|
|---|
| 52 | property IntPtr Ptr
|
|---|
| 53 | {
|
|---|
| 54 | IntPtr get(void){ return IntPtr(ptr); }
|
|---|
| 55 | }
|
|---|
| 56 | /// <summary>
|
|---|
| 57 | /// �z��v�f�ɃA�N�Z�X�����N�Z�T
|
|---|
| 58 | /// </summary>
|
|---|
| 59 | /// <param name="index">�z��v�f�C���f�b�N�X</param>
|
|---|
| 60 | /// <param name="value">���蓖�Ă�</param>
|
|---|
| 61 | /// <returns>�v�f�̒l</returns>
|
|---|
| 62 | property Single default[Int32]
|
|---|
| 63 | {
|
|---|
| 64 | Single get(Int32 index){
|
|---|
| 65 | return Get(index);
|
|---|
| 66 | }
|
|---|
| 67 | void set(Int32 index, Single value){
|
|---|
| 68 | Set(index, value);
|
|---|
| 69 | }
|
|---|
| 70 | }
|
|---|
| 71 | /// <summary>
|
|---|
| 72 | /// �w�肵���C���f�b�N�X�̔z��v�f������� /// </summary>
|
|---|
| 73 | /// <param name="index">�z��v�f�C���f�b�N�X</param>
|
|---|
| 74 | /// <returns>�v�f�̒l</returns>
|
|---|
| 75 | Single Get(Int32 index)
|
|---|
| 76 | {
|
|---|
| 77 | if(index < 0 || index >= length){
|
|---|
| 78 | throw gcnew ArgumentOutOfRangeException();
|
|---|
| 79 | }
|
|---|
| 80 | return *(ptr + index);
|
|---|
| 81 | }
|
|---|
| 82 | /// <summary>
|
|---|
| 83 | /// �w�肵���C���f�b�N�X�̔z��v�f��肷�� /// </summary>
|
|---|
| 84 | /// <param name="index">�z��v�f�C���f�b�N�X</param>
|
|---|
| 85 | /// <param name="value">���蓖�Ă�</param>
|
|---|
| 86 | void Set(Int32 index, Single value){
|
|---|
| 87 | if(index < 0 || index >= length){
|
|---|
| 88 | throw gcnew ArgumentOutOfRangeException();
|
|---|
| 89 | }
|
|---|
| 90 | *(ptr + index) = value;
|
|---|
| 91 | }
|
|---|
| 92 | };
|
|---|
| 93 | }
|
|---|
| 94 | }
|
|---|