001// ______________________________________________________
002// Generated by codegen - https://gitee.com/l0km/codegen 
003// template: thrift/client/perservice/client.async.decorator.class.vm
004// ______________________________________________________
005
006
007package net.gdface.sdk.thrift;
008import java.nio.ByteBuffer;
009import java.util.List;
010import java.util.Map;
011import net.gdface.image.MatType;
012import net.gdface.sdk.CodeInfo;
013import net.gdface.sdk.CompareResult;
014import net.gdface.sdk.FRect;
015import net.gdface.sdk.FaceApi;
016import net.gdface.sdk.FseResult;
017import net.gdface.thrift.TypeTransformer;
018
019import com.google.common.base.Function;
020import com.google.common.net.HostAndPort;
021import com.google.common.util.concurrent.FutureCallback;
022import com.google.common.util.concurrent.Futures;
023import com.google.common.util.concurrent.ListenableFuture;
024import net.gdface.thrift.ClientFactory;
025import static com.google.common.base.Preconditions.*;
026
027/**
028 * 基于thrift/swift框架生成的client端代码提供{@link FaceApi}接口的异步RPC实现(线程安全)<br>
029 * 转发所有{@link FaceApi}接口方法到{@link #delegate()}指定的实例<br>
030 * 所有服务端抛出的{@link RuntimeException}异常被封装到{@link ServiceRuntimeException}中抛出<br>
031 * Example:<br>
032 * <pre>
033 *        FaceApiThriftClientAsync thriftInstance = ClientFactory
034 *            .builder()
035 *            .setHostAndPort("127.0.0.1",26413)
036 *            .build(FaceApi.class, FaceApiThriftClientAsync.class);
037 * </pre>
038 * 计算机生成代码(generated by automated tools ThriftServiceDecoratorGenerator @author guyadong)<br>
039 * @author guyadong
040 *
041 */
042public class FaceApiThriftClientAsync {
043    private final ClientFactory factory;
044
045    public ClientFactory getFactory() {
046        return factory;
047    }
048    public FaceApiThriftClientAsync(ClientFactory factory) {
049        super();
050        this.factory = checkNotNull(factory,"factory is null");
051    }
052    /**
053     * @param host RPC service host
054     * @param port RPC service port 
055     */
056    public FaceApiThriftClientAsync(String host,int port) {
057        this(ClientFactory.builder().setHostAndPort(host,port));
058    }
059    /**
060     * @param hostAndPort RPC service host and port 
061     */
062    public FaceApiThriftClientAsync(HostAndPort hostAndPort) {
063        this(ClientFactory.builder().setHostAndPort(hostAndPort));
064    }
065    /**
066     * test if connectable for RPC service
067     * @return return {@code true} if connectable ,otherwise {@code false}
068     */
069    public boolean testConnect(){
070        return factory.testConnect();
071    }
072
073    /**
074     * @return 返回{@link net.gdface.sdk.thrift.client.FaceApi.Async}实例
075     */
076    protected net.gdface.sdk.thrift.client.FaceApi.Async delegate() {
077        return factory.applyInstance(net.gdface.sdk.thrift.client.FaceApi.Async.class);
078    }
079    @Override
080    public String toString() {
081        StringBuilder builder = new StringBuilder();
082        builder.append("FaceApiThriftClientAsync [factory=");
083        builder.append(factory);
084        builder.append(",interface=");
085        builder.append(FaceApi.class.getName());
086        builder.append("]");
087        return builder.toString();
088    }
089    /**
090     * 默认的{@link FutureCallback}实现
091     * @author guyadong
092     *
093     * @param <V>
094     */
095    public static class DefaultCallback<V> implements FutureCallback<V>{
096        @Override
097        public void onSuccess(V result) {
098            // DO NOTHING
099        }
100        @Override
101        public void onFailure(Throwable t) {
102            try{
103                throw t;
104            }
105            catch(net.gdface.sdk.thrift.client.ImageErrorException e){
106                onImageErrorException(e);
107            }
108            catch(net.gdface.sdk.thrift.client.NotFaceDetectedException e){
109                onNotFaceDetectedException(e);
110            }
111            catch(net.gdface.sdk.thrift.client.ServiceRuntimeException e){
112                onServiceRuntimeException(e);
113            }
114            catch(Throwable e){
115                onThrowable(e);
116            }
117        }
118        protected void onImageErrorException(net.gdface.sdk.thrift.client.ImageErrorException e){
119            System.out.println(e.getServiceStackTraceMessage());
120        }
121        protected void onNotFaceDetectedException(net.gdface.sdk.thrift.client.NotFaceDetectedException e){
122            System.out.println(e.getServiceStackTraceMessage());
123        }
124        protected void onServiceRuntimeException(net.gdface.sdk.thrift.client.ServiceRuntimeException e){
125            System.out.println(e.getServiceStackTraceMessage());
126        }
127        protected void onThrowable(Throwable e){
128            e.printStackTrace();
129        }
130    }
131    /**
132     * see also {@link net.gdface.sdk.FaceApi#compare2Face(byte[],net.gdface.sdk.CodeInfo,byte[],net.gdface.sdk.CodeInfo)}
133     */
134    public ListenableFuture<Double> compare2Face(byte[] imgData1,
135        CodeInfo facePos1,
136        byte[] imgData2,
137        CodeInfo facePos2){        
138        net.gdface.sdk.thrift.client.FaceApi.Async async = delegate();
139        ListenableFuture<Double> future = async.compare2Face(imgData1,
140            TypeTransformer.getInstance().to(
141                    facePos1,
142                    CodeInfo.class,
143                    net.gdface.sdk.thrift.client.CodeInfo.class),
144            imgData2,
145            TypeTransformer.getInstance().to(
146                    facePos2,
147                    CodeInfo.class,
148                    net.gdface.sdk.thrift.client.CodeInfo.class));
149        return factory.wrap(async,future);
150    }
151    public void compare2Face(byte[] imgData1,
152        CodeInfo facePos1,
153        byte[] imgData2,
154        CodeInfo facePos2,
155        FutureCallback<Double>callback){
156        factory.addCallback(compare2Face(imgData1,facePos1,imgData2,facePos2), callback);
157    }
158    /**
159     * see also {@link net.gdface.sdk.FaceApi#compareCode(byte[],byte[])}
160     */
161    public ListenableFuture<Double> compareCode(byte[] code1,
162        byte[] code2){        
163        net.gdface.sdk.thrift.client.FaceApi.Async async = delegate();
164        ListenableFuture<Double> future = async.compareCode(code1,
165            code2);
166        return factory.wrap(async,future);
167    }
168    public void compareCode(byte[] code1,
169        byte[] code2,
170        FutureCallback<Double>callback){
171        factory.addCallback(compareCode(code1,code2), callback);
172    }
173    /**
174     * see also {@link net.gdface.sdk.FaceApi#compareCodes(byte[],net.gdface.sdk.CodeInfo[])}
175     */
176    public ListenableFuture<double[]> compareCodes(byte[] code1,
177        CodeInfo[] codes){        
178        net.gdface.sdk.thrift.client.FaceApi.Async async = delegate();
179        ListenableFuture<double[]> future = Futures.transform(
180            async.compareCodes(code1,
181            TypeTransformer.getInstance().to(
182                    codes,
183                    CodeInfo.class,
184                    net.gdface.sdk.thrift.client.CodeInfo.class)),
185            new Function<java.util.List<Double>,double[]>(){
186                @Override
187                public double[] apply(java.util.List<Double> input) {
188                    return TypeTransformer.getInstance().todoubleArray(
189                    input,
190                    double.class,
191                    double.class);
192                }
193            });
194        return factory.wrap(async,future);
195    }
196    public void compareCodes(byte[] code1,
197        CodeInfo[] codes,
198        FutureCallback<double[]>callback){
199        factory.addCallback(compareCodes(code1,codes), callback);
200    }
201    /**
202     * see also {@link net.gdface.sdk.FaceApi#compareFaces(byte[],byte[],int)}
203     */
204    public ListenableFuture<CompareResult> compareFaces(byte[] code,
205        byte[] imgData,
206        int faceNum){        
207        net.gdface.sdk.thrift.client.FaceApi.Async async = delegate();
208        ListenableFuture<CompareResult> future = Futures.transform(
209            async.compareFaces(code,
210            imgData,
211            faceNum),
212            new Function<net.gdface.sdk.thrift.client.CompareResult,CompareResult>(){
213                @Override
214                public CompareResult apply(net.gdface.sdk.thrift.client.CompareResult input) {
215                    return TypeTransformer.getInstance().to(
216                    input,
217                    net.gdface.sdk.thrift.client.CompareResult.class,
218                    CompareResult.class);
219                }
220            });
221        return factory.wrap(async,future);
222    }
223    public void compareFaces(byte[] code,
224        byte[] imgData,
225        int faceNum,
226        FutureCallback<CompareResult>callback){
227        factory.addCallback(compareFaces(code,imgData,faceNum), callback);
228    }
229    /**
230     * see also {@link net.gdface.sdk.FaceApi#compareFeatures(byte[],java.util.List)}
231     */
232    public ListenableFuture<List<Double>> compareFeatures(byte[] code1,
233        List<byte[]> codes){        
234        net.gdface.sdk.thrift.client.FaceApi.Async async = delegate();
235        ListenableFuture<List<Double>> future = async.compareFeatures(code1,
236            TypeTransformer.getInstance().to(
237                    codes,
238                    byte[].class,
239                    byte[].class));
240        return factory.wrap(async,future);
241    }
242    public void compareFeatures(byte[] code1,
243        List<byte[]> codes,
244        FutureCallback<List<Double>>callback){
245        factory.addCallback(compareFeatures(code1,codes), callback);
246    }
247    /**
248     * see also {@link net.gdface.sdk.FaceApi#detectAndCompare2Face(byte[],net.gdface.sdk.FRect,byte[],net.gdface.sdk.FRect)}
249     */
250    public ListenableFuture<Double> detectAndCompare2Face(byte[] imgData1,
251        FRect detectRect1,
252        byte[] imgData2,
253        FRect detectRect2){        
254        net.gdface.sdk.thrift.client.FaceApi.Async async = delegate();
255        ListenableFuture<Double> future = async.detectAndCompare2Face(imgData1,
256            TypeTransformer.getInstance().to(
257                    detectRect1,
258                    FRect.class,
259                    net.gdface.sdk.thrift.client.FRect.class),
260            imgData2,
261            TypeTransformer.getInstance().to(
262                    detectRect2,
263                    FRect.class,
264                    net.gdface.sdk.thrift.client.FRect.class));
265        return factory.wrap(async,future);
266    }
267    public void detectAndCompare2Face(byte[] imgData1,
268        FRect detectRect1,
269        byte[] imgData2,
270        FRect detectRect2,
271        FutureCallback<Double>callback){
272        factory.addCallback(detectAndCompare2Face(imgData1,detectRect1,imgData2,detectRect2), callback);
273    }
274    /**
275     * see also {@link net.gdface.sdk.FaceApi#detectAndGetCodeInfo(byte[],int)}
276     */
277    public ListenableFuture<CodeInfo[]> detectAndGetCodeInfo(byte[] imgData,
278        int faceNum){        
279        net.gdface.sdk.thrift.client.FaceApi.Async async = delegate();
280        ListenableFuture<CodeInfo[]> future = Futures.transform(
281            async.detectAndGetCodeInfo(imgData,
282            faceNum),
283            new Function<java.util.List<net.gdface.sdk.thrift.client.CodeInfo>,CodeInfo[]>(){
284                @Override
285                public CodeInfo[] apply(java.util.List<net.gdface.sdk.thrift.client.CodeInfo> input) {
286                    return TypeTransformer.getInstance().toArray(
287                    input,
288                    net.gdface.sdk.thrift.client.CodeInfo.class,
289                    CodeInfo.class);
290                }
291            });
292        return factory.wrap(async,future);
293    }
294    public void detectAndGetCodeInfo(byte[] imgData,
295        int faceNum,
296        FutureCallback<CodeInfo[]>callback){
297        factory.addCallback(detectAndGetCodeInfo(imgData,faceNum), callback);
298    }
299    /**
300     * see also {@link net.gdface.sdk.FaceApi#detectCenterFace(byte[])}
301     */
302    public ListenableFuture<CodeInfo> detectCenterFace(byte[] imgData){        
303        net.gdface.sdk.thrift.client.FaceApi.Async async = delegate();
304        ListenableFuture<CodeInfo> future = Futures.transform(
305            async.detectCenterFace(imgData),
306            new Function<net.gdface.sdk.thrift.client.CodeInfo,CodeInfo>(){
307                @Override
308                public CodeInfo apply(net.gdface.sdk.thrift.client.CodeInfo input) {
309                    return TypeTransformer.getInstance().to(
310                    input,
311                    net.gdface.sdk.thrift.client.CodeInfo.class,
312                    CodeInfo.class);
313                }
314            });
315        return factory.wrap(async,future);
316    }
317    public void detectCenterFace(byte[] imgData,
318        FutureCallback<CodeInfo>callback){
319        factory.addCallback(detectCenterFace(imgData), callback);
320    }
321    /**
322     * see also {@link net.gdface.sdk.FaceApi#detectFace(byte[])}
323     */
324    public ListenableFuture<CodeInfo[]> detectFace(byte[] imgData){        
325        net.gdface.sdk.thrift.client.FaceApi.Async async = delegate();
326        ListenableFuture<CodeInfo[]> future = Futures.transform(
327            async.detectFace(imgData),
328            new Function<java.util.List<net.gdface.sdk.thrift.client.CodeInfo>,CodeInfo[]>(){
329                @Override
330                public CodeInfo[] apply(java.util.List<net.gdface.sdk.thrift.client.CodeInfo> input) {
331                    return TypeTransformer.getInstance().toArray(
332                    input,
333                    net.gdface.sdk.thrift.client.CodeInfo.class,
334                    CodeInfo.class);
335                }
336            });
337        return factory.wrap(async,future);
338    }
339    public void detectFace(byte[] imgData,
340        FutureCallback<CodeInfo[]>callback){
341        factory.addCallback(detectFace(imgData), callback);
342    }
343    /**
344     * see also {@link net.gdface.sdk.FaceApi#detectMaxFace(byte[])}
345     */
346    public ListenableFuture<CodeInfo> detectMaxFace(byte[] imgData){        
347        net.gdface.sdk.thrift.client.FaceApi.Async async = delegate();
348        ListenableFuture<CodeInfo> future = Futures.transform(
349            async.detectMaxFace(imgData),
350            new Function<net.gdface.sdk.thrift.client.CodeInfo,CodeInfo>(){
351                @Override
352                public CodeInfo apply(net.gdface.sdk.thrift.client.CodeInfo input) {
353                    return TypeTransformer.getInstance().to(
354                    input,
355                    net.gdface.sdk.thrift.client.CodeInfo.class,
356                    CodeInfo.class);
357                }
358            });
359        return factory.wrap(async,future);
360    }
361    public void detectMaxFace(byte[] imgData,
362        FutureCallback<CodeInfo>callback){
363        factory.addCallback(detectMaxFace(imgData), callback);
364    }
365    /**
366     * see also {@link net.gdface.sdk.FaceApi#getCodeInfo(byte[],int,net.gdface.sdk.CodeInfo[])}
367     */
368    public ListenableFuture<CodeInfo[]> getCodeInfo(byte[] imgData,
369        int faceNum,
370        CodeInfo[] facePos){        
371        net.gdface.sdk.thrift.client.FaceApi.Async async = delegate();
372        ListenableFuture<CodeInfo[]> future = Futures.transform(
373            async.getCodeInfo(imgData,
374            faceNum,
375            TypeTransformer.getInstance().to(
376                    facePos,
377                    CodeInfo.class,
378                    net.gdface.sdk.thrift.client.CodeInfo.class)),
379            new Function<java.util.List<net.gdface.sdk.thrift.client.CodeInfo>,CodeInfo[]>(){
380                @Override
381                public CodeInfo[] apply(java.util.List<net.gdface.sdk.thrift.client.CodeInfo> input) {
382                    return TypeTransformer.getInstance().toArray(
383                    input,
384                    net.gdface.sdk.thrift.client.CodeInfo.class,
385                    CodeInfo.class);
386                }
387            });
388        return factory.wrap(async,future);
389    }
390    public void getCodeInfo(byte[] imgData,
391        int faceNum,
392        CodeInfo[] facePos,
393        FutureCallback<CodeInfo[]>callback){
394        factory.addCallback(getCodeInfo(imgData,faceNum,facePos), callback);
395    }
396    /**
397     * see also {@link net.gdface.sdk.FaceApi#getCodeInfo(byte[],net.gdface.sdk.CodeInfo)}
398     */
399    public ListenableFuture<CodeInfo> getCodeInfo(byte[] imgData,
400        CodeInfo facePos){        
401        net.gdface.sdk.thrift.client.FaceApi.Async async = delegate();
402        ListenableFuture<CodeInfo> future = Futures.transform(
403            async.getCodeInfoSingle(imgData,
404            TypeTransformer.getInstance().to(
405                    facePos,
406                    CodeInfo.class,
407                    net.gdface.sdk.thrift.client.CodeInfo.class)),
408            new Function<net.gdface.sdk.thrift.client.CodeInfo,CodeInfo>(){
409                @Override
410                public CodeInfo apply(net.gdface.sdk.thrift.client.CodeInfo input) {
411                    return TypeTransformer.getInstance().to(
412                    input,
413                    net.gdface.sdk.thrift.client.CodeInfo.class,
414                    CodeInfo.class);
415                }
416            });
417        return factory.wrap(async,future);
418    }
419    public void getCodeInfo(byte[] imgData,
420        CodeInfo facePos,
421        FutureCallback<CodeInfo>callback){
422        factory.addCallback(getCodeInfo(imgData,facePos), callback);
423    }
424    /**
425     * see also {@link net.gdface.sdk.FaceApi#getFeature(java.util.Map)}
426     */
427    public ListenableFuture<byte[]> getFeature(Map<ByteBuffer, CodeInfo> faces){        
428        net.gdface.sdk.thrift.client.FaceApi.Async async = delegate();
429        ListenableFuture<byte[]> future = async.getFeature(TypeTransformer.getInstance().to(
430                    faces,
431                    ByteBuffer.class,
432                    CodeInfo.class,
433                    byte[].class,
434                    net.gdface.sdk.thrift.client.CodeInfo.class));
435        return factory.wrap(async,future);
436    }
437    public void getFeature(Map<ByteBuffer, CodeInfo> faces,
438        FutureCallback<byte[]>callback){
439        factory.addCallback(getFeature(faces), callback);
440    }
441    /**
442     * see also {@link net.gdface.sdk.FaceApi#hasFace(byte[])}
443     */
444    public ListenableFuture<Boolean> hasFace(byte[] imgData){        
445        net.gdface.sdk.thrift.client.FaceApi.Async async = delegate();
446        ListenableFuture<Boolean> future = async.hasFace(imgData);
447        return factory.wrap(async,future);
448    }
449    public void hasFace(byte[] imgData,
450        FutureCallback<Boolean>callback){
451        factory.addCallback(hasFace(imgData), callback);
452    }
453    /**
454     * see also {@link net.gdface.sdk.FaceApi#isLocal()}
455     */
456    public boolean isLocal(){
457        return false;
458    }
459    /**
460     * see also {@link net.gdface.sdk.FaceApi#matDetectAndGetCodeInfo(net.gdface.image.MatType,byte[],int,int,int)}
461     */
462    public ListenableFuture<CodeInfo[]> matDetectAndGetCodeInfo(MatType matType,
463        byte[] matData,
464        int width,
465        int height,
466        int faceNum){        
467        net.gdface.sdk.thrift.client.FaceApi.Async async = delegate();
468        ListenableFuture<CodeInfo[]> future = Futures.transform(
469            async.matDetectAndGetCodeInfo(TypeTransformer.getInstance().to(
470                    matType,
471                    MatType.class,
472                    net.gdface.sdk.thrift.client.MatType.class),
473            matData,
474            width,
475            height,
476            faceNum),
477            new Function<java.util.List<net.gdface.sdk.thrift.client.CodeInfo>,CodeInfo[]>(){
478                @Override
479                public CodeInfo[] apply(java.util.List<net.gdface.sdk.thrift.client.CodeInfo> input) {
480                    return TypeTransformer.getInstance().toArray(
481                    input,
482                    net.gdface.sdk.thrift.client.CodeInfo.class,
483                    CodeInfo.class);
484                }
485            });
486        return factory.wrap(async,future);
487    }
488    public void matDetectAndGetCodeInfo(MatType matType,
489        byte[] matData,
490        int width,
491        int height,
492        int faceNum,
493        FutureCallback<CodeInfo[]>callback){
494        factory.addCallback(matDetectAndGetCodeInfo(matType,matData,width,height,faceNum), callback);
495    }
496    /**
497     * see also {@link net.gdface.sdk.FaceApi#matDetectFace(net.gdface.image.MatType,byte[],int,int)}
498     */
499    public ListenableFuture<CodeInfo[]> matDetectFace(MatType matType,
500        byte[] matData,
501        int width,
502        int height){        
503        net.gdface.sdk.thrift.client.FaceApi.Async async = delegate();
504        ListenableFuture<CodeInfo[]> future = Futures.transform(
505            async.matDetectFace(TypeTransformer.getInstance().to(
506                    matType,
507                    MatType.class,
508                    net.gdface.sdk.thrift.client.MatType.class),
509            matData,
510            width,
511            height),
512            new Function<java.util.List<net.gdface.sdk.thrift.client.CodeInfo>,CodeInfo[]>(){
513                @Override
514                public CodeInfo[] apply(java.util.List<net.gdface.sdk.thrift.client.CodeInfo> input) {
515                    return TypeTransformer.getInstance().toArray(
516                    input,
517                    net.gdface.sdk.thrift.client.CodeInfo.class,
518                    CodeInfo.class);
519                }
520            });
521        return factory.wrap(async,future);
522    }
523    public void matDetectFace(MatType matType,
524        byte[] matData,
525        int width,
526        int height,
527        FutureCallback<CodeInfo[]>callback){
528        factory.addCallback(matDetectFace(matType,matData,width,height), callback);
529    }
530    /**
531     * see also {@link net.gdface.sdk.FaceApi#matDetectMaxFace(net.gdface.image.MatType,byte[],int,int)}
532     */
533    public ListenableFuture<CodeInfo> matDetectMaxFace(MatType matType,
534        byte[] matData,
535        int width,
536        int height){        
537        net.gdface.sdk.thrift.client.FaceApi.Async async = delegate();
538        ListenableFuture<CodeInfo> future = Futures.transform(
539            async.matDetectMaxFace(TypeTransformer.getInstance().to(
540                    matType,
541                    MatType.class,
542                    net.gdface.sdk.thrift.client.MatType.class),
543            matData,
544            width,
545            height),
546            new Function<net.gdface.sdk.thrift.client.CodeInfo,CodeInfo>(){
547                @Override
548                public CodeInfo apply(net.gdface.sdk.thrift.client.CodeInfo input) {
549                    return TypeTransformer.getInstance().to(
550                    input,
551                    net.gdface.sdk.thrift.client.CodeInfo.class,
552                    CodeInfo.class);
553                }
554            });
555        return factory.wrap(async,future);
556    }
557    public void matDetectMaxFace(MatType matType,
558        byte[] matData,
559        int width,
560        int height,
561        FutureCallback<CodeInfo>callback){
562        factory.addCallback(matDetectMaxFace(matType,matData,width,height), callback);
563    }
564    /**
565     * see also {@link net.gdface.sdk.FaceApi#matGetCodeInfo(net.gdface.image.MatType,byte[],int,int,int,net.gdface.sdk.CodeInfo[])}
566     */
567    public ListenableFuture<CodeInfo[]> matGetCodeInfo(MatType matType,
568        byte[] matData,
569        int width,
570        int height,
571        int facenum,
572        CodeInfo[] facePos){        
573        net.gdface.sdk.thrift.client.FaceApi.Async async = delegate();
574        ListenableFuture<CodeInfo[]> future = Futures.transform(
575            async.matGetCodeInfo(TypeTransformer.getInstance().to(
576                    matType,
577                    MatType.class,
578                    net.gdface.sdk.thrift.client.MatType.class),
579            matData,
580            width,
581            height,
582            facenum,
583            TypeTransformer.getInstance().to(
584                    facePos,
585                    CodeInfo.class,
586                    net.gdface.sdk.thrift.client.CodeInfo.class)),
587            new Function<java.util.List<net.gdface.sdk.thrift.client.CodeInfo>,CodeInfo[]>(){
588                @Override
589                public CodeInfo[] apply(java.util.List<net.gdface.sdk.thrift.client.CodeInfo> input) {
590                    return TypeTransformer.getInstance().toArray(
591                    input,
592                    net.gdface.sdk.thrift.client.CodeInfo.class,
593                    CodeInfo.class);
594                }
595            });
596        return factory.wrap(async,future);
597    }
598    public void matGetCodeInfo(MatType matType,
599        byte[] matData,
600        int width,
601        int height,
602        int facenum,
603        CodeInfo[] facePos,
604        FutureCallback<CodeInfo[]>callback){
605        factory.addCallback(matGetCodeInfo(matType,matData,width,height,facenum,facePos), callback);
606    }
607    /**
608     * see also {@link net.gdface.sdk.FaceApi#matGetCodeInfo(net.gdface.image.MatType,byte[],int,int,net.gdface.sdk.CodeInfo)}
609     */
610    public ListenableFuture<CodeInfo> matGetCodeInfo(MatType matType,
611        byte[] matData,
612        int width,
613        int height,
614        CodeInfo facePos){        
615        net.gdface.sdk.thrift.client.FaceApi.Async async = delegate();
616        ListenableFuture<CodeInfo> future = Futures.transform(
617            async.matGetCodeInfoSingle(TypeTransformer.getInstance().to(
618                    matType,
619                    MatType.class,
620                    net.gdface.sdk.thrift.client.MatType.class),
621            matData,
622            width,
623            height,
624            TypeTransformer.getInstance().to(
625                    facePos,
626                    CodeInfo.class,
627                    net.gdface.sdk.thrift.client.CodeInfo.class)),
628            new Function<net.gdface.sdk.thrift.client.CodeInfo,CodeInfo>(){
629                @Override
630                public CodeInfo apply(net.gdface.sdk.thrift.client.CodeInfo input) {
631                    return TypeTransformer.getInstance().to(
632                    input,
633                    net.gdface.sdk.thrift.client.CodeInfo.class,
634                    CodeInfo.class);
635                }
636            });
637        return factory.wrap(async,future);
638    }
639    public void matGetCodeInfo(MatType matType,
640        byte[] matData,
641        int width,
642        int height,
643        CodeInfo facePos,
644        FutureCallback<CodeInfo>callback){
645        factory.addCallback(matGetCodeInfo(matType,matData,width,height,facePos), callback);
646    }
647    /**
648     * see also {@link net.gdface.sdk.FaceApi#matHasFace(net.gdface.image.MatType,byte[],int,int)}
649     */
650    public ListenableFuture<Boolean> matHasFace(MatType matType,
651        byte[] matData,
652        int width,
653        int height){        
654        net.gdface.sdk.thrift.client.FaceApi.Async async = delegate();
655        ListenableFuture<Boolean> future = async.matHasFace(TypeTransformer.getInstance().to(
656                    matType,
657                    MatType.class,
658                    net.gdface.sdk.thrift.client.MatType.class),
659            matData,
660            width,
661            height);
662        return factory.wrap(async,future);
663    }
664    public void matHasFace(MatType matType,
665        byte[] matData,
666        int width,
667        int height,
668        FutureCallback<Boolean>callback){
669        factory.addCallback(matHasFace(matType,matData,width,height), callback);
670    }
671    /**
672     * see also {@link net.gdface.sdk.FaceApi#matSearchFaces(net.gdface.image.MatType,byte[],int,int,net.gdface.sdk.CodeInfo,double,int)}
673     */
674    public ListenableFuture<FseResult[]> matSearchFaces(MatType matType,
675        byte[] matData,
676        int width,
677        int height,
678        CodeInfo facePos,
679        double similarty,
680        int rows){        
681        net.gdface.sdk.thrift.client.FaceApi.Async async = delegate();
682        ListenableFuture<FseResult[]> future = Futures.transform(
683            async.matSearchFaces(TypeTransformer.getInstance().to(
684                    matType,
685                    MatType.class,
686                    net.gdface.sdk.thrift.client.MatType.class),
687            matData,
688            width,
689            height,
690            TypeTransformer.getInstance().to(
691                    facePos,
692                    CodeInfo.class,
693                    net.gdface.sdk.thrift.client.CodeInfo.class),
694            similarty,
695            rows),
696            new Function<java.util.List<net.gdface.sdk.thrift.client.FseResult>,FseResult[]>(){
697                @Override
698                public FseResult[] apply(java.util.List<net.gdface.sdk.thrift.client.FseResult> input) {
699                    return TypeTransformer.getInstance().toArray(
700                    input,
701                    net.gdface.sdk.thrift.client.FseResult.class,
702                    FseResult.class);
703                }
704            });
705        return factory.wrap(async,future);
706    }
707    public void matSearchFaces(MatType matType,
708        byte[] matData,
709        int width,
710        int height,
711        CodeInfo facePos,
712        double similarty,
713        int rows,
714        FutureCallback<FseResult[]>callback){
715        factory.addCallback(matSearchFaces(matType,matData,width,height,facePos,similarty,rows), callback);
716    }
717    /**
718     * see also {@link net.gdface.sdk.FaceApi#matWearMask(net.gdface.image.MatType,byte[],int,int,net.gdface.sdk.CodeInfo)}
719     */
720    public ListenableFuture<Boolean> matWearMask(MatType matType,
721        byte[] matData,
722        int width,
723        int height,
724        CodeInfo faceInfo){        
725        net.gdface.sdk.thrift.client.FaceApi.Async async = delegate();
726        ListenableFuture<Boolean> future = async.matWearMask(TypeTransformer.getInstance().to(
727                    matType,
728                    MatType.class,
729                    net.gdface.sdk.thrift.client.MatType.class),
730            matData,
731            width,
732            height,
733            TypeTransformer.getInstance().to(
734                    faceInfo,
735                    CodeInfo.class,
736                    net.gdface.sdk.thrift.client.CodeInfo.class));
737        return factory.wrap(async,future);
738    }
739    public void matWearMask(MatType matType,
740        byte[] matData,
741        int width,
742        int height,
743        CodeInfo faceInfo,
744        FutureCallback<Boolean>callback){
745        factory.addCallback(matWearMask(matType,matData,width,height,faceInfo), callback);
746    }
747    /**
748     * see also {@link net.gdface.sdk.FaceApi#sdkCapacity()}
749     */
750    public ListenableFuture<Map<String, String>> sdkCapacity(){        
751        net.gdface.sdk.thrift.client.FaceApi.Async async = delegate();
752        ListenableFuture<Map<String, String>> future = async.sdkCapacity();
753        return factory.wrap(async,future);
754    }
755    public void sdkCapacity(FutureCallback<Map<String, String>>callback){
756        factory.addCallback(sdkCapacity(), callback);
757    }
758    /**
759     * see also {@link net.gdface.sdk.FaceApi#searchFaces(byte[],net.gdface.sdk.CodeInfo,double,int)}
760     */
761    public ListenableFuture<FseResult[]> searchFaces(byte[] imgData,
762        CodeInfo facePos,
763        double similarty,
764        int rows){        
765        net.gdface.sdk.thrift.client.FaceApi.Async async = delegate();
766        ListenableFuture<FseResult[]> future = Futures.transform(
767            async.searchFaces(imgData,
768            TypeTransformer.getInstance().to(
769                    facePos,
770                    CodeInfo.class,
771                    net.gdface.sdk.thrift.client.CodeInfo.class),
772            similarty,
773            rows),
774            new Function<java.util.List<net.gdface.sdk.thrift.client.FseResult>,FseResult[]>(){
775                @Override
776                public FseResult[] apply(java.util.List<net.gdface.sdk.thrift.client.FseResult> input) {
777                    return TypeTransformer.getInstance().toArray(
778                    input,
779                    net.gdface.sdk.thrift.client.FseResult.class,
780                    FseResult.class);
781                }
782            });
783        return factory.wrap(async,future);
784    }
785    public void searchFaces(byte[] imgData,
786        CodeInfo facePos,
787        double similarty,
788        int rows,
789        FutureCallback<FseResult[]>callback){
790        factory.addCallback(searchFaces(imgData,facePos,similarty,rows), callback);
791    }
792    /**
793     * see also {@link net.gdface.sdk.FaceApi#searchFeatures(byte[],double,int)}
794     */
795    public ListenableFuture<FseResult[]> searchFeatures(byte[] feature,
796        double similarty,
797        int rows){        
798        net.gdface.sdk.thrift.client.FaceApi.Async async = delegate();
799        ListenableFuture<FseResult[]> future = Futures.transform(
800            async.searchFeatures(feature,
801            similarty,
802            rows),
803            new Function<java.util.List<net.gdface.sdk.thrift.client.FseResult>,FseResult[]>(){
804                @Override
805                public FseResult[] apply(java.util.List<net.gdface.sdk.thrift.client.FseResult> input) {
806                    return TypeTransformer.getInstance().toArray(
807                    input,
808                    net.gdface.sdk.thrift.client.FseResult.class,
809                    FseResult.class);
810                }
811            });
812        return factory.wrap(async,future);
813    }
814    public void searchFeatures(byte[] feature,
815        double similarty,
816        int rows,
817        FutureCallback<FseResult[]>callback){
818        factory.addCallback(searchFeatures(feature,similarty,rows), callback);
819    }
820    /**
821     * see also {@link net.gdface.sdk.FaceApi#wearMask(byte[],net.gdface.sdk.CodeInfo)}
822     */
823    public ListenableFuture<Boolean> wearMask(byte[] imgData,
824        CodeInfo faceInfo){        
825        net.gdface.sdk.thrift.client.FaceApi.Async async = delegate();
826        ListenableFuture<Boolean> future = async.wearMask(imgData,
827            TypeTransformer.getInstance().to(
828                    faceInfo,
829                    CodeInfo.class,
830                    net.gdface.sdk.thrift.client.CodeInfo.class));
831        return factory.wrap(async,future);
832    }
833    public void wearMask(byte[] imgData,
834        CodeInfo faceInfo,
835        FutureCallback<Boolean>callback){
836        factory.addCallback(wearMask(imgData,faceInfo), callback);
837    }
838}