Int4.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. //
  2. // Int4.h
  3. //
  4. // Created by Giles Payne on 2020/02/05.
  5. //
  6. #pragma once
  7. #ifdef __cplusplus
  8. #import "opencv2/core.hpp"
  9. #else
  10. #define CV_EXPORTS
  11. #endif
  12. #import <Foundation/Foundation.h>
  13. @class Mat;
  14. NS_ASSUME_NONNULL_BEGIN
  15. /**
  16. * Simple wrapper for a vector of four `int`
  17. */
  18. CV_EXPORTS @interface Int4 : NSObject
  19. #pragma mark - Properties
  20. /**
  21. * First vector element
  22. */
  23. @property int v0;
  24. /**
  25. * Second vector element
  26. */
  27. @property int v1;
  28. /**
  29. * Third vector element
  30. */
  31. @property int v2;
  32. /**
  33. * Fourth vector element
  34. */
  35. @property int v3;
  36. #ifdef __cplusplus
  37. /**
  38. * The wrapped vector
  39. */
  40. @property(readonly) cv::Vec4i& nativeRef;
  41. #endif
  42. #pragma mark - Constructors
  43. /**
  44. * Create zero-initialize vecior
  45. */
  46. -(instancetype)init;
  47. /**
  48. * Create vector with specified element values
  49. * @param v0 First element
  50. * @param v1 Second element
  51. * @param v2 Third element
  52. * @param v3 Fourth element
  53. */
  54. -(instancetype)initWithV0:(int)v0 v1:(int)v1 v2:(int)v2 v3:(int)v3;
  55. /**
  56. * Create vector with specified element values
  57. * @param vals array of element values
  58. */
  59. -(instancetype)initWithVals:(NSArray<NSNumber*>*)vals;
  60. #ifdef __cplusplus
  61. +(instancetype)fromNative:(cv::Vec4i&)vec4i;
  62. #endif
  63. /**
  64. * Update vector with specified element values
  65. * @param vals array of element values
  66. */
  67. -(void)set:(NSArray<NSNumber*>*)vals NS_SWIFT_NAME(set(vals:));
  68. /**
  69. * Get vector as an array
  70. */
  71. -(NSArray<NSNumber*>*)get;
  72. #pragma mark - Common Methods
  73. /**
  74. * Compare for equality
  75. * @param other Object to compare
  76. */
  77. -(BOOL)isEqual:(nullable id)other;
  78. @end
  79. NS_ASSUME_NONNULL_END