osaf/services/saf/amf/amfd/apptype.cc | 31 ++++++++++---------------------
osaf/services/saf/amf/amfd/include/app.h | 4 ----
2 files changed, 10 insertions(+), 25 deletions(-)
diff --git a/osaf/services/saf/amf/amfd/apptype.cc
b/osaf/services/saf/amf/amfd/apptype.cc
--- a/osaf/services/saf/amf/amfd/apptype.cc
+++ b/osaf/services/saf/amf/amfd/apptype.cc
@@ -23,22 +23,17 @@
#include <si.h>
#include <util.h>
-static NCS_PATRICIA_TREE apptype_db;
+AmfDb<AVD_APP_TYPE> *app_type_db = 0;
AVD_APP_TYPE *avd_apptype_get(const SaNameT *dn)
{
- SaNameT tmp = {0};
-
- tmp.length = dn->length;
- memcpy(tmp.value, dn->value, tmp.length);
-
- return (AVD_APP_TYPE *)ncs_patricia_tree_get(&apptype_db, (uint8_t
*)&tmp);
+ return app_type_db->find(dn);
}
static void apptype_delete(AVD_APP_TYPE **apptype)
{
- unsigned int rc = ncs_patricia_tree_del(&apptype_db,
&(*apptype)->tree_node);
- osafassert(rc == NCSCC_RC_SUCCESS);
+ app_type_db->erase(*apptype);
+
delete [] (*apptype)->sgAmfApptSGTypes;
delete *apptype;
*apptype = NULL;
@@ -46,13 +41,11 @@ static void apptype_delete(AVD_APP_TYPE
static void apptype_add_to_model(AVD_APP_TYPE *app_type)
{
- unsigned int rc;
-
osafassert(app_type != NULL);
TRACE("'%s'", app_type->name.value);
- rc = ncs_patricia_tree_add(&apptype_db, &app_type->tree_node);
- osafassert(rc == NCSCC_RC_SUCCESS);
-}
+
+ app_type_db->insert(app_type);
+
static int is_config_valid(const SaNameT *dn, const SaImmAttrValuesT_2
**attributes,
const CcbUtilOperationData_t *opdata)
@@ -113,11 +106,10 @@ static AVD_APP_TYPE *apptype_create(SaNa
TRACE_ENTER2("'%s'", dn->value);
app_type = new AVD_APP_TYPE();
-
+
memcpy(app_type->name.value, dn->value, dn->length);
app_type->name.length = dn->length;
- app_type->tree_node.key_info = (uint8_t *)&(app_type->name);
-
+
while ((attr = attributes[i++]) != NULL)
if (!strcmp(attr->attrName, "saAmfApptSGTypes"))
break;
@@ -291,10 +283,7 @@ void avd_apptype_remove_app(AVD_APP *app
void avd_apptype_constructor(void)
{
- NCS_PATRICIA_PARAMS patricia_params;
-
- patricia_params.key_size = sizeof(SaNameT);
- osafassert(ncs_patricia_tree_init(&apptype_db, &patricia_params) ==
NCSCC_RC_SUCCESS);
+ app_type_db = new AmfDb<AVD_APP_TYPE>;
avd_class_impl_set("SaAmfAppBaseType", NULL, NULL,
avd_imm_default_OK_completed_cb, NULL);
diff --git a/osaf/services/saf/amf/amfd/include/app.h
b/osaf/services/saf/amf/amfd/include/app.h
--- a/osaf/services/saf/amf/amfd/include/app.h
+++ b/osaf/services/saf/amf/amfd/include/app.h
@@ -27,8 +27,6 @@
#include <saAmf.h>
#include <saImm.h>
-// TODO(hafe) remove include below when apptype is using map
-#include <ncspatricia.h>
#include <sg.h>
#include <si.h>
#include "db_template.h"
@@ -37,8 +35,6 @@ struct avd_sg_tag;
struct avd_si_tag;
typedef struct avd_app_type_tag {
-
- NCS_PATRICIA_NODE tree_node; /* key is name */
SaNameT name;
SaNameT *sgAmfApptSGTypes;
uint32_t no_sg_types;
------------------------------------------------------------------------------
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel