//============================================================================================================================= // // EasyAR Sense 3.1.0-final-7bf6504c6 // Copyright (c) 2015-2020 VisionStar Information Technology (Shanghai) Co., Ltd. All Rights Reserved. // EasyAR is the registered trademark or trademark of VisionStar Information Technology (Shanghai) Co., Ltd in China // and other countries for the augmented reality technology developed by VisionStar Information Technology (Shanghai) Co., Ltd. // //============================================================================================================================= #import "easyar/types.oc.h" /// /// Buffer stores a raw byte array, which can be used to access image data. /// To access image data in Java API, get buffer from `Image`_ and copy to a Java byte array. /// You can always access image data since the first version of EasyAR Sense. Refer to `Image`_ . /// @interface easyar_Buffer : easyar_RefBase + (instancetype)new NS_UNAVAILABLE; - (instancetype)init NS_UNAVAILABLE; /// /// Wraps a raw memory block. When Buffer is released by all holders, deleter callback will be invoked to execute user-defined memory destruction. deleter must be thread-safe. /// + (easyar_Buffer *)wrap:(void *)ptr size:(int)size deleter:(void (^)())deleter; /// /// Creates a Buffer of specified byte size. /// + (easyar_Buffer *)create:(int)size; /// /// Returns raw data address. /// - (void *)data; /// /// Byte size of raw data. /// - (int)size; /// /// Copies raw memory. It can be used in languages or platforms without complete support for memory operations. /// + (void)memoryCopy:(void *)src dest:(void *)dest length:(int)length; /// /// Tries to copy data from a raw memory address into Buffer. If copy succeeds, it returns true, or else it returns false. Possible failure causes includes: source or destination data range overflow. /// - (bool)tryCopyFrom:(void *)src srcIndex:(int)srcIndex index:(int)index length:(int)length; /// /// Copies buffer data to user array. /// - (bool)tryCopyTo:(int)index dest:(void *)dest destIndex:(int)destIndex length:(int)length; /// /// Creates a sub-buffer with a reference to the original Buffer. A Buffer will only be released after all its sub-buffers are released. /// - (easyar_Buffer *)partition:(int)index length:(int)length; @end /// /// A mapping from file path to `Buffer`_ . It can be used to represent multiple files in the memory. /// @interface easyar_BufferDictionary : easyar_RefBase + (instancetype)new NS_UNAVAILABLE; - (instancetype)init NS_UNAVAILABLE; + (easyar_BufferDictionary *) create; /// /// Current file count. /// - (int)count; /// /// Checks if a specified path is in the dictionary. /// - (bool)contains:(NSString *)path; /// /// Tries to get the corresponding `Buffer`_ for a specified path. /// - (easyar_Buffer *)tryGet:(NSString *)path; /// /// Sets `Buffer`_ for a specified path. /// - (void)set:(NSString *)path buffer:(easyar_Buffer *)buffer; /// /// Removes a specified path. /// - (bool)remove:(NSString *)path; /// /// Clears the dictionary. /// - (void)clear; @end