Sei sulla pagina 1di 321
Foils FOR-CAT-E-CAA-F-V5R7
Foils
FOR-CAT-E-CAA-F-V5R7
➘ ➘ ➘ ➘ ➘ ➘ ➘ ➘
➘ ➘
➘ ➘ ➘ ➘
Automation API
Automation
API
-
-
. .
.
.
Build Time View
Build Time View
AddPrereqComponent("System",Protected); AddPrereqComponent("System",Protected);
AddPrereqComponent("System",Protected); AddPrereqComponent("System",Protected);
AddPrereqComponent("ObjectModelerBase", AddPrereqComponent("ObjectModelerBase", Protected); Protected);
BUILT_OBJECT_TYPE=SHARED LIBRARY
BUILT_OBJECT_TYPE=SHARED LIBRARY
# Link with external libraries # # # # # Link with include files
#
Link with external libraries
#
#
#
#
#
Link with include files
#include #include “MyModule.h” “MyModule.h” #ifdef #ifdef _WINDOWS_SOURCE _WINDOWS_SOURCE Class Class
#include #include “MyModule.h” “MyModule.h”
#ifdef #ifdef _WINDOWS_SOURCE _WINDOWS_SOURCE
Class Class ExportedByMyModule ExportedByMyModule MyClass MyClass
#ifdef #ifdef
MyModule MyModule
{ {
#define #define ExportedByMyModule ExportedByMyModule
#else #else
declspec(dllexport) declspec(dllexport)
#define #define ExportedByMyModule ExportedByMyModule
#endif #endif
#else #else
declspec(dllimport) declspec(dllimport)
#define #define ExportedByMyModule ExportedByMyModule
#endif #endif
Persistent Displayable Surfacic
Persistent
Displayable
Surfacic
Alternative notation :
Alternative notation :
#include "CATITransform.h" [ ] CATITransform * transformInterface; // [ Here we get the instance of
#include "CATITransform.h"
[
]
CATITransform * transformInterface;
// [
Here
we get the instance of the interface
]
if (transformInterface)
{
CATVector3f translVector(10., 10., 10.);
transformInterface-> (translVector);
cout << "Element translated" << endl;
}
service is , not to the implementation.
[ ] [ ] // // Query Query if if point point implementation implementation can
[
]
[
]
// // Query Query if if point point implementation implementation can can provide provide a a CATITransform CATITransform interface interface
CATITransform CATITransform * * transformInterface transformInterface = = NULL; NULL;
// // Use Use returned returned interface interface to to manipulate manipulate point point
if if SUCCEEDED SUCCEEDED (rc) (rc)
{
{
transformInterface transformInterface -> -> ( (
); );
cout cout << << "Point "Point translated" translated" << << endl; endl;
}
}
[
]
[
]
returns as its second argument an instance of if
implementation instance adheres to it, otherwise.
[ ] [ ] // // Query Query if if CATIVisu CATIVisu interface interface is
[
]
[
]
// // Query Query if if CATIVisu CATIVisu interface interface is is supported supported in in addition addition to to CATITransform CATITransform
// // Use Use returned returned interface interface to to manipulate manipulate point point
if if SUCCEEDED SUCCEEDED (rc) (rc)
{
{
visuInterface-> visuInterface-> ( (
); );
cout cout << << "Point "Point displayed" displayed" << << endl; endl;
}
}
[
]
[
]
as
input, i.e. an interface instance can be queried against adherence to
another interface just as the implementation object it stands for.
CATISample.h CATISample.h CATISample.cpp CATISample.cpp [ ] [ ] [ ] [ #include #include “CATBaseUnknown.h”
CATISample.h CATISample.h
CATISample.cpp CATISample.cpp
[
]
[
]
[
]
[
#include #include “CATBaseUnknown.h” “CATBaseUnknown.h”
]
#include #include “CATISample.h” “CATISample.h”
extern extern IID IID IID_CATISample; IID_CATISample;
class class CATISample: CATISample: public public
{
[
{
] [
]
; ;
public: public:
)
virtual virtual
Method1( Method1(
)
= = 0 0 ; ;
)
virtual virtual
Method2( Method2(
)
= = 0 0 ; ;
};
};
[
]
[
]
CATISample.cpp CATISample.cpp #include #include “IUnknown.h” “IUnknown.h” extern extern "C" "C"
CATISample.cpp
CATISample.cpp
#include #include “IUnknown.h” “IUnknown.h”
extern extern "C" "C" const const
– – – –
ImplSample.cpp ImplSample.cpp ImplSample.h ImplSample.h [ ] [ ] [ #include #include “CATBaseUnknown.h”
ImplSample.cpp ImplSample.cpp
ImplSample.h ImplSample.h
[
]
[
]
[
#include #include “CATBaseUnknown.h” “CATBaseUnknown.h”
]
]
#include #include “ImplSample.h” “ImplSample.h”
[
class class ImplSample: ImplSample: public public
{
{
; ;
[
]
[
]
public: public:
// // CATISample CATISample adhesion adhesion
[
]
ImplSample() ImplSample() ; ;
[
~ImplSample() ;
~ImplSample() ;
]
ImplSample::Method1() ImplSample::Method1() { { … … } }
ImplSample::Method2() ImplSample::Method2() { { … … } }
// // CATISample CATISample adhesion adhesion
Method1(…) Method1(…) ; ;
// // Other Other methods methods
[
]
Method2(…) Method2(…) ; ;
[
]
// // Other Other methods methods
[
]
[
]
}
} ;
;
ImplSampleB.h ImplSampleB.h ImplSampleB.cpp ImplSampleB.cpp [ ] [ ] [ #include #include “CATBaseUnknown.h”
ImplSampleB.h ImplSampleB.h
ImplSampleB.cpp ImplSampleB.cpp
[
]
[
]
[
#include #include “CATBaseUnknown.h” “CATBaseUnknown.h”
]
]
#include #include “ImplSampleB.h” “ImplSampleB.h”
[
class class ImplSampleB: ImplSampleB: public public
{
{
; ;
[
]
public: public:
[
]
ImplSampleB() ImplSampleB() ; ;
// // CATISample CATISample adhesion adhesion
[
]
~ImplSampleB() ~ImplSampleB() ; ;
[
]
ImplSample::Method1() ImplSample::Method1() { { … … } }
// // CATISample CATISample adhesion adhesion
ImplSample::Method2() ImplSample::Method2() { { … … } }
Method1(…) Method1(…) ; ;
Method2(…) Method2(…) ; ;
// // Other Other methods methods
[
]
[
]
// // Other Other methods methods
[
]
[
]
}
} ;
;
• • •
–
] [ [ ] // // Retrieve Retrieve the the Factory Factory ; CATICatalogFactory CATICatalogFactory
]
[ [
]
// // Retrieve Retrieve the the Factory Factory
;
CATICatalogFactory CATICatalogFactory *myFactory *myFactory = =
;
CATICatalog CATICatalog *myCatalog *myCatalog = = myFactory-> myFactory-> (“CatalogA”); (“CatalogA”);
]
[ [
]
• •
• //Code Generated by the CAA Wizard //This source file insures the regeneration of the
//Code Generated by the CAA Wizard
//This source file insures the regeneration of the tie TIE_CAAIPoint.h
#include "CAAIPoint.h"
ImplSample.cpp ImplSample.cpp – [ ] [ #include #include “ImplSample.h” “ImplSample.h” ]
ImplSample.cpp ImplSample.cpp
[
]
[
#include #include “ImplSample.h” “ImplSample.h”
]
CATImplementClass CATImplementClass ( ( ImplSample, ImplSample,
Implementation, Implementation,
CATBaseUnknown, CATBaseUnknown,
CATNull CATNull ) )
[
]
[
]
// // CATISample CATISample adhesion adhesion
)
{ … }
ImplSample::Method1( ImplSample::Method1(
)
{ … }
)
{ … }
ImplSample::Method2( ImplSample::Method2(
)
{ … }
// // Other Other methods methods
[
] [
]
– CATITransform* T; delete T; – CATITransform* T; T->Translate(); –
CATITransform* T;
delete T;
CATITransform* T;
T->Translate();
– – – –
QueryInterface QueryInterface does does an an to to secure secure the the interface interface pointer
QueryInterface QueryInterface does does an an to to secure secure
the the interface interface pointer pointer before before returning returning it it to to caller. caller.
[
]
[
]
CATIVisu* CATIVisu* visuItf visuItf = = NULL; NULL;
hr hr = = persistentItf-> persistentItf-> (IID_CATIVisu, (IID_CATIVisu, (void**)&visuItf) (void**)&visuItf) ; ;
persistentItf-> persistentItf-> (); (); // // Done Done with with old old interface interface
visuItf->Draw( visuItf->Draw(
) ) ; ;
visuItf-> visuItf-> () () ; ;
// // Done Done with with last last interface interface
[
]
[
]
a pointer copy does not increase the reference count, we must call AddRef()
CAAIPoint *piPoint = factory->CreatePoint( ); PointImpl *pPointImpl = new PointImpl( );
CAAIPoint *piPoint = factory->CreatePoint( );
PointImpl *pPointImpl = new PointImpl( );
pPointImpl->QueryInterface( IID_CAAIPoint, (void**)&piPoint);
pPointImpl->Release( );
return piPoint;
piPoint-> QueryInterface(IID_CATIMove, (void**)&piMove);
piPoint->Release( );
piPoint
TIE_CAAIPoint
piMove->Release( );
PointImpl
1
0
1
2
1 2 1 0
piMove
TIE_CATIMove
1
0
– – • • – •
– •
– –
aCATIVisu->Draw() Access a public member of the interface. It makes the usage of interface very
aCATIVisu->Draw()
Access a public member of the interface. It makes
the usage of interface very similar to a regular C++ pointer on
implementation. Remark: do not use the "." operator with
handlers.
aCATIVisu = aCATITransfor
Make aCATIVisu refer to the same implementation
as aCATITransfor.
Since those handlers are not of the same type, it manages a
downcast if left value is a subtype of right value. If not, it runs a
QueryInterface on left value. Therefore the result can be a NULL
handler.
aCATIVisu(CATITransfor)
Handlers preferred way of performing a
QueryInterface(). Result can therefore be a null_var handler.
if (aCATIVisu==aCATITransfor)
Test if two interface instances are dealing with the same
implementation. Thanks to NULL_var which defines NULL handler
value.
if (aCATIVisu!=aCATITransfor) Test if two interface instances are dealing with
different implementations.
if (!aCATIVisu)
Test if an interface instance is actually bound to an
implementation.
– • – • • – • – • – –
{ { CATIPersistent_var spPersiOnX; spPersiOnX = GetIVisu(); spPersiOnX ->Release(); } CATIPersistent_var
{
{
CATIPersistent_var spPersiOnX;
spPersiOnX = GetIVisu();
spPersiOnX ->Release();
}
CATIPersistent_var spPersiOnX;
CATIVisu *pVisuOnX = GetIVisu();
spPersiOnX = pVisuOnX;
pVisuOnX ->Release();
}
{ { CATIVisu_var spVisuOnX; spVisuOnX = GetParentIVisu(); spVisuOnX ->Release(); CATIVisu_var spVisuOnX;
{
{
CATIVisu_var spVisuOnX;
spVisuOnX = GetParentIVisu();
spVisuOnX ->Release();
CATIVisu_var spVisuOnX;
spVisuOnX = GetParentIVisu();
}
}
– – –
Usually one dictionary per framework stored under …\CNext\code\dictionary ImplSample CATISample libImplSample
Usually one dictionary per framework
stored under
…\CNext\code\dictionary
ImplSample
CATISample
libImplSample
ImplSample
CATISample2
libExtSample
Component
Interface it adheres to
directly, through its
extensions or by inheritance
Library that contains the actual
code for this given interface
adhesion.
ExtSample.h ExtSample.h ExtSample.cpp ExtSample.cpp [ ] ] #include #include “CATBaseUnknown.h”
ExtSample.h ExtSample.h
ExtSample.cpp ExtSample.cpp
[
]
]
#include #include “CATBaseUnknown.h” “CATBaseUnknown.h”
[
[
]
]
#include #include “ExtSample.h” “ExtSample.h”
[
class class ExtSample: ExtSample: public public CATBaseUnknown CATBaseUnknown
{
{
CATDeclareClass; CATDeclareClass;
CATImplementClass CATImplementClass ( ( ExtSample, ExtSample,
,
,
CATBaseUnknown, CATBaseUnknown,
public: public:
) )
ExtSample() ExtSample() ; ;
[
]
[
]
~ExtSample() ~ExtSample() ; ;
// // CATISample2 CATISample2 adhesion adhesion
[
]
[
// // CATISample2 CATISample2 adhesion adhesion
]
ExtSample::Method3() ExtSample::Method3() { { … … } }
Method3(…) Method3(…) ; ;
// // Other Other methods methods
// // Other Other methods methods
[
]
[
]
[
]
[
]
}
} ;
;
– • • – • •
•
CATObject CATObject Boooh! Object Object ExtA ExtA Extension Extension for for A A type type
CATObject CATObject
Boooh!
Object Object ExtA ExtA
Extension Extension for for A A type type
A
Object Object ExtA2 ExtA2
Extension Extension for for A A type type
Boooh! – A Build Object Object ExtA ExtA Extension Extension for for A A type
Boooh!
A
Build
Object Object ExtA ExtA
Extension Extension for for A A type type
Object ExtA2
Object ExtA2
A CATIContainer
libA
Extension Extension for for A A
A CATIPersistent libA2
Build
Late Late type type factory factory A CATIContainer libA A CATIPersistent libA2 Object Object ExtA
Late Late type type factory factory
A CATIContainer libA
A CATIPersistent libA2
Object Object ExtA ExtA
Extension Extension for for «A» «A» type type
– CATObject CATObject Object Object ExtA ExtA A Extension Extension for for A A type
CATObject CATObject
Object Object ExtA ExtA
A
Extension Extension for for A A type type
Object Object ExtAB ExtAB
AB
Extension Extension for for AB AB type type
« Base Imp » || « late type » Base « Code|Data Extension » «
« Base Imp » || « late type »
Base
« Code|Data Extension »
« Code|Data Extension »
« Code|Data Extension »
Factories
QueryInterface()
AddRef()
Release()
• Capturing and Generating • • • •
• Capturing and Generating
• • • • • • • • • • • • • •
– • • • – –
– • • • – • •
❍ ✔ H, Sketch: ✔ ❍ ✔✔ ✔✔
✔ H, Sketch:
✔✔
✔✔
– – – • •
– – • –
. User assembles features to create new features . By saving user defined . User
. User assembles
features to create new
features
.
By saving user defined
. User instantiates
features from catalog
feature in catalog, company
standard features basis is
enriched
. User freely
assembles native and
user defined features
.
User
saves final result
into a document
– • • – • • • • – •
Effectivity and specification filtering Versioning control Any feature can defines R/W access on its attributes
Effectivity and specification filtering
Versioning control
Any feature can defines R/W access on
its attributes
Any feature can stream/unstream itself
(model / Data base)
Any feature can undo modifications
applied to it
Feature
Facilities for referencing inside parts of
features in a stable way
Any feature is an event sender on its
attributes modification
Any feature can list or add attributes
(referenced and aggregated objects),
Cutting and pasting features onto each
other is semi automatic
Maturity and release process
For concurrent use
Propagating change requests across the spec tree is under the responsibility of the spec modeler
Propagating change requests across the spec
tree is under the responsibility of the spec
modeler infrastructure
…while deciding when and how
responding to change request
is under the responsibility of the
application
– • – • • •
• • • • • •
• – – – – – –
• – – – Update Specifications Results
Update
Specifications
Results
– – Pad 2: Notification propagated by the specs modeler Pad 3: Update decided by
Pad
2: Notification
propagated by the
specs modeler
Pad
3: Update decided
by the application
Sketch
Sketch
Line
Line
1: Feature modified
– – – • • •
– • Solid 1: Solid is modified • Solid to offset 2.1: Owner feature, is
Solid
1: Solid is
modified
Solid to
offset
2.1: Owner
feature, is
updated
instead of the
result
In
Offset
1.1: Offset is
not up to date
Out
Result
2: Update
Solid
required on
solid
1.2: Solid is
not up to date
• – – • • Steps to create a new Startup: 1: Create or upgrade
Steps to create a new Startup:
1: Create or
upgrade catalog
2: Create startup in
catalog
01011
Feature
101010
0101…
Startup
3: Save catalog
Catalog
• – – – 1: Open Catalog Feature 3: Instantiate Feature with a factory Startup
1: Open Catalog
Feature
3: Instantiate
Feature with a
factory
Startup
0101110
10100101
2: Read startup
from catalog
Feature Feature
Instance Feature
Instance Instance
Catalog
• – – • Father Feature Feature OM Extension Interface
Father Feature
Feature
OM Extension
Interface
• – Instances Startup 1: Instantiation 2: Save Container Catalog Document on Disk Document in
Instances
Startup
1: Instantiation
2: Save
Container
Catalog
Document on
Disk
Document in memory
• – Interface to instantiate a startup, and manage attributes CATISpecObject Interface to remove a
Interface to instantiate a
startup, and manage attributes
CATISpecObject
Interface to remove a feature
LifeCycleObject
Interface to extend a feature
Any Feature
CATIExtendable
CATISpecAttrAccess
Interface to valuates feature’s
attributes
CATISpecUpdate
Interface to manage feature
update
• – • • – • •
• Interface to instantiate a startup CATISpecBase LifeCycleObject CAT Extendable CATISpecAttrManager
Interface to instantiate a startup
CATISpecBase
LifeCycleObject
CAT Extendable
CATISpecAttrManager
CATISpecAttrValue
CATISpecUpdate
Interface to remove a feature
Interface to extend a feature
Any Feature
Interface to manage feature’s
attributes
Interface to valuates feature’s
attributes
Interface to manage feature
update
CATObject CATObject
CATObject CATObject
– – • • • • – • • – • •
Data Structure defined in a header file Data Structure defined by program and stored in
Data Structure defined in a header file
Data Structure defined by program and
stored in a feature catalog
Methods are defined in a header file and implemented in a cpp file Supported interfaces
Methods are defined in a header file and
implemented in a cpp file
Supported interfaces are defined in a
dictionary and implemented by an
extension
Instantiation through the class constructor and the new operator Instantiation from the startup retrieved in
Instantiation through the class
constructor and the new operator
Instantiation from the startup retrieved in
the feature catalog, and then attribute
valuation
Instances
Startup
Container
MyCatalog.CATfct
Document in memory
– • • •
– • • –
– • – – •
– • – • – • – –
• – • – • • – • •
– – • – • – – • – • – – • • •
– – – •
– • – – – •
– • – • • – • –
– –
– • •
– – • • –
– CAAFeature CATIBuild CAAEBuildOnFeature – • • •
CAAFeature
CATIBuild
CAAEBuildOnFeature
– – – • • – •
– • – • – – • – • – –
– • – – – – • – – – –
– – • – • •
• – – – – –
<<feature extension>> Electrical Application Electrical Datas <<feature>>
<<feature extension>>
Electrical Application
Electrical Datas
<<feature>>
Hydraulic Application
<<feature extension>>
Hydraulic Datas
Other Applications
– • • • • – – • • •
– • • •
– – May be NULL if no inheritance
May be NULL if no inheritance
– –
– The container must be of type CATFeatCont or must derive from a CATFeatCont Pointer
The container must be of type CATFeatCont
or must derive from a CATFeatCont
Pointer on the document (CATDocument *)
– Open the catalog inside the applicative container. From that point, extensions will be automatically
Open the catalog inside the applicative container. From that point,
extensions will be automatically instantiated in this applicative container.
– The link between the feature (thru the CAT Extendable interface) and the feature extension
The link between the feature (thru the CAT Extendable interface) and the feature extension is created
at this step
• • •
<<featureDS>> CATINavigateObject CATINavigateProvider CAANavigProviderImpl Spec Container
<<featureDS>>
CATINavigateObject
CATINavigateProvider
CAANavigProviderImpl
Spec Container
<<feature>>
CATINavigateObject
<<feature extension>>
Applicative Container
Using CATINavigateProvider allows to link
the aggregated feature to the DS feature
– CATIxxxProvider CAAProviderImpl –
CATIxxxProvider
CAAProviderImpl
retrieve document Retrieve the applicative container
retrieve document
Retrieve the applicative container
check if extension is actived retrieve aggregated feature Add aggregated feature to the list
check if extension is actived
retrieve aggregated feature
Add aggregated feature to the list
• – • – • –
• – – • – – –
Send notification Update the model (if necessary) (user interaction) Sets the graphic representation to the
Send
notification
Update the model
(if necessary)
(user
interaction)
Sets the graphic
representation to the
viewpoint
Attaches
Sends Notification
Asks for the graphic
representation
• – • – • • Controller Root object Displayed objects
Controller
Root
object
Displayed objects
• – • • •
• – –
• – • – – – –
• – –
• – • – • – • – •
• – – – CATIModelEvents Root Object Displayed CATIModelEvents Object
CATIModelEvents
Root Object
Displayed
CATIModelEvents
Object
• – – –
Root Object • Displayed Object
Root Object
Displayed
Object
CATIVisu
CATIVisu
• – • – – CATExtIVisu CATI3DGeoVisu TSTEVisuOnMyObject CATRep* BuildRep();
CATExtIVisu
CATI3DGeoVisu
TSTEVisuOnMyObject
CATRep* BuildRep();
• – CATExtIModelEvents CATIModelEvents TSTEEventsOnMyObject
CATExtIModelEvents
CATIModelEvents
TSTEEventsOnMyObject
• • • – • – •
– • Command 1,N – 0,N Frame Toolbar • 0,N 1,N Document 1,1 0,N Workshop
Command
1,N
0,N
Frame
Toolbar
0,N
1,N
Document
1,1
0,N
Workshop
Workbench
Type
– – – –
• •
– – –
– • • – • • – •
– • • – • •
❑
– – – – – –
– – • –
• – • –
Root container
Root container
– – – – • • – –
– – • • – •
– – • – • – – – – –
– – • • –
–
– • • • • – – –
– • – –
– • ));
));
– •
– – • – • – – • – •
• • • – – • – – • – –
❍ ❍ ❍ ❍ ✔ ❍ ✔ ✔ ✔ ✔ ✔ ✔
– • – • – • – • – –
– • • • – • • – • •
– • •
– • – – • – – –
– – • –
• • •
– •
– • – • • •
• – – Columns 0 1 CircleLimitationsFrame: Rows - placed at row 1 and column
Columns
0
1
CircleLimitationsFrame:
Rows
- placed at row 1 and column 1,
0
- 1 row span and 1 column span,
- attached to four sides.
1
• – – Column index 0 for non resizable 1 for resizable
Column index
0 for non resizable
1 for resizable
– • • • Text resources are stored in a CATNls file Path to Icon
Text resources are
stored in a CATNls file
Path to Icon resource is stored in a CATRsc file
– Father class for resource inheritance – Class name • • Icon files (*.bmp) MyDialogBox.CATNls
Father class for
resource inheritance
Class
name
Icon files (*.bmp)
MyDialogBox.CATNls
English files
MyDialogBox.CATRsc
French language support files
– • Message Key Message File – • •
Message Key
Message File
• – – – – – – • – – – – –
– • – •
Build ( ) myFirstCB ( ) mySecondCB ( ) callback mechanism Control object that will
Build ( )
myFirstCB ( )
mySecondCB ( )
callback mechanism
Control object that will callback
the current object
Notification
CB method
User data to be passed
to the CB method
– MyCommand () BuildGraph () Build () State Machine definition (states, agents and transitions) Dialog
MyCommand ()
BuildGraph ()
Build ()
State Machine definition
(states, agents and transitions)
Dialog definition
(layout, controls)
Provided by application programmer
– MyCommand () BuildGraph () MyActionMethod () Build ()
MyCommand ()
BuildGraph ()
MyActionMethod ()
Build ()
• DestroyDestroy ()() GetArgsGetArgs ()() SetVisibilitySetVisibility ()() BeginApplication () EndApplication ()