|
Hi.
I received a good answer to my question from Rational support.
I will attach a tech note to this mail. Please read the tech
note.
As an answer to the second question there is an option on the passive class specification window. Open the specification, go to the C++ targetRTS tab and change the "GenerateDescriptor" to false. This was exactly what I was looking for.
Hope it helps you too.
Regards,
Andrea Scaggiante
Software Engineer Tecnomare SpA - Robotics & Subsea Via Enrico Caviglia 11 20139 Milano ITALY Tel +39-02535751 Fax +39-0255211952 E-mail: [EMAIL PROTECTED] Web: http://www.tecnomare.it
|
Subject: How to use C/C++ External Library Components to share model elements:
PRODUCT: Rose RealTime 6.1
OS: Windows NT/2000, Sun Solaris 2.5, 2.6, 2.7, HP-UX 10.20
DEFECT #: N/A
PATCH #: N/A
REFERENCES: N/A
CREATED: 30-Mar-2000
REVISED:
QUESTION: How do you use C/C++ External Library components to share model
elements:
NOTE: For clarity, only references to creating and using C++ Libraries will be
made in this tech note. Any functionality described herein for C++ Libraries
and C++ External Libraries also extends to C Libraries/External Libraries.
Asterisks (*) are used to indicate that additional information is available at
the bottom of this tech note.
ANSWER:
Components of type "C++ External Library" are used to link compiled library
files with a model. When used in combination with Shared Packages and C++
Libraries, C++ External Library Components can also be used to distribute
previously compiled model elements to other developers to avoid rebuilding the
components.
For demonstration purposes, this tech note will refer to two separate models:
One model will be used to create the C++ External Library and will be called
the PRODUCER. A second model will re-use the model elements created by the
Producer model and will be called the USER. This note assumes that a common
file system space is available for sharing files and is pointed to by the Path
Map** $LIBRARY_PATH. See end of note if external distribution is required.
In this example, generic, descriptive element names will be used.
The steps involved in producing and using a C++ External Library for the
purpose of reusing model elements are:
In the PRODUCER model:
1. Isolate the model elements you would like to share into at least one
Logical Package. Name the package "MyLogicalPackage." This package should be
controlled* so that it saves as "MyLogicalPackage.rtlogpkg."
2. Prepare C++ Library Component:
a. Create a new component in the Component View called
"MyLibraryComponent"
b. Make the following changes on the Component Specification Dialog for
"MyLibraryComponent"
i) On the General Tab: Type="C++ Library"
ii) Click the "Apply" Command Button
iii) On the C++ Compilation Tab: TargetConfiguration = <Current system
configuration>
iv) On the C++ Generation Tab: OutputDirectory = $LIBRARY_PATH\$name
3. Redistribute model element references*** among components
a. Remove references to all model elements contained in
"MyLogicalPackage" from the existing components.
b. Create a reference to "MyLogicalPackage" in "MyLibraryComponent"
4. Establish a dependency**** between the remaining relevant/affected
components (which may be only one executable component) and
"MyLibraryComponent"
5. Create a sharable C++ External Library:
a. Create a new Component Package called "MyExtLibCompPkg." Control* the
package so that it saves as "MyExtLibCompPkg.rtcmppkg"
b. In the new package, create a new Component called "MyExtLibComp"
c. Make the following changes on the Component Specification Dialog for
"MyExtLibComp:"
i) On the General Tab: Type = "C++ External Library"
ii) Click the "Apply" Command Button
iii) On the C++ External Library Tab: Libraries =
$LIBRARY_PATH\MyLibraryComponent\build\libMyLibraryComponent.LIB (path\name of
C++ Library created in step 2)
iv) On the C++ External Library Tab: Inclusion Paths =
$LIBRARY_PATH\MyLibraryComponent\src (directory of C++ Library created in step
2)
6. As in step 3b, create a reference*** to "MyLogicalPackage" in
"MyExtLibComp" and references to any of the RTClass/RTCClass elements (ex:
Timing or Log protocol classes) used by the C++ Library Component (these
elements will be detected and added during generation of the C++ Library, but
are not automatically added to the C++ External Library).
7. Rebuild the model to ensure that all model elements are properly accounted
for and that all required dependencies were created.
In the USER model:
8. Share the Logical View model elements:
a. Right-click on the Logical View folder and select File->Share External
Package...
b. Navigate to the location of "MyLogicalPackage.rtlogpkg" (created in
step 1 for Producer) and select it.
9. Share external libraries:
a. Right-click on the Component View folder to display popup-menu and
select File->Share External Package...
b. Nagivate to the location of "MyExtLibCompPkg.rtcmppkg" (created in
step 5 for Producer).
10. Use the model elements in "MyLogicalPackage" in the USER model where
required.
11. Establish a dependency**** from existing components to "MyExtLibComp"
where required.
At this point, the USER model has incorporated the functionality of the shared
model elements into its design. The model can be built without the shared
model elements undergoing code generation and compilation, only linking.
External Distribution Note: If you need to deliver the component libraries to a
third party (via a .tar or .zip file) the following files should be included:
-The sharable External Library component package (and all controlled units
located within it)
-The sharable logical package(s) (and all controlled units located within it)
-the generated header files (with "RTSystem/" and "x/" subdirectories preserved)
-the pre-compiled library file (libMyLibraryComponent.LIB in this example)
For more information, contact Rational Software Technical Support.
*Controlling Units: To control a unit is to make the unit save to its own
file. To enable the control of units in a model, right-click on the Model icon
in the model browser window, select File->Control Child Units. You may or may
not control child units recursively. For each of the packages that need to be
controlled, right-click on the package and select File->Control Unit. Again,
you may or may not control child units recursively. This action will save the
model across several directories, and will save each controlled package into
its own .rtxxxpkg file where xxx is an abbreviation of the view (Use Case /
Logical / Component / Deployment) in which the package exists.
**Pathmaps: Pathmaps are used to indicate differing absolute paths among
developers. In this example, a pathmap is ideal when specifying the location
of the library file created in step 2--so long as the pathmap resolves to an
absolute path on both the PRODUCER and USERs file system. Use File->Edit Path
Map... to link a Path Map to an absolute path.
***Referencing Model Elements: All Components can contain references to model
elements in the Logical View (Capsules/Classes/Protocols etc.). An Executable
or Library Component that refers to a Logical View model element will include
that element in any code generation/compilation activity performed on the
component. Since "MyExtLibComp" Component refers to the shared Logical View
model elements, no additional code generation or compilation will be attempted
on the shared model elements by the toolset since it is of type C++ External
Library. To reference Logical View model elements in a component: Drag and
drop the model elements (in this case, the entire logical package) onto the C++
External Library component. Using a logical package is a short-cut way of
referring to a group of logical model elements. By adding a logical model
element to the shared logical package, you will automatically be adding it to
the external library as well.
****Establishing Dependencies: Dependencies among components indicate their
order of compilation and linking. To establish a dependency among components,
drag each component into a component diagram. Use the "Dependency" tool (a
dashed-line with arrowhead) to draw an arrow from the dependant component to
the depended component. In step number 4 you will draw the arrow to
"MyLibraryComponent." In step number 11, you will draw the arrow to
"MyExtLibComp"
