You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rh...@apache.org on 2014/09/17 21:48:00 UTC
svn commit: r1625782 - in /qpid/proton/trunk/proton-c: include/proton/cid.h
include/proton/object.h src/messenger/store.c src/messenger/subscription.c
src/messenger/transform.c src/object/iterator.c src/object/map.c
src/object/object.c src/tests/object.c
Author: rhs
Date: Wed Sep 17 19:47:59 2014
New Revision: 1625782
URL: http://svn.apache.org/r1625782
Log:
added class ids
Added:
qpid/proton/trunk/proton-c/include/proton/cid.h
Modified:
qpid/proton/trunk/proton-c/include/proton/object.h
qpid/proton/trunk/proton-c/src/messenger/store.c
qpid/proton/trunk/proton-c/src/messenger/subscription.c
qpid/proton/trunk/proton-c/src/messenger/transform.c
qpid/proton/trunk/proton-c/src/object/iterator.c
qpid/proton/trunk/proton-c/src/object/map.c
qpid/proton/trunk/proton-c/src/object/object.c
qpid/proton/trunk/proton-c/src/tests/object.c
Added: qpid/proton/trunk/proton-c/include/proton/cid.h
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/include/proton/cid.h?rev=1625782&view=auto
==============================================================================
--- qpid/proton/trunk/proton-c/include/proton/cid.h (added)
+++ qpid/proton/trunk/proton-c/include/proton/cid.h Wed Sep 17 19:47:59 2014
@@ -0,0 +1,54 @@
+#ifndef PROTON_CID_H
+#define PROTON_CID_H 1
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+typedef enum {
+ CID_pn_object = 1,
+ CID_pn_void,
+ CID_pn_weakref,
+
+ CID_pn_string,
+ CID_pn_list,
+ CID_pn_map,
+ CID_pn_hash,
+
+ CID_pn_collector,
+ CID_pn_event,
+
+ CID_pn_encoder,
+ CID_pn_decoder,
+ CID_pn_data,
+
+ CID_pn_connection,
+ CID_pn_session,
+ CID_pn_link,
+ CID_pn_delivery,
+ CID_pn_transport,
+
+ CID_pn_message,
+
+ CID_pn_io,
+ CID_pn_selector,
+ CID_pn_selectable
+} pn_cid_t;
+
+#endif /* cid.h */
Modified: qpid/proton/trunk/proton-c/include/proton/object.h
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/include/proton/object.h?rev=1625782&r1=1625781&r2=1625782&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/include/proton/object.h (original)
+++ qpid/proton/trunk/proton-c/include/proton/object.h Wed Sep 17 19:47:59 2014
@@ -22,6 +22,7 @@
*
*/
+#include <proton/cid.h>
#include <proton/types.h>
#include <stdarg.h>
#include <proton/type_compat.h>
@@ -45,6 +46,7 @@ typedef struct pn_iterator_t pn_iterator
struct pn_class_t {
const char *name;
+ const pn_cid_t cid;
void *(*newinst)(const pn_class_t *, size_t);
void (*initialize)(void *);
void (*incref)(void *);
@@ -64,6 +66,7 @@ PN_EXTERN extern const pn_class_t *PN_WE
#define PN_CLASS(PREFIX) { \
#PREFIX, \
+ CID_ ## PREFIX, \
pn_object_new, \
PREFIX ## _initialize, \
pn_object_incref, \
@@ -79,6 +82,7 @@ PN_EXTERN extern const pn_class_t *PN_WE
#define PN_METACLASS(PREFIX) { \
#PREFIX, \
+ CID_ ## PREFIX, \
PREFIX ## _new, \
PREFIX ## _initialize, \
PREFIX ## _incref, \
@@ -92,6 +96,7 @@ PN_EXTERN extern const pn_class_t *PN_WE
PREFIX ## _inspect \
}
+PN_EXTERN pn_cid_t pn_class_id(const pn_class_t *clazz);
PN_EXTERN const char *pn_class_name(const pn_class_t *clazz);
PN_EXTERN void *pn_class_new(const pn_class_t *clazz, size_t size);
PN_EXTERN void *pn_class_incref(const pn_class_t *clazz, void *object);
Modified: qpid/proton/trunk/proton-c/src/messenger/store.c
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/src/messenger/store.c?rev=1625782&r1=1625781&r2=1625782&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/src/messenger/store.c (original)
+++ qpid/proton/trunk/proton-c/src/messenger/store.c Wed Sep 17 19:47:59 2014
@@ -197,6 +197,7 @@ pni_stream_t *pni_stream_get(pni_store_t
return pni_stream(store, address, false);
}
+#define CID_pni_entry CID_pn_object
#define pni_entry_initialize NULL
#define pni_entry_hashcode NULL
#define pni_entry_compare NULL
Modified: qpid/proton/trunk/proton-c/src/messenger/subscription.c
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/src/messenger/subscription.c?rev=1625782&r1=1625781&r2=1625782&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/src/messenger/subscription.c (original)
+++ qpid/proton/trunk/proton-c/src/messenger/subscription.c Wed Sep 17 19:47:59 2014
@@ -55,6 +55,7 @@ void pn_subscription_finalize(void *obj)
pn_free(sub->address);
}
+#define CID_pn_subscription CID_pn_object
#define pn_subscription_hashcode NULL
#define pn_subscription_compare NULL
#define pn_subscription_inspect NULL
Modified: qpid/proton/trunk/proton-c/src/messenger/transform.c
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/src/messenger/transform.c?rev=1625782&r1=1625781&r2=1625782&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/src/messenger/transform.c (original)
+++ qpid/proton/trunk/proton-c/src/messenger/transform.c Wed Sep 17 19:47:59 2014
@@ -55,6 +55,7 @@ static void pn_rule_finalize(void *objec
pn_free(rule->substitution);
}
+#define CID_pn_rule CID_pn_object
#define pn_rule_initialize NULL
#define pn_rule_hashcode NULL
#define pn_rule_compare NULL
@@ -75,6 +76,7 @@ static void pn_transform_finalize(void *
pn_free(transform->rules);
}
+#define CID_pn_transform CID_pn_object
#define pn_transform_initialize NULL
#define pn_transform_hashcode NULL
#define pn_transform_compare NULL
Modified: qpid/proton/trunk/proton-c/src/object/iterator.c
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/src/object/iterator.c?rev=1625782&r1=1625781&r2=1625782&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/src/object/iterator.c (original)
+++ qpid/proton/trunk/proton-c/src/object/iterator.c Wed Sep 17 19:47:59 2014
@@ -43,6 +43,7 @@ static void pn_iterator_finalize(void *o
free(it->state);
}
+#define CID_pn_iterator CID_pn_object
#define pn_iterator_hashcode NULL
#define pn_iterator_compare NULL
#define pn_iterator_inspect NULL
Modified: qpid/proton/trunk/proton-c/src/object/map.c
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/src/object/map.c?rev=1625782&r1=1625781&r2=1625782&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/src/object/map.c (original)
+++ qpid/proton/trunk/proton-c/src/object/map.c Wed Sep 17 19:47:59 2014
@@ -336,6 +336,7 @@ static bool pni_identity_equals(void *a,
extern const pn_class_t *PN_UINTPTR;
+#define CID_pni_uintptr CID_pn_void
static const pn_class_t *pni_uintptr_reify(void *object) { return PN_UINTPTR; }
#define pni_uintptr_new NULL
#define pni_uintptr_free NULL
Modified: qpid/proton/trunk/proton-c/src/object/object.c
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/src/object/object.c?rev=1625782&r1=1625781&r2=1625782&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/src/object/object.c (original)
+++ qpid/proton/trunk/proton-c/src/object/object.c Wed Sep 17 19:47:59 2014
@@ -52,6 +52,11 @@ const char *pn_class_name(const pn_class
return clazz->name;
}
+pn_cid_t pn_class_id(const pn_class_t *clazz)
+{
+ return clazz->cid;
+}
+
void *pn_class_new(const pn_class_t *clazz, size_t size)
{
assert(clazz);
Modified: qpid/proton/trunk/proton-c/src/tests/object.c
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/src/tests/object.c?rev=1625782&r1=1625781&r2=1625782&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/src/tests/object.c (original)
+++ qpid/proton/trunk/proton-c/src/tests/object.c Wed Sep 17 19:47:59 2014
@@ -89,6 +89,7 @@ static void noop(void *o) {}
static uintptr_t zero(void *o) { return 0; }
static intptr_t delta(void *a, void *b) { return (uintptr_t) b - (uintptr_t) a; }
+#define CID_noop CID_pn_object
#define noop_initialize noop
#define noop_finalize noop
#define noop_hashcode zero
@@ -148,6 +149,7 @@ static void finalizer(void *object)
(**called)++;
}
+#define CID_finalizer CID_pn_object
#define finalizer_initialize NULL
#define finalizer_finalize finalizer
#define finalizer_hashcode NULL
@@ -176,6 +178,7 @@ static void test_free(void)
static uintptr_t hashcode(void *obj) { return (uintptr_t) obj; }
+#define CID_hashcode CID_pn_object
#define hashcode_initialize NULL
#define hashcode_finalize NULL
#define hashcode_compare NULL
@@ -192,6 +195,7 @@ static void test_hashcode(void)
pn_free(obj);
}
+#define CID_compare CID_pn_object
#define compare_initialize NULL
#define compare_finalize NULL
#define compare_compare delta
@@ -561,6 +565,7 @@ static uintptr_t collider_hashcode(void
return 23;
}
+#define CID_collider CID_pn_object
#define collider_initialize NULL
#define collider_finalize NULL
#define collider_inspect NULL
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org