Book a Demo

Author Topic: can i gen code according to the requirement's sta  (Read 4565 times)

teddyboy

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
can i gen code according to the requirement's sta
« on: June 07, 2007, 03:18:37 am »
I have a class linked to a  external requirement, how can i generate code according to the requirement's status?
thanks.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: can i gen code according to the requirement's
« Reply #1 on: June 07, 2007, 01:37:02 pm »
Since it's an external requirement, you could create a custom connector template, and list over the connectors (with a filter on the list so that it doesn't list over everything).

teddyboy

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
thanks!//Re: can i gen code according
« Reply #2 on: June 07, 2007, 04:02:22 pm »
I'll try. thank you very much!

teddyboy

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Help!//Re: can i gen code according to the requir
« Reply #3 on: June 07, 2007, 04:33:27 pm »
It's seem too diffcult to me to build a custom template,can you give some hint? thanks!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: can i gen code according to the requirement's
« Reply #4 on: June 07, 2007, 05:09:13 pm »
It's a bit hard without knowing what you want to do with it.

First, make sure you've read http://www.sparxsystems.com.au/EAUserGuide/index.html?customtemplates.htm

I created a connector template with the name Requirement.  And just put %connectorDestElemName% in the template.

I then got all of the names of the external requirements EA links to with the following list.
%list="Connector__Requirement" @separator=" " connectorType=="Realisation" and connectorDestElemType=="Requirement"%

teddyboy

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: can i gen code according to the requirement's
« Reply #5 on: June 07, 2007, 07:15:44 pm »
Thank you!
the problem is:
I have a class1 to realize requirement1 as follow:
+------------------+-----<<realize>>------+----------------+
|   class1         |                      | requirement1    
+------------------+                      +----------------+
|   operation1()   |                      |  status=?value?|
|   operation2()   |                      +----------------+
+------------------|

I want to generate code as:
if requirement1.status = "x" then generate operation1()
else generate operation2();
« Last Edit: June 08, 2007, 06:59:26 pm by teddyboy »

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: can i gen code according to the requirement's
« Reply #6 on: June 11, 2007, 01:37:43 pm »
Well, the substitution macro you're after is connectorDestElemStatus, and I could write templates that did this, but I don't think you'll be able to use it in any useful way.  At least not without answering some more questions.

How are operation1 and operation2 linked to particular statuses of requirement1?  For that matter, how are they linked to requirement1 as opposed to another requirement that class1 realizes.

It comes down to, what do you want to happen in general?

teddyboy

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: can i gen code according to the requirement's
« Reply #7 on: June 11, 2007, 04:04:33 pm »
Thank you very much!
In real time system, the code space is very limited and the performance is very important, so I want to generate a bin file without any useless octs(even the bit_tst and jump code). In design time we must consider all possible requirements but when produce the product we must prune some requiement(functions) having no use for the user.
So i also wander how can i link a class's member operation to realize a/some requirement(s).

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: can i gen code according to the requirement's
« Reply #8 on: June 11, 2007, 05:45:03 pm »
I can't give you a full solution, but look at the RefGUID predefined tagged value type (http://sparxsystems.com/EAUserGuide/predefinedtaggedvaluetypes.htm), then add something like this to the start of the operation template.

That should filter out operations you don't want to see.

Code: [Select]
$status = %list="Connector__RequirementStatus" @separator=" " connectorType=="Realisation" and connectorDestElemType=="Requirement" and opTag:"requirement"==connectorDestElemGUID%
%if $status != "x"%
%endTemplate%

teddyboy

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: can i gen code according to the requirement's
« Reply #9 on: June 11, 2007, 06:40:31 pm »
connectorDestElemType is always NULL(""),why?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: can i gen code according to the requirement's
« Reply #10 on: June 11, 2007, 07:25:45 pm »
Quote
connectorDestElemType is always NULL(""),why?

Sorry, it was only added in EA 7.0.