Topic
  • 6 replies
  • Latest Post - ‏2013-01-30T07:10:21Z by SystemAdmin
SystemAdmin
SystemAdmin
3180 Posts

Pinned topic Is there a direct conntection from Link to LinkRef?

‏2013-01-29T08:06:40Z |

Hello
 

LinkRef lnkRefWork;
for lnkRefWork in (objSource<-sLinkModuleName) do {
}

 

We all know the loops running over all Links resp. LinkRefs. Inside a Linkref I want to place the line:

 

 

Object objSource = source(lnkRefWork);



But the source() only accepts a Link as a parameter.

So we have to use two loops.

Any ideas to reduce this?

Best regards
Wolfgang



 

 

Updated on 2014-01-06T13:57:44Z at 2014-01-06T13:57:44Z by iron-man
  • SystemAdmin
    SystemAdmin
    3180 Posts

    Re: Is there a direct conntection from Link to LinkRef?

    ‏2013-01-29T16:19:50Z  
    As you previously stated do what a politician does, rename your two loops as one and claim success.
  • SystemAdmin
    SystemAdmin
    3180 Posts

    Re: Is there a direct conntection from Link to LinkRef?

    ‏2013-01-29T16:36:15Z  

    You could use the LinkRef to get the module name and absolute number of the source object. You can then use that info to get the source object directly:
     

    LinkRef lnkRefWork;
    for lnkRefWork in (objSource<-sLinkModuleName) do {
        ModName_ srcModRef = source(lnkRefWork)
        int srcAbsNum = source(lnkRefWork)
        Module srcMod = read(fullName(srcModRef), false)
        Object objSource = object(srcAbsNum, srcMod)
    }
    
    Updated on 2014-01-06T13:58:07Z at 2014-01-06T13:58:07Z by iron-man
  • llandale
    llandale
    3005 Posts

    Re: Is there a direct conntection from Link to LinkRef?

    ‏2013-01-29T18:23:20Z  
    No, I see no translation of LinkRef to Link, without a 2nd loop.

    I dislike the "object(AbsNo)" command as it is restricted to the current display set which is restricted to the default view for the module.

    I think you are stuck with the customary approach:
    1. LinkRef loop to open source module
    2. Link loop to find source objects

    -Louie
  • Mathias Mamsch
    Mathias Mamsch
    2003 Posts

    Re: Is there a direct conntection from Link to LinkRef?

    ‏2013-01-29T19:42:23Z  
    Well I am not sure what your intention is - if you want minimal code, then make a library function that will give you all the inlinks. You need to understand that LinkRefs and Links are two completely different things in DOORS. A Link is something with a start object and an end object that is loaded to memory with the start object or the module it is contained in. Before the module containing the start object is loaded to memory, it does not exist from a DOORS perspective.

    The LinkRef is the little yellow in-link marker, that is placed on an object to indicate that there is a link ending from somewhere on that object. You need this LinkRef only, to find out, which modules to open, so all links will that end in the module will be loaded to memory. If for example you already knew the modules from where you receive links, then you could just open them without thinking about LinkRefs and then iterate over Links directly. Therefore you can see, why there is

    a) no connection between Link and LinkRef -> these are separate things.
    b) no source function for the LinkRef -> a LinkRef is no link, therefore it does not carry information about the link, like creation dates, etc.
    c) you need to explicitly have a loop to open the source modules, and the real loop to iterate over the links

    Maybe that clears matters up, regards, Mathias
    Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
  • SystemAdmin
    SystemAdmin
    3180 Posts

    Re: Is there a direct conntection from Link to LinkRef?

    ‏2013-01-30T06:39:56Z  
    Well I am not sure what your intention is - if you want minimal code, then make a library function that will give you all the inlinks. You need to understand that LinkRefs and Links are two completely different things in DOORS. A Link is something with a start object and an end object that is loaded to memory with the start object or the module it is contained in. Before the module containing the start object is loaded to memory, it does not exist from a DOORS perspective.

    The LinkRef is the little yellow in-link marker, that is placed on an object to indicate that there is a link ending from somewhere on that object. You need this LinkRef only, to find out, which modules to open, so all links will that end in the module will be loaded to memory. If for example you already knew the modules from where you receive links, then you could just open them without thinking about LinkRefs and then iterate over Links directly. Therefore you can see, why there is

    a) no connection between Link and LinkRef -> these are separate things.
    b) no source function for the LinkRef -> a LinkRef is no link, therefore it does not carry information about the link, like creation dates, etc.
    c) you need to explicitly have a loop to open the source modules, and the real loop to iterate over the links

    Maybe that clears matters up, regards, Mathias
    Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
    Hello

    Thanks for the answer. My Intention is: Two loops seems to look like a little oversized code and I thought to reduce it. But if I cannot - ok.

    Best regards
    Wolfgang
  • SystemAdmin
    SystemAdmin
    3180 Posts

    Re: Is there a direct conntection from Link to LinkRef?

    ‏2013-01-30T07:10:21Z  
    As you previously stated do what a politician does, rename your two loops as one and claim success.
    > As you previously stated do what a politician does, rename your two loops as one and claim success.

    You cannot alter the internal structure of a thing by renaming it. A renamed problem is still a problem. But a renamed solution is a solution. It may me to expensive, to complicate, stupid, senseless or whatever. The most important point is: You have a solution and the other has not.

    P.S.: It is very strange here. Sometimes the editor gimicks work and sometimes not.