osaf/services/saf/amf/amfd/include/sg.h | 14 ++++++++++----
osaf/services/saf/amf/amfd/include/su.h | 15 ++++++++++++++-
2 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/osaf/services/saf/amf/amfd/include/sg.h
b/osaf/services/saf/amf/amfd/include/sg.h
--- a/osaf/services/saf/amf/amfd/include/sg.h
+++ b/osaf/services/saf/amf/amfd/include/sg.h
@@ -43,6 +43,7 @@
#include "db_template.h"
#include "node.h"
#include <list>
+#include <set>
class AVD_SU;
class AVD_SI;
@@ -179,10 +180,13 @@
* Checkpointing - Sent
as a one time update.
*/
- AVD_SU *list_of_su; /* the list of service units in this
- * group in the descending order of
- * the rank.
- */
+ /* the list of service units in this
+ * group in the descending order of
+ * the rank.
+ */
+ std::set<AVD_SU*, AVD_SU::comparator> list_of_su;
+ AVD_SU* first_su();
+
AVD_SI *list_of_si; /* the list of service instances in
* this group in the descending order
* of the rank.
@@ -405,6 +409,8 @@
bool is_sg_serviceable_outside_ng(const AVD_AMF_NG *ng);
SaAisErrorT check_sg_stability();
bool ng_using_saAmfSGAdminState;
+
+ uint32_t term_su_list_in_reverse();
private:
// disallow copy and assign, TODO(hafe) add common macro for this
AVD_SG(const AVD_SG&);
diff --git a/osaf/services/saf/amf/amfd/include/su.h
b/osaf/services/saf/amf/amfd/include/su.h
--- a/osaf/services/saf/amf/amfd/include/su.h
+++ b/osaf/services/saf/amf/amfd/include/su.h
@@ -92,7 +92,6 @@
// TODO: use some container for the comp list
struct avd_comp_tag *list_of_comp; /* the list of components in
this SU */
- AVD_SU *sg_list_su_next; /* the next SU in the SG */
AVD_SU *avnd_list_su_next; /* the next SU in the AvND */
struct avd_sutype *su_type;
AVD_SU *su_list_su_type_next;
@@ -137,6 +136,20 @@
bool any_susi_fsm_in_unasgn();
bool any_susi_fsm_in_modify();
SaAisErrorT check_su_stability();
+
+ struct comparator {
+ bool operator() (const AVD_SU* lhs, const AVD_SU* rhs) {
+ if (lhs->saAmfSURank == rhs->saAmfSURank) {
+ std::string left(Amf::to_string(&lhs->name));
+ return left.compare(Amf::to_string(&rhs->name));
+ } else {
+ // in descending order of SU rank (lowest to
+ // highest integer). Note: the lower the integer
+ // value, the higher the rank.
+ return lhs->saAmfSURank < rhs->saAmfSURank;
+ }
+ }
+ };
private:
void initialize();
void send_attribute_update(AVSV_AMF_SU_ATTR_ID attrib_id);
------------------------------------------------------------------------------
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel