osaf/services/saf/amf/amfd/ctcstype.cc | 12 +++++++++---
osaf/services/saf/amf/amfd/include/comp.h | 22 +++++++++++++++-------
2 files changed, 24 insertions(+), 10 deletions(-)
diff --git a/osaf/services/saf/amf/amfd/ctcstype.cc
b/osaf/services/saf/amf/amfd/ctcstype.cc
--- a/osaf/services/saf/amf/amfd/ctcstype.cc
+++ b/osaf/services/saf/amf/amfd/ctcstype.cc
@@ -86,6 +86,13 @@ static int is_config_valid(const SaNameT
return 1;
}
+//
+AVD_CTCS_TYPE::AVD_CTCS_TYPE(const SaNameT *dn) {
+ memcpy(&name.value, dn->value, dn->length);
+ name.length = dn->length;
+}
+
+//
static AVD_CTCS_TYPE *ctcstype_create(const SaNameT *dn, const
SaImmAttrValuesT_2 **attributes)
{
AVD_CTCS_TYPE *ctcstype;
@@ -94,10 +101,9 @@ static AVD_CTCS_TYPE *ctcstype_create(co
TRACE_ENTER2("'%s'", dn->value);
- ctcstype = new AVD_CTCS_TYPE();
+ ctcstype = new AVD_CTCS_TYPE(dn);
- memcpy(ctcstype->name.value, dn->value, dn->length);
- ctcstype->name.length = dn->length;
+
error =
immutil_getAttr(const_cast<SaImmAttrNameT>("saAmfCtCompCapability"),
attributes, 0, &ctcstype->saAmfCtCompCapability);
osafassert(error == SA_AIS_OK);
diff --git a/osaf/services/saf/amf/amfd/include/comp.h
b/osaf/services/saf/amf/amfd/include/comp.h
--- a/osaf/services/saf/amf/amfd/include/comp.h
+++ b/osaf/services/saf/amf/amfd/include/comp.h
@@ -185,13 +185,21 @@ private:
extern AmfDb<std::string, AVD_COMPCS_TYPE> *compcstype_db;
/* AMF Class SaAmfCtCsType */
-typedef struct {
- SaNameT name;
- SaAmfCompCapabilityModelT saAmfCtCompCapability;
- SaUint32T saAmfCtDefNumMaxActiveCSIs;
- SaUint32T saAmfCtDefNumMaxStandbyCSIs;
- AVD_COMP_TYPE *comptype;
-} AVD_CTCS_TYPE;
+class AVD_CTCS_TYPE {
+ public:
+ explicit AVD_CTCS_TYPE(const SaNameT *dn);
+
+ SaNameT name {};
+ SaAmfCompCapabilityModelT saAmfCtCompCapability {};
+ SaUint32T saAmfCtDefNumMaxActiveCSIs {};
+ SaUint32T saAmfCtDefNumMaxStandbyCSIs {};
+ AVD_COMP_TYPE *comptype {};
+ private:
+ AVD_CTCS_TYPE();
+ // disallow copy and assign
+ AVD_CTCS_TYPE(const AVD_CTCS_TYPE&);
+ void operator=(const AVD_CTCS_TYPE&);
+};
extern AmfDb<std::string, AVD_CTCS_TYPE> *ctcstype_db;
------------------------------------------------------------------------------
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel