osaf/services/saf/amf/amfd/csi.cc        |  20 +++++++++-----------
 osaf/services/saf/amf/amfd/include/csi.h |   5 +++--
 2 files changed, 12 insertions(+), 13 deletions(-)


diff --git a/osaf/services/saf/amf/amfd/csi.cc 
b/osaf/services/saf/amf/amfd/csi.cc
--- a/osaf/services/saf/amf/amfd/csi.cc
+++ b/osaf/services/saf/amf/amfd/csi.cc
@@ -24,7 +24,7 @@
 #include <imm.h>
 #include <proc.h>
 
-static NCS_PATRICIA_TREE csi_db;
+AmfDb<AVD_CSI> *csi_db = 0;
 
 void avd_csi_delete(AVD_CSI *csi)
 {
@@ -42,8 +42,8 @@ void avd_csi_delete(AVD_CSI *csi)
        avd_cstype_remove_csi(csi);
        avd_si_remove_csi(csi);
 
-       rc = ncs_patricia_tree_del(&csi_db, &csi->tree_node);
-       osafassert(rc == NCSCC_RC_SUCCESS);
+       csi_db->erase(csi);
+
        delete csi;
        TRACE_LEAVE2();
 }
@@ -74,8 +74,8 @@ AVD_CSI *avd_csi_get(const SaNameT *dn)
 
        tmp.length = dn->length;
        memcpy(tmp.value, dn->value, tmp.length);
-       
-       return (AVD_CSI *)ncs_patricia_tree_get(&csi_db, (uint8_t *)&tmp);
+
+       return csi_db->find(&tmp);
 }
 
 /**
@@ -260,8 +260,9 @@ AVD_CSI *csi_create(const SaNameT *csi_n
        csi->name.length = csi_name->length;
        csi->tree_node.key_info = (uint8_t *)&(csi->name);
 
-       if (ncs_patricia_tree_add(&csi_db, &csi->tree_node) != NCSCC_RC_SUCCESS)
-               osafassert(0);
+       if (csi_db->find(&csi->name) == NULL) {
+               csi_db->insert(csi);
+       }
 
        return csi;
 }
@@ -1238,10 +1239,7 @@ void avd_csi_add_csiattr(AVD_CSI *csi, A
 
 void avd_csi_constructor(void)
 {
-       NCS_PATRICIA_PARAMS patricia_params;
-
-       patricia_params.key_size = sizeof(SaNameT);
-       osafassert(ncs_patricia_tree_init(&csi_db, &patricia_params) == 
NCSCC_RC_SUCCESS);
+       csi_db = new AmfCsiDb<AVD_CSI>;
        avd_class_impl_set(const_cast<SaImmClassNameT>("SaAmfCSI"), NULL, NULL, 
csi_ccb_completed_cb, csi_ccb_apply_cb);
 }
 
diff --git a/osaf/services/saf/amf/amfd/include/csi.h 
b/osaf/services/saf/amf/amfd/include/csi.h
--- a/osaf/services/saf/amf/amfd/include/csi.h
+++ b/osaf/services/saf/amf/amfd/include/csi.h
@@ -37,6 +37,7 @@
 #include <susi.h>
 #include <comp.h>
 #include <pg.h>
+#include "db_template.h"
 
 /* The attribute value structure for the CSIs. */
 typedef struct avd_csi_attr_tag {
@@ -54,8 +55,6 @@ typedef struct avd_csi_deps_tag {
  * associated with the CSI on the AvD.
  */
 typedef struct avd_csi_tag {
-       NCS_PATRICIA_NODE tree_node;    /* key will be the CSI name */
-
        SaNameT name;
        SaNameT saAmfCSType;
        AVD_CSI_DEPS *saAmfCSIDependencies; /* list of all CSI dependencies for 
this CSI */
@@ -83,6 +82,8 @@ typedef struct avd_csi_tag {
                                   from * current SI being assigned */
 } AVD_CSI;
 
+extern AmfDb<AVD_CSI> *csi_db;
+
 typedef struct avd_cstype {
        NCS_PATRICIA_NODE tree_node;    /* key is name */
        SaNameT name;           /* name of the CSType */

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to