DictValue.cs 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. #if !UNITY_WSA_10_0
  2. using OpenCVForUnity.CoreModule;
  3. using OpenCVForUnity.UtilsModule;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Runtime.InteropServices;
  7. namespace OpenCVForUnity.DnnModule
  8. {
  9. // C++: class DictValue
  10. //javadoc: DictValue
  11. public class DictValue : DisposableOpenCVObject
  12. {
  13. protected override void Dispose (bool disposing)
  14. {
  15. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  16. try {
  17. if (disposing) {
  18. }
  19. if (IsEnabledDispose) {
  20. if (nativeObj != IntPtr.Zero)
  21. dnn_DictValue_delete (nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. } finally {
  25. base.Dispose (disposing);
  26. }
  27. #else
  28. return;
  29. #endif
  30. }
  31. protected internal DictValue (IntPtr addr)
  32. : base (addr)
  33. {
  34. }
  35. public IntPtr getNativeObjAddr ()
  36. {
  37. return nativeObj;
  38. }
  39. // internal usage only
  40. public static DictValue __fromPtr__ (IntPtr addr)
  41. {
  42. return new DictValue (addr);
  43. }
  44. //
  45. // C++: cv::dnn::DictValue::DictValue(String s)
  46. //
  47. //javadoc: DictValue::DictValue(s)
  48. public DictValue (string s)
  49. {
  50. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  51. nativeObj = dnn_DictValue_DictValue_10 (s);
  52. return;
  53. #else
  54. return null;
  55. #endif
  56. }
  57. //
  58. // C++: cv::dnn::DictValue::DictValue(double p)
  59. //
  60. //javadoc: DictValue::DictValue(p)
  61. public DictValue (double p)
  62. {
  63. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  64. nativeObj = dnn_DictValue_DictValue_11 (p);
  65. return;
  66. #else
  67. return null;
  68. #endif
  69. }
  70. //
  71. // C++: cv::dnn::DictValue::DictValue(int i)
  72. //
  73. //javadoc: DictValue::DictValue(i)
  74. public DictValue (int i)
  75. {
  76. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  77. nativeObj = dnn_DictValue_DictValue_12 (i);
  78. return;
  79. #else
  80. return null;
  81. #endif
  82. }
  83. //
  84. // C++: String cv::dnn::DictValue::getStringValue(int idx = -1)
  85. //
  86. //javadoc: DictValue::getStringValue(idx)
  87. public string getStringValue (int idx)
  88. {
  89. ThrowIfDisposed ();
  90. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  91. string retVal = Marshal.PtrToStringAnsi (dnn_DictValue_getStringValue_10 (nativeObj, idx));
  92. return retVal;
  93. #else
  94. return null;
  95. #endif
  96. }
  97. //javadoc: DictValue::getStringValue()
  98. public string getStringValue ()
  99. {
  100. ThrowIfDisposed ();
  101. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  102. string retVal = Marshal.PtrToStringAnsi (dnn_DictValue_getStringValue_11 (nativeObj));
  103. return retVal;
  104. #else
  105. return null;
  106. #endif
  107. }
  108. //
  109. // C++: bool cv::dnn::DictValue::isInt()
  110. //
  111. //javadoc: DictValue::isInt()
  112. public bool isInt ()
  113. {
  114. ThrowIfDisposed ();
  115. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  116. bool retVal = dnn_DictValue_isInt_10 (nativeObj);
  117. return retVal;
  118. #else
  119. return false;
  120. #endif
  121. }
  122. //
  123. // C++: bool cv::dnn::DictValue::isReal()
  124. //
  125. //javadoc: DictValue::isReal()
  126. public bool isReal ()
  127. {
  128. ThrowIfDisposed ();
  129. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  130. bool retVal = dnn_DictValue_isReal_10 (nativeObj);
  131. return retVal;
  132. #else
  133. return false;
  134. #endif
  135. }
  136. //
  137. // C++: bool cv::dnn::DictValue::isString()
  138. //
  139. //javadoc: DictValue::isString()
  140. public bool isString ()
  141. {
  142. ThrowIfDisposed ();
  143. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  144. bool retVal = dnn_DictValue_isString_10 (nativeObj);
  145. return retVal;
  146. #else
  147. return false;
  148. #endif
  149. }
  150. //
  151. // C++: double cv::dnn::DictValue::getRealValue(int idx = -1)
  152. //
  153. //javadoc: DictValue::getRealValue(idx)
  154. public double getRealValue (int idx)
  155. {
  156. ThrowIfDisposed ();
  157. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  158. double retVal = dnn_DictValue_getRealValue_10 (nativeObj, idx);
  159. return retVal;
  160. #else
  161. return -1;
  162. #endif
  163. }
  164. //javadoc: DictValue::getRealValue()
  165. public double getRealValue ()
  166. {
  167. ThrowIfDisposed ();
  168. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  169. double retVal = dnn_DictValue_getRealValue_11 (nativeObj);
  170. return retVal;
  171. #else
  172. return -1;
  173. #endif
  174. }
  175. //
  176. // C++: int cv::dnn::DictValue::getIntValue(int idx = -1)
  177. //
  178. //javadoc: DictValue::getIntValue(idx)
  179. public int getIntValue (int idx)
  180. {
  181. ThrowIfDisposed ();
  182. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  183. int retVal = dnn_DictValue_getIntValue_10 (nativeObj, idx);
  184. return retVal;
  185. #else
  186. return -1;
  187. #endif
  188. }
  189. //javadoc: DictValue::getIntValue()
  190. public int getIntValue ()
  191. {
  192. ThrowIfDisposed ();
  193. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  194. int retVal = dnn_DictValue_getIntValue_11 (nativeObj);
  195. return retVal;
  196. #else
  197. return -1;
  198. #endif
  199. }
  200. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  201. const string LIBNAME = "__Internal";
  202. #else
  203. const string LIBNAME = "opencvforunity";
  204. #endif
  205. // C++: cv::dnn::DictValue::DictValue(String s)
  206. [DllImport (LIBNAME)]
  207. private static extern IntPtr dnn_DictValue_DictValue_10 (string s);
  208. // C++: cv::dnn::DictValue::DictValue(double p)
  209. [DllImport (LIBNAME)]
  210. private static extern IntPtr dnn_DictValue_DictValue_11 (double p);
  211. // C++: cv::dnn::DictValue::DictValue(int i)
  212. [DllImport (LIBNAME)]
  213. private static extern IntPtr dnn_DictValue_DictValue_12 (int i);
  214. // C++: String cv::dnn::DictValue::getStringValue(int idx = -1)
  215. [DllImport (LIBNAME)]
  216. private static extern IntPtr dnn_DictValue_getStringValue_10 (IntPtr nativeObj, int idx);
  217. [DllImport (LIBNAME)]
  218. private static extern IntPtr dnn_DictValue_getStringValue_11 (IntPtr nativeObj);
  219. // C++: bool cv::dnn::DictValue::isInt()
  220. [DllImport (LIBNAME)]
  221. private static extern bool dnn_DictValue_isInt_10 (IntPtr nativeObj);
  222. // C++: bool cv::dnn::DictValue::isReal()
  223. [DllImport (LIBNAME)]
  224. private static extern bool dnn_DictValue_isReal_10 (IntPtr nativeObj);
  225. // C++: bool cv::dnn::DictValue::isString()
  226. [DllImport (LIBNAME)]
  227. private static extern bool dnn_DictValue_isString_10 (IntPtr nativeObj);
  228. // C++: double cv::dnn::DictValue::getRealValue(int idx = -1)
  229. [DllImport (LIBNAME)]
  230. private static extern double dnn_DictValue_getRealValue_10 (IntPtr nativeObj, int idx);
  231. [DllImport (LIBNAME)]
  232. private static extern double dnn_DictValue_getRealValue_11 (IntPtr nativeObj);
  233. // C++: int cv::dnn::DictValue::getIntValue(int idx = -1)
  234. [DllImport (LIBNAME)]
  235. private static extern int dnn_DictValue_getIntValue_10 (IntPtr nativeObj, int idx);
  236. [DllImport (LIBNAME)]
  237. private static extern int dnn_DictValue_getIntValue_11 (IntPtr nativeObj);
  238. // native support for java finalize()
  239. [DllImport (LIBNAME)]
  240. private static extern void dnn_DictValue_delete (IntPtr nativeObj);
  241. }
  242. }
  243. #endif