1 possibility would be to use a Rose Script something like as below
(the (untested) example shown, generates asserts for pointer
parameters being NULL ; but you could easily add more complicated
checks on different parameter data types )
Dim AllClasses As ClassCollection
Dim theOperations As OperationCollection
Dim theOperation As Operation
Dim theParameters As ParameterCollection
Dim theParameter As Parameter
Dim codeText As String
Dim dummyBool As Boolean
Set AllClasses = RoseApp.CurrentModel.GetAllClasses()
For i = 1 To AllClasses.Count
Set theOperations = AllClasses.GetAt(i).Operations
For j = 1 To theOperations.Count
Set theOperation = theOperations.GetAt(j)
codeText = ""
Set theParameters = theOperation.Parameters
For k = 1 To theParameters.Count
Set theParameter = theParameters.GetAt(k)
If Right$(theParameter.Type, 1) = "*" Then
codeText = codeText + "ASSERT(" + theParameter.Name + " != 0);" +
Chr$(13) + Chr$(10)
End If
Next k
dummyBool = theOperation.OverrideProperty("cg", "EntryCode", codeText)
Next j
Next i
This will add relevant code to the EntryCode of the Operations. Then
just use normal C++ - Code Generation to put in the real code files.
regards,
Mark Helie,
Alenia-Marconi Systems
>
>Hello all,
>
>Does anybody have experience with having ROSE generate
instrumentation
>code ?
>
>For example, can I tell ROSE to generate an ASSERT for lets say every
>input parameter of a method ?
>
>I can specify this as entry code, but then i would have to specify it
>for every method of every class manually. Is there a more generic
way,
>because if I would specifysometing in the model properties for the
>method, it would be without the parameters for the method ofcourse.
Can
>this be parametrised, for instance, can i specify something like
>ASSERT($parameters), with $parameters filled in at code generation
time
>by ROSE?
>
>
>Thanks in advance,
>
>Sven Biebaut
>
>*********************************************************************
***
>* Rose Forum is a public venue for ideas and discussions.
>* For technical support, visit http://www.rational.com/support
>*
>* Admin.Subscription Requests: [EMAIL PROTECTED]
>* Archive of messages:
http://www.rational.com/products/rose/usergroups/rose_forum.jtmpl
>* Other Requests: [EMAIL PROTECTED]
>*
>* To unsubscribe from the list, please send email
>*
>* To: [EMAIL PROTECTED]
>* Subject:<BLANK>
>* Body: unsubscribe rose_forum
>*
>*********************************************************************
****
************************************************************************
* Rose Forum is a public venue for ideas and discussions.
* For technical support, visit http://www.rational.com/support
*
* Admin.Subscription Requests: [EMAIL PROTECTED]
* Archive of messages:
http://www.rational.com/products/rose/usergroups/rose_forum.jtmpl
* Other Requests: [EMAIL PROTECTED]
*
* To unsubscribe from the list, please send email
*
* To: [EMAIL PROTECTED]
* Subject:<BLANK>
* Body: unsubscribe rose_forum
*
*************************************************************************