Rever order of history

I am iterating history on module level , now is there any way to start iterating history in reverse order like newer changes come first , please suggest me solution.

Thanks,
Hardik Shah
SystemAdmin - Tue Sep 14 07:55:11 EDT 2010

Re: Rever order of history
Mathias Mamsch - Tue Sep 14 13:55:58 EDT 2010

You can put those history entries in a skip list in reverse order:
 

History h 
int count = 0
Skip sk = create() 
for h in current Module do put (sk, count--, h)
// iterate them in reverse ...
for h in sk do { print (h.date) }

 


Hope this helps, Regards, Mathias

 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

Re: Rever order of history
SystemAdmin - Tue Sep 14 15:27:10 EDT 2010

Mathias Mamsch - Tue Sep 14 13:55:58 EDT 2010

You can put those history entries in a skip list in reverse order:
 

History h 
int count = 0
Skip sk = create() 
for h in current Module do put (sk, count--, h)
// iterate them in reverse ...
for h in sk do { print (h.date) }

 


Hope this helps, Regards, Mathias

 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

thanks,
this will help, but for that I have to put in in skip list before getting the reverse order, so it did too much processing.

so is there a way which will help to apply filter on history so that while iterating History on module only those history are iterated which are applicable.

Thanks,
Hardik Shah

Re: Rever order of history
Mathias Mamsch - Tue Sep 14 16:05:17 EDT 2010

SystemAdmin - Tue Sep 14 15:27:10 EDT 2010
thanks,
this will help, but for that I have to put in in skip list before getting the reverse order, so it did too much processing.

so is there a way which will help to apply filter on history so that while iterating History on module only those history are iterated which are applicable.

Thanks,
Hardik Shah

I am not sure what you mean by "too much processing", but putting all history entries will only take a neglectable processing power and time and memory, more so since you only need to do this once. As far as I know this is the only way to get the history entries in a backwards order. To filter them you would need to check your conditions in one of the loops. Regards, Mathias

Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: Rever order of history
SystemAdmin - Wed Sep 15 01:18:16 EDT 2010

Mathias Mamsch - Tue Sep 14 16:05:17 EDT 2010
I am not sure what you mean by "too much processing", but putting all history entries will only take a neglectable processing power and time and memory, more so since you only need to do this once. As far as I know this is the only way to get the history entries in a backwards order. To filter them you would need to check your conditions in one of the loops. Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

can we get history after specific date, not checking if condition but using some filter or some other way.

Thanks,
Hardik Shah

Re: Rever order of history
Mathias Mamsch - Wed Sep 15 04:25:47 EDT 2010

SystemAdmin - Wed Sep 15 01:18:16 EDT 2010
can we get history after specific date, not checking if condition but using some filter or some other way.

Thanks,
Hardik Shah

If you take a look at the perms list you will find that for the type History you only have the following perms:

void ::do (History&, Object, void) V7.1,V8.0,V8.1,V8.2,V8.3,V9.1-0,V9.2-1,V9.2-2
void ::do (History&, SessionObject_, void) V8.1,V8.2,V8.3,V9.1-0,V9.2-1,V9.2-2
void ::do (History&, SessionModule_, void) V8.1,V8.2,V8.3,V9.1-0,V9.2-1,V9.2-2
void ::do (History&, Module, void) V7.1,V8.0,V8.1,V8.2,V8.3,V9.1-0,V9.2-1,V9.2-2
void ::do (History&, Root__, void) V7.1,V8.0,V8.1,V8.2,V8.3,V9.1-0,V9.2-1,V9.2-2
 
SessionObject_ session (Object) V8.1,V8.2,V8.3,V9.1-0,V9.2-1,V9.2-2
SessionModule_ session (Module)  V8.1,V8.2,V8.3,V9.1-0,V9.2-1,V9.2-2
Root__ top (Module) V7.1,V8.0,V8.1,V8.2,V8.3,V9.1-0,V9.2-1,V9.2-2

 


Meaning you can do:

 

 

History h
Object obj = current
Module mod = current
for h in obj do ...
for h in session obj do ... // only since V8.1
for h in session mod do ... // only since V8.1
for h in mod do ... 
for h in top mod do ...



and that is it! Whatever all these perms do, it seems clear, that you have no ability to filter history entries. And it is still not clear why you would not want to iterate over all history entries of the module.

Regards, Mathias



 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

Re: Rever order of history
llandale - Wed Sep 15 17:10:02 EDT 2010

Mathias Mamsch - Tue Sep 14 13:55:58 EDT 2010

You can put those history entries in a skip list in reverse order:
 

History h 
int count = 0
Skip sk = create() 
for h in current Module do put (sk, count--, h)
// iterate them in reverse ...
for h in sk do { print (h.date) }

 


Hope this helps, Regards, Mathias

 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

You suggested this, it indeed works.

void  PrintHist(History hst)
{  if (null hst) print "\tNull Hist\n"
   else
   {  noError()
      print (hst.sessionNo) "\t" (hst.type) "\t[" (hst.attrName) "]\n"
      lastError()
   }
}   // end PrintHist()
 
Skip   skpHist = create()
int    Counter = 100
 
History hst
for hst in (current Object) do
{  PrintHist(hst)
   put(skpHist, Counter--, hst)
}
 
print "************ Reverse *************\n"
for hst in skpHist do
{  PrintHist(hst)
}
   
delete(skpHist)


I am sure that back in v7, it would not work because I discovered that "hst1 = hst2" does not assign a variable value, it creates an alias. I was unable to store relevant History for later use, I had to count history and save the Count, then plow through History again until I came to the right one. Maybe then I can adjust my code to take advantage of the superior handling of History variables.

 

 

  • Louie

 

 

Re: Rever order of history
Mathias Mamsch - Thu Sep 16 05:26:01 EDT 2010

llandale - Wed Sep 15 17:10:02 EDT 2010

You suggested this, it indeed works.

void  PrintHist(History hst)
{  if (null hst) print "\tNull Hist\n"
   else
   {  noError()
      print (hst.sessionNo) "\t" (hst.type) "\t[" (hst.attrName) "]\n"
      lastError()
   }
}   // end PrintHist()
 
Skip   skpHist = create()
int    Counter = 100
 
History hst
for hst in (current Object) do
{  PrintHist(hst)
   put(skpHist, Counter--, hst)
}
 
print "************ Reverse *************\n"
for hst in skpHist do
{  PrintHist(hst)
}
   
delete(skpHist)


I am sure that back in v7, it would not work because I discovered that "hst1 = hst2" does not assign a variable value, it creates an alias. I was unable to store relevant History for later use, I had to count history and save the Count, then plow through History again until I came to the right one. Maybe then I can adjust my code to take advantage of the superior handling of History variables.

 

 

  • Louie

 

 

Cite: louie

 

I am sure that back in v7, it would not work because I discovered that 
"hst1 = hst2" does not assign a variable value, it creates an alias ...



To be concise there is no such thing as an alias in DXL. In DOORS you have a stack and a heap like in every language. Doing:



 

 

History h1 = null 
History h2 = h1 
print "Stack address of h1: " ((addr_ (&h1)) int) "\n"
print "Stack address of h2: " ((addr_ (&h2)) int) "\n"
 
for h1 in (current Object) do { 
     print "Turning...\n"; 
     if (!null h2) error "World stopped turning!?" 
}



Every variable you declare will take exactly one place (4 bytes of memory for non-arrays) on the stack, and will share this place with NO other variable (that would be an alias!). So h1 is no alias of h2 and I bet it has been always like this.

But you are right: in DOORS 7.1 the for History in ... loop seems to free the history entry with each iteration and replace it by the next one. That is an important code compatibility issue. Thanks for pointing that out.

Regards, Mathias



 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

Re: Rever order of history
llandale - Thu Sep 16 12:57:38 EDT 2010

Mathias Mamsch - Thu Sep 16 05:26:01 EDT 2010

Cite: louie

 

I am sure that back in v7, it would not work because I discovered that 
"hst1 = hst2" does not assign a variable value, it creates an alias ...



To be concise there is no such thing as an alias in DXL. In DOORS you have a stack and a heap like in every language. Doing:



 

 

History h1 = null 
History h2 = h1 
print "Stack address of h1: " ((addr_ (&h1)) int) "\n"
print "Stack address of h2: " ((addr_ (&h2)) int) "\n"
 
for h1 in (current Object) do { 
     print "Turning...\n"; 
     if (!null h2) error "World stopped turning!?" 
}



Every variable you declare will take exactly one place (4 bytes of memory for non-arrays) on the stack, and will share this place with NO other variable (that would be an alias!). So h1 is no alias of h2 and I bet it has been always like this.

But you are right: in DOORS 7.1 the for History in ... loop seems to free the history entry with each iteration and replace it by the next one. That is an important code compatibility issue. Thanks for pointing that out.

Regards, Mathias



 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

in v71, my code produces this result:

3173    createObject    []
3173    modifyObject    [Allocation]
3173    modifyObject    [Allocation Rationale]
3173    modifyObject    [Behavioral Req]
3173    modifyObject    [Classification]
3173    modifyObject    [Decomposable]
3173    modifyObject    [EDM Req]
3173    modifyObject    [Flight Req]
3173    modifyObject    [KPP]
3173    modifyObject    [Link_SYS]
3173    modifyObject    [Object Text]
3173    modifyObject    [Rationale]
3173    modifyObject    [Required]
3173    modifyObject    [Safety Impact]
3173    modifyObject    [ShipShore Req]
3173    modifyObject    [Target Release]
3173    modifyObject    [Verification Level]
3173    modifyObject    [Verification Method]
3238    modifyObject    [Link_SYS]
3238    modifyObject    [Object Text]
************ Reverse *************
1       deleteType      []
1       deleteType      []
1       deleteType      []
1       deleteType      []
1       deleteType      []
1       deleteType      []
1       deleteType      []
1       deleteType      []
1       deleteType      []
1       deleteType      []
1       deleteType      []
1       deleteType      []
1       deleteType      []
1       deleteType      []
1       deleteType      []
1       deleteType      []
1       deleteType      []
1       deleteType      []
1       deleteType      []
1       deleteType      []
-R-E- DXL: <Line:0> Stack Underflow
Backtrace:
        <Line:21>


Your code continues to work. So it appears they fixed something.

 

  • Louie