Hi,

I will change comments when I push the code.

Thanks,
Zoran

-----Original Message-----
From: Anders Björnerstedt [mailto:[email protected]] 
Sent: Tuesday, June 09, 2015 11:05 AM
To: [email protected]
Subject: Re: [devel] [PATCH 1 of 1] imm: create NO_DANGLING references in 
finalizeSync [#1381]

Ack with minor comments on ... the comments.
Not tested.

On 06/08/2015 05:00 PM, Zoran Milinkovic wrote:
>   osaf/services/saf/immsv/immnd/ImmModel.cc |  66 
> +++++++++++++++++++++++++++++++
>   1 files changed, 66 insertions(+), 0 deletions(-)
>
>
> When all data is synced, NO_DANGLING references are created and are added to 
> sReverseRefsNoDanglingMMap.
I dont think the NO_DANGLING references are >created< here.
The NO_DANGLING references are already there in the synced data as attribute 
values of type SaNameT or SaStringT.
The thing created/populated here is the reverseRefs map.
>
> diff --git a/osaf/services/saf/immsv/immnd/ImmModel.cc 
> b/osaf/services/saf/immsv/immnd/ImmModel.cc
> --- a/osaf/services/saf/immsv/immnd/ImmModel.cc
> +++ b/osaf/services/saf/immsv/immnd/ImmModel.cc
> @@ -17217,6 +17217,72 @@ ImmModel::finalizeSync(ImmsvOmFinalizeSy
>                   ol = ol->next;
>               }
>   
> +            // Create NO_DANGLING references
Above should be: // Populate the sReverseRefsNoDanglingMMap.

> +            ClassInfo* ci;
> +            ObjectSet os;
> +            ImmAttrValue *av;
> +            ObjectSet::iterator osi;
> +            ObjectSet::iterator aosi;
> +            ImmAttrValueMap::iterator avmi;
> +            AttrMap::iterator ami;
> +            ClassMap::iterator cmi;
> +            ObjectMap::iterator omi;
> +            for(cmi=sClassMap.begin(); cmi!=sClassMap.end(); ++cmi) {
> +                ci = cmi->second;
> +                // Check if the class has at least one attribute with 
> NO_DANGLING flag;
> +                for(ami=ci->mAttrMap.begin();
> +                        ami!=ci->mAttrMap.end() && !(ami->second->mFlags & 
> SA_IMM_ATTR_NO_DANGLING);
> +                        ++ami);
> +                if(ami == ci->mAttrMap.end()) {
> +                    continue;
> +                }
> +
> +                // Iterate through all objects of the class
> +                for(osi=ci->mExtent.begin(); osi!=ci->mExtent.end(); ++osi) {
> +                    os.clear();
> +                    for(ami = ci->mAttrMap.begin(); ami!=ci->mAttrMap.end(); 
> ++ami) {
> +                        // Assemble NO_DANGLING references
Would suggest: //Collect NO_DANGLING references
> +                        if(ami->second->mFlags & SA_IMM_ATTR_NO_DANGLING) {
> +                            avmi = 
> (*osi)->mAttrValueMap.find(ami->first.c_str());
> +                            // Attribute must exist
> +                            osafassert(avmi != (*osi)->mAttrValueMap.end());
> +                            av = avmi->second;
> +                            if(!av->empty()) {
> +                                omi = sObjectMap.find(av->getValueC_str());
> +                                if(omi == sObjectMap.end()) {
> +                                    std::string objName;
> +                                    getObjectName(*osi, objName);
> +                                    LOG_ER("Object '%s' is missing. 
> Reference from '%s'",
> +                                            av->getValueC_str(), 
> objName.c_str());
> +                                    abort();
> +                                }
> +                                os.insert(omi->second);
> +                            }
> +                            if(av->isMultiValued()) {
> +                                while((av = ((ImmAttrMultiValue 
> *)av)->getNextAttrValue())) {
> +                                    if(!av->empty()) {
> +                                        omi = 
> sObjectMap.find(av->getValueC_str());
> +                                        if(omi == sObjectMap.end()) {
> +                                            std::string objName;
> +                                            getObjectName(*osi, objName);
> +                                            LOG_ER("Object '%s' is missing. 
> Reference from '%s'",
> +                                                    av->getValueC_str(), 
> objName.c_str());
> +                                            abort();
> +                                        }
> +                                        os.insert(omi->second);
> +                                    }
> +                                }
> +                            }
> +                        }
> +                    }
> +
> +                    // Add NO_DANGLING references
Suggest: //Add NO_DANGLING references to reverse-map
> +                    for(aosi=os.begin(); aosi!=os.end(); ++aosi) {
> +                        
> sReverseRefsNoDanglingMMap.insert(std::pair<ObjectInfo *, ObjectInfo 
> *>(*aosi, *osi));
> +                    }
> +                }
> +            }
> +
>               TRACE_5("Synced %u CCB-outcomes",(unsigned int) 
> sCcbVector.size());
>               
>               this->setLoader(0);
>
> ----------------------------------------------------------------------
> -------- _______________________________________________
> Opensaf-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/opensaf-devel


------------------------------------------------------------------------------
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

------------------------------------------------------------------------------
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to