Upload packaging folder
[platform/upstream/iotjs.git] / tools / src / iotjs_objectwrap.h
1 /* Copyright 2015-present Samsung Electronics Co., Ltd. and other contributors
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15
16 #ifndef IOTJS_OBJECTWRAP_H
17 #define IOTJS_OBJECTWRAP_H
18
19
20 #include "iotjs_binding.h"
21
22
23 // This wrapper refer javascript object but never increase reference count
24 // If the object is freed by GC, then this wrapper instance will be also freed.
25 typedef struct {
26   iotjs_jval_t jobject;
27 } IOTJS_VALIDATED_STRUCT(iotjs_jobjectwrap_t);
28
29 void iotjs_jobjectwrap_initialize(iotjs_jobjectwrap_t* jobjectwrap,
30                                   const iotjs_jval_t* jobject,
31                                   JFreeHandlerType jfreehandler);
32
33 void iotjs_jobjectwrap_destroy(iotjs_jobjectwrap_t* jobjectwrap);
34
35 iotjs_jval_t* iotjs_jobjectwrap_jobject(iotjs_jobjectwrap_t* jobjectwrap);
36 iotjs_jobjectwrap_t* iotjs_jobjectwrap_from_jobject(
37     const iotjs_jval_t* jobject);
38
39
40 #endif /* IOTJS_OBJECTWRAP_H */