osaf/services/saf/amf/amfd/include/sg.h |  13 +++++++++----
 osaf/services/saf/amf/amfd/include/su.h |  15 ++++++++++++++-
 2 files changed, 23 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
@@ -181,10 +181,13 @@ public:
                                                         * 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.
@@ -404,6 +407,8 @@ public:
        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
@@ -93,7 +93,6 @@ class AVD_SU {
        // TODO: use some container for the comp list
        AVD_COMP *list_of_comp; /* the list of  components in this SU */
 
-       AVD_SU *sg_list_su_next;        /* the next SU in the SG */
        AVD_SUTYPE *su_type;
        AVD_SU *su_list_su_type_next;
 
@@ -137,6 +136,20 @@ class AVD_SU {
        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
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to