123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263 |
- #if !UNITY_WSA_10_0
- using OpenCVForUnity.CoreModule;
- using OpenCVForUnity.UtilsModule;
- using System;
- using System.Collections.Generic;
- using System.Runtime.InteropServices;
- namespace OpenCVForUnity.DnnModule
- {
- // C++: class DictValue
- /**
- * This struct stores the scalar value (or array) of one of the following type: double, cv::String or int64.
- * TODO: Maybe int64 is useless because double type exactly stores at least 2^52 integers.
- */
- public class DictValue : DisposableOpenCVObject
- {
- protected override void Dispose(bool disposing)
- {
- try
- {
- if (disposing)
- {
- }
- if (IsEnabledDispose)
- {
- if (nativeObj != IntPtr.Zero)
- dnn_DictValue_delete(nativeObj);
- nativeObj = IntPtr.Zero;
- }
- }
- finally
- {
- base.Dispose(disposing);
- }
- }
- protected internal DictValue(IntPtr addr) : base(addr) { }
- public IntPtr getNativeObjAddr() { return nativeObj; }
- // internal usage only
- public static DictValue __fromPtr__(IntPtr addr) { return new DictValue(addr); }
- //
- // C++: cv::dnn::DictValue::DictValue(int i)
- //
- public DictValue(int i)
- {
- nativeObj = DisposableObject.ThrowIfNullIntPtr(dnn_DictValue_DictValue_10(i));
- }
- //
- // C++: cv::dnn::DictValue::DictValue(double p)
- //
- public DictValue(double p)
- {
- nativeObj = DisposableObject.ThrowIfNullIntPtr(dnn_DictValue_DictValue_11(p));
- }
- //
- // C++: cv::dnn::DictValue::DictValue(String s)
- //
- public DictValue(string s)
- {
- nativeObj = DisposableObject.ThrowIfNullIntPtr(dnn_DictValue_DictValue_12(s));
- }
- //
- // C++: bool cv::dnn::DictValue::isInt()
- //
- public bool isInt()
- {
- ThrowIfDisposed();
- return dnn_DictValue_isInt_10(nativeObj);
- }
- //
- // C++: bool cv::dnn::DictValue::isString()
- //
- public bool isString()
- {
- ThrowIfDisposed();
- return dnn_DictValue_isString_10(nativeObj);
- }
- //
- // C++: bool cv::dnn::DictValue::isReal()
- //
- public bool isReal()
- {
- ThrowIfDisposed();
- return dnn_DictValue_isReal_10(nativeObj);
- }
- //
- // C++: int cv::dnn::DictValue::getIntValue(int idx = -1)
- //
- public int getIntValue(int idx)
- {
- ThrowIfDisposed();
- return dnn_DictValue_getIntValue_10(nativeObj, idx);
- }
- public int getIntValue()
- {
- ThrowIfDisposed();
- return dnn_DictValue_getIntValue_11(nativeObj);
- }
- //
- // C++: double cv::dnn::DictValue::getRealValue(int idx = -1)
- //
- public double getRealValue(int idx)
- {
- ThrowIfDisposed();
- return dnn_DictValue_getRealValue_10(nativeObj, idx);
- }
- public double getRealValue()
- {
- ThrowIfDisposed();
- return dnn_DictValue_getRealValue_11(nativeObj);
- }
- //
- // C++: String cv::dnn::DictValue::getStringValue(int idx = -1)
- //
- public string getStringValue(int idx)
- {
- ThrowIfDisposed();
- string retVal = Marshal.PtrToStringAnsi(DisposableObject.ThrowIfNullIntPtr(dnn_DictValue_getStringValue_10(nativeObj, idx)));
- return retVal;
- }
- public string getStringValue()
- {
- ThrowIfDisposed();
- string retVal = Marshal.PtrToStringAnsi(DisposableObject.ThrowIfNullIntPtr(dnn_DictValue_getStringValue_11(nativeObj)));
- return retVal;
- }
- #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
- const string LIBNAME = "__Internal";
- #else
- const string LIBNAME = "opencvforunity";
- #endif
- // C++: cv::dnn::DictValue::DictValue(int i)
- [DllImport(LIBNAME)]
- private static extern IntPtr dnn_DictValue_DictValue_10(int i);
- // C++: cv::dnn::DictValue::DictValue(double p)
- [DllImport(LIBNAME)]
- private static extern IntPtr dnn_DictValue_DictValue_11(double p);
- // C++: cv::dnn::DictValue::DictValue(String s)
- [DllImport(LIBNAME)]
- private static extern IntPtr dnn_DictValue_DictValue_12(string s);
- // C++: bool cv::dnn::DictValue::isInt()
- [DllImport(LIBNAME)]
- [return: MarshalAs(UnmanagedType.U1)]
- private static extern bool dnn_DictValue_isInt_10(IntPtr nativeObj);
- // C++: bool cv::dnn::DictValue::isString()
- [DllImport(LIBNAME)]
- [return: MarshalAs(UnmanagedType.U1)]
- private static extern bool dnn_DictValue_isString_10(IntPtr nativeObj);
- // C++: bool cv::dnn::DictValue::isReal()
- [DllImport(LIBNAME)]
- [return: MarshalAs(UnmanagedType.U1)]
- private static extern bool dnn_DictValue_isReal_10(IntPtr nativeObj);
- // C++: int cv::dnn::DictValue::getIntValue(int idx = -1)
- [DllImport(LIBNAME)]
- private static extern int dnn_DictValue_getIntValue_10(IntPtr nativeObj, int idx);
- [DllImport(LIBNAME)]
- private static extern int dnn_DictValue_getIntValue_11(IntPtr nativeObj);
- // C++: double cv::dnn::DictValue::getRealValue(int idx = -1)
- [DllImport(LIBNAME)]
- private static extern double dnn_DictValue_getRealValue_10(IntPtr nativeObj, int idx);
- [DllImport(LIBNAME)]
- private static extern double dnn_DictValue_getRealValue_11(IntPtr nativeObj);
- // C++: String cv::dnn::DictValue::getStringValue(int idx = -1)
- [DllImport(LIBNAME)]
- private static extern IntPtr dnn_DictValue_getStringValue_10(IntPtr nativeObj, int idx);
- [DllImport(LIBNAME)]
- private static extern IntPtr dnn_DictValue_getStringValue_11(IntPtr nativeObj);
- // native support for java finalize()
- [DllImport(LIBNAME)]
- private static extern void dnn_DictValue_delete(IntPtr nativeObj);
- }
- }
- #endif
|