Qpid Proton C API  0.38.0
object.h
1 #ifndef PROTON_OBJECT_H
2 #define PROTON_OBJECT_H 1
3 
4 /*
5  *
6  * Licensed to the Apache Software Foundation (ASF) under one
7  * or more contributor license agreements. See the NOTICE file
8  * distributed with this work for additional information
9  * regarding copyright ownership. The ASF licenses this file
10  * to you under the Apache License, Version 2.0 (the
11  * "License"); you may not use this file except in compliance
12  * with the License. You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing,
17  * software distributed under the License is distributed on an
18  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19  * KIND, either express or implied. See the License for the
20  * specific language governing permissions and limitations
21  * under the License.
22  *
23  */
24 
25 #include <proton/cid.h>
26 #include <proton/types.h>
27 #include <proton/import_export.h>
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
36 PN_EXTERN pn_class_t *pn_class_create(const char *name,
37  void (*initialize)(void*),
38  void (*finalize)(void*),
39  void (*incref)(void*),
40  void (*decref)(void*),
41  int (*refcount)(void*));
42 
43 PN_EXTERN void *pn_class_new(const pn_class_t *clazz, size_t size);
44 PN_EXTERN const char *pn_class_name(const pn_class_t *clazz);
45 PN_EXTERN pn_cid_t pn_class_id(const pn_class_t *clazz);
46 
47 PN_EXTERN const pn_class_t *pn_class(void* object);
48 PN_EXTERN void *pn_incref(void *object);
49 PN_EXTERN int pn_decref(void *object);
50 PN_EXTERN int pn_refcount(void *object);
51 PN_EXTERN void pn_free(void *object);
52 PN_EXTERN char *pn_tostring(void *object);
53 
54 #define PN_LEGCTX ((pn_handle_t) 0)
55 
73 #define PN_HANDLE(name) \
74 static const char _PN_HANDLE_ ## name = 0; \
75 static const pn_handle_t name = ((pn_handle_t) &_PN_HANDLE_ ## name);
76 
77 PN_EXTERN extern const pn_class_t *PN_OBJECT;
78 PN_EXTERN extern const pn_class_t *PN_VOID;
79 
80 PN_EXTERN pn_record_t *pn_record(void);
81 PN_EXTERN void pn_record_def(pn_record_t *record, pn_handle_t key, const pn_class_t *clazz);
82 PN_EXTERN bool pn_record_has(pn_record_t *record, pn_handle_t key);
83 PN_EXTERN void *pn_record_get(pn_record_t *record, pn_handle_t key);
84 PN_EXTERN void pn_record_set(pn_record_t *record, pn_handle_t key, void *value);
85 PN_EXTERN void pn_record_clear(pn_record_t *record);
86 
91 #ifdef __cplusplus
92 }
93 #endif
94 
95 #endif /* object.h */
AMQP and API data types.
const void * pn_handle_t
A type to represent the internal navigational state of a proton object.
Definition: types.h:467
struct pn_record_t pn_record_t
A type representing attached context information.
Definition: types.h:477
struct pn_class_t pn_class_t
A type representing the type of a proton internal object.
Definition: types.h:472