You are on page 1of 190

ENOVIAVPM Training

Foils

Exercises

Solutions

Appendixes

VPM Programming

Version 1 Release 3
June 2000
FOR-E-APVPP-03-AL

VPM Programming

DO NOT

COPY

Copyright DASSAULT SYSTEMES 2000


ALL RIGHTS RESERVED
No part of this publication may be marked, reproduced, translated, stored in a
retrieval system or transmitted, in any form or by any means, including electronic,
mechanical, photocopying, recording or otherwise, without the express prior written
permission of DASSAULT SYSTEMES.
Specifically, this training material is provided for your internal training requirements
only and shall not be used to train any third party in the use and operation of our
software.

Copyright DASSAULT SYSTEMES 2000

i-2

Menu

VPM Programming

Table of Contents
Appendix 1 - DB2 Main Instructions .................................................................... 9
Appendix 2 - Oracle Main Instructions ............................................................... 11
Appendix 3 - DB table structure .......................................................................... 13
Appendix 4 - Environment Table Administration ............................................... 63
Appendix 5 - C++ Reminder ............................................................................... 67
Appendix 6 - Headers .......................................................................................... 71
CATDMUsrMethod.h ................................................................................. 71
CATVpmAFUsrMethod.h .......................................................................... 87
CATVpmPEUsrMethod.h ........................................................................... 92
CATVpmSCUsrManager.h ......................................................................... 94
CATVpmPEUsrManager ............................................................................ 97
CATVpmSCUsrLogin.h ............................................................................. 99
CATCfgInterfaces.h .................................................................................. 101
CATVPMFilter.h ...................................................................................... 125
CATVPMFilterManager.h ........................................................................ 126
CATVPMNode.h ...................................................................................... 128
CATLnkAPI.h ........................................................................................... 129
CATVpmPubSubUsrAdmin.h .................................................................. 134
CATVpmPubSubUsrManager.h ............................................................... 138
CATDMUsrInstance.h .............................................................................. 143
CATDMUsrMethodContext.h .................................................................. 150
CATDMUSRSelect.h ................................................................................ 152
CATDMUSRUpsate.h .............................................................................. 154
CATDMUSRCatia.h ................................................................................. 156
CATDMUSRResultPanel.h ...................................................................... 157
CATcdm.h ................................................................................................. 158
CATUnicodeString.h ................................................................................ 160
Appendix 7 - APIs and VPM version ................................................................ 177

Copyright DASSAULT SYSTEMES 2000

i-3

Menu

VPM Programming

Copyright DASSAULT SYSTEMES 2000

i-4

Menu

VPM Programming

Preface
Course objectives
At the end of the VPM Programming course, participants will be capable of managing VPM
possibilities for customization:
Consequently, the user will be able to:
Understand the data structure in the data base
Implement the User Exit provided to customize the functionalities of:
the BOM product
the AFL product
the P&O product
the CFG product
the STEP product
Create Data Base triggers
Create new tools or methods to the PSN or VPMA, using the API for Configuration,
Database Access, P&O, MML management or Publish/Subscribe.

Prerequisites
To take full advantage of this instruction, participants are expected to be familiar with UNIX
commands and text editors, C++ programmation, VPM user functionalities and VPM
Administration course.

Training materials delivered


Each participant will receive four documents:
The Foils document used by the trainer during the lecture
The Appendix document in order to get additional information on specific domains
The Exercises document used for hands-on
The Solutions document that contains the solution for the exercises.

CATIA-related publications
VPM Administration Users Guide
Reference documentation
Moreover, VPM online documentation can be accessed by selecting the item Main, Contents or
Index in the Help menu in VPMA.

Copyright DASSAULT SYSTEMES 2000

i-5

Menu

VPM Programming

Course schedule
VPM Programmation training is a 4-day course. Each half-day comprises :
a theoretical talk with foils
exercises allowing the participants to apply the concepts covered in the lesson.

Morning

Afternoon

Day 1

Chapter 1: Introduction
Exercise 1: CDM profile customization
Chapter 2: User Exit Miscellaneous
Chapter 3: User Exit - Action Flow
Exercise 2: AFL Customization

Chapter 4: User Exit - BOM


Exercise 3: Browsing Data Structure
Chapter 4: User Exit - BOM
Exercise 4: BOM Object Creation
Customization

Day 2

Chapter 4: User Exit - BOM


Exercise 5: Data Base Access
Chapter 5: Version - Revision
Exercise 6: Version - Revision
Customization

Chapter 6: User Exit - New


Functionality Creation
Exercise 7: Interface Customization

Day 3

Chapter 7: API for Managing MML


Links
Exercise 8: MML API
Chapter 8: Configuration API
Exercise 9: Configuration API

Chapter 9: Filter
Exercise 10: Filter
Chapter 10: P&O API
Exercise 11: P&O API

Day 4

Chapter 11: Publish and Subscribe


API
Exercise 12: Publish/Subscribe API
Chapter 12: User Exit - DMUSLF
Exercise 13: DMUSLF

Chapter 13: User Exit - STEP


Exercise 14: STEP Customization
Chapter 14: Triggers
Exercise 15: SQL Triggers

Copyright DASSAULT SYSTEMES 2000

i-6

Menu

VPM Programming

Readers Comments
We would very much appreciate your comments on this guide. Please specify the pages and
lines to which they apply. All comments (concerning the general presentation, terminology,
step-by-step procedures, examples, methodology and / or your overall evaluation, etc.) will be
carefully examined by the authors of this documentation.
Please send your comments including your name and address to:
DASSAULT SYSTEMES
Training Department
CSM / STT
9, quai Marcel Dassault
92156 SURESNES Cedex (FRANCE)
Fax: (33-1) 40.99.43.76

Copyright DASSAULT SYSTEMES 2000

i-7

Menu

VPM Programming

Copyright DASSAULT SYSTEMES 2000

i-8

Menu

VPM Programming

Appendix 1 - DB2 Main Instructions


Listing Objects
Log into DB2

db2

List database(s)

list db directory

Enter into a database

connect to DataBaseName

Tables in the database

select * from sysibm.systables


list tables for all

Tables belonging to owner VPMENV


list tables for schema VPMENV
Table structure

select * from owner.table


describe table owner.table

Objects in the table

select attribute list from owner.table where Query

Creating Objects
Database creation

create db DBName on TableSpacePath

Table creation
create table owner.table (AttributeName AttributeType NOT NULL)
View creation
create view owner.view as select AttibuteList from owner.table where Query
Index creation
create unique index owner.index on owner.table (AttributeList)
Creation of a new column
alter table owner.table add AttributeName attribute_type
Insertion of a new row in a table
insert into owner.table (AttributeList) values (ValueList)

Copyright DASSAULT SYSTEMES 2000

1-9

Menu

VPM Programming

Updating Objects
Update an object

update owner.table set AttributeName = Value where Query

Note : The Statement without query is applied for all the objects in the table.

Deleting Objects
Deleting a db

drop db DataBaseName

Deleting a table

drop table owner.table

Deleting a view

drop view owner.table

Deleting an index

drop index owner.index

Deleting a row in a table

delete from owner.table where Query

Copyright DASSAULT SYSTEMES 2000

1-10

Menu

VPM Programming

Appendix 2 - Oracle Main Instructions


Listing Objects
Log into Oracle

sqlplus user/pwd (system/manager)

Tables in the database

select table_name from all_tables;

Tables belonging to owner VPMENV


select table_name from all_tables where owner=VPMENV;
List of users created:

select username from all_users;

Table structure

desc owner.table;

Objects in the table


select attribute list from owner.table where Query;
Note : Each attribute containing $ must be between double-quote.

Creating Objects
Table creation
create table owner.table (AttributeName AttributeType NOT NULL);
View creation
create view owner.view as select AttibuteList from owner.table where Query;
Index creation
create unique index owner.index on owner.table (AttributeList);
Creation of a new column
alter table owner.table add AttributeName attribute_type;
Insertion of a new row in a table
insert into owner.table (AttributeList) values (ValueList);

Updating Objects
Update an object

update owner.table set AtttibuteName = value where Query;

Note : The Statement without query is applied for all the objects in the table.

Copyright DASSAULT SYSTEMES 2000

1-11

Menu

VPM Programming

Deleting Objects
Deleting a table

drop table owner.table;

Deleting a view

drop view owner.table;

Deleting an index

drop index owner.index;

Deleting a row in a table

delete from owner.table where Query;

Copyright DASSAULT SYSTEMES 2000

1-12

Menu

VPM Programming

Appendix 3 - DB table structure


Note to the reader:
The information provided in this document is validated for VPM 1.3
Changes to the data model, programming interfaces or other product data may be required to
implement enhancements, new functions or to correct problems. These may cause
unpredictable results in user programming.

Note : In every following table description, the Type name CHARACTER* means RAW for ORACLE data base
and CHAR for DB2 data base

Copyright DASSAULT SYSTEMES 2000

1-13

Menu

VPM Programming

The main tables for the following modules are:


BOM (owner: Environment)
PART_LIST
CATIA_MODEL
DOCUMENT
$EXT
$EXT_LF
LF00001
$LOCK
BOUNDING_BOX
CLASH
PART_PTR
ZONE
Architecture
CDM.$COROUTINES
CDM.MACRO_LIST
PROFILE.PROFILE_USER
CATIA.CONAME
CATIA.PROJECT
CATIA.PRODUCT
Publish-Subscribe (owner: Administrator)
EVENTS
EXP_SUBSCRIBE
PUBLISHED_EVENTS
People & Organisation (owner: Administrator)
organization_
person_
role_

Copyright DASSAULT SYSTEMES 2000

1-14

Menu

VPM Programming

Security (owner: Administrator)


role_
person_
access_object_
data_group_
process_
Configuration (owner: Administrator)
configuration0001_
effectivity_
configuration0002_
EFFTYPE_FOR_PART_
MODIF_STATUS_

not used

PART_EFFLINK_
Action (owner: Administrator)
Action_
application_

not used

Category_

not used

Config_

not used

data_item_

not used

driver_

not used

DicoEntity_

not used

Document_

not used

EFF_FOR_PART_

not used

filter_unit_
Part_

not used

PLANNED_EFF_
Rep_

not used

site_

not used

RDB_DOCUMENT

Copyright DASSAULT SYSTEMES 2000

1-15

Menu

VPM Programming

PART_LIST (Attributes describing the part)


Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------$COID

CHARACTER**

Identifier of a part ( Complex object id )

$COMPID

CHARACTER**

00000000 for a part

S_.........

..............;

Specific company attributes for the


signature of a part

STATUS

CHARACTER**

Other company attributes for description

PART_DESCRIPTION

CHARACTER**

Other company attributes for description

C_PART_VERSION

CHARACTER**

Version mechanism attribute

C_MATURITY

CHARACTER**

Maturity management attribute

D_TOOL

CHARACTER*

not used

D_PARM

CHARACTER*

not used

C_RESPONSIBLE

CHARACTER*

Owner of the part

C_ORG_RESPONSIBLE

CHARACTER*

Organization to which the part belongs

C_CREATE

TIMESTAMP

Creation date of the part

C_CREATE_USER

CHARACTER*

User used to create the part

C_LASTMOD

TIMESTAMP

Last modification date

C_LASTMOD_USER

CHARACTER*

User used to modify the part

C_VERSION

INTEGER

Number of times that the part has


been overwritten

Copyright DASSAULT SYSTEMES 2000

1-16

Menu

VPM Programming

CATIA_MODEL (Attributes describing the model)


Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------$COID

CHARACTER*

Complex object identifier equal to the part $COID

$COMPID

CHARACTER*

Component identifier of the model

S_.........

.................

Specific company attributes for signature of a model

MODEL_DESCRIPTION

CHARACTER*

Other company attributes for description

STATUS

CHARACTER*

Other company attributes for description

C_REVISION

CHARACTER*

Revision mechanism attribute

C_MATURITY

CHARACTER*

Maturity management attribute

D_TOOL

CHARACTER*

not used

D_PARM

CHARACTER*

not used

C_RESPONSIBLE

CHARACTER*

Owner of the model

C_ORG_RESPONSIBLE

CHARACTER*

Organization to which the model belongs

C_CREATE

TIMESTAMP

Creation date of the model

C_CREATE_USER

CHARACTER*

User used to create the model

C_LASTMOD

TIMESTAMP

Last modification date

C_LASTMOD_USER

CHARACTER*

User used to modify the model

C_VERSION

INTEGER

Number of times that the model has been overwritten

C_COMPID_DATA

CHARACTER*

$COMPID value of $EXT_LF table for the model

C_INTFORM

SMALLINT

equal to 1

C_COMPNAME_DATA

VARCHAR

Table name containing the link to the repository


(always EXT_LF)

C_SOFT_VER

VARCHAR

Version of CDM, which last modified the table (416)

C_NICKNAME

VARCHAR

equal to the model name, will be displayed on CATIA

C_XMIN , C_XMAX .....

DOUBLE

Volume of the model is defined as engineering model

C_SIZE

DOUBLE

storage of the model size

C_LAST_REPOSITORY

VARCHAR

Repository where the model is stored

Copyright DASSAULT SYSTEMES 2000

1-17

Menu

VPM Programming

DOCUMENT (Attributes describing the document)


Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------$COID

CHARACTER*

Complex object identifier equal to the part $COID

$COMPID

CHARACTER*

Component identifier of the model

S_.........

.................

Specific company attributes for signature of a document

NOTES

VARCHAR

not used

C_REVISION

CHARACTER*

Revision mechanism attribute

C_MATURITY

CHARACTER*

Maturity management attribute

D_TOOL

CHARACTER*

Define the tool used to open the document

D_PARM

CHARACTER*

Tools parameter if required

D_PATH

CHARACTER*

Directory where the document is stored if not in DB

C_RESPONSIBLE

CHARACTER*

Owner of the document

C_ORG_RESPONSIBLE

CHARACTER*

Organization to which the document belongs

C_CREATE

TIMESTAMP

Creation date of the document

C_CREATE_USER

CHARACTER*

User used to create the document

C_LASTMOD

TIMESTAMP

Last modification date

C_LASTMOD_USER

CHARACTER*

User used to modify the document

C_VERSION

INTEGER

Number of times that the document has


been overwritten

C_COMPID_DATA

CHARACTER*

$COMPID value of $EXT_LF table for


the document

C_COMPNAME_DATA

VARCHAR

Table name containing the link to the repository


(always EXT_LF)

C_SOFT_VER

VARCHAR

Version of CDM, which last modified the table (416)

C_TYPE_REP

VARCHAR

C_LAST_REPOSITORY

VARCHAR

Repository where the document is stored

C_INTFORM

SMALLINT

Referenced for futur use

Copyright DASSAULT SYSTEMES 2000

1-18

Menu

VPM Programming

CATIA_PLOT
Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------$COID

CHARACTER

Complex object identifier equal to the part $COID

$COMPID

CHARACTER

Component identifier of the model

S_.........

Specific company attributes for signature of a plot

D_TOOL

CHARACTER

D_PARM

CHARACTER

C_REVISION

CHARACTER

Revision mechanism attribute

C_MATURITY

CHARACTER

Maturity management attribute

C_NICKNAME

VARCHAR

Equal to the plot name, will be displayed on CATIA

C_LAST_REPOSITORY

VARCHAR

Repository where the plot is stored

C_X

DOUBLE

C_Y

DOUBLE

C_ANGLE

SMALLINT

C_UNIT

DOUBLE

C_RESPONSIBLE

CHARACTER

Owner of the plot

C_ORG_RESPONSIBLE

CHARACTER

Organisation to which the plot belongs

C_CREATE

TIMESTAMP

Creation date of the plot

C_CREATE_USER

CHARACTER

User used to create the plot

C_LASTMOD

TIMESTAMP

Last modification date

C_LASTMOD_USER

CHARACTER

User used to modify the plot

C_VERSION

INTEGER

Number of times that the plot has been overwritten

C_COMPID_DATA

CHARACTER

$COMPID value of $EXT_LF table for the plot

C_COMPNAME_DATA

VARCHAR

Table name containing the link to the repository


(always EXT_LF)

C_SOFT_VER

VARCHAR

Version of CDM which last modified the table

C_INTFORM

SMALLINT

Referenced for futur use

Copyright DASSAULT SYSTEMES 2000

1-19

Menu

VPM Programming

$EXT (Table managing the links between objects)


Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------$COID

CHARACTER*

Complex object identifier equal to the part $COID

$COMPID

CHARACTER*

Component identifier of the object

$SITE

CHARACTER*

database Id if parent and child are in different DB

$CONAME

VARCHAR

PART_LIST table name for the child

$COMPNAME

VARCHAR

Representation table name for the child

$COID_REF

CHARACTER*

$COID of the child

$COMPID_REF

CHARACTER*

$COMPID of the child

$COMPID_FATHER

CHARACTER*

$COMPID of the father

$COMPNAME_FATHER

VARCHAR

Representation table name for the father

$TYPE

CHARACTER*

Relation type between parent and child

C_RESPONSIBLE

CHARACTER*

Owner of the link

C_ORG_RESPONSIBLE

CHARACTER*

Organization responsible for this link

C_VERSION

INTEGER

Number of times the link has been overwritten

DISCI_COID

CHARACTER*

$COID of a discipline (CDM used only)

DISCI_COMPID

CHARACTER*

$COMPID of a discipline (CDM used only)

C_LASTMOD

TIMESTAMP

Last modification date

C_MML_TS

TIMESTAMP

Timestamp of the last MML synchronization

CATMML_STATUS

CHARACTER*

Status on the MML links : UPD, ...

EXPORT_ID

CHARACTER*

Name field on the link

$USER1

VARCHAR

Positioning matrix for assembly link and


NEW_MATRIX false

XMIN, XMAX......

DOUBLE

Volume constituted of the set of child volumes

C_MAT01, C_MAT02........

DOUBLE

Positioning matrix for assembly link and


NEW_MATRIX true

Copyright DASSAULT SYSTEMES 2000

1-20

Menu

VPM Programming

$EXT_LF (Table managing the links between an object and its repository)
Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------$COID

CHARACTER*

Complex object identifier equal to the part $COID

$COMPID

CHARACTER*

Component identifier of the object

$TYPE

CHARACTER*

Reserved for futur used

$COMPID_FATHER

CHARACTER*

$COMPID of the object (model or document)

$CUR_ACC_MET

CHARACTER*

Access Method used

$CUR_ACC_MET_DATA

VARCHAR

Directory or table in which the repository is stored

REPRES_TYPE

VARCHAR

Type of representation

Note:
$CUR_ACC_MET :
- DBLFCDM

: repository stored inside the database using BLOB format

- DBLFAIX

: repository stored in unix directory using BLOB format

- DBLFCAT

: repository store in unix directory using CATIA model format

$CUR_ACC_MET_DATA is equal to :
Repository table name followed by the $coid$compid of the object within the repository table for DBLFCDM access
method. For instance :VPMENV.LF00001
$COID$COMPID
Repository information defined in the REPOSITORY field of the insert panel for DBLFAIX access method. For
instance : BIN PATH /tmp/xxxxxx
Repository directory in case of DBLFCAT

LF00001 (table to manage longfields within the database)


Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------$COID

CHARACTER*

Complex object identifier equal to the part $COID

$COMPID

CHARACTER*

Component identifier of the object

$RECNO

INTEGER

Record number

$SEQNO

INTEGER

Sequence number

$DATA

LONG VARCHAR Repository BLOB

Copyright DASSAULT SYSTEMES 2000

1-21

Menu

VPM Programming

$LOCK (table to manage locks on objects)


Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------$COID

CHARACTER*

Complex object identifier equal to the part $COID

$COMPID

CHARACTER*

Component identifier of the object

$LOCKTYPE

CHARACTER*

Type of locks put on the object

$COMPREF

CHARACTER*

$COMPID of the object to be locked

C_COMPNAME

VARCHAR

Representation table name of the locked object

C_RESPONSIBLE

CHARACTER*

Owner of the lock

C_ORG_RESPONSIBLE

CHARACTER*

Organization of the owner of the lock

C_CREATE

TIMESTAMP

Timestamp of creation of the lock

DURATION

VARCHAR

Duration, after which the lock should be removed

COMMENTS

VARCHAR

Comments on the lock

BOUNDING_BOX (table used to manage volumes and spacemap)


Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------$COID

CHARACTER*

Complex object identifier equal to the part $COID

$COMPID

CHARACTER*

Component identifier of the object equals to:


CSB^ENC^ : for a volume
$COMPID of the model for a spacemap

REF_XMIN, REF_XMAX....

DOUBLE

Part volume within an assembly

ASS_XMIN, ASS_XMAX.....

DOUBLE

Sub-assembly volume

TYPE

CHARACTER*

P : for part / M : for model / ^ : no spacemap

VALID

CHARACTER*

V or ^

$DATA

LONG VARCHAR Spacemap meshing data

Note : ^ stands for space CHARACTER*

Copyright DASSAULT SYSTEMES 2000

1-22

Menu

VPM Programming

CLASH (table used to manage the clashes storage)


Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------$COID

CHARACTER*

Complex object identifier equal to the part $COID

$COMPID

CHARACTER*

Component identifier of the object

S_TYPEOFCALC

INTEGER

Type of computation, 3 availaible values:


clash,clash+contact, clash+contact+clearance

S_CLEARANCEVALUE

DOUBLE

clearance values used for the computation

TYPEOFRESULT

INTEGER

type of result (clash / clearance)

MINIMALDISTANCE

DOUBLE

Minimal distance taken into account

INSTANCE_1_COMPID

CHARACTER*

COMPID of clashed instances in the

INSTANCE_2_COMPID

CHARACTER*

PART_PTR table

STATUS

INTEGER

current status of the clashes

COMMENTITF

CHARACTER*

comments

C_RESPONSIBLE

CHARACTER*

Owner of the clash

C_ORG_RESPONSIBLE

CHARACTER*

Organisation of the owner

C_LASTMOD

TIMESTAMP

clash written date

PART_PTR (Instances table)


Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------$COID

CHARACTER*

COID of the root part

$COMPID

CHARACTER*

COMPID of the instance

NAME

VARCHAR

instance name

NB_LINK

INTEGER

number of links to reach the instance from the root

OID

CHARACTER*

path between the root and the instance

C_COID_PART

CHARACTER*

$COID of the pointed part

C_ENV_PART

CHARACTER*

Environment of the pointed part

C_RESPONSIBLE

CHARACTER*

Owner of the instance

C_ORG_RESPONSIBLE

CHARACTER*

Organisation of the owner

C_USED_CLASH

CHARACTER*

Clash used by the pointed part

C_USED_ASSY

CHARACTER*

C_MAT01, C_MAT02, ...

DOUBLE

Copyright DASSAULT SYSTEMES 2000

Positioning matrix for the instance

1-23

Menu

VPM Programming

ZONE (table used to manage predefined volume attached to a product)


Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------$COID

CHARACTER*

Complex object identifier equal to the part $COID

$COMPID

CHARACTER*

Component identifier of the object

S_ZONE_NAME

CHARACTER*

Name of the zone

XMIN, XMAX..........

DOUBLE

Volume defined for a zone

CDM.$COROUTINES (table in which all BOM objects must be declared)


Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------$COID

CHARACTER*

Complex object identifier (equals to the


environment name of the object to be declared)

$COMPID

CHARACTER*

Component identifier

$CREATOR

CHARACTER*

Object owner, equals to the environment name

$OBJ

VARCHAR

Table or view to be declared or on which the


trigger will be launched

$COR_NAME

VARCHAR

see the following note

$PARM

VARCHAR

see the following note

$COND

CHARACTER*

Trigger condition ( Insert, Delete, Update, Select)


$ for table declaration

$PRIORITY

SMALLINT

Priority

$WHEN

CHARACTER*

When Trigger must be launched ( After,Before)

$PGMNAME

CHARACTER*

Name of the trigger program (source file, not module)

$ATTRIBUTES

VARCHAR

Name of attributes on which modification launchs trigger

$EDBS_FLAG

CHARACTER*

= Y ( Trigger component ) / N otherwise

Note: $COR_NAME
- To declare a PART_LIST:
ROOT : required when creating a new complex object ( PART_LIST )
CO_COMPONENT: an object is declared as component of a complex object
VCO_ALL_COMPONENT: This specific view must be defined for each new object

- To declare an object within the complex object (CATIA_MODEL, DOCUMENT):


CO_COMPONENT: an object is declared as component of a complex object
VCO_ALL_COMPONENT: This specific view must be defined for each new object

- For another view on an object, this declaration must be added:


VCO_COMPONENT: Used to declare a view on an object

- For $EXT_LF table:


LF_RELATION: define the relation object within the complex object

Copyright DASSAULT SYSTEMES 2000

1-24

Menu

VPM Programming

- For a trigger: Comment


Note: $PARM
- ENVNAME.PART_LIST for CO_COMPONENT
- ENVNAME.$OBJ for VCO_ALL_COMPONENT
- ENVNAME.TABLE_NAME for VCO_COMPONENT ( in this case OBJ is different from the table name)
- ENVNAME.$EXT_LF for LF_RELATION
- * for ROOT
- Parameters for trigger

CDM.MACRO_LIST (table in which all the BOM profiles (aka CDMA profile) are
stored)
Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------$COID

CHARACTER*

Identifier of the profile

$COMPID

CHARACTER*

00000000 for a profile

MACRO_NAME

VARCHAR

Profile name

SEQNO

SMALLINT

Sequence number of the line of text

MACRO_TEXT

VARCHAR

Profile text

PROFILE.PROFILE_USER (table used when declaring a profile in P&O)


Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------$COID

CHARACTER*

Identification of the profile

$COMPID

CHARACTER*

Same

USER_NAME

CHARACTER*

Reserved for VPM

ENV

CHARACTER*

Name of the environment for the profile

MACRO_NAME

VARCHAR

Name of the environment for the profile_LIST

CATIA.CONAME (table managing every available environment )


Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------$COID

CHARACTER*

$COID of the project

$COMPID

CHARACTER*

Environment name

S_CONAME

VARCHAR

Root complex object name (ENVNAME.PART_LIST)

Copyright DASSAULT SYSTEMES 2000

1-25

Menu

VPM Programming

CATIA.PROJECT (table in which everyproject are defined)


Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------$COID

CHARACTER*

Identification of the project

$COMPID

CHARACTER*

00000000 for a project

S_PROJECT

VARCHAR

Name of the project

CATIA.PRODUCT (table used to store CSB product)


Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------$COID

CHARACTER*

Product id

$COMPID

CHARACTER*

Component identifier of the object

S_COID_REF

CHARACTER*

COID of the product part

S_ENV_REF

CHARACTER*

Name of the referenced environment

S_TABLE_REF

CHARACTER*

Name of the referenced environment

U_PRODNAM

CHARACTER*

Not used

EVENTS ( events library )


Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------EVENT_OID

CHARACTER*

Object Id in EVENTS table

EVENT_NAME

VARCHAR

Part Delete, Action Promote ...

FATHER_OID

CHARACTER*

Reserved for futur use

PSTYPE_OWNER

VARCHAR

Not used

PSTYPE_NAME

VARCHAR

Not used

Copyright DASSAULT SYSTEMES 2000

1-26

Menu

VPM Programming

EXP_SUBSCRIBERS (subscribers)
Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------SUBSCRIBER_OID

CHARACTER*

User Id of the person suscribing

PUBLISHER_OID

CHARACTER*

OID of the published object

EVENT_OID

CHARACTER*

OID of the concerned event

SYNC_DATE

TIMESTAMP

Publish date

SUBSCRIBER_TYPE

VARCHAR

Not used

ACTION_TYPE

VARCHAR

Shell if request ( mail for suscribe with mail)

ACTION

VARCHAR

Name of the shell to launch

ACTION_DATA

VARCHAR

Parametres for the shell (OID, TIMESTAMP)

SUB_NICKNAME

VARCHAR

Parametres for the shell (email address ...)

PUB_NICKNAME

VARCHAR

Parametres for the shell (suscriber Id ...)

PUBLISHED_EVENTS (available events)


Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------PUBLISHER_OID

CHARACTER*

OID of the published object

EVENT_OID

CHARACTER*

OID of the published event

PUBLISH_DATE

TIMESTAMP

Publish date

RDB_DOCUMENTS (link between action data & BLOB storage)


Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------OID_DOC

VARCHAR

OID of the documentation

DOC_USAGE

VARCHAR

type of stored data

DESCRIPTION

VARCHAR

data description

DOC_APPLICATION

VARCHAR

viewer used to open the document


(empty for action)

DOC_FORMAT

CHARACTER*

extention used referencing the viewer

ACC_MET

CHARACTER*

BLOB - join BLOB storage table


(RDB_DOC_BLOB)

Copyright DASSAULT SYSTEMES 2000

1-27

Menu

VPM Programming

All tables (except the three Pub-Sub tables) have six comon attributs :
Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------OID

VARCHAR

Object Id

VIRTUAL_OID

VARCHAR

Not used

TYPE

VARCHAR

Object type

OID_DOC

VARCHAR

OID of the linked document

LAST_MODIFIER_ID

CHARACTER*

Data Base id of the last modifier

LAST_UPDATE_DATE

TIMESTAMP

Date of the last modification

Type name

Explanation

organization_
Column name

---------------------------------------------------------------------------------------------------------------id

CHARACTER*

Organizations Id

name

CHARACTER*

name given at the creation

description

VARCHAR

description given at the creation

address

VARCHAR

address given at the creation

relating_org

VARCHAR

Organization parents OID

relating_org_

VARCHAR

Organization parents OID in the view table

manager_

VARCHAR

Manager OID in person_ table

manager

VARCHAR

Manager OID in person_ view table

Type name

Explanation

role_
Column name

---------------------------------------------------------------------------------------------------------------name

CHARACTER*

Name of the role

description

VARCHAR

description

belongs_to_

VARCHAR

OID of the referenced oganization

belongs_to

VARCHAR

OID of the referenced oganization view

relating_role

VARCHAR

Reserved for futur use

relating_role_

VARCHAR

Reserved for futur use

Copyright DASSAULT SYSTEMES 2000

1-28

Menu

VPM Programming

person_
Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------id

CHARACTER*

id of the person

last_name

VARCHAR

last name of the person

first_name

VARCHAR

first name of the person

belongs_to

VARCHAR

OID of the referenced oganization

belongs_to_

VARCHAR

OID of the referenced oganization view

phone_number

CHARACTER*

Phone_number

address

VARCHAR

address

email

VARCHAR

email

current_role

VARCHAR

OID of the attached role

current_role_

VARCHAR

OID of the attached role view in role_ table

access_object_ (privilege management)


Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------id

CHARACTER*

OID of the relating role

someone

VARCHAR

OID of the relating person

owner

VARCHAR

OID of the creator (person)

application

VARCHAR

OID of the relating application (VPM)

func

VARCHAR

OID of the relating function (BOM)

command

VARCHAR

OID of the relating command (Create Part)

workspace

VARCHAR

Reserved for futur use

authorization

INTEGER

Revoke & Grant management

data_in

VARCHAR

link to data group or profile environment

data_out

VARCHAR

link on profile

Copyright DASSAULT SYSTEMES 2000

1-29

Menu

VPM Programming

data_group_
Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------name

VARCHAR

Name of the data group

group_type

VARCHAR

Data group type ( My_Data / My Org_Data)

owner

VARCHAR

OID of the creator in person_ table

description

VARCHAR

description given at the creation

usage

VARCHAR

not used

Type name

Explanation

process_
Column name

---------------------------------------------------------------------------------------------------------------application

VARCHAR

VPM, VPMAdmin ...

func

VARCHAR

BOM, Action ...

command

VARCHAR

Create Part, Promote action ...

owner

VARCHAR

OID of the (Process group) creator in person_ table

description

VARCHAR

description given at the creation

configuration0001_ (configuration item associed to each configurable part)


Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------id

VARCHAR

id of configuration item

description

VARCHAR

description - not used

design

VARCHAR

UID of the part set configurable

owner

VARCHAR

not used

status

VARCHAR

not used

released

INTEGER

not used

Copyright DASSAULT SYSTEMES 2000

1-30

Menu

VPM Programming

effectivity_
Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------id

VARCHAR

effectivity id

description

VARCHAR

not used

status

VARCHAR

Validated modification or not

released

INTEGER

Not used

start_range

INTEGER

start range

end_range

INTEGER

end range

start_program

VARCHAR

start_id

VARCHAR

end_program

VARCHAR

end_id

VARCHAR

start_date

INTEGER

start date

end_date

INTEGER

end date

lot_id

VARCHAR

specific type of effectivity - not used

lot_size

VARCHAR

specific type of effectivity - not used

modif_id

VARCHAR

modificatoin tag (by default , action id)

action_type

VARCHAR

add / del link in PSN (`+/- in info link panel)

validation

VARCHAR

not used

oldlink

VARCHAR

optional modification

option_id

VARCHAR

option name

option_type

VARCHAR

simple option or complex option (with date/range)

option_start

INTEGER

Start (/ End) date (/range) when option is combined

option_end

INTEGER

with a date (/range)

option_lot_id

VARCHAR

not used

pack_type

VARCHAR

pack_start

INTEGER

pack_end

INTEGER

pack_lot_id

VARCHAR

pack_name

VARCHAR

Copyright DASSAULT SYSTEMES 2000

Name of the pack

1-31

Menu

VPM Programming

configuration0002_ (configuration handlers)


Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------id

VARCHAR

id given to the CH at the creation

CUR_DATE

VARCHAR

current date (flag)

description

VARCHAR

description given at the creation

apply

VARCHAR

UID product

status

VARCHAR

not used

owner

VARCHAR

OID of the creator in the person table - not used

flag_frozen

INTEGER

not used

released

INTEGER

not used

organization

VARCHAR

visibility

VARCHAR

EFFTYPE_FOR_PART_ (Set configurable data)


Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------PARTID

VARCHAR

UID of the configurable part

ALLOWED_TYPE

INTEGER

type of the allowed effectivity

PART_EFFLINK_ (Paste effectivity data)


Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------PART_ID

VARCHAR

UID of the part on which you pasted effectivity

PART_CHILD

VARCHAR

UID of the copied part

Copyright DASSAULT SYSTEMES 2000

1-32

Menu

VPM Programming

Action_
Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------nbr

INTEGER

action number

name

VARCHAR

action id (type, number & subnumber combined)

secondary_id

VARCHAR

customized id (= action id by default)

action_type

VARCHAR

type given at the creation

description

VARCHAR

abstract

creator

VARCHAR

id of the creator

owner

VARCHAR

id of the owner

organization

VARCHAR

id of the creators organisation

priority

VARCHAR

priority given to the action

status

VARCHAR

status of the action

start_date

VARCHAR

Target start date (yyyy-mm-dd-hh.mm.dd)

end_date

VARCHAR

Target end date (yyyy-mm-dd-hh.mm.dd)

various

VARCHAR

control parameter (system parameter)

working_eff

VARCHAR

modification tag (used for query)

applicability_0001

VARCHAR

industrial eff type at validation time

applicability_opt

VARCHAR

option name generated by this action - not used

applicability_min

INTEGER

range / date (min value) generated by this action

applicability_max

INTEGER

range / date (max value) generated by this action

proposed_eff_type

VARCHAR

type of proposed eff (range / date)

proposed_eff_opt

VARCHAR

option id which has been proposed - not used

proposed_eff_min

INTEGER

range / date (min value) which has been proposed

proposed_eff_max

INTEGER

range / date (max value) which has been proposed

product

VARCHAR

product defined for the action

Copyright DASSAULT SYSTEMES 2000

1-33

Menu

VPM Programming

filter_unit_ ( Configuration filter )


Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------cfg_itm_

VARCHAR

OID of the corresponding configuration item

cfg_itm

VARCHAR

OID of the corresponding cfg item in the view

eff_type

VARCHAR

type of effectivity (opt, opt+date .....)

eff_val1

INTEGER

date / Range start value

eff_val2

INTEGER

date / Range end value

eff_str1

VARCHAR

option name

eff_str2

VARCHAR

not used

date_fu

INTEGER

Referenced for futur use

eff_str3

VARCHAR

eff_str4

VARCHAR

eff_str5

VARCHAR

eff_source

INTEGER

PLANNED_EFF_ (Proposed effectivity table)


Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------ACTION_NAME

VARCHAR

action id (DSG xx)

EFF_TYPE

VARCHAR

date/range

BOT

INTEGER

date / Range start value

TOP

INTEGER

date / Range end value

OPTION_NAME

VARCHAR

BOT_PROGRAM

VARCHAR

BOT_ID

VARCHAR

TOP_PROGRAM

VARCHAR

TOP_ID

VARCHAR

Copyright DASSAULT SYSTEMES 2000

1-34

Menu

VPM Programming

MILESTONE
Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------ID

VARCHAR

Milestone ID

PROGRAM

VARCHAR

Program Name

PRODUCT

VARCHAR

Part Reference

DESCRIPTION

VARCHAR

Milestone Description

PROGRAM_STEP

VARCHAR

PHASE

VARCHAR

MILESTONE_TYPE

VARCHAR

Date / Range

MILESTONE_VALUE

INTEGER

Milestone Value

VALUE_MIN

INTEGER

VALUE_MAX

INTEGER

FROZEN

INTEGER

STATUS

VARCHAR

OWNER

VARCHAR

Owner of the Milestone

ORGANIZATION

VARCHAR

Organization

Type name

Explanation

Frozen Status

MML_ENTITY
Column name

---------------------------------------------------------------------------------------------------------------OBJECT_CATAB

VARCHAR

Model Table (CATIA_MODEL)

OBJECT_COID

CHARACTER

Model Coid

OBJECT_COMPID

CHARACTER

Model Compid

ENTITY_ID_1

CHARACTER

Entity UID (first part)

ENTITY_ID_2

CHARACTER

Entity UID (second part)

ENTITY_KEY

CHARACTER

Entity Key

ENTITY_NICKNAME

VARCHAR

Not Used

TS

TIMESTAMP

Entity Timestamp

UBIT

CHARACTER

UBIT

Copyright DASSAULT SYSTEMES 2000

1-35

Menu

VPM Programming

MML_LINK
Column name

Type name

Explanation

---------------------------------------------------------------------------------------------------------------OBJECT_CATAB

VARCHAR

Model Table

OBJECT_COID

CHARACTER

Model Coid

OBJECT_COMPID

CHARACTER

Model Compid

ENTITY_ID_1

CHARACTER

Entity UID (first part)

ENTITY_ID_2

CHARACTER

Entity UID (second part)

ENTITY_KEY

CHARACTER

Entity Key

TYPE

CHARACTER

Link Type

TS

TIMESTAMP

Link Timestamp

STATUS

CHARACTER

Link Status

UBIT

CHARACTER

UBIT

Copyright DASSAULT SYSTEMES 2000

1-36

Menu

VPM Programming

Index

Copyright DASSAULT SYSTEMES 2000

1-37

Menu

VPM Programming

CDM/CATIA Dictionaries and BOM Environment

Copyright DASSAULT SYSTEMES 2000

1-38

Menu

VPM Programming

BOM: Links between objects

Copyright DASSAULT SYSTEMES 2000

1-39

Menu

VPM Programming

BOM: Repository links - Model inside DB

Copyright DASSAULT SYSTEMES 2000

1-40

Menu

VPM Programming

BOM: Repository links - Model outside DB

Copyright DASSAULT SYSTEMES 2000

1-41

Menu

VPM Programming

BOM: Repository links - DOCUMENT inside DB

Copyright DASSAULT SYSTEMES 2000

1-42

Menu

VPM Programming

BOM: Repository links - Document outside DB

Copyright DASSAULT SYSTEMES 2000

1-43

Menu

VPM Programming

BOM: Repository links - Document outside DB

Copyright DASSAULT SYSTEMES 2000

1-44

Menu

VPM Programming

BOM: Assembly links between objects

Copyright DASSAULT SYSTEMES 2000

1-45

Menu

VPM Programming

BOM: MML links between objects

Copyright DASSAULT SYSTEMES 2000

1-46

Menu

VPM Programming

BOM: Lock

Copyright DASSAULT SYSTEMES 2000

1-47

Menu

VPM Programming

BOM: Bounding box

Copyright DASSAULT SYSTEMES 2000

1-48

Menu

VPM Programming

BOM: Zone

Copyright DASSAULT SYSTEMES 2000

1-49

Menu

VPM Programming

Configuration item and effectivity

Copyright DASSAULT SYSTEMES 2000

1-50

Menu

VPM Programming

Effectivity view

Copyright DASSAULT SYSTEMES 2000

1-51

Menu

VPM Programming

Copyright DASSAULT SYSTEMES 2000

1-52

Menu

VPM Programming

Dictionaries

Copyright DASSAULT SYSTEMES 2000

1-53

Menu

VPM Programming

Milestones

Copyright DASSAULT SYSTEMES 2000

1-54

Menu

VPM Programming

Copyright DASSAULT SYSTEMES 2000

1-55

Menu

VPM Programming

People & Organisation

Copyright DASSAULT SYSTEMES 2000

1-56

Menu

VPM Programming

Security

Copyright DASSAULT SYSTEMES 2000

1-57

Menu

VPM Programming

Security view

Copyright DASSAULT SYSTEMES 2000

1-58

Menu

VPM Programming

Action

Action

Copyright DASSAULT SYSTEMES 2000

1-59

Menu

VPM Programming

Action

Copyright DASSAULT SYSTEMES 2000

1-60

Menu

VPM Programming

Publish - Subscribe

Copyright DASSAULT SYSTEMES 2000

1-61

Menu

VPM Programming

Copyright DASSAULT SYSTEMES 2000

1-62

Menu

VPM Programming

Appendix 4 - Environment Table Administration


Creating a Project:
1. Edit a command stream file CreateProject with the following content:
(See sample in $CAT_CUST/InstallVPM/reffiles/DBMS/VPINSTC2)
*ON_CST_ERROR STOP
*ON_ERROR
STOP
*COMMAND
*RUN

VPPARCUS

*COMMAND
*RUN

VPPARPRO

*COMMAND
ASSIGN 00000000 TO GLOBAL_T ;
ASSIGN T TO GLOBAL_VARIABLE_NAME ;
RUN OID_TO_HEXA ;;
EXECUTE IMMEDIATEINSERT INTO &DICOCATI.PROJECT
($COID, $COMPID, S_PROJECT)
VALUES
(&COID_PROJX, &TX, ProjectName);;
EXECUTE IMMEDIATE
COMMIT WORK ;;
*RUN
2. Change the value of catcdm.c_stream in USRENV.dcls to reference the directory where the
command stream file is located.
3. Test that this directory is referenced as first directory by using the catpath command:
catpath -l -A catcdm.c_stream
4. Run the dbcdmb command
dbcdmb CreateProject -u DbAdmin -p DbAdminPassword

Copyright DASSAULT SYSTEMES 2000

1-63

Menu

VPM Programming

Deleting a Profile
This is done in three steps:
1. Remove the link Role / Profile (only for specific profiles declared in P&O):
With P&O: delete the proper row in the tab Privilege
2. Remove the link Profile / Environment (only for specific profiles declared in P&O):
Two possibilities
a. With P&O: delete the proper objects in the tab Profile
b. In the Data Base with the following instruction:
db2: delete from PROFILE.PROFILE_USER where MACRO_NAME = ProfileName
Oracle: delete from PROFILE.PROFILE_USER where MACRO_NAME = ProfileName;
3. Remove the physical data of the profile in the Data Base
db2: delete from CDM.MACRO_LIST where MACRO_NAME = ProfileName
Oracle: delete from CDM.MACRO_LIST where MACRO_NAME = ProfileName;

Deleting an Environment
This is done in five steps:
1. Identify the profiles (other than the default profiles) belonging to the environment. Two
possibilities:
a. With P&O: in the tab Profile
b. In the Data Base with the following instruction:
db2: select MACRO_NAME from PROFILE.PROFILE_USER where ENV = EnviromentName
Oracle: select MACRO_NAME from PROFILE.PROFILE_USER where ENV = EnviromentName;
2. Remove all the specific and default profile in the database
Note : See former paragraph.

3. Remove the declaration of the environment:


db2: delete from CATIA_CONAME where S_CONAME = EnviromentName.PART_LIST
Oracle: delete from CATIA_CONAME where S_CONAME = EnviromentName.PART_LIST;
4. Remove the the table declarations and triggers in the CDM dictionary:
db2: delete from CDM.$COROUTINES where $CREATOR = EnviromentName
Oracle: delete from CDM.$COROUTINES where $CREATOR = EnviromentName;
5. Remove tables and views of the environment.
In order to list all tables and views in the data base, use the following instructions:
db2: list tables for schema EnvironmentName
Oracle: select table_name from all_tables where owner = EnviromentName;

Copyright DASSAULT SYSTEMES 2000

1-64

Menu

VPM Programming

Deleting a Project
This is done in three steps:
1. List the environments belonging to the project:
db2: select S_CONAME from CATIA.CONAME where $COID = $COIDofProject
Oracle: select S_CONAME from CATIA.CONAME where $COID = $COIDofProject;
2. Remove these associated environments:
Note : You can in one shot delete the declarations of all environments belonging to the project. The third step
of the former paragraph will be completed for all the environments using the following instructions:

db2: delete from CATIA.CONAME where $COID = $COIDofProject


Oracle: delete from CATIA.CONAME where $COID = $COIDofProject;
3. Remove the project declaration:
db2: delete from CATIA.PROJECT where S_PROJECT = ProjectName
Oracle: delete from CATIA.PROJECT where S_PROJECT = ProjectName;

Copyright DASSAULT SYSTEMES 2000

1-65

Menu

VPM Programming

Copyright DASSAULT SYSTEMES 2000

1-66

Menu

VPM Programming

Appendix 5 - C++ Reminder


Memory Management
In C++, the memory management is handled with two following instructions:
1. new
char * String = new char[50];
// Reserves a memory space for 50 characters
// Caution: this string can save only 49 characters!
2. delete
delete String;

// Release the memory space referenced by String

3. void * memcpy (void * Targ, const void * Source, unsigned Count);


Copies Count octets from Source to Targ.

String Management
The following functionalities are available in stdlib.h
1. String copy:
char * strcpy (char * Targ, const char * Source);
Copies Source, including the termination null chracter \0, to the location specified by
Targ, and returns Targ. No overflow checking is performed when strings are copied or
appended.
char * strncpy (char * Targ, const char * Source, unsigned Count);
Copies the initial Count characters of Source to Targ, and returns Targ. If Count is less
than or equal to the length of Source, a null character is not automatically appended to
the copied string.
2. String concatenation:
char * strcat (char * Left, const char * Right);
Appends Right to Left and terminates the resulting string with a null character. No
overflow checking is performed when strings are copied or appended.
char * strncat (char * Left, const char * Right, unsigned Count);
Appends, at most, the first Count characters of Right to Left.

Copyright DASSAULT SYSTEMES 2000

1-67

Menu

VPM Programming

3. String comparison:
char * strcmp (const char * Str1, const char * Str2);
Compares the two string Str1 and Str2.
The return value for each of these functions indicates the lexicographic relation of Str1
to Str2.
Value
Relationship of Str1 to Str2
<0
Str1 less than Str2
0
Str1 identical Str2
>0
Str1 greater than Str2
char * strncmp (const char * Str1, const char * Str2, unsigned Count );
Compares, at most, the first Count characters in Str1 and Str2.
char * strcimp (const char * Str1, const char * Str2);
Same as strcmp but does not differentiate lower and upper cases.
char * strnicmp (const char * Str1, const char * Str2, unsigned Count );
Same as strncmp but does not differentiate lower and upper cases.

String and I/O Management


These functionalities are available in stdio.h
1. printf (const char * format, ...)
Note : Declared in in stdio.h

Syntax for format:


int
%d
float
%e
double
%le
char *
%s

%f
%lf

%g

2. sprintf (char * Buffer, const char * format, ...)


3. cout
Note : Declared in in iostream.h

cout << Buffer

// Buffer can be: char *, int, double ...

4. Text format (can be used for printf and cout):


New Line
\n
Tabulation
\t

Copyright DASSAULT SYSTEMES 2000

1-68

Menu

VPM Programming

File Management
Instructions available in fstream.h
char *
Buffer1
= new char[50];
char *
Buffer2
= new char[50];
char *
FileName = new char[50];
fstream
File; // Object created to open a connection
strcpy (FileName, Test.txt);
// Test.txt: toto tutu
File.open(FileName, ios::in );
// Open the file FileName in read mode
/* File.open(FileName, ios::out );
Open the file FileName in write mode */
/* File.open(FileName, ios::in | ios::out);
Open the file FileName in R/W mode */
if (!File)
cout << The file does not exit. << endl;
else
{
File >> Buffer1; // The value of Buffer1 is toto
File >> Buffer2; // The value of Buffer2 is tutu
}
File.close(); // Close the connection
delete Buffer1[];
delete Buffer2[];
delete FileName[];

UNIX Interface
This functionality is available in stdlib.h
char * getenv (char *);
Can be used under UNIX in oder to get the value of an environment declarative variable.
Example: char * User = getenv(USER);

Copyright DASSAULT SYSTEMES 2000

1-69

Menu

VPM Programming

Copyright DASSAULT SYSTEMES 2000

1-70

Menu

VPM Programming

Appendix 6 - Headers
CATDMUsrMethod.h
libLV0XUSR.a
/* -*-c++-*-*/
// COPYRIGHT DASSAULT SYSTEMES 1997
//=============================================================================
//
// CATDMUsrMethod:
// Contains all the user exits related to BOM
//
//=============================================================================
// Usage Notes:
//
//=============================================================================
// Sep. 97 Creation
//=============================================================================
#ifndef CATDMUsrMethod_h
#define CATDMUsrMethod_h
#include <time.h>
// Modification types for commit
enum ModificationType {
ADDLINK=1,
REMOVELINK=2,
MOVELINK=4,
REPLACELINK=8,
MOVEREPLACELINK=4+8,
RENAMELINK=16,
ADDLINKTOCONF=32+1
};
// Action types for versioning
enum RevVerAction
{
ACTION_NEW,
ACTION_UPDATE
};
// Actions for config-handlers control
enum CHAction
{
CH_CREATE,
CH_RENAME,
CH_DUPLICATE,
CH_DELETE,
CH_EDIT_CONTENT, // editer la definition(contenu) du CH
CH_EDIT_LINK, // editer les liens du CH (CHs children et brothers)
CH_CHANGE_OWNER
};

Copyright DASSAULT SYSTEMES 2000

1-71

Menu

VPM Programming

#ifndef PartAsmID_def
#define PartAsmID_def
typedef struct PartAsmId_ {
char coid[8];
char compid[8];
char caenv[8];
char catab[18];
char clien[8]; // link COMPID (towards father)
double xmat[12]; // transformation matrix
int level;
} PartAsmID;
#endif
#ifndef ObjID_def
#define ObjID_def
typedef struct
{
char Xcoid[17]; // Coid (hexadecimal notation)
char Xcompid[17]; // Compid (hexadecimal notation)
double coid;
// Coid (binary)
double compid; // Compid (binary)
char caenv[9];
char catab[19];
} ObjID;
#endif
#ifndef EffParam_def
#define EffParam_def
typedef struct
{
char Type[40]; // Type of the effectivity:
// modif, date, range, option_undef, pack_undef,
// option_date, option_range, pack_date, pack_range
char Modif[40]; // Modification name (Type=modif)
char Option[40]; // Option name (Type=option_XXX)
int NbOpt;
// Nb options in OptList (Type=pack_XXX)
char** OptList; // Options (combined with AND operator) (Type=pack_XXX)
int BotRange; // Bottom value for range (Type=range, XXX_range)
int TopRange; // Top value for range (Type=range, XXX_range)
time_t BegDate;
// Start value for date (Type=date, XXX_date)
time_t EndDate;
// End vallue for date (Type=date, XXX_date)
} EffParam;
#endif
#ifndef Error_def
#define Error_def
typedef struct
{
int Ier;
// Error code
char* ShortMsg; // Short message (deleted by VPM if not NULL and if Ier!=0)
char* LongMsg; // Long message (deleted by VPM if not NULL and if Ier!=0)
} Error;
#endif
/**

Copyright DASSAULT SYSTEMES 2000

1-72

Menu

VPM Programming

* Note:<BR>
*
* Following convention is used for naming parameters: parameter names prefixed by:
* <dl>
* <dd> <tt>i</tt> are input parameters
* <dd> <tt>o</tt> are ouput parameters
* <dd> <tt>io</tt> are input/output parameters
* </dl>
*/

class CATDMUsrMethod
{
public:
//---------------------------------------// Additional tools and methods management
//---------------------------------------static Error ExecuteUsrMethod(const char *iMethodName,
const int &iNbSelectedInstances,
ObjID *iSelectedObjects);
static Error OpenPSNWithUsrMethod(const char* iMethodName,
const int& iNbSelectedInstances,
int* iDepthArray,
PartAsmID** iObjArray,
double** iComputedXmatArray);

//------------------// PSN save management


//------------------/**
* Allows customization of the proposed values list in the
* Modification Name combo, when commiting changes on a configurable
* part in PSN.
* <p>
* If method does not provide a history list (<tt>oHistSize=0</tt>),
* the caller method will use default history.
* Allocation of <tt>oHistory</tt>s elements has to be done in function
* GetConfNameHistory.
* Desallocation is the responsability of VPM.
*
* @param iUser
* user name
* @param iOrg
* user organization
* @param oHistory
* points on the list of proposed values
* @param oHistSize
* number of proposed values
*/
static void GetConfNameHistory(const char iUser[9], const char iOrg[11],
char*** oHistory, int* oHistSize);

Copyright DASSAULT SYSTEMES 2000

1-73

Menu

VPM Programming

/**
* Allows user to validate keyed flag versus current modifications.
*
* @param iModificationFlag
* flag which is going to be used in order to save following modifications
* @param iModificationFlag
* number of modifications
* @param iTypeOfModifications
* types of the modifications
* @param iAddedLinks
* list of added links
* @param iRemovedLinks
* list of removed links
*
* @return
* If method return an error, another modification flag must
* be keyed or commit canceled.
*/
static Error IsAValidFlagForCommit(const char* iModificationFlag,
const int iNbModifications,
int* iTypeOfModifications,
ObjID* iAddedLinks,
ObjID* iRemovedLinks);
/**
* User exit called when saving Product Structure modifications
* @return
* <tt>1</tt> Action flow will test whether the current user/role has the right to
*
write the modifications (maintenance phase)<BR>
* <tt>0</tt> Action flow wont be called when saving the modifications
*
(development phase)
*/
static int ActionFlowCheck(const char *iModificationFlag,
const char *iUser);
static Error SuccessfullyCommitInGraph(const char* iModificationFlag,
const int iNbModifications,
int* iTypeOfModifications,
ObjID* iAddedLinks,
ObjID* iRemovedLinks);
static void SuccessfullyRollBackInGraph();
//------------------------// Modifications management
//------------------------/**
* User exit called when validating action and commiting PSN graph modifications
* @param iModif
* Modification to validate
* @param oType
* Type of the validation (option, range, date, pack, option_range, option_date,
* pack_range, pack_date)
* @param oOptListSize

Copyright DASSAULT SYSTEMES 2000

1-74

Menu

VPM Programming

* Number of options in oOptList


* = 1 if type is equal option, option_range or option_date
* = n if type is equal pack, pack_range or pack_date
* @param oOptList
* significant only if oType is equal to option, option_range,
* option_date, pack, pack_range or pack_date
* @param oRangeBot
* significant only if oType is equal to range, option_range
* or pack_range
* @param oRangeTop
* significant only if oType is equal to range, option_range
* or pack_range
* @param oDateBeg
* significant only if oType is equal to date, option_date
* or pack_date
* @param oDateEnd
* significant only if oType is equal to date, option_date
* or pack_date
*
* @return
* If Error.Ier equals 0 validation is done, else error message is displayed
*/
static Error DefaultModValidation(const char *iModif, char **oType, int &oOptListSize, char ***oOptList, int
&oRangeBot, int &oRangeTop, time_t &oDateBeg, time_t &oDateEnd);
/**
* User exit called when validating a modification
* @param iModification
* Modification to validate
* @param iUser
* Identifier of the user
* @param iValidationType
* Type of the validation (option, range, date, pack, option_range, option_date,
* pack_range, pack_date)
* @param iNbOptions
* Number of options in iOptionList
* = 1 if type is equal option, option_range or option_date
* = n if type is equal pack, pack_range or pack_date
* @param iOptionList
* significant only if iValidationType is equal to option, option_range,
* option_date, pack, pack_range or pack_date
* @param iRangeBot
* significant only if iValidationType is equal to range, option_range
* or pack_range
* @param iRangeTop
* significant only if iValidationType is equal to range, option_range
* or pack_range
* @param iDateBeg
* significant only if iValidationType is equal to date, option_date
* or pack_date
* @param iDateEnd
* significant only if iValidationType is equal to date, option_date
* or pack_date
*
* @return

Copyright DASSAULT SYSTEMES 2000

1-75

Menu

VPM Programming

* If Error.Ier equals 0 validation is allowed, else error message is displayed


*/
static Error AuthorizedModValidation(const char *iModification,
const char *iUser,
const char *iValidationType,
const int iNbOptions,
char **iOptionList,
const int iRangeBot, const int iRangeTop,
const time_t iDateBeg, const time_t iDateEnd);
/**
* User exit called when promoting a modification
*
* @return
* If Error.Ier equals 0 promote is allowed, else error message is displayed
*/
static Error AuthorizedModPromote(const char *iModification, const char *iUser);
/**
* User exit called when demoting a modification
*
* @return
* If Error.Ier equals 0 demote is allowed, else error message is displayed
*/
static Error AuthorizedModDemote(const char *iModification, const char *iUser);
/**
* User exit called when deleting a modification
*
* @return
* If Error.Ier equals 0 delete is allowed, else error message is displayed
*/
static Error AuthorizedModDelete(const char *iModification, const char *iUser);
/**
* User exit called when creating a modification
*
* @return
* <tt>0</tt> iModification will be of Personal type and belongs to iUser
*
(only iUser will see iModification until promoted)
* <tt>1</tt> iModification will be of Public type (everybody can see it)
*/
static int ModCreateOwner(const char *iModification, const char *iUser);
//----------------------------------------------------------------// Check user authorization for basic operations
// Operations are performed if no error (error code =0) is returned
//----------------------------------------------------------------// Cut link
static Error AuthorizedCut(const ObjID& iLink);
// Move Link
static Error AuthorizedMove(const ObjID& iLink);
// Create Link (with paste method)
static Error AuthorizedPaste(const ObjID& iFather, const ObjID& iChild);
// CheckIn object

Copyright DASSAULT SYSTEMES 2000

1-76

Menu

VPM Programming

static Error AuthorizedCheckIn(const ObjID& iObj);


// CheckOut object
static Error AuthorizedCheckOut(const ObjID& iObj);
// Delete object
static Error AuthorizedDelete(const ObjID& iObj);
// Create object
static Error AuthorizedCreate(const ObjID& iObj);
// Update object
static Error AuthorizedUpdate(const ObjID& iObj);
// Replace
static Error AuthorizedReplace(const ObjID& iFather,const ObjID& iLink,
const ObjID& iChild,const ObjID& iNewChild);

/**
* Checks autorisation before saving model in CATIA V4.
*
* @return
* 0
means save is authorized in CATIA V4
* not 0 it is an error code :
*
=> save in CATIA will not be performed
*
*/
static int AuthorizedCATIASave(const ObjID& iObj);

// Change maturity
static Error AuthorizedPromotion(const ObjID& iObj,
const char* iOldStatus,
const char* iNewStatus);
/**
* User exit called when changing ownership.
*
* @return
* If Error.Ier equals 0 modification is allowed, else error message is
* displayed.
*/
static Error AuthorizedReassign(const ObjID& iObj,
const char iUser[9],
const char iOrg[11]);

* <tt>-2</tt> Help values with first value as default value<BR>


* <tt>&nbsp;1</tt> Authorized values without default value<BR>
* <tt>&nbsp;2</tt> Authorized values with first value as default value
*
* @param oNbValues
* number of values returned
* @param oValues

Copyright DASSAULT SYSTEMES 2000

1-77

Menu

VPM Programming

* list of values (this array is allocated and deleted by VPM)


*/
static void GetInputListOfValues(const char* iCatab,
const char* iAttribute,
int* oAuthorized=0,
int* oNbValues=0,
char*** oValues=0);
/**
* Allows to check attribute values or to valuate company attributes
* before writing a part or an object.
*
* @param iUpdate
* <tt>0</tt> user-exit called in write context<BR>
* <tt>1</tt> user-exit called in update context
* @param iCaenv
* Owner of the environment into which the object is being written
* @param iCatab
* Name of the table into which the object is being written
* @param iNbAttPart
* Number of attributes given for the part
* @param iNbAttObj
* Number of attributes given for the object
* @param ioAttNames
* Names of the given attributes for the part and the object being written
* (array size : iNbAttPart + iNbAttObj)
* @param ioAttVals
* Values of the given attributes for the part and the object being written
* (array size : iNbAttPart + iNbAttObj)
*
* @return
* The method must return 0 if the operation is accepted or error code
* if it is refused. In such a case, an error message is displayed in an
* error notification panel and the operation is canceled.
* The attributes given in the list are the ones that were valuated in
* the insert panel. If you wish to valuate a hidden attribute, you
* will have to reallocate AttNames and AttVals and add the attribute
* and its value.
*/
static Error ComputeValuesBeforeWrite(const int iUpdate,
const char* const iCaenv,
const char* const iCatab,
int *iNbAttPart,
int *iNbAttObj,
char ***ioAttNames,
char ***ioAttVals);
//---------------------// Long Field management
//---------------------/**
* Allows to check source location or to customize LF management
*
* @param iCaenv
* Owner of the environment into which the object is being written

Copyright DASSAULT SYSTEMES 2000

1-78

Menu

VPM Programming

* @param iCatab
* Name of the table into which the object is being written
* @param iSource
* Where the LF (long field) comes from :<BR>
* <tt>1</tt> File<BR>
* <tt>2</tt> CATIA V4<BR>
* <tt>3</tt> New one (empty)<BR>
* <tt>4</tt> Object in database<BR>
* <tt>5</tt> Document<BR>
* <tt>7</tt> DENEB product
* @param ioPath
* Significant only when <tt>iSource</tt> is equal to File (1).<BR>
* It is the full path of the file.
* @param ioObj
* Significant only when <tt>iSource</tt> is equal to Object in database (4).<BR>
* @param ioRepository
* Where the LF is going to be written
*
* @return
* The method must return 0 if the operation is accepted or error code
* if it is refused. In such a case, an error message is displayed in an
* error notification panel and the operation is canceled.
*/
static Error CheckLFBeforeWrite(const char* const iCaenv,
const char* const iCatab,
const int iSource,
char **ioPath,
ObjID *ioObj,
char** ioRepository);
//---------------------------// Version/revision management
//---------------------------/**
* Provides a list of proposed values upon creation/update of a
* version.<BR>
* If number of values is greater than 0, the values will be
* displayed in a list inside input panel.
*<p>
* Note : <b>used in NEW revisioning mode</b>
*
* @param iobj
* object from which we want to create a new version
* @param iMaturity
* maturity of the object
* @param iLastRev
* last existing version number
* @param iCurRev
* version number of the object being handled
* @param oNbVerValues
* number of values returned
* @param oVerValues
* list of values (memory has to be allocated within the user
* exit ; it is freed by the caller)
* @param oAuthorized

Copyright DASSAULT SYSTEMES 2000

1-79

Menu

VPM Programming

* decides if output values are to be taken as authorized values


* (default is : help values)
*/
static void GetNewVersionListOfValues(const ObjID& iObj
const char* iMaturity ,
const char* iLastVer ,
const char* iCurVer
,
int*
oNbVerValues ,
char***
oVerValues ,
int*
oIsAuthorized);
/**
* Provides a list of proposed values upon creation/update of a
* revision. <BR>
* If number of values is greater than 0, the values will be
* displayed in a list inside input panel.
*<p>
* Note : <b>used in NEW revisioning mode</b>
*
* @param iObj
* object from which we want to create a new revision
* @param iMaturity
* maturity of the object
* @param iLastRev
* last existing revision number
* @param iCurRev
* revision number of the object being handled
* @param oNbRevValues
* number of values returned
* @param oAuthorized
* decides if output values are to be taken as authorized values
* (default is : help values)
*/
static void GetNewRevisionListOfValues(const ObjID& iObj
const char* iMaturity ,
const char* iLastRev ,
const char* iCurRev ,
int*
oNbRevValues,
char***
oRevValues ,
int*
oAuthorized );

/**
* Checks the validity of the keyed value for revision .
*<p>
* Note : <b>used in NEW revisioning mode</b>
* @param iObj
* object from which we want to create a new version
* @param iMaturity
* maturity of the object
* @param iPrevVer
* previous version number of the object
* @param iNewVer
* new version number
* @param iAction
* create or update operation

Copyright DASSAULT SYSTEMES 2000

1-80

Menu

VPM Programming

* @return
* The method must return an Error with Ier=0 if the operation is
* accepted or error code if it is refused.
* In such a case, an error message is displayed in an error
* notification panel .
*/
static Error IsAValidNewVersion(const ObjID&
iObj ,
const char*
iMaturity,
const char*
iPrevVer ,
const char*
iNewVer ,
const RevVerAction iAction );
/**
* Checks the validity of the keyed value for revision.
*<p>
* Note : <b>used in NEW revisioning mode</b>
*
* @param iObj
* object from which we want to create a new revision
* @param iMaturity
* maturity of the object
* @param iPrevRev
* previous revision number of the object
* @param iNewRev
* new revision number
* @param iAction
* create or update operation
*
* @return
* The method must return an Error with Ier=0 if the operation is
* accepted or error code if it is refused.
* In such a case, an error message is displayed in an error
*
notification panel.
*/
static Error IsAValidNewRevision(const ObjID&
iObj ,
const char*
iMaturity,
const char*
iPrevRev ,
const char*
iNewRev ,
const RevVerAction iAction );
/**
* Checks the validity of the keyed value for revision duplication
* when versioning a part.
*<p>
* Note : <b>used in NEW revisioning mode when declarative
*
CATCDMA.VPM.VERSION.SELECTREVISION.INPUT is set to TRUE</b>
*
* @param iObj
* object from which we want to create a new revision
* @param iPrevRev
* previous revision number of the object
* @param iNewRev
* new revision number
*
* @return
* The method must return an Error with Ier=0 if the operation is

Copyright DASSAULT SYSTEMES 2000

1-81

Menu

VPM Programming

* accepted or error code if it is refused.


* In such a case, an error message is displayed in an error
*
notification panel.
*/
static Error IsAValidDuplicatedRevision(const ObjID& iObj
const char* iPrevRev,
const char* iNewRev );

/**
* Checks the validity of the keyed value for version or revision.
*<p>
* Note : <b>used in OLD revisioning mode </b>
* @param iObj
* object from witch we want to create a new version or revision
* @param iVersion
* version of the part
* @param iOldVerRev
* version or revision of iobj
* @param iNewVerRev
* version or revision keyed
*
* @return
* The method must return an Error with Ier=0 if the operation is
* accepted or error code if it is refused.
* In such a case, an error message is displayed in an error
* notification panel.
*/
static Error IsAValidRevisionVersion(const ObjID& iObj
,
const char iVersion[4] ,
const char iOldVerRev[4],
const char iNewVerRev[4]);
/**
* Called before creating new part version.
*<p>
* Note : <b>used in BOTH revisioning mode</b>
*
* @param iObj
* object from which we want to create a new version
* @param iNewPartNumber
* <tt>0</tt> same part number<BR>
* <tt>1</tt> new part number
*/
static Error AuthorizedNewVersion(const ObjID& iObj
const int iNewPartNumber);

/**
* Called before creating new representation revision.
*<p>
* Note : <b>used in BOTH revisioning mode</b>
*
* @param iObj
* object from which we want to create a new revision
*/
static Error AuthorizedNewRevision(const ObjID& iObj);

Copyright DASSAULT SYSTEMES 2000

1-82

Menu

VPM Programming

Copyright DASSAULT SYSTEMES 2000

1-83

Menu

VPM Programming

//-----------------------//
//----------------------/**
* Allows user to perform specific action before object creation.
*
* @param iCaenv
* Environment into which the object is going to be created
* @param iObject
* Object (type) to be created
*
* @return
* If the method return an error, the creation is canceled
* and an error message will be displayed in an error
* notification panel.
*/
static Error BeforeCreateUserAction(const char* const iCaenv, const char* const iObject);

//-----------------------//
//----------------------/**
* Allows user to perform specific action after write.
*
* @param iObj
* object created
*
* @return
* If the method return an error, a rollback will be performed
* and an error message will be displayed in an error
* notification panel.
*/
static Error AfterWriteUserAction(const ObjID& iObj);

//-----------------------//
//----------------------/**
* Allows user to perform specific action after commit.
*
* @param iObj
* object created
*
* @return
* If the method return an error, a rollback will be performed
* and an error message will be displayed in an error
* notification panel.
*/
static Error AfterCommitUserAction();
//-----------------------//
//-----------------------

Copyright DASSAULT SYSTEMES 2000

1-84

Menu

VPM Programming

/**
* Allows user to perform specific action after rollback.
*/
static void AfterRollbackUserAction();

//--------------------//
//-------------------/**
* User exit called when user print result panel.
*
* @return
* an HTML color (for instance : #FFFFFF) <BR>
* returned char* will be deleted by VPM
*/
static char* GetBGColorForPrint(const char* iCatab,
const char* iAttribute,
const char* iValue);
/**
* Called when user select OK in New config-handler panel.
* Allows to format the config-handler Id.
*
* @param iObj
* object (product) associated to the config-handler.
* @param iCHUserId
* user config-handler Id
* @param oCHNewId
* updated (formatted) config-handler Id
*
* @return
* If the method return an error, the creation will not be performed
* and an error message will be displayed in an error
* notification panel.
*/
static Error FormatConfigHandlerId(const ObjID& iObj,
const char* iCHUserId,
char **oCHNewId);
/**
* Called when display option selection box.
* Allows to change options available.
*
* @param iUser
* user ID.
* @param iRole
* user role.
* @param iOrg
* user organization.
* @param iObj
* object (product) of current dictionary.
* @param ioNbOpt
* number of proposed/returned options.
* @param ioOptNameList

Copyright DASSAULT SYSTEMES 2000

1-85

Menu

VPM Programming

* list of options name proposed/returned.


* @param ioOptTypeList
* list of options type proposed.
* @param iOptDescList
* list of options description proposed/returned.
*
* @return
* If the method return an error,
* and an error message will be displayed in an error
* notification panel.
*/
static Error OptionListToDisplay(const char *iUser, const char *iRole, const char *iOrg,
const ObjID& iObj,
const int iNbOpt, int &oNbOpt,
char ***ioOptNameList, char ***ioOptTypeList, char ***ioOptDescList);
/**
* User exit called when modifying an effectivity
*
* @param iUser
* user ID.
* @param iRole
* user role.
* @param iOrg
* user organization.
* @param iLink
* link associated to the effectivity to modify.
* @param iOldEff
* old effectivity (initial effectivity to modify)
* @param iNewEff
* new effectivity (effectivity after modifications)
*
* @return
* If Error.Ier equals 0 modification is allowed, else error message is displayed
*/
static Error AuthorizedEffModification(const char *iUser, const char *iRole, const char *iOrg,
const ObjID& iLink,
const EffParam& iOldEff, const EffParam& iNewEff);

static Error ConfigHandlerControl(const char *iUser, const char *iRole, const char *iOrg,
const ObjID& iProduct,
const char* iCHName,
const CHAction iAction);
};
#endif

Copyright DASSAULT SYSTEMES 2000

1-86

Menu

VPM Programming

CATVpmAFUsrMethod.h
libVX0AFUSR.a
/* -*-c++-*-*/
// COPYRIGHT DASSAULT SYSTEMES 1997
//========================================================================
//
// CATVpmAFUsrMethod:
// Contains all the user exits related to ActionFlow
//
//========================================================================
// Usage Notes:
//
//========================================================================
// Sep. 97 Creation
//========================================================================
#ifndef CATVpmAFUsrMethod_h
#define CATVpmAFUsrMethod_h
#include CATDMUsrMethod.h
//========================================================================
// Type definitions
//========================================================================
//
// Structure representing an action
//
typedef struct
{
char*
identifier;
char*
secondid;
char*
type;
char*
owner;
char*
priority;
char*
status;
char*
product;
} Action;

Copyright DASSAULT SYSTEMES 2000

1-87

Menu

VPM Programming

//========================================================================
// User Methods
//========================================================================
/**
* This class regroups the user exits for Action Flow.
* These user exits are static methods called by the Action Flow component,
* and which content can be modified by the customer to suit their specific
* needs.
*/
class CATVpmAFUsrMethod
{
public :
//---------------------------------------------------------------// Static data members
//---------------------------------------------------------------static Action _CurrentAction;
static ObjID _CurrentActionProduct; // Added VPM1.3
//---------------------------------------------------------------// Status Graph Customization
//---------------------------------------------------------------/**
* <b>Status Graph customization :</b>
* <br>Executes a user command related to a Status Graph transition.
* <p>
* @param iCommandName
* command name as defined in the Status Graph
* @param iNbParam
* number of command parameters
* @param iParamList
* command parameters passed as a <tt>iNbParam</tt> sized array of strings
* @return error object
*/
static Error ExecuteUsrCommand (const char * iCommandName,
const int & iNbParam,
char
** iParamList);

Copyright DASSAULT SYSTEMES 2000

1-88

Menu

VPM Programming

/**
* <b>Status Graph customization :</b>
* <br>Retrieves the person identifier relating to a :Notify generic command,
* <br>using the :EXT parameter - i.e. the recipient of the notification.
* <p>
* @param iOperationName
* operation name as defined in the Status Graph
* @param oPersonId
* person identifier of the notification recipient
* @return error object
*/
static Error GetNewUsrPersonId (const char * iOperationName,
char
** oPersonId);
/**
* <b>Status Graph customization :</b>
* <br>Retrieves the message relating to a :Notify generic command.
* <p>
* @param iOperationName
* operation name as defined in the Status Graph
* @param oMessageTitle
* title (subject) of the message
* @param oMessageText
* full message text
* @return error object
*/
static Error GetUsrMessageText (const char * iOperationName,
char
** oMessageTitle,
char
** oMessageText);
/**
* <b>Status Graph customization :</b>
* <br>Checks a user condition associated to a status change transition :
* <br>if an error is returned, (i.e. Ier != 0), the condition is false,
* <br>otherwise it is true and the operation which it applies to is executed.
* <p>
* @param iConditionName
* condition name as defined in the Status Graph
* @param iOperationName
* operation name as defined in the Status Graph, which the condition applies to
* @return error object
*/
static Error CheckUsrCondition (const char * iConditionName,
const char * iOperationName);

Copyright DASSAULT SYSTEMES 2000

1-89

Menu

VPM Programming

// ---------------------------------------------------------------/**
* <b>Action Property Editor customization :</b>
* <br>Checks access to an external file when trying to associate it to the action
* <br>(by reference) : if an error is returned (i.e. Ier != 0), the file is
* <br>not accessible and therefore, the file is not associated while
* <br>the error message is displayed.
* <br>Also retrieves an updated pathname for this file where accessible.
* <p>
* @param iCurrentFullFileName
* full pathname of the selected file
* @param oNewFullFileName
* full pathname of the accessible file (if NULL, the input name is used)
* @return error object
*/
static Error CheckUsrLibraryAccess (const char * iCurrentFullFileName,
char
** oNewFullFileName);
/**
* <b>Action Property Editor customization :</b>
* <br>Retrieves action secondary id when creating a new action in
* <br>secondary id mode.
* <br>NOTE : this user exit is not called any more and has just been
* <br>maintained in this header for compatibility reasons (see
* <br>ModifySecondaryId method).
* <p>
* @param oSecondId
* action secondary id
* @param oModifiable
* indicates if the action name (i.e. secondary id) can be edited from
* within the Action Property Editor window :
* Y : yes, the action name can be edited
* otherwise : the action name cannot be modified
* @return error object
*/
static Error GetUsrSecondaryId (char ** oSecondId,
char & oModifiable);

Copyright DASSAULT SYSTEMES 2000

1-90

Menu

VPM Programming

/**
* <b>Action Property Editor customization :</b>
* <br>Retrieves action secondary id when user modifies action type or id in
* <br>secondary id mode.
* <p>
* @param iTypePrefix
* action type prefix
* @param iTypeName
* action type name
* @param iCurrentId
* action current secondary id (since last modified)
* @param iClashMode
* = Y if save attempt has been made and resulted in a clash due to an existing action with the same
id
* @param ioModifiable
* indicates if the action name (i.e. secondary id) can be edited from
* within the Action Property Editor window :
* Y : yes, the action name can be edited
* otherwise : the action name cannot be modified
* @param oNewId
* action secondary id
* @return error object
*/
iTypePrefix,
static Error ModifySecondaryId (const char*
const char*
iTypeName,
const char*
iCurrentId,
char
iClashMode,
char&
ioModifiable,
char**
oNewId);
};

#endif

Copyright DASSAULT SYSTEMES 2000

1-91

Menu

VPM Programming

CATVpmPEUsrMethod.h
libVX0PEUSR.a
// COPYRIGHT DASSAULT SYSTEMES 1997
//=============================================================================
/**
* CATVpmPEUsrMethod.h:
* <b>People & Security</b> user exit interface.
**/
//=============================================================================
/**
* <u>Usage Notes:</u>
* Overwrite your own CATVpmPEUsrMethod using code/sample files;
* Then compile and link using code/command/mkVX0PEUSR.sh script shell.
**/
//=============================================================================
#ifndef CATVpmPEUsrMethod_h
#define CATVpmPEUsrMethod_h
// ============================================================================ //
// defines.
// ============================================================================ //
// --> The following defines determine basic test conditions for the application,
// CATVpmPasswdPan
// --------------#define MIN_USERID_LENGTH 2
#define MAX_USERID_LENGTH 8
#define MIN_PASSWD_LENGTH 4
#define MAX_PASSWD_LENGTH 8

// ============================================================================ //
// User Methods
// ============================================================================ //
class CATVpmPEUsrMethod
{
public :
/**
* LoginVpmSession ( person, org, role_name, role_org )
* Called at the end login time, when the user succeeded in login.
* Returns 0 when ok.
**/
static int LoginVpmSession ( const char* iPersonId,
const char* iOrgId,
const char* iRoleName,
const char* iRoleOrgId ) ;
/**
* EndVpmSession ()
* Called at the end of interactive applications
* No return value.
**/
static void EndVpmSession () ;

Copyright DASSAULT SYSTEMES 2000

1-92

Menu

VPM Programming

/**
* UpdatePasswordPermitted ()
* Determines that the user exit to change the password can be called
* and is functional.
*
* Returns the following values:
* 0 = Update of password is NOT permitted.
* 1 = Update of password is permitted, but original password is NOT
*
required.
* 2 = Update of password is permitted, AND original password IS
*
required.
**/
static int ChangePasswordEnabled() ;
/**
* ChangePassword ()
* Modifies the password of customer specific VPM components.
*
* Returns the following values.
* -1 = Original password is incorrect.
* 0 = General failure of password change.
* 1 = Password modification successful.
**/
static int ChangePassword ( const char* iPersonId,
const char* iCurrentPasswd,
const char* iNewPasswd ) ;
/**
* ValidateUserId( char *iUserId )
* ValidatePassword( char *iPassword )
* Level of validation is implementation specific. Only basic checking is
* managed here.
*
* Return values are as follows:
* 1 = Validated OK.
* 0 = General Failure.
* -1 = Too short.
* -2 = Too long.
* -3 = Combination of alpha and numeric characters required.
* -4 = Password and user id cannot be the same.
**/
static int ValidateUserId ( const char *iUserId ) ;
static int ValidatePassword ( const char *iPassword ) ;
};
#endif

Copyright DASSAULT SYSTEMES 2000

1-93

Menu

VPM Programming

CATVpmSCUsrManager.h
libVX0PEMNG.a
// COPYRIGHT DASSAULT SYSTEMES 1999
//========================================================================
//
// <b>CATVpmSCUsrManager</b> :
// VPM Security Manager customer class.
//
//========================================================================
// Usage Notes:
// This class provides :
// - information on current VPM user (ID, role) ;
// - access check methods on privileges and data owner.
//
// Any program or library including this header should be linked with module
// VX0PEMNG
//========================================================================
// Nov. 99 Creation
JIC
//========================================================================
#ifndef _CATVpmSCUsrManager_h_
#define _CATVpmSCUsrManager_h_

class CATVpmSCUsrManager
{
public:
/**
* ---------------------------------------------------------------------* <u>GetLoginUserId</u>()
* Get the ID of the VPM user currently logged in.
*
* @return
* ID of the VPM user (NULL if not found).
* Memory disallocation is in charge of the calling method.
* ---------------------------------------------------------------------**/
static const char* GetLoginUserId();
/**
* ---------------------------------------------------------------------* <u>GetLoginRoleName</u>()
* Get the name of the VPM role used by the current user to log in.
*
* @return
* Name of the VPM role (NULL if not found).

Copyright DASSAULT SYSTEMES 2000

1-94

Menu

VPM Programming

* Memory disallocation is in charge of the calling method.


* ---------------------------------------------------------------------**/
static const char* GetLoginRoleName();
/**
* ---------------------------------------------------------------------* <u>GetLoginRoleOrganizationId</u>()
* Get the ID of the organization the VPM role used by the current user
* to log in belongs to.
*
* @return
* ID of the VPM role organization (NULL if not found).
* Memory disallocation is in charge of the calling method.
* ---------------------------------------------------------------------**/
static const char* GetLoginRoleOrganizationId();
/**
* ---------------------------------------------------------------------* <u>CheckAccess</u>()
* Check access to a VPM process.
*
* @param iApplication
* @param iFunction
* @param iCommand
* Components of the process to be checked.
*
* @return
* >0 if access is granted.
* ---------------------------------------------------------------------**/
static int CheckAccess(const char* const iApplication,
const char* const iFunction ,
const char* const iCommand );
/**
* ---------------------------------------------------------------------* <u>CheckDataAccess</u>()
* Check privilege access to a VPM process on given data.
*
* @param iApplication
* @param iFunction
* @param iCommand
* Components of the process to be checked.
*
* @param iUser

Copyright DASSAULT SYSTEMES 2000

1-95

Menu

VPM Programming

* @param iOrganization
* User and organization owners.
*
* @return
* >0 if access is granted.
* ---------------------------------------------------------------------**/
static int CheckDataAccess(const char* const iApplication ,
const char* const iFunction ,
const char* const iCommand ,
const char* const iUser
,
const char* const iOrganization);
protected:
private:
CATVpmSCUsrManager();
~CATVpmSCUsrManager();
};
#endif

Copyright DASSAULT SYSTEMES 2000

1-96

Menu

VPM Programming

CATVpmPEUsrManager
libVX0PEMNG.a

/* -*-c++-*-*/
// COPYRIGHT DASSAULT SYSTEMES 1999
//
=========================================================================
====
//
// <b>CATVpmPEUsrManager</b> :
// VPM People Manager customer class.
//
//
=========================================================================
====
// Usage Notes:
// This class provides information on VPM users.
//
// Any program or library including this header should be linked with module
// VX0PEMNG
//
=========================================================================
====
// Nov. 99 Creation
JIC
//
=========================================================================
====
#ifndef _CATVpmPEUsrManager_h_
#define _CATVpmPEUsrManager_h_

Copyright DASSAULT SYSTEMES 2000

1-97

Menu

VPM Programming

class CATVpmPEUsrManager
{
public:
/**
* ---------------------------------------------------------------------* <u>GetUserEmail</u>()
* Get the e-mail address of a VPM user.
*
* @param iUserId
* ID of the VPM user.
*
* @return
* E-mail address of the VPM user, if it exists (NULL if not found).
* Memory disallocation is in charge of the calling method.
* ---------------------------------------------------------------------**/
static const char* GetUserEmail(const char* const iUserId);
/**
* ---------------------------------------------------------------------* <u>GetUserOrganizationId</u>()
* Get the organization ID a VPM user.
*
* @param iUserId
* ID of the VPM user.
*
* @return
* ID of the organization the user belongs to (NULL if not found).
* Memory disallocation is in charge of the calling method.
* ---------------------------------------------------------------------**/
static const char* GetUserOrganizationId(const char* const iUserId);
protected:
private:
CATVpmPEUsrManager();
~CATVpmPEUsrManager();
};
#endif

Copyright DASSAULT SYSTEMES 2000

1-98

Menu

VPM Programming

CATVpmSCUsrLogin.h
libVX0PEMNG.a
/* -*-c++-*-*/
// COPYRIGHT DASSAULT SYSTEMES 2000
//=======================================================================//
// <b>CATVpmSCUsrLogin</b> :
// VPM Security Login customer class.
//
//======================================================================//
Usage Notes:
// This class provides login services for the VPM application.
//
// Any program or library including this header should be linked with module
// VX0PEMNG
//======================================================================//
Apr. 00 Creation
JIC
//=======================================================================//
#ifndef _CATVpmSCUsrLogin_h_
#define _CATVpmSCUsrLogin_h_

class CATVpmSCUsrLogin
{
public:
/**
* <u>Login</u>()
* All-in-one login method.
*
* @param iUserId
* ID of the VPM user.
* @param iPassword
* User password ; ignored when not in server authentication mode.
* @param iRoleName
* Role name to log on with.
* @param iRoleOrganizationId
* ID of the organization to which belongs the role.
*
* @return
* 0 when successful, error code otherwise (see file :
* <i>CATVpmLoginError.h</i>).
**/
static int Login(const char* const iUserId
,
const char* const iPassword
,
const char* const iRoleName
,
const char* const iRoleOrganizationId);

Copyright DASSAULT SYSTEMES 2000

1-99

Menu

VPM Programming

protected:
private:
CATVpmSCUsrLogin();
~CATVpmSCUsrLogin();
};
#endif

Copyright DASSAULT SYSTEMES 2000

1-100

Menu

VPM Programming

CATCfgInterfaces.h
libLV012MET.a
#ifndef CATCfgInterfaces_h
#define CATCfgInterfaces_h
#include CATDMUsrMethod.h
#include <time.h>
#include CATVPMExpandDec.h
class CATVPMVolume;
class CATCfgInterfaces {
public:
// Get database id of a part identified by PART_NUMBER and PART_VERSION
// Input
// ----// iCaenv :
Part environment
// iPartNumberAttrName : Name of the attribute containing the part number
//
(S_PART_NUMBER with a default installation)
// iPartNumber :
Part number
// iPartVersion :
Part version
//
// Output
// -----// oDbId : database id of the part
// Error.Ier:
//
0 : OK
//
-1 : No part with this part number and part version
//
-2 : more than one part with this part number and part_version
static Error GetDbID(const char *iCaenv, const char *iPartNumberAttrName, const char
*iPartNumber, const char *iPartVersion, ObjID &oDbId);
// Get the number of config handler for a part
static Error GetCfgHandler(const ObjID &iPartID, int &oNbCfgHnd);
// Get a config handler by its number (from 1 to oNbCfgHandler)
static Error GetCfgHandler(const ObjID &iPartID, const int &iCfgHndIndex, char oCfgHndId[40],
char oCfgHndDesc[255]);
// Expand a tree into a file (only parts with model are printed)
static Error Expand (const ObjID &iPartID, const char *iCfgHandler, const char *iFileName,
const CATVPMSaveMode SaveSessionMode = Text);
// Expand a tree into a step file for batch export
static Error ExpandSTEP (const ObjID &iPartID, const char *iFileName,
const CATUnicodeString &ExportMode,
const CATUnicodeString &ActionName );

Copyright DASSAULT SYSTEMES 2000

1-101

Menu

VPM Programming

// Expand a tree into a file (only parts with model are printed)
// filter result by a given bounding box
static Error ExpandWithCSB (
const ObjID &iPartID,
const char *iCfgHandler,
const char *iFileName,
const CATVPMSaveMode SaveSessionMode,
CATVPMVolume & iCSBFilter);
// Expand a tree into a step file for batch export
// filter result by a given bounding box
static Error ExpandSTEPWithCSB (const ObjID &iPartID,
const char *iFileName,
const CATUnicodeString &ExportMode,
const CATUnicodeString &ActionName,
CATVPMVolume & iCSBFilter);

//
// --- Set a part configurable
//
// Part identification:
// iEnv(string): environment
// iCoid(double): coid of the part
// iCompid(double): compid of the part
//
// Allowed effectivity types:
// iRange(integer):
=1 allowed ; =0 not allowed
// iDate(integer):
=1 allowed ; =0 not allowed
// iOption(integer):
=1 allowed ; =0 not allowed
// iModification(integer): =1 allowed ; =0 not allowed
//
// Error: return-code for error management
//
static Error SetConfigurable(const char *iEnv, double iCoid, double iCompid,
int iRange, int iDate, int iOption, int iModification);

Copyright DASSAULT SYSTEMES 2000

1-102

Menu

VPM Programming

//
// --- Unset a part configurable
//
// Part identification:
// iEnv(string): environment
// iCoid(double): coid of the part
// iCompid(double): compid of the part
//
// Error: return-code for error management
//
static Error UnsetConfigurable(const char *iEnv, double iCoid, double iCompid);
//
// --- Create Modification effectivity on a link
//
// Link identification:
// iEnv(string): environment
// iCoid(double): coid of the link
// iCompid(double): compid of the link
//
// iModification: modification name of effectivity
//
// Error: return-code for error management
//
static Error CreateModifEffectivity(const char *iEnv, double iCoid, double iCompid, const char
*iModification);
//
// --- Create Current-date effectivity on a link
//
// Link identification:
// iEnv(string): environment
// iCoid(double): coid of the link
// iCompid(double): compid of the link
//
// iModification: modification name for history of effectivity
//
// Error: return-code for error management
//
static Error CreateCurDateEffectivity(const char *iEnv, double iCoid, double iCompid, const char
*iModification);

Copyright DASSAULT SYSTEMES 2000

1-103

Menu

VPM Programming

//
// --- Create Date effectivity on a link
//
// Link identification:
// iEnv(string): environment
// iCoid(double): coid of the link
// iCompid(double): compid of the link
//
// iModification: modification name for history of effectivity
//
// Effectivity parameters:
// iBegDate(time_t): beginning date of effectivity
// iEndDate(time_t): ending date of effectivity
//
0 -> infinity
//
// Error: return-code for error management
//
static Error CreateDateEffectivity(const char *iEnv, double iCoid, double iCompid, const char
*iModification, time_t iBegDate, time_t iEndDate=0);
//
// --- Create Date effectivity on a link
//
// Link identification:
// iEnv(string): environment
// iCoid(double): coid of the link
// iCompid(double): compid of the link
//
// iModification: modification name for history of effectivity
//
// Effectivity parameters:
// iBegDate(string): beginning date of effectivity (format: YYYY-MM-DD)
// iEndDate(string): ending date of effectivity (format: YYYY-MM-DD)
//
NULL -> infinity
//
// Error: return-code for error management
//
static Error CreateDateEffectivity(const char *iEnv, double iCoid, double iCompid, const char
*iModification, const char *iBegDate, const char *iEndDate=NULL);

Copyright DASSAULT SYSTEMES 2000

1-104

Menu

VPM Programming

//
// --- Create Range effectivity on a link
//
// Link identification:
// iEnv(string): environment
// iCoid(double): coid of the link
// iCompid(double): compid of the link
//
// iModification: modification name for history of effectivity
//
// Effectivity parameters:
// iBotRange(integer): bottom range of effectivity
// iTopRange(integer): top range of effectivity
//
// Error: return-code for error management
//
static Error CreateRangeEffectivity(const char *iEnv, double iCoid, double iCompid, const char
*iModification, unsigned int iBotRange, unsigned int iTopRange);
//
// --- Create Option effectivity on a link
//
// Link identification:
// iEnv(string): environment
// iCoid(double): coid of the link
// iCompid(double): compid of the link
//
// iModification: modification name for history of effectivity
//
// Effectivity parameters:
// iOption(string): option name of effectivity
//
// Error: return-code for error management
//
static Error CreateOptEffectivity(const char *iEnv, double iCoid, double iCompid, const char
*iModification, const char *iOptionName);

Copyright DASSAULT SYSTEMES 2000

1-105

Menu

VPM Programming

//
// --- Create complex-option effectivity on a link (options combined with AND operator)
//
// Link identification:
// iEnv(string): environment
// iCoid(double): coid of the link
// iCompid(double): compid of the link
//
// iModification: modification name for history of effectivity
//
// Effectivity parameters:
// iNbOpt(integer): number of options in iOptList
// iOptList(string): list of options for effectivity
//
// Error: return-code for error management
//
static Error CreateOptEffectivity(const char *iEnv, double iCoid, double iCompid, const char
*iModification, int iNbOpt, const char **iOptList);
//
// --- Create Option-date effectivity on a link
//
// Link identification:
// iEnv(string): environment
// iCoid(double): coid of the link
// iCompid(double): compid of the link
//
// iModification: modification name for history of effectivity
//
// Effectivity parameters:
// iOption(string): option name of effectivity
// iBegDate(time_t): beginning date of effectivity
// iEndDate(time_t): ending date of effectivity
//
0 -> infinity
//
// Error: return-code for error management
//
static Error CreateOptDateEffectivity(const char *iEnv, double iCoid, double iCompid, const char
*iModification, const char *iOptionName, time_t iBegDate, time_t iEndDate=NULL);

Copyright DASSAULT SYSTEMES 2000

1-106

Menu

VPM Programming

//
// --- Create Option-date effectivity on a link
//
// Link identification:
// iEnv(string): environment
// iCoid(double): coid of the link
// iCompid(double): compid of the link
//
// iModification: modification name for history of effectivity
//
// Effectivity parameters:
// iOption(string): option name of effectivity
// iBegDate(string): beginning date of effectivity (format: YYYY-MM-DD)
// iEndDate(string): ending date of effectivity (format: YYYY-MM-DD)
//
NULL -> infinity
//
// Error: return-code for error management
//
static Error CreateOptDateEffectivity(const char *iEnv, double iCoid, double iCompid, const char
*iModification, const char *iOptionName, const char *iBegDate, const char *iEndDate=NULL);
//
// --- Create complex-option-date effectivity on a link (options combined with AND operator)
//
// Link identification:
// iEnv(string): environment
// iCoid(double): coid of the link
// iCompid(double): compid of the link
//
// iModification: modification name for history of effectivity
//
// Effectivity parameters:
// iNbOpt(integer): number of options in iOptList
// iOptList(string): option list for effectivity
// iBegDate(time_t): beginning date of effectivity
// iEndDate(time_t): ending date of effectivity
//
0 -> infinity
//
// Error: return-code for error management
//
static Error CreateOptDateEffectivity(const char *iEnv, double iCoid, double iCompid, const char
*iModification, int iNbOpt, const char **iOptList, time_t iBegDate, time_t iEndDate=0);

Copyright DASSAULT SYSTEMES 2000

1-107

Menu

VPM Programming

//
// --- Create complex-option-date effectivity on a link (combined with AND operator)
//
// Link identification:
// iEnv(string): environment
// iCoid(double): coid of the link
// iCompid(double): compid of the link
//
// iModification: modification name for history of effectivity
//
// Effectivity parameters:
// iNbOpt(integer): number of options in iOptList
// iOptList(string): option list for effectivity
// iBegDate(string): beginning date of effectivity (format: YYYY-MM-DD)
// iEndDate(string): ending date of effectivity (format: YYYY-MM-DD)
//
NULL -> infinity
//
// Error: return-code for error management
//
static Error CreateOptDateEffectivity(const char *iEnv, double iCoid, double iCompid, const char
*iModification, int iNbOpt, const char **iOptList, const char *iBegDate, const char
*iEndDate=NULL);
//
// --- Create Option-range effectivity on a link
//
// Link identification:
// iEnv(string): environment
// iCoid(double): coid of the link
// iCompid(double): compid of the link
//
// iModification: modification name for history of effectivity
//
// Effectivity parameters:
// iOption(string): option name of effectivity
// iBotRange(integer): bottom range of effectivity
// iTopRange(integer): top range of effectivity
//
// Error: return-code for error management
//
static Error CreateOptRangeEffectivity(const char *iEnv, double iCoid, double iCompid, const char
*iModification, const char *iOptionName, unsigned int iBotRange, unsigned int iTopRange);

Copyright DASSAULT SYSTEMES 2000

1-108

Menu

VPM Programming

//
// --- Create complex-option-range effectivity on a link (options combined with AND operator)
//
// Link identification:
// iEnv(string): environment
// iCoid(double): coid of the link
// iCompid(double): compid of the link
//
// iModification: modification name for history of effectivity
//
// Effectivity parameters:
// iNbOpt(integer): number of options in iOptList
// iOptList(string): option list for effectivity
// iBotRange(integer): bottom range of effectivity
// iTopRange(integer): top range of effectivity
//
// Error: return-code for error management
//
static Error CreateOptRangeEffectivity(const char *iEnv, double iCoid, double iCompid, const char
*iModification, int iNbOpt, const char **iOptList, unsigned int iBotRange, unsigned int iTopRange
);
//
// --- Delete option effectivity on a link
//
// Link identification:
// iEnv(string): environment
// iCoid(double): coid of the link
// iCompid(double): compid of the link
//
// Effectivity parameters:
// iOption(string): option name of effectivity
//
// Error: return-code for error management
//
static Error DeleteOptEffectivity(const char *iEnv, double iCoid, double iCompid, const char
*iOptionName);

Copyright DASSAULT SYSTEMES 2000

1-109

Menu

VPM Programming

//
// --- Delete option-date effectivity on a link
//
// Link identification:
// iEnv(string): environment
// iCoid(double): coid of the link
// iCompid(double): compid of the link
//
// Effectivity parameters:
// iOption(string): option name of effectivity
// iBegDate(time_t): beginning date of effectivity
// iEndDate(time_t): ending date of effectivity
//
0 -> infinity
//
// Error: return-code for error management
//
static Error DeleteOptDateEffectivity(const char *iEnv, double iCoid, double iCompid, const char
*iOptionName, time_t iBegDate, time_t iEndDate=0);
//
// --- Delete option-date effectivity on a link
//
// Link identification:
// iEnv(string): environment
// iCoid(double): coid of the link
// iCompid(double): compid of the link
//
// Effectivity parameters:
// iOption(string): option name of effectivity
// iBegDate(tring): beginning date of effectivity
// iEndDate(string): ending date of effectivity
//
NULL -> infinity
//
// Error: return-code for error management
//
static Error DeleteOptDateEffectivity(const char *iEnv, double iCoid, double iCompid, const char
*iOptionName, const char *iBegDate, const char *iEndDate=NULL);

Copyright DASSAULT SYSTEMES 2000

1-110

Menu

VPM Programming

//
// --- Delete option-range effectivity on a link
//
// Link identification:
// iEnv(string): environment
// iCoid(double): coid of the link
// iCompid(double): compid of the link
//
// Effectivity parameters:
// iOption(string): option name of effectivity
// iBotRange(integer): bottom range of effectivity
// iTopRange(integer): top range of effectivity
//
// Error: return-code for error management
//
static Error DeleteOptRangeEffectivity(const char *iEnv, double iCoid, double iCompid, const char
*iOptionName, unsigned int iBotRange, unsigned int iTopRange);
//
// --- Delete date effectivity on a link
//
// Link identification:
// iEnv(string): environment
// iCoid(double): coid of the link
// iCompid(double): compid of the link
//
// Effectivity parameters:
// iBegDate(time_t): beginning date of effectivity
// iEndDate(time_t): ending date of effectivity
//
0 -> infinity
//
// Error: return-code for error management
//
static Error DeleteDateEffectivity(const char *iEnv, double iCoid, double iCompid, time_t iBegDate,
time_t iEndDate=0);

Copyright DASSAULT SYSTEMES 2000

1-111

Menu

VPM Programming

//
// --- Delete date effectivity on a link
//
// Link identification:
// iEnv(string): environment
// iCoid(double): coid of the link
// iCompid(double): compid of the link
//
// Effectivity parameters:
// iBegDate(string): beginning date of effectivity
// iEndDate(string): ending date of effectivity
//
NULL -> infinity
//
// Error: return-code for error management
//
static Error DeleteDateEffectivity(const char *iEnv, double iCoid, double iCompid, const char
*iBegDate, const char *iEndDate=NULL);
//
// --- Delete range effectivity on a link
//
// Link identification:
// iEnv(string): environment
// iCoid(double): coid of the link
// iCompid(double): compid of the link
//
// Effectivity parameters:
// iBotRange(integer): bottom range of effectivity
// iTopRange(integer): top range of effectivity
//
// Error: return-code for error management
//
static Error DeleteRangeEffectivity(const char *iEnv, double iCoid, double iCompid, unsigned int
iBotRange, unsigned int iTopRange);

Copyright DASSAULT SYSTEMES 2000

1-112

Menu

VPM Programming

//
// --- Replace link with other one for Current-date effectivity
//
// Source link identification:
// iEnv1(string): environment
// iCoid1(double): coid of the source link
// iCompid1(double): compid of the source link
//
// Destination link identification:
// iEnv2(string): environment
// iCoid2(double): coid of the destination link
// iCompid2(double): compid of the destination link
//
// iModification: modification name for history
//
// Error: return-code for error management
//
static Error CurDateReplace(const char *iEnv1, double iCoid1, double iCompid1,
const char *iEnv2, double iCoid2, double iCompid2,
const char *iModification);
//
// --- Create an option dictionary on a configurable product
// --- If iCoid and iCompid are zero then a corporate dictionary is created
//
// Part identification:
// iEnv(string): environment
// iCoid(double): coid of the part
// iCompid(double): compid of the part
//
// Error: return-code for error management
//
static Error CreateDictionary(const char *iEnv, double iCoid, double iCompid);
//
// --- Delete an option dictionary on a product
//
// Part identification:
// iEnv(string): environment
// iCoid(double): coid of the part
// iCompid(double): compid of the part
//
// Error: return-code for error management
//
static Error DeleteDictionary(const char *iEnv, double iCoid, double iCompid);

Copyright DASSAULT SYSTEMES 2000

1-113

Menu

VPM Programming

//
// --- Add a category to the dictionary associated to the configurable product
// --- If iCoid and iCompid are zero then the category is added to the corporate dictionary
//
// Dictionary identification (the part to which the dictionary is attached):
// iEnv(string): environment
// iCoid(double): coid of the part
// iCompid(double): compid of the part
//
// Category parameters:
// iName(string):
category name
// iDesc(string):
description of the category
// iMutuallyExcl(int): is option selection within the category mutually exclusive
// iMandatory(int): is option selection within the category mandatory
//
// Error: return-code for error management
//
50074 = Category with this name already exists
//
static Error AddCategoryToDictionary(const char *iEnv, double iCoid, double iCompid,
const char *iName, const char *iDesc,
const int iMutuallyExcl, const int iMandatory);
//
// --- Add an option to the dictionary associated to the configurable product
// --- If iCoid and iCompid are zero then the option is added to the corporate dictionary
//
// Part identification:
// iEnv(string): environment
// iCoid(double): coid of the part
// iCompid(double): compid of the part
//
// Option parameters:
// iName(string):
option name
// iCategory(string): category to which the option belongs
// iDesc(string):
description of the option
// iDefaultOption:
is this the default option in the category
// iDefaultReplaceable: can the default be changed by the user
//
// Error: return-code for error management
//
50073 = Option with this name already exists in the category
//
static Error AddOptionToDictionary(const char *iEnv, double iCoid, double iCompid,
const char *iName, const char *iCategory, const char *iDesc,
const int iDefaultOption=0, const int iDefaultReplaceable=1);

Copyright DASSAULT SYSTEMES 2000

1-114

Menu

VPM Programming

//
// --- Remove an option from the dictionary associated to the configurable product
//
// Part identification:
// iEnv(string): environment
// iCoid(double): coid of the part
// iCompid(double): compid of the part
//
// Option parameters:
// iName(string): option name
//
// Error: return-code for error management
//
static Error RemoveOptionFromDictionary(const char *iEnv, double iCoid, double iCompid,
const char *iName);
//
// --- Add an if then rule or package rule to the dictionary associated to
// --- the configurable product
// --- If iCoid and iCompid are zero then the rule is added to the corporate dictionary
//
// Part identification:
// iEnv(string): environment
// iCoid(double): coid of the part
// iCompid(double): compid of the part
//
// Option parameters:
// iRuleId(string): the rule identifier
// iRuleString(string): the rule
// iRuleType(int):
=1, if then type
//
=2, package
// iDesc(string):
description of the rule
//
// Error: return-code for error management
//
50075 = Rule already exists in the dictionary
//
static Error AddRuleToDictionary(const char *iEnv, double iCoid, double iCompid,
const char* iRuleId, const char *iRuleString,
const int iRuleType, const char *iDesc);

Copyright DASSAULT SYSTEMES 2000

1-115

Menu

VPM Programming

//
// --- Add a compatibility matrix (initially only a definition) to the dictionary associated to
// --- the configurable product
// --- If iCoid and iCompid are zero then the matrix is added to the corporate dictionary
//
// Part identification:
// iEnv(string): environment
// iCoid(double): coid of the part
// iCompid(double): compid of the part
//
// Option parameters:
// iName(string):
matrix name
// iDesc(string):
description of the matrix
// iNbCategories(int):
number of categories in definition
// iCategories(string array) : categories in definition (must already exist)
//
// Error: return-code for error management
//
50076 = Matrix already exists in the dictionary
//
50086 = Invalid category in matrix definition
//
static Error AddCompatibilityMatrixToDictionary(const char *iEnv, double iCoid, double iCompid,
const char* iName, const char* iDesc,
int iNbCategories, const char **iCategories);
//
// --- Add a compatibility rule to the matrix
// --- If iCoid and iCompid are zero then the rule is added to a matrix in the corporate dictionary
//
// Part identification:
// iEnv(string): environment
// iCoid(double): coid of the part
// iCompid(double): compid of the part
//
// Option parameters:
// iMatrix(string): matrix to which rule is to be added
// iRuleId(string): the rule identifier
// iRuleString(string): rule to be added (must be consistent with matrix definition)
//
// Error: return-code for error management
//
50075 = Rule already exists in the matrix
//
50087 = The matrix has not been defined
//
static Error AddCompatibilityRuleToMatrix(const char *iEnv, double iCoid, double iCompid,
const char* iMatrix,
const char* iRuleId, const char* iRuleString);

Copyright DASSAULT SYSTEMES 2000

1-116

Menu

VPM Programming

//
// --- Get the number of options in the dictionary associated to the configurable product
//
// Product identification:
// iEnv(string): environment
// iCoid(double): coid of the product
// iCompid(double): compid of the product
//
// Result:
// oNbOpt(integer): number of options in the dictionary
//
// Error: return-code for error management
//
static Error GetOptFromDictionary(const char *iEnv, double iCoid, double iCompid, int &oNbOpt);
//
// --- Get one option from the dictionary associated to the configurable product
//
// Product identification:
// iEnv(string): environment
// iCoid(double): coid of the product
// iCompid(double): compid of the product
//
// Option parameters:
// iOptIndex(integer): index of the option to get parameters (from 1 to NbOpt)
// oName(string):
option name
// oCateg(string): category of the option
// oDesc(string):
description of the option
// oUsed(integer): flag to know if the option is used in the assembly
//
(=1 used ; =0 not used)
//
// Error: return-code for error management
//
static Error GetOptFromDictionary(const char *iEnv, double iCoid, double iCompid, int iOptIndex,
char oName[40], char oCateg[40], char oDesc[255], int &oUsed);

Copyright DASSAULT SYSTEMES 2000

1-117

Menu

VPM Programming

//
// --- Create a config-handler on a configurable product
//
// Part identification:
// iEnv(string): environment
// iCoid(double): coid of the part
// iCompid(double): compid of the part
//
// Config-handler parameters:
// iCHId(string): config-handler Id
// iCHDesc(string): description of the config-handler
// iBotRange(integer): bottom range of the config-handler (=0 No range)
// iTopRange(integer): top range of the config-handler (=0 Infinity)
// iCurDateFlag(integer): flag to set(=1) or unset(=0) current date
// iBegDate(time_t): beginning date of the config-handler (=0 No date)
// iEndDate(time_t): ending date of the config-handler (=0 Infinity)
// iNbOpt(integer): number of options in iOptList (=0 No option)
// iOptList(list of string): selected options of the config-handler
// iNbModif(integer): number of modifications in iModifList (=0 No modif)
// iModifList(list of string): selected modifications of the config-handler
//
// Error: return-code for error management
//
static Error CreateConfigHandler(const char *iEnv, double iCoid, double iCompid,
const char *iCHId, const char *iCHDesc,
unsigned int iBotRange, unsigned int iTopRange,
const int iCurDateFlag, time_t iBegDate, time_t iEndDate,
const int iNbOpt, char **iOptList,
const int iNbModif, char **iModifList);

Copyright DASSAULT SYSTEMES 2000

1-118

Menu

VPM Programming

//
// --- Create a config-handler on a configurable product
//
// Part identification:
// iEnv(string): environment
// iCoid(double): coid of the part
// iCompid(double): compid of the part
//
// Config-handler parameters:
// iCHId(string): config-handler Id
// iCHDesc(string): description of the config-handler
// iBotRange(integer): bottom range of the config-handler (=0 No range)
// iTopRange(integer): top range of the config-handler (=0 Infinity)
// iCurDateFlag(integer): flag to set(=1) or unset(=0) current date
// iBegDate(string): beginning date of the config-handler (format: YYYY-MM-DD)
// iEndDate(string): ending date of the config-handler (format: YYYY-MM-DD)
// iNbOpt(integer): number of options in iOptList (=0 No option)
// iOptList(list of string): selected options of the config-handler
// iNbModif(integer): number of modifications in iModifList (=0 No modif)
// iModifList(list of string): selected modifications of the config-handler
//
// Error: return-code for error management
//
static Error CreateConfigHandler(const char *iEnv, double iCoid, double iCompid,
const char *iCHId, const char *iCHDesc,
unsigned int iBotRange, unsigned int iTopRange,
const int iCurDateFlag, const char *iBegDate, const char *iEndDate,
const int iNbOpt, char **iOptList,
const int iNbModif, char **iModifList);

Copyright DASSAULT SYSTEMES 2000

1-119

Menu

VPM Programming

//
// --- Add an option to an existing config-handler
//
// Part identification:
// iEnv(string): environment
// iCoid(double): coid of the part
// iCompid(double): compid of the part
//
// Config-handler parameters:
// iOptName(string): option name to add in the config-handler
//
// Error: return-code for error management
//
static Error AddOptionToConfigHandler(const char *iEnv, double iCoid, double iCompid,
const char *iCHId, const char *iOptName);
//
// --- Remove an option from a config-handler
//
// Part identification:
// iEnv(string): environment
// iCoid(double): coid of the part
// iCompid(double): compid of the part
//
// Config-handler parameters:
// iOptName(string): option name to remove
//
// Error: return-code for error management
//
static Error RemoveOptionFromConfigHandler(const char *iEnv, double iCoid, double iCompid,
const char *iCHId, const char *iOptName);

Copyright DASSAULT SYSTEMES 2000

1-120

Menu

VPM Programming

//
// --- Make a config-handler child of another existing config-handler
//
// Identification of the father config-handler:
// iFatherEnv(string): environment of the associated part
// iFatherCoid(double): coid of the associated part
// iFatherCompid(double): compid of the associated part
// iFatherCHId(string): config-handler Id
//
// Identification of the child config-handler:
// iChildEnv(string): environment of the associated part
// iChildCoid(double): coid of the associated part
// iChildCompid(double): compid of the associated part
// iChildCHId(string): config-handler Id
//
// Error: return-code for error management
//
static Error AddChildToConfigHandler (const char *iFatherEnv, double iFatherCoid, double
iFatherCompid,
const char *iFatherCHId,
const char *iChildEnv, double iChildCoid, double iChildCompid,
const char *iChildCHId);
//
// --- Remove link between two existing config-handler
//
// Identification of the father config-handler:
// iFatherEnv(string): environment of the associated part
// iFatherCoid(double): coid of the associated part
// iFatherCompid(double): compid of the associated part
// iFatherCHId(string): config-handler Id
//
// Identification of the child config-handler:
// iChildEnv(string): environment of the associated part
// iChildCoid(double): coid of the associated part
// iChildCompid(double): compid of the associated part
// iChildCHId(string): config-handler Id
//
// Error: return-code for error management
//
static Error RemoveChildFromConfigHandler (const char *iFatherEnv, double iFatherCoid, double
iFatherCompid,
const char *iFatherCHId,
const char *iChildEnv, double iChildCoid, double iChildCompid,
const char *iChildCHId);

Copyright DASSAULT SYSTEMES 2000

1-121

Menu

VPM Programming

//
// --- Make a config-handler brother of another existing config-handler
//
// Part identification:
// iEnv(string): environment of the associated part
// iCoid(double): coid of the associated part
// iCompid(double): compid of the associated part
//
// Identification of the father config-handler:
// iFatherCHId(string): config-handler Id
//
// Identification of the brother config-handler:
// iBrotherCHId(string): config-handler Id
//
// Error: return-code for error management
//
static Error AddBrotherToConfigHandler (const char *iEnv, double iCoid, double iCompid,
const char *iFatherCHId, const char *iBrotherCHId);
//
// --- Delete a config-handler
//
// Product identification:
// iEnv(string): environment
// iCoid(double): coid of the product
// iCompid(double): compid of the product
//
// Identification of the config-handler:
// iCHId(string): config-handler Id
//
// Error: return-code for error management
//
static Error DeleteConfigHandler(const char *iEnv, double iCoid, double iCompid,
const char *iCHId);

Copyright DASSAULT SYSTEMES 2000

1-122

Menu

VPM Programming

//
// --- Set Action-Flow mode to modify assembly structure
//
// Part identification:
// iEnv(string): environment
// iCoid(double): coid of the part
// iCompid(double): compid of the part
//
// Action-Flow mode:
// iAFMode(integer): =1 Need an open Action to modify assembly structure
//
=0 No Action needed
//
// Error: return-code for error management
//
static Error SetAFMode(const char *iEnv, double iCoid, double iCompid, int iAFMode);
//
// --- Get the number of effectivities on a link
//
// Link identification:
// iEnv(string): environment
// iCoid(double): coid of the link
// iCompid(double): compid of the link
//
// Result:
// oNbEff(integer): number of effectivities on the link
//
// Error: return-code for error management
//
static Error GetEffectivityForLink(const char *iEnv, double iCoid, double iCompid, int &oNbEff);
//
// --- Get one effectivity for a link
//
// Link identification:
// iEnv(string): environment
// iCoid(double): coid of the link
// iCompid(double): compid of the link
//
// Effectivity parameters:
// iEffIndex(integer): index of the effectivity to get parameters (from 1 to NbEff)
// oEff(EffParam): parameters of the effectivity
//
// Error: return-code for error management
//
static Error GetEffectivityForLink(const char *iEnv, double iCoid, double iCompid, int iEffIndex,
EffParam &oEff);

Copyright DASSAULT SYSTEMES 2000

1-123

Menu

VPM Programming

//
// --- Delete one effectivity on a link
//
// Link identification:
// iEnv(string): environment
// iCoid(double): coid of the link
// iCompid(double): compid of the link
//
// Effectivity parameters:
//
iEffIndex(integer): index of the effectivity to delete (from 1 to NbEff using
GetEffectivityForLink)
//
// Error: return-code for error management
//
static Error DeleteEffectivity(const char *iEnv, double iCoid, double iCompid, int iEffIndex);
//
// --- Update a product dictionary with effectivities of its associated assembly
//
// Product identification:
// iEnv(string): environment
// iCoid(double): coid of the product
// iCompid(double): compid of the product
//
// Options:
// iStopAtDico(integer): if =1 (default) scanning each branch until dictionary encountered
//
else until leaves.
//
if =0 scanning until leaves even if dictionary encountered
//
(so the options of child dictionaries are duplicated in
//
father/current dictionary).
//
// Error: return-code for error management
//
static Error UpdateDictionaryFromAssembly(const char *iEnv, double iCoid, double iCompid,
const int iStopAtDico=1);
};
#endif

Copyright DASSAULT SYSTEMES 2000

1-124

Menu

VPM Programming

CATVPMFilter.h
libLV0PSBAS.a
/* -*-c++-*-*/
// COPYRIGHT DASSAULT SYSTEMES 1998
//========================================================================
//
// CATVPMFilter:
//
//
//========================================================================
// Usage Notes:
//
//========================================================================
// 98 Creation
Pierre-yves BISSON
//========================================================================
#ifndef CATVPMFilter_h
#define CATVPMFilter_h
#include CATListOfCATVPMNode.h
class SdaiEntityInstance;
class CATVPMFilter
{
public:
virtual void StartExpand(SdaiEntityInstance *iPart) const = 0;
virtual void EndExpand() const = 0;
virtual int Filter(CATVPMNode *iFather, const CATListOfCATVPMNode &iProposedNodes,
CATListOfCATVPMNode &oValid, CATListOfCATVPMNode &oNotValid) const = 0;
};
#endif

Copyright DASSAULT SYSTEMES 2000

1-125

Menu

VPM Programming

CATVPMFilterManager.h
libLV0PSCFG.a
/* -*-c++-*-*/
// COPYRIGHT DASSAULT SYSTEMES 1999
//========================================================================
//
// CATVPMFilterManager:
// Manage filters used during PSN expand
//
//========================================================================
// Usage Notes:
//
//========================================================================
// July 99 Creation
Marc MONTERGOUS
//========================================================================
#ifndef CATVPMFilterManager_H
#define CATVPMFilterManager_H
/**
* Manage filters used during PSN expand
* <BR>
* Usage Note:<BR>
* Add library LV0PSCFG as prereq for link
*/
class CATVPMFilterManager
{
public:
CATVPMFilterManager();
int GetNbFilter() const;
//***********************
//* Retrieve information
//***********************
const char *GetFiltername(const int iNum);
const char *GetFilterLibrary(const int iNum);
const char *GetFilterClass(const int iNum);

Copyright DASSAULT SYSTEMES 2000

1-126

Menu

VPM Programming

//***********************
//* Add filter
//***********************
/**
* Adds a new filter. It will be executed after all filters already declared.
* @return
* <tt>1</tt> filter is added
* <tt>0</tt> filter already exists (not added)
*/
int AddFilter(const char *iName, const char *iLibrary, const char * iClassName);
/**
* Adds a new filter.
* @return
* <tt>1</tt> filter is added
* <tt>0</tt> filter already exists (not added)
*/
int InsertFilter(const int iNum,const char*iName, const char *iLibrary, const char *iClassName);

//***********************
//* Remove filter
//***********************
/**
* @return
* <tt>1</tt> filter is removed
* <tt>0</tt> filter does not exist (=> not removed)
* <tt>-1</tt> it is forbidden to remove this filter
*/
int RemoveFilter(const char *iName);
/**
* @return
* <tt>1</tt> filter is removed
* <tt>0</tt> filter does not exist (=> not removed)
* <tt>-1</tt> it is forbidden to remove this filter
*/
int RemoveFilter(const int iNum);
};
#endif

Copyright DASSAULT SYSTEMES 2000

1-127

Menu

VPM Programming

CATVPMNode.h
libLV012MET.a
#ifndef CATVPMNode_h
#define CATVPMNode_h
#include CATListOfCATVPMNode.h
class SdaiEntityInstance;
class CATPSNNodeDatas;
class CATVPMBatchGraph;
class CATListPtrSdaiEntityInstance;
enum CATVPMChildrenOption
{
All,
Leaves,
AllParts,
PartLeaves
}
class CATVPMNode
{
friend class CATVPMBatchGraph;
public:
virtual CATVPMNode *GetRoot() = 0;
virtual void GetPath(CATLISTP(SdaiEntityInstance) &oPath) = 0;
virtual CATPSNNodeDatas *GetNodeDatas() const = 0;
virtual void SetNodeDatas(CATPSNNodeDatas *iData) = 0;
virtual int IsNodeDataValuated() const = 0;
virtual CATVPMNode *GetFather() const = 0;
virtual void GetChildren(CATListOfCATVPMNode &oChildren, CATVPMChildrenOption
iOption = All, int NbLevels = 1) const = 0;
// Lien pointant sur le noeud
virtual SdaiEntityInstance *Link() = 0;
// Piece sous jacente
virtual SdaiEntityInstance *Instance() = 0;
virtual void Select () = 0;
virtual void Deselect () = 0;
};
#endif

Copyright DASSAULT SYSTEMES 2000

1-128

Menu

VPM Programming

CATLnkAPI.h
libVX0MMODL.a
/* -*-c++-*-*/
// COPYRIGHT DASSAULT SYSTEMES 1999
//========================================================================
//
// CATLnkAPI:
// Contains all public methods related to MML
//
//========================================================================
// Usage Notes:
//
//========================================================================
// Nov. 99 Creation
//========================================================================

#ifndef CATLnkAPI_h
#define CATLnkAPI_h

#include CATUnicodeString.h
#include CATListOfCATUnicodeString.h

//-------- definitions of table types


#define MML_LINK_UNKNOWN
#define MML_LINK_EXT1
#define MML_LINK_ENTITY2
#define MML_LINK_BOTH3

#define MML_BITMASK_SYNCHRO 1
#define MML_BITMASK_TYPE 2
#define MML_MODE_FULL
1
#define MML_MODE_DISPLAY 2
#define MML_MODE_SYNTHESE 3

//-------- definition of the ObjID type


// Warning ! APIs for MML require fields coid and compid to be filled and
// dont manage fields Xcoid and Xcompid.
#ifndef ObjID_def
#define ObjID_def

Copyright DASSAULT SYSTEMES 2000

1-129

Menu

VPM Programming

typedef struct
{
char Xcoid[17]; // Coid (hexadecimal notation)
char Xcompid[17]; // Compid (hexadecimal notation)
double coid;
// Coid (binary)
double compid;
// Compid (binary)
char caenv[9];
char catab[19];
} ObjID;
#endif

//-------- class embedding the methods


class CATLnkAPI
{
public:
/**
* Return the list of objects impacted by a given one.
* <BR>
* @param iInst
* Input object (impacting one).
* @param oCount
* Output count of objects sent back.
* @result
* Pointer to an array of the impacted objects. This array contains
* oCount objects and should be freed by te caller.
*/
static ObjID * GetImpactedBy (const ObjID & iInst, int & oCount);
/**
* Return the list of objects impacting on a given one.
* <BR>
* @param iInst
* Input object (impacted one).
* @param oCount
* Output count of objects sent back.
* @result
* Pointer to an array of the impacting objects. This array contains
* oCount objects and should be freed by te caller.
*/
static ObjID * GetImpactingOn (const ObjID & iInst, int & oCount);

Copyright DASSAULT SYSTEMES 2000

1-130

Menu

VPM Programming

/**
* Return MML links between two objects.
* <BR>
* @param iImpacted
* ObjID of the impacted object.
* @param iImpacting
* ObjID of the impacting model.
* @param oLinkTypes
* List of link types between those models.
* @param oLinkInfo
* List of informations flag related to the links.
* BIT b0, flag MML_BITMASK_SYNCHRO :
*
0 the link is not synchronised.
*
1 the link is synchronized.
* BIT b1, flag MML_BITMASK_TYPE (VPM1.2 and above only) :
*
0 the link is of type object-to-object ($EXT)
*
1 the link is of type element-to-element (MML_LINK)
* @param iMode
* Mode of the returned information, either : <BR>
* MML_MODE_FULL
get all e2e and m2m links individualy<BR>
* MML_MODE_DISPLAY get links the way they would be displayed in the
*
MML graph (MML_BITMASK_TYPE is then useless)<BR>
* MML_MODE_SYNTHESIS get only one synthetic link, only MML_BITMASK_SYNCHRO
*
conveys information (oLinkTypes is senseless)<BR>
* @return
* Error status.
*/
// !!!! Only mode MML_MODE_FULL works for the moment !!!
static int GetLinksBetween (const ObjID & iImpacted, const ObjID & iImpacting,
CATListOfCATUnicodeString & oLinkTypes, CATListOfInt & oLinkInfos, int iMode =
MML_MODE_FULL);
/**
* Send back the number of MML entities associated to the given object.
* <BR>
* This function is the one used in the internal VPM code to provide
* information about the number of entities.
* @param iInst
* Objects we want to know the number of entities of.
* @return
* Number of entities. Can be zero.
*/
static int GetEntityCount (const ObjID & iInst);

Copyright DASSAULT SYSTEMES 2000

1-131

Menu

VPM Programming

/**
* This function deletes from the database all MML_LINK links related to the
* given Object (representing a model).<BR>
* This function is the one used in the internal VPM code to delete
* links belonging to a model on its deletion.
* <BR>
* @param iInst
* Object on which to delete links.
*/
static void DeleteLinks (const ObjID & iInst);
/**
* This function deletes from the database all MML_ENTITY entities related to the
* given Object (representing a model).<BR>
* This function is the one used in the internal VPM code to delete
* entities belonging to a model on its deletion.
* <BR>
* @param iInst
* Object on which to delete entities.
*/
static void DeleteEntities (const ObjID & iInst);
/**
* Checks if this model is pointed by other ones (if it impacts on
* other one). Checks both $EXT and MML_LINK.<BR>
* This function is the one used in the internal VPM code to check
* links on a model before deletion.
* <BR>
* @param iInst
* Object on which to check MML links.
* @return
* 1 if the model is pointed or zero if not.
*/
static int IsPointedModel (const ObjID & iInst);

Copyright DASSAULT SYSTEMES 2000

1-132

Menu

VPM Programming

/**
* This function checks if this part contains models pointed by other ones.
* Checks both $EXT and MML_LINK.<BR>
* This function is the one used in the internal VPM code to check
* links on a part before deletion.
* <BR>
* @param iInst
* Object of the part on the models of which we want to check MML links.
* @param oNameList
* On succes (return 1), contains an array of CATUnicodeString, being the
* name of the pointed models. This array has to be deleted by the caller.
* It is used for display purpose only.
* @return
* 1 if this part contains pointed models or zero if not.
*/
static int IsPointedPart (const ObjID & iInst, CATUnicodeString & oNames);
/**
* Computes the list of all environments containing MML link tables.
* According to the parameter, sends back environments for $EXT or
* MML_LINK tables.<BR>
* This function is the one used in the internal VPM code.
* <BR>
* @param iRelationType
* either MML_LINK_EXT or MML_LINK_ENTITY or MML_LINK_BOTH
* @return
* the environment list
*/
static CATListOfCATUnicodeString ComputeRelationEnvironments (int iRelationType);
};
#endif

Copyright DASSAULT SYSTEMES 2000

1-133

Menu

VPM Programming

CATVpmPubSubUsrAdmin.h
libPR0PUBSUB.a
/* -*-c++-*-*/
// COPYRIGHT DASSAULT SYSTEMES 1999
//========================================================================
//
// <b>CATVpmPubSubUsrAdmin</b> :
// Publish/Subscribe administration customer class
//
//========================================================================
// Usage Notes :
// This class provides publish/subscribe adminstration tools for events, and
// should not be used in interactive programs.
// The manager provides connection open/close method, which have to be used
// accordingly by the caller. Modifications arent reported to database as long
// as the manager isnt asked to commit.
//
// Event naming :
// Custom event names must begin with the string Extern..
//========================================================================
// Nov. 99 Creation
JIC
//========================================================================
#ifndef _CATVpmPubSubUsrAdmin_h_
#define _CATVpmPubSubUsrAdmin_h_

class CATVpmPubSubUsrAdmin
{
public:
/**
* Note : All following method will return -1 if internal publish/subscribe
*
manager cannot be found.
**/
/**
* ---------------------------------------------------------------------* <u>OpenConnection</u>()
* Open a connection to the publish/subscribe database.
* All the other methods require an opened connection.
*
* Returns 0 if successful, 1 otherwise.
* ---------------------------------------------------------------------**/
static int OpenConnection();

Copyright DASSAULT SYSTEMES 2000

1-134

Menu

VPM Programming

/**
* ---------------------------------------------------------------------* <u>CloseConnection</u>()
* Close the connection to the publish/subscribe database.
*
* Returns 0 if successful, 1 otherwise.
* ---------------------------------------------------------------------**/
static int CloseConnection();
/**
* ---------------------------------------------------------------------* <u>Commit</u>()
* Commit changes to the publish/subscribe database.
*
* Returns 0 if successful, 1 otherwise.
* ---------------------------------------------------------------------**/
static int Commit();
/**
* ---------------------------------------------------------------------* <u>Commit</u>()
* Rollback any changes made in the publish/subscribe database.
*
* Returns 0 if successful, 1 otherwise.
* ---------------------------------------------------------------------**/
static int Rollback();
/**
* ---------------------------------------------------------------------* <u>GetRootEvents</u>()
* Find root publish/subscribe events, e.g. events with no father.
*
* Returns size of output array.
* Memory desallocation is in charge of the calling method.
* ---------------------------------------------------------------------**/
static int GetRootEvents(char**& oEvents);

Copyright DASSAULT SYSTEMES 2000

1-135

Menu

VPM Programming

/**
* ---------------------------------------------------------------------* <u>GetEvent</u>()
* Find a publish/subscribe event from its name.
*
* Returns 0 if event was found, 1 otherwise.
* ---------------------------------------------------------------------**/
static int GetEvent(const char* const iName);
/**
* ---------------------------------------------------------------------* <u>GetEventChildren</u>()
* Find the children events of a publish/subscribe event from its name.
*
* Returns size of output array.
* Memory desallocation is in charge of the calling method.
* ---------------------------------------------------------------------**/
static int GetEventChildren(const char* const iFatherName,
char**&
oEvents );
/**
* ---------------------------------------------------------------------* <u>CreateEvent</u>()
* Creates a new publish/subscribe event in the database.
*
* Returns 0 if successful, 1 otherwise.
* ---------------------------------------------------------------------**/
,
static int CreateEvent(const char* const iName
const char* const iFatherName);
/**
* ---------------------------------------------------------------------* <u>DeleteEvent</u>()
* Deletes an existing publish/subscribe event from the database.
* Note : all children events, and associated subscriptions and publica* tions are also deleted.
*
* Returns 0 if successful, 1 otherwise.
* ---------------------------------------------------------------------**/
static int DeleteEvent(const char* const iEventName);
protected:

Copyright DASSAULT SYSTEMES 2000

1-136

Menu

VPM Programming

private:
CATVpmPubSubUsrAdmin();
~CATVpmPubSubUsrAdmin();
};
#endif

Copyright DASSAULT SYSTEMES 2000

1-137

Menu

VPM Programming

CATVpmPubSubUsrManager.h
libPR0PUBSUB.a
/* -*-c++-*-*/
// COPYRIGHT DASSAULT SYSTEMES 1999
//========================================================================
//
// <b>CATVpmPubSubUsrManager</b> :
// Publish/Subscribe management customer interface class
//
//========================================================================
// Usage Notes :
// This class provides publish/subscribe method for querying, subscribing to,
// and publishing events.
// It reads data from the database and caches it into memory as long as it is
// not asked to synchronize or write its contents into the database.
//
// Objects identifiers :
// Subscribers are referred to by their user name.
// Publishers are referred to by their internal identifiers ($COID, $COMPID,
// on 16 bytes) when BOM objects, and by their name when actions (16 bytes
// max.).
//========================================================================
// Nov. 99 Creation
JIC
//========================================================================
#ifndef _CATVpmPubSubUsrManager_h_
#define _CATVpmPubSubUsrManager_h_

// Publish/subscribe
#include CATVpmPSActionType.h

class CATVpmPubSubUsrManager
{
public:
/**
* Note : All following methods will return :
*
-1 if access to publish/subscribe is not authorized by security.
*
-2 if database connection is not opened.
*
-3 if internal publish/subscribe manager cannot be found.
*
-4 if any input argument is null.
*
-5 if the input event name doesnt refer to any existing event.
*
-6 if an internal error occured.
**/

Copyright DASSAULT SYSTEMES 2000

1-138

Menu

VPM Programming

/**
* ---------------------------------------------------------------------* <u>Subscribe</u>()
*
* @param iSubscriberOID
* ID of the subscriber (e.g. user) requiring a subscription.
* @param iEvent
* Publish/subscribe event to subscribe to.
* @param iPublisherOID
* ID of the publisher (e.g. object) for which the event is subscribed
* to.
* @param iActionType
* @param iAction
* @param iActionData
* Type, contents and related data of the action to be executed when
* the event is raised.
* @param iSubscriberNickname
* Nickname of the subscribing user (e-mail address, for example).
* @param iPublisherNickname
* Nickname of the publisher object.
* @param oErrorMessage
* Internal error message when -6 is returned.
* Memory disallocation is in charge of the calling method.
*
* @return
* 0 if successful,
* -7 when subscriber is beyond users sphere of influence,
* non-zero otherwise.
* ---------------------------------------------------------------------**/
iSubscriberOID ,
static int Subscribe(const char* const
const char* const
iEvent
,
const char* const
iPublisherOID
,
const CATVpmPSActionType iActionType
,
const char* const
iAction
,
const char* const
iActionData
,
const char* const
iSubscriberNickname,
const char* const
iPublisherNickname ,
char*&
oErrorMessage
);

Copyright DASSAULT SYSTEMES 2000

1-139

Menu

VPM Programming

/**
* ---------------------------------------------------------------------* <u>UnSubscribe</u>()
* Remove existing subscription(s).
* First method removes all existing subscriptions, regardless of asso* ciated action.
*
* @param iSubscriberOID
* ID of the subscriber (e.g. user) that made a subscription.
* @param iEvent
* Publish/subscribe event that was subscribed to.
* @param iPublisherOID
* ID of the publisher (e.g. object) for which the event was subscri* bed to.
* @param iActionType
* Type of the action associated to the subscription.
* @param iActionType
* Action associated to the subscription.
* @param oErrorMessage
* Internal error message when -6 is returned (null otherwise).
* Memory disallocation is in charge of the calling method.
*
* @return
* 0 if successful,
* -7 when subscriber is beyond users sphere of influence,
* -8 if subscription couldnt be found,
* non-zero otherwise.
* ---------------------------------------------------------------------**/
iSubscriberOID,
static int UnSubscribe(const char* const
const char* const
iEvent
,
const char* const
iPublisherOID ,
char*&
oErrorMessage );
iSubscriberOID,
static int UnSubscribe(const char* const
const char* const
iEvent
,
const char* const
iPublisherOID ,
const CATVpmPSActionType iActionType ,
const char* const
iAction
,
char*&
oErrorMessage );

Copyright DASSAULT SYSTEMES 2000

1-140

Menu

VPM Programming

/**
* ---------------------------------------------------------------------* <u>IsSubscriber</u>()
* Checks if given subscriber has subscribed to a given event for.
*
* @param iSubscriberOID
* ID of the subscriber (e.g. user) that made a subscription.
* @param iEvent
* Publish/subscrib event that was subscribed to.
* @param iPublisherOID
* Publisher ID (object) on which iEvent was subscribed.
* @param oErrorMessage
* Internal error message when -6 is returned (null otherwise).
* Memory disallocation is in charge of the calling method.
*
* @return
* 1 if subscription exists, 0 or error code otherwise.
* ---------------------------------------------------------------------**/
static int IsSubscriber(const char* const iSubscriberOID,
const char* const iEvent
,
const char* const iPublisherOID ,
char*&
oErrorMessage );
/**
* ---------------------------------------------------------------------* <u>PublishedEvent</u>()
* Publish an event, e.g. raise all the subscriptions registered on that
* event for a given publisher object.
*
* @param iEvent
* Publish/subscribe event to be raised.
* @param iPublisherOID
* Publisher raising the event, e.g. ID of the object for which iEvent
* occurred.
* @param oErrorMessage
* Internal error message when -6 is returned (null otherwise).
* Memory disallocation is in charge of the calling method.
*
* @return
* 0 if successful, non-zero otherwise.
* ---------------------------------------------------------------------**/
,
static int PublishEvent(const char* const iEvent
const char* const iPublisherOID,
char*&
oErrorMessage);

Copyright DASSAULT SYSTEMES 2000

1-141

Menu

VPM Programming

protected:
private:
/**
* ---------------------------------------------------------------------* <u>CATVpmPubSubUsrManager</u>()
* Default destructor - use forbidden by implementation.
* ---------------------------------------------------------------------**/
CATVpmPubSubUsrManager();
/**
* ---------------------------------------------------------------------* <u>~CATVpmPubSubUsrManager</u>()
* Destructor.
* ---------------------------------------------------------------------**/
~CATVpmPubSubUsrManager();
};
#endif

Copyright DASSAULT SYSTEMES 2000

1-142

Menu

VPM Programming

CATDMUsrInstance.h
libLV003DBA.a
/* -*-c++-*-*/
// COPYRIGHT DASSAULT SYSTEMES 1999
//========================================================================
//
// <b>CATDMUsrInstance</b> :
// VPM BOM instance customer interface class.
//
// This class provides customer with access to VPM data management functions.
// It can be used in customer-written code (user-exits, typically) in order to
// perform specific actions on database objects.
//
// Current features :
// - Retrieval of values
// - Maturity management (get/set object maturity, promote/demote).
//
//========================================================================
// Usage Notes:
//
// Object identification :
// Database objects are referred to through <b>ObjID</b> structure (see
// <i>CATDMUsrMethod.h</i>), containing database environment (owner) and table
// names as well as internal object identifiers ($COID, $COMPID attributes).
//
// Security management :
// Security checks are performed whenever required, as in standard VPM interac// tive functions.
//
// Data persistency :
// All persistent functions (e.g., the ones that perform modifications in the
// database), are automatically commited on success (otherwise the operation is
// rollbacked).
//
// Memory issues :
// All methods return an <b>Error</b> structure (see <i>CATDMUsrMethod.h</i>),
// containing the error code and messages when processing didnt end correctly,
// and the contents of which are to be freed by the caller when not empty.
// When method ends successfully, Error structure contains a zeroed error code
// and null message strings, so they need not be disallocated.
//
// Whenever memory has to be allocated for value return (pointers, typically),
// disallocation is also the responsability of the caller.
//
// Building & linking a custom library :
// Any module including this file should be linked with the LV003DBA library,

Copyright DASSAULT SYSTEMES 2000

1-143

Menu

VPM Programming

// which contains the class implementation.


//
//========================================================================
// Nov. 99 Creation
JIC
//========================================================================
#ifndef _CATDMUsrInstance_h_
#define _CATDMUsrInstance_h_

// Database access
#include CATDMUsrMethod.h

// Forward class declaration


class CATDMInstance;

class CATDMUsrInstance
{
public:
/**
* ---------------------------------------------------------------------* <u>CATDMUsrInstance</u>()
* Build an object instance from a given environment and table, with gi* ven identifier attributes.
*
* @param iCaenv
* Database environment.
* @param iCatab
* Database table.
* @param iCoid
* Object $COID identifier in hexadecimal format.
* @param iCompid
* Object $COMPID identifier in hexadecimal format.
* ---------------------------------------------------------------------**/
CATDMUsrInstance(const chariCaenv [ 9],
const char iCatab [19],
const char iCoid [17],
const char iCompid[17]);

Copyright DASSAULT SYSTEMES 2000

1-144

Menu

VPM Programming

/**
* ---------------------------------------------------------------------* <u>CATDMUsrInstance</u>()
* Build an object instance from a given environment and table, with gi* ven identifier attributes.
*
* @param iCaenv
* Database environment.
* @param iCatab
* Database table.
* @param iCoid
* Object $COID identifier in decimal format.
* @param iCompid
* Object $COMPID identifier in decimal format.
* ---------------------------------------------------------------------**/
CATDMUsrInstance(const char iCaenv [ 9],
const char iCatab [19],
const double iCoid
,
const double iCompid );
/**
* ---------------------------------------------------------------------* <u>CATDMUsrInstance</u>()
* Build an instance object from another one.
*
* @param iInstance
* Object instance to build from.
* ---------------------------------------------------------------------**/
CATDMUsrInstance(const CATDMUsrInstance& iInstance);
/**
* ---------------------------------------------------------------------* <u>~CATDMUsrInstance</u>()
* Destructor.
* ---------------------------------------------------------------------**/
~CATDMUsrInstance();

Copyright DASSAULT SYSTEMES 2000

1-145

Menu

VPM Programming

/**
* ---------------------------------------------------------------------* <u>operator=</u>()
* Assignment operator.
* Assign an instance object to another one.
*
* @param iInstance
* Object instance to build from.
*
* @return
* Assigned object.
* ---------------------------------------------------------------------**/
CATDMUsrInstance& operator=(const CATDMUsrInstance& iInstance);
/**
* ---------------------------------------------------------------------* <u>operator==</u>()
* Equality operator.
* Compare an object instance to another one according to their internal
* identifiers.
*
* @param iInstance
* Object instance to compare with.
*
* @return
* 1 if objects are identical, 0 otherwise.
* ---------------------------------------------------------------------**/
int operator==(const CATDMUsrInstance& iInstance) const;
/**
* ---------------------------------------------------------------------* <u>operator!=</u>()
* Inequality operator.
* Compare an object instance to another one according to their internal
* identifiers.
*
* @param iInstance
* Object instance to compare with.
*
* @return
* 1 if objects are different, 0 otherwise.
* ---------------------------------------------------------------------**/
int operator!=(const CATDMUsrInstance& iInstance) const;

Copyright DASSAULT SYSTEMES 2000

1-146

Menu

VPM Programming

/**
* ---------------------------------------------------------------------* <u>GetValue</u>()
* Get the value of an attribute.
*
* @param iAttribute
* Attribute for which the value is to be retrieved.
* @param oValue
* Value of the attribute.
*
* @return
* Error code and messages.
* ---------------------------------------------------------------------*/
Error GetValue(const char* const iAttribute,
char*&
oValue ) const;
/**
* ---------------------------------------------------------------------* <u>GetRevision</u>()
* Get the revision number of an object.
*
* @param oRevision
* Output revision number.
*
* @return
* Error code and messages.
* ---------------------------------------------------------------------**/
Error GetRevision(char*& oRevision) const;
/**
* ---------------------------------------------------------------------* <u>GetMaturity</u>()
* Get the maturity of an object.
*
* @param oMaturity
* Output maturity string.
* @param oIsLocked
* If not null, contains the lock status of the object
*
* @return
* Error code and messages.
* ---------------------------------------------------------------------**/
Error GetMaturity(char*& oMaturity ,
int* oIsLocked=NULL) const;

Copyright DASSAULT SYSTEMES 2000

1-147

Menu

VPM Programming

/**
* ---------------------------------------------------------------------* <u>SetMaturity</u>()
* Set the maturity of an object to a new value.
* Input value must belong to the list of authorized maturity values in
* use for the object.
*
* @param iObjectID
* Object identifier.
* @param iMaturity
* New maturity string.
*
* @return
* Error code and messages.
* ---------------------------------------------------------------------**/
Error SetMaturity(const char* const iMaturity);
/**
* ---------------------------------------------------------------------* <u>Promote</u>()
* Promotes an object to the next maturity, e.g. sets its maturity to the
* next higher value in the authorized maturity list
*
* @param iObjectID
* Object identifier.
*
* @return
* Error code and messages.
* ---------------------------------------------------------------------**/
Error Promote();

Copyright DASSAULT SYSTEMES 2000

1-148

Menu

VPM Programming

/**
* ---------------------------------------------------------------------* <u>Demote</u>()
* Demotes an object to the previous maturity, e.g. sets its maturity to
* the next lower value in the authorized maturity list.
*
* @param iObjectID
* Object identifier.
*
* @return
* Error code and messages.
* ---------------------------------------------------------------------**/
Error Demote();
protected:
private:
/**
* ---------------------------------------------------------------------* <u>CATDMUsrInstance</u>()
* Default destructor - use forbidden by implementation.
* ---------------------------------------------------------------------**/
CATDMUsrInstance();
CATDMInstance* _instance;
};
#endif

Copyright DASSAULT SYSTEMES 2000

1-149

Menu

VPM Programming

CATDMUsrMethodContext.h
libLV002DLG.a
/* -*-c++-*-*/
// COPYRIGHT DASSAULT SYSTEMES 1997
//========================================================================
//
// <b>CATDMUsrMethodContext</b>:
// Information on the context of the current operation, e.g. is whether VPM
// performing a part duplication, check-out, etc.
//
//========================================================================
// Usage Notes:
//
// Use CATDMUsrMethodContext::GetTaskCaller() within user-exits to check cur// rent context, so it is possible to perform different actions according to
// its value.
//
//========================================================================
// Sep. 97 Creation
//========================================================================
#ifndef CATDMUsrMethodContext_h
#define CATDMUsrMethodContext_h

// <b>TaskType</b>
// Definition of possible contexts
enum TaskType
{
CATDMNoContext
CATDMQuery
CATDMImport
CATDMDuplicate
CATDMNewVersionDPN
CATDMNewVersionSPN
CATDMNewRevision
CATDMUpdateVersionRevision
CATDMCheckOut
CATDMCreate
CATDMRename
CATDMDelete
CATPSNDuplicate
CATPSNCreate
)
};

Copyright DASSAULT SYSTEMES 2000

= 0,
= 1,
= 2,
= 3,
= 4,
= 5,
= 6,
= 7,
= 8,
= 9,
=10,
=11,
=12,
=13

// No current context
// Query panel
// Import panel
// Duplicate an object from VPM-Access
// Create new version with different part number
// Create new version with same part number
// Create new revision
// Update version/revision
// Check-out a part
// Create an object (Create&Save icon, Extract/Save...)
// Update an object (Update icon)
// Deletion
// Duplicate from Graph
// Create from Graph (Associate new part...

1-150

Menu

VPM Programming

// <b>CATDMUsrMethodContext</b> class declaration


class CATDMUsrMethodContext
{
public:
/**
* <u>GetTaskCaller</u>()
* Get current execution context.
*
* @param oType
* Current context (see enumeration above).
*
* @return
* 1 if context is currently set, 0 otherwise.
*/
static int GetTaskCaller(TaskType& oType);
};
#endif

Copyright DASSAULT SYSTEMES 2000

1-151

Menu

VPM Programming

CATDMUSRSelect.h
libLV003DBA.a
/* -*-c++-*-*/
// COPYRIGHT DASSAULT SYSTEMES 1997
//=======================================================================//
// CATDMUSRSelect:
// Basic service to perform queries against the database
//
//======================================================================//
Usage Notes:
//
//======================================================================//
Sep. 97 Creation
//========================================================================
#ifndef CATDMUSRSelect_H
#define CATDMUSRSelect_H
#include CATDMListResultLine.h
class CATDMSelect;
/**
* Basic service to perform queries against the database<BR>
* <BR>
* Usage Note:<BR>
* Add library LV003DBA as prereq for link
*/
class CATDMUSRSelect
{
public:
/**
* @param i_select_order
*
<b>ORDER HAVE TO BE IN UPPER CASE</b> (for instance : SELECT FROM WHERE
LIKE).
* @param o_ier
* Return code
* @param i_nbfetchmax
* if i_nbfetchmax<0 fetch without limit<BR>
* else use this value as limitation during fetch
*/
CATDMUSRSelect(const CATUnicodeString& i_select_order,
int *o_ier,const int i_nbfetchmax=-1);
~CATDMUSRSelect();

Copyright DASSAULT SYSTEMES 2000

1-152

Menu

VPM Programming

/**
* Returns the result of the query.
*/
virtual void GetSelectResult(CATDMListResultLine* o_result,int *o_ier);
/**
* Returns number of hints.
*/
virtual int GetSelectCount(int *o_ier);
private:
CATDMSelect* catdmselect;
};
#endif

Copyright DASSAULT SYSTEMES 2000

1-153

Menu

VPM Programming

CATDMUSRUpsate.h
libLV003DBA.a
/* -*-c++-*-*/
// COPYRIGHT DASSAULT SYSTEMES 1997
//
=========================================================================
====
//
// CATDMUSRUpdate:
// Basic service to update attributes into the database
//
//
=========================================================================
====
// Usage Notes:
//
//
=========================================================================
====
// Sep. 97 Creation
//
=========================================================================
====
#ifndef CATDMUSRUpdate_H
#define CATDMUSRUpdate_H
#include <CATUnicodeString.h>
#include <CATListOfCATUnicodeString.h>
class CATDMUpdate;
/**
* Basic service to update attributes into the database<BR>
* <BR>
* Usage Note:<BR>
*
* Add library LV003DBA as prereq for link
*/
class CATDMUSRUpdate
{
public:
/**
* @param i_dbname
* Database name

Copyright DASSAULT SYSTEMES 2000

1-154

Menu

VPM Programming

* @param catenv
* Environment
* @param catab
* Table
* @param coid
* $COID
* @param compid
* $COMPID
* @param iUseSecurityView
* <tt>0</tt> : security view is not used<BR>
* <tt>1</tt> : security view is used
*/
CATDMUSRUpdate(const CATUnicodeString& i_dbname,
const CATUnicodeString& catenv,
const CATUnicodeString& catab,
const double coid,
const double compid,
const int iUseSecurityView=1);
virtual ~CATDMUSRUpdate();
/**
* Defines the SET CLAUSE.<BR>
* @param i_att
* Contains all the attributes name which are going to be updated.
* @param i_val
* Contains all the values (in string format).<BR>
* Single quotes are added automatically (when necessary).
*/
virtual void SetSetClause(const CATListOfCATUnicodeString &i_att,
const CATListOfCATUnicodeString &i_val);
/**
* Performs update
*/
virtual int Update();
private:
CATDMUpdate *catdmupdate;
};
#endif

Copyright DASSAULT SYSTEMES 2000

1-155

Menu

VPM Programming

CATDMUSRCatia.h
libLV003DBA.a
#ifndef CATDMUSRCATIA_H
#define CATDMUSRCATIA_H
// IN MODULE: LV003DBA
#include <CATUnicodeString.h>
class CATDMUSRCatia
{
public:
//Connect to an environment
//default=dernier environement
static int ConnectEnvironment(const CATUnicodeString &i_caenv=);
//Return current environment
static int GetCurrentEnv(CATUnicodeString &o_caenv);
// 001122334455667788 => double
static double HexaToDouble(const CATUnicodeString &i_hexcoid);
// double => 001122334455667788
static CATUnicodeString DoubleToXHexa(double i_coid);
};
#endif

Copyright DASSAULT SYSTEMES 2000

1-156

Menu

VPM Programming

CATDMUSRResultPanel.h
libLV005CDA.a
#ifndef CATDMUSRRESULTPANEL_H
#define CATDMUSRRESULTPANEL_H
// IN MODULE: LV005CDA
class CATDMUSRResultPanel
{
public:
//Refresh all result panels.
static void RefreshObjectsInPanels();
};
#endif

Copyright DASSAULT SYSTEMES 2000

1-157

Menu

VPM Programming

CATcdm.h
libLV003DBA.a
#ifndef _CATCDM_H_
#define _CATCDM_H_
//========================================================================
//
CDM HEADER FILE
//
// This is the CDM header file. It includes all that CDM needs
// to know about CDM.
//
//========================================================================
//
// Includes
//#include <CATcdm_const.h>
#include <string.h>
//========================================================================
//
// Debug
//
extern int une_fois;
extern int debug1;
extern int debug2;

/* flag dinit
*/
/* 1: TRUE 0: FALSE
/* 1: TRUE 0: FALSE

*/
*/

enum column_type {
NOT_NULL_CHAR=452,
NULL_CHAR=453,
NOT_NULL_VARCHAR=448,
NULL_VARCHAR=449,
NOT_NULL_LONG_VARCHAR=456, NULL_LONG_VARCHAR=457,
NOT_NULL_INTEGER=496,
NULL_INTEGER=497,
NOT_NULL_SMALLINT=500,
NULL_SMALLINT=501,
NOT_NULL_DECIMAL=484,
NULL_DECIMAL=485,
NOT_NULL_FLOAT=480,
NULL_FLOAT=481,
NOT_NULL_DATE=384,
NULL_DATE=385,
NOT_NULL_TIME=388,
NULL_TIME=389,
NOT_NULL_TIMESTAMP=392,
NULL_TIMESTAMP=393
};
//========================================================================
//
// CLASS cdm
// Centralizes some definitions and general methods

Copyright DASSAULT SYSTEMES 2000

1-158

Menu

VPM Programming

//
class CATcdm {
public:
static int dbcopw (const char* par_name, const char* par_value, int len);
static int dbconn (const char* cdmenv);
static int dbquin ();
static char * dbqucn ();
static const char* dbcsta ();
static int dbfin ();
static int commit ();
static int rollback ();
static int execute (const char* sql_order, int number_of_params=0, ...);
static char * getDBCA ();
static int
static int
static int
static int
static int

dbexec (const char* order);


DbexecWithTriggers (const char* iOrder);
dbexc (const char* order);
dblabw (const char* name, const void* area, int length);
dblabd (const char* name);

static int align (int possible_offset, column_type type, int size=1);


static void get_label (char *label, const char* prefix=NULL);
};
#endif /* _CATCDM_H_ */

Copyright DASSAULT SYSTEMES 2000

1-159

Menu

VPM Programming

CATUnicodeString.h
libNS0S3STR.a
/* -*-C++-*- */
// COPYRIGHT DASSAULT SYSTEMES 1997
//=======================================================================//
// CATUnicodeString:
// Class for character string support in a SBCS, DBCS, or MBCS environment
//
//======================================================================//
Considerations of usage:
// CATUnicodeString has to be used whenever a character string is
// needed, ie either seen, entered, or manipulated by the
// end user. In this way, the application is shielded from
// implementation details regarding language, locale, bytecoding
// of characters, etc. The application thus becomes portable from a
// geographical standpoint.
//
// For other strings, not seen by the user but internally manipulated
// by the application, the CATString type (from the System framework)
// is mandatory, instead of the raw type char*.
//
//
========================================================================//
// February 96 Creation from dsString and TEMPOSTRING O Fresse
//
//========================================================================
#ifdef _WINDOWS_SOURCE
#ifdef __NS0S3STR
#define ExportedByNS0S3STR __declspec(dllexport)
#else
#define ExportedByNS0S3STR __declspec(dllimport)
#endif
#else
#define ExportedByNS0S3STR
#endif
#ifndef CATUnicodeString_H
#define CATUnicodeString_H
#include <stdlib.h>
#include CATUnicodeChar.h
#include CATI18NTypes.h
#include CATBaseUnknown.h
#include CATBSTR.h
class CATInterUnicodeString ;

Copyright DASSAULT SYSTEMES 2000

1-160

Menu

VPM Programming

class CATString ;
class istream;

//------------------------------------------------------------------/**
* CATUnicodeString is the class to use whenever a character string
* is to be manipulated by your application, instead of the CATString class,
* or worse, a char*.
* <p>
* CATUnicodeString has to be used whenever a character string is
* needed, ie either seen, entered, or manipulated by the
* end user. In this way, the application is shielded from
* implementation details regarding language, locale, bytecoding
* of characters, and so forth. Applications thus become portable
* since they can handle character strings expressed in any language.
* <p>
* For other strings, not seen by the user but internally manipulated
* by the application, the CATString class from the System framework
* is required, instead of the raw type char* you should never use.
*
* @see CATString
*/
class ExportedByNS0S3STR CATUnicodeString : public CATBaseUnknown
{
// Class utilities: marshalling, type management
friend class CATMarshallableUnicodeString;
CATDeclareClass;
public :
//------------// Ctors, Dtors
//------------/**
* Constructs an empty CATUnicodeString instance.
*/
CATUnicodeString(); // Creates an empty string
/**
* Copy constructor.
* Constructs a CATUnicodeString instance from another CATUnicodeString.
*/
CATUnicodeString(const CATUnicodeString& iString);
// From a char*
/**

Copyright DASSAULT SYSTEMES 2000

1-161

Menu

VPM Programming

* Constructs a CATUnicodeString instance from a pointer to a char.


* @param iPtrRoChar
* Pointer to the character string.
*/
CATUnicodeString(const char* const iPtrToChar);
// From a char* limited to its firt iLength characters
/**
* Constructs a CATUnicodeString instance from a pointer to a char,
* taking into account a given number of characters starting from
* the first one.
* @param iPtrRoChar
* Pointer to the character string.
* @param iLength
* Number of characters to be taken into account, starting at
* the first character.
*/
CATUnicodeString(const char* const iPtrToChar, size_t iLength);
// By repeating iNbTimes a given character
/**
* Constructing a CATUnicodeString instance by repeating a given character.
* @param iChar
* Character to be repeated.
* @param iNbTimes
* Number of times <tt>iChar</tt> is to be repeated.
*/
CATUnicodeString(const CATUnicodeChar& iChar, size_t iNbTimes=1);
// By repeting iNbTimes a given string
/**
* Constructing a CATUnicodeString instance by repeating a given character
* string.
* @param iString
* Character string to be repeated.
* @param iNbTimes
* Number of times <tt>iString</tt> is to be repeated.
*/
CATUnicodeString(const CATUnicodeString& iString, size_t iNbTimes);
~CATUnicodeString() ;

//-------------------// Pseudoconstructors
//-------------------// The following methods recycle an existing CATUnicodeString instance by
// changing their contents using a new source, as opposed to deleting

Copyright DASSAULT SYSTEMES 2000

1-162

Menu

VPM Programming

// unwanted instances and creating new ones from scratch.


// Building from CATUnicodeChars
/**
* Recycles an existing CATUnicodeString instance from a table of
* Unicode characters.
* @param iUnicodeChar
* Table of Unicode characters.
* @param iNbChar
* Number of Unicode characters in the table.
* @return 1 if the character string is successfully built and 0 otherwise.
*/
int BuildFromUCChar(const CATUC2Bytes *iUnicodeChar, int iNbChar);
// Building from numerals
/**
* Recycles an existing CATUnicodeString instance from an integer.
* @param iValue
* Integer value.
* @param iFormat
* Format of the integer value, defaulted to %d, according to the sprintf
* library function base conversions.
* @return
* A positive value corresponding to the number of bytes of the corresponding
* character string encoded as a char* if the recycling succeeds and 0
* otherwise.
*/
int BuildFromNum(int
iValue, const char *iFormat=%d);
/**
* Recycles an existing CATUnicodeString instance from a long integer.
* @param iValue
* Long integer value.
* @param iFormat
* Format of the long integer value, defaulted to %ld, according to the
* sprintf library function base conversions.
* @return
* A positive value corresponding to the number of bytes of the corresponding
* character string encoded as a char* if the recycling succeeds and 0
* otherwise.
*/
int BuildFromNum(long
iValue, const char *iFormat=%ld);
/**
* Recycles an existing CATUnicodeString instance from an unsigned long integer.
* @param iValue
* Unsigned long integer value.
* @param iFormat
* Format of the unsigned long integer value, defaulted to %uld, according

Copyright DASSAULT SYSTEMES 2000

1-163

Menu

VPM Programming

* to the sprintf library function base conversions.


* @return
* A positive value corresponding to the number of bytes of the corresponding
* character string encoded as a char* if the recycling succeeds and 0
* otherwise.
*/
int BuildFromNum(unsigned long iValue, const char *iFormat=%uld);
/**
* Recycles an existing CATUnicodeString instance from a double.
* @param iValue
* Double value.
* @param iFormat
* Format of the double value, defaulted to %g, according to the sprintf
* library function base conversions.
* @return
* A positive value corresponding to the number of bytes of the corresponding
* character string encoded as a char* if the recycling succeeds and 0
* otherwise.
*/
int BuildFromNum(double
iValue, const char *iFormat=%g);
/**
* Recycles an existing CATUnicodeString instance from a long double.
* @param iValue
* Long double value.
* @param iFormat
* Format of the long double value, defaulted to %Lg, according to the
* sprintf library function base conversions.
* @return
* A positive value corresponding to the number of bytes of the corresponding
* character string encoded as a char* if the recycling succeeds and 0
* otherwise.
*/
int BuildFromNum(long double iValue, const char *iFormat=%Lg);
// Example :
// CATUnicodeString string;
// long valueToConvert;
// int isBuildOK = string.BuildFromNum(valueToConvert, The Value is : %d);
// Upon successful completion, these subroutines return the number of bytes
// transmitted. Otherwise, they return 0.
// Building from an istream
/**
* Recycles an existing CATUnicodeString instance from an input stream.
* @param iStreamToRead
* Input stream.
* @param iSkipWhite
* Flag to indicate whether white lines must be skipped (!=0) or not (=0).

Copyright DASSAULT SYSTEMES 2000

1-164

Menu

VPM Programming

* @return
* The input stream.
*/
istream& BuildFromStream( istream& iStreamToRead,
int iSkipWhite = 1); // White lines skipped if != 0
// Building from STEP Standard (ISO 10133) Express strings
/**
* Recycles an existing CATUnicodeString instance from a STEP character string
* encoded using the Express format.
* @param iExpressString
* Pointer to the Express-encoded character string.
* @return
* 0 is the CATUnicodeString instance is successfully recycled and -1
* otherwise.
*/
int BuildFromSTEP(const char *iExpressString);
// Refer to STEP part 21 for details on Express encoding of strings
// Building from the UTF8 format
/**
* Recycles an existing CATUnicodeString instance from a UTF-8 encoded
* character string.
* @param iUTF8Data
* Pointer to the UTF-8 encoded character string.
* @param iNbBytes
* Length of <tt>iUTF8Data</tt> in bytes.
* @return
* 0 is the CATUnicodeString instance is successfully recycled and a negative
* value otherwise.
*/
int BuildFromUTF8(const char *iUTF8Data, size_t iNbBytes);
// Building from the BSTR format
/**
* Recycles an existing CATUnicodeString instance from a BSTR-encoded character
* string.
* A BSTR is a Basic string, or binary string, ie a pointer to a wide
* character string.
* @param iBSTR
* Pointer to the BSTR-wide character string.
* @return
* 0 is the CATUnicodeString instance if successfully recycled and a negative
* value otherwise.
*/
int BuildFromBSTR(const CATBSTR &iBSTR);

Copyright DASSAULT SYSTEMES 2000

1-165

Menu

VPM Programming

// (Re)Initializing an instance (empties it)


/**
* Blanks out an existing CATUnicodeString instance.
*/
void Reset();

//---------// Operators
//---------// Assignment
/**
* Assignment operator from a char*.
* @param iPtrToCharToCopy
* Pointer to the char* character string to be copied.
*/
CATUnicodeString &operator =(const char
*iPtrToCharToCopy);
/**
* Assignment operator from a CATUnicodeString instance.
* @param iStringToCopy
* CATUnicodeString instance to copy.
*/
CATUnicodeString &operator =(const CATUnicodeString &iStringToCopy) ;
// Comparison
//
CAUTION: the locale is taken into account when comparing.
//
As a consequence, comparing two instances with different
//
locales can lead to non-significant results.
/**
* Equality operator.
*/
int operator == ( const CATUnicodeString &iStringToCompare ) const ;
/**
* Inequality operator.
*/
int operator != ( const CATUnicodeString &iStringToCompare ) const ;
/**
* Less-than operator.
*/
int operator < ( const CATUnicodeString &iStringToCompare ) const ;
/**
* Less-than or equal operator.
*/
int operator <= ( const CATUnicodeString &iStringToCompare ) const ;
/**
* Greater-than or equal operator.

Copyright DASSAULT SYSTEMES 2000

1-166

Menu

VPM Programming

*/
int operator >= ( const CATUnicodeString &iStringToCompare ) const ;
/**
* Greater-than operator.
*/
int operator > ( const CATUnicodeString &iStringToCompare ) const ;
// Table-like access
/**
* Subscripting operator.
*/
CATUnicodeChar operator[](size_t iPos) const;
// Bound checks are performed.
// C-mode indexing: the first char in string is at index 0

//----------------// Pseudooperators
//----------------// Compares two CATUnicodeString with extended diagnostics.
/**
* Compares CATUnicodeString instances
* @return
* 2 if the strings are identical, 1 if only case differences are
* found (<tt>Hello == hello</tt>), and 0 otherwise.
*/
int Compare(const CATUnicodeString &iStringToCompare) const;
// Return value: 2: strictly equal
//
1: equal, but case may be different (Hello == hello)
//
0: different
// Concatenation
/**
* Concatenates CATUnicodeString instances.
* The string passed as a parameter is appended to the current string.
* For example:
* <pre>
* CATUnicodeString Hello(Hello);
* CATUnicodeString Goodbye(Goodbye);
* Hello.Append(Goodbye);
// Hello now contains HelloGoodbye
* </pre>
*/
CATUnicodeString& Append( const CATUnicodeString &iStringToAppend );
// CATUnicodeString Hello(Hello);
// Hello.Append(Goodbye); // Hello now contains HelloGoodbye

Copyright DASSAULT SYSTEMES 2000

1-167

Menu

VPM Programming

// Capitalization
/**
* Converts the current string to uppercase characters.
*/
void ToUpper() ; // Turns The string into THE STRING
/**
* Converts the current string to lowercase characters.
*/
void ToLower() ; // Turns The string into the string
// Substring extraction
/**
* Returns a substring extracted from the current string.
* @param iStartPos
* The first character to be extracted.
* @param iNbCharsToExtract
* The number of characters to be extracted.
*/
CATUnicodeString SubString ( int iStartPos,
int iNbCharsToExtract ) const ;

//-----------------// Format conversion


//-----------------// To numerals
/**
* Converts the current string to an integer returned as the first parameter.
* For example:
* <pre>
* CATUnicodeString StringToConvert(1250);
* int Value;
* int IsConversionOK = StringToConvert.ConvertToNum(&Value);
* // IsConversionOK is set to 1
* </pre>
* @returns 1 if conversion succeeds and 0 otherwise.
*/
int ConvertToNum(int
*oValue, const char *iFormat=%d) const;
/**
* Converts the current string to a long integer returned as the first parameter.
*/
int ConvertToNum(long
*oValue, const char *iFormat=%ld) const;
/**
* Converts the current string to an unsigned integer returned as the first
* parameter.

Copyright DASSAULT SYSTEMES 2000

1-168

Menu

VPM Programming

*/
int ConvertToNum(unsigned long *oValue, const char *iFormat=%uld) const;
/**
* Converts the current string to a double returned as the first parameter.
*/
int ConvertToNum(double
*oValue, const char *iFormat=%le) const;
/**
* Converts the current string to a long double returned as the first parameter.
*/
int ConvertToNum(long double *oValue, const char *iFormat=%le) const;
// Example :
//
CATUnicodeString stringToConvert;
//
long value;
//
int isConvertOK = ConvertToNum(&value);
// These subroutines return the number of successfully matched and assigned
// input items
// To STEP Standard (ISO 10133) Express string encoding scheme
// Refer to STEP part 21 for details on Express encoding of chars
/**
* Converts the current string to an EXPRESS-encoded string for STEP.
*/
void ConvertToSTEP( char *oExpressString) const;
// To UTF8 format
/**
* Converts the current string to an UTF-8 encoded string.
*/
void ConvertToUTF8( char *oUTF8Data, size_t *oNbBytes) const;
// oUTF8Data should be allocated as a table of
// 4*(this->GetLengthInChar()) elements
// To CATBSTR format
/**
* Converts the current string to a BSTR (basic string for OLE).
*/
void ConvertToBSTR( CATBSTR *oBSTR) const;
// To characters
/**
* Converts the current string to a char* returned.
*/
const char
*ConvertToChar() const;
/**
* Converts the current string to a CATUC2Bytes character encoded string
* returned.
*/

Copyright DASSAULT SYSTEMES 2000

1-169

Menu

VPM Programming

const CATUC2Bytes *ConvertToUCChar() const;


//-------------------// String manipulation
//-------------------// Extending or truncating
/**
* Extends or truncates the current string.
* If <tt>iNewSizeInChar</tt> is greater than the length of the current string,
* the <tt>iPaddingChar</tt> character is used to fill in the created
* characters. Otherwise, the character string is truncated to its new size
* if <tt>iAllowToTruncate</tt> is not set to 0, or remains as is if
* if <tt>iAllowToTruncate</tt> is set to 0.
* @param iNewSizeInChar
* Number of characters to be assigned to the current string.
* @param iPaddingChar
* Character used to fill the possible blanks.
* @param iAllowToTruncate
* Flag to be declared if truncation is allowed.
* <tt>iAllowTruncate</tt> sets to 0 preventing truncation, and
* other values allow for truncation.
*/
void
Resize(int
iNewSizeInChar,
const CATUnicodeChar& iPaddingChar,
int
iAllowToTruncate);
/**
* Extends or truncates the current string.
* If <tt>iNewSizeInChar</tt> is greater than the length of the current string,
* the <tt>iPaddingChar</tt> character is used to fill in the created
* characters. Otherwise, the character string is truncated to its new size.
* @param iNewSizeInChar
* Number of characters to be assigned to the current string.
* @param iPaddingChar
* Character used to fill the possible blanks.
*/
inline void Resize(int
iNewSizeInChar,
const CATUnicodeChar& iPaddingChar)
{Resize(iNewSizeInChar, iPaddingChar, 1);}
/**
* Extends or truncates the current string.
* If <tt>iNewSizeInChar</tt> is greater than the length of the current string,
* blanks are used to fill in the created characters. Otherwise, the character
* string is truncated to its new size.
* @param iNewSizeInChar
* Number of characters to be assigned to the current string.
*/

Copyright DASSAULT SYSTEMES 2000

1-170

Menu

VPM Programming

inline void Resize(int


iNewSizeInChar)
{Resize(iNewSizeInChar, , 1);}
// Instance size (in char) is set to iNewSizeInChar, with possible
// truncation if iAllowToTruncate != 0. If the new length exceeds previous
// one, iPaddingChar is repeated to pad extra space.

// Substring replacement
/**
* Replaces a character substring by another one.
* @param iStringToReplace
* Character string to be replaced in the current character string.
* @param iReplacingString
* Replacing character substring.
* @return
* The position of the first character of <tt>iStringToReplace</tt> in the
* current characer string if the replacement succeeds, and -1 otherwise.
*/
int ReplaceSubString(const CATUnicodeString &iStringToReplace,
const CATUnicodeString &iReplacingString);
/**
* Replaces several subsequent characters by a character string.
* @param iFirstCharToReplace
* Position of the first character to be replaced in the character string.
* @param iNbCharsToReplace
* Number of characters to be replaced.
* @param iStringToInsert
* Character string to be inserted in place of the <tt>iNbCharsToReplace</tt>
* characters.
*/
void ReplaceSubString(int
iFirstCharToReplace,
int
iNbCharsToReplace,
const CATUnicodeString &iStringToInsert);
/**
* Replaces several subsequent characters by the first nth characters of
* a given character string.
* @param iFirstCharToReplace
* Position of the first character to be replaced in the character string.
* @param iNbCharsToReplace
* Number of characters to be replaced.
* @param iStringToInsert
* Character string to be inserted in place of the <tt>iNbCharsToReplace</tt>
* characters.
*/
void ReplaceSubString(int
iFirstCharToReplace,
int
iNbCharsToReplace,
const CATUnicodeString &iStringToInsert,

Copyright DASSAULT SYSTEMES 2000

1-171

Menu

VPM Programming

int
iNbCharToTake) ;
// CATUnicodeString testString(Coca Cola);
// testString.Replace(6, 4, Coca);
// testString == Coca Coca
// testString.Replace(6, 4, Colargol, 4); // testString == Coca Cola
// testString.Replace(Coca, Pepsi); // testString == Pepsi Cola
// Removing iNbCarsToRemove characters after iStartPos index
/**
* Removes several subsequent characters.
* @param iFirstCharToRemove
* Position of the first character to be removed.
* @param iNbCharsToRemove
* Number of characters to be removed.
*/
void Remove(int iFirstCharToRemove, int iNbCharsToRemove=1) ;
// Inserting iStringToInsert after iStartPos index
/**
* Inserts a character string.
* @param iFirstCharToInsert
* Position of the first character to be inserted.
* @param iStringToInsert
* Character string to be inserted.
*/
void Insert(int iFirstCharToInsert, const CATUnicodeString &iStringToInsert) ;
//----------------// String stripping
//----------------// Where to look for chars to strip
/**
* Character string stripping mode.
* @param CATStripModeLeading
* Requests leading characters only to be stripped.
* @param CATStripModeTrailing
* Requests trailing characters only to be stripped.
* @param CATStripModeBoth
* Requests both leading and trailing characters to be stripped.
* @param CATStripModeAll
* Requests all characters found to be stripped.
*/
enum CATStripMode {CATStripModeLeading = 0x1, // head of string
CATStripModeTrailing = 0x2, // tail of string
CATStripModeBoth = 0x3, // head & tail
CATStripModeAll =
0x4};// Everywhere within string

Copyright DASSAULT SYSTEMES 2000

1-172

Menu

VPM Programming

// Strip a given char (ie deleting it repeatedly)


/**
* Strips, ie deletes, a given character wherever it is found, according to
* the indicated stripping mode.
* @param iStripMode
* Stripping mode.
* @param iCharToStrip
* The character to be stripped.
*/
CATUnicodeString Strip(CATUnicodeString::CATStripMode iStripMode,
const CATUnicodeChar& iCharToStrip) const;
// Strips blanks
/**
* Strips blanks according to the indicated stripping mode.
* @param iStripMode
* Stripping mode.
*/
inline CATUnicodeString Strip(CATUnicodeString::CATStripMode iStripMode) const
{ return Strip(iStripMode, );}
// Strips blanks in leading mode
/**
* Strips leading blanks.
*/
inline CATUnicodeString Strip() const
{ return Strip(CATStripModeLeading, );}

//---------------// String analysis


//---------------// Measurement
/**
* Returns the character string length, expressed as a number of characters.
* Use this method rather than <a href=GetLengthInByte()>GetLengthInByte()</a>
* since a character string length expressed in bytes is meaningless for
* a number of languages, such as Japanese, Korean or Chinese.
*/
int GetLengthInChar() const;
/**
* Returns the character string length, expressed as a number of bytes.
* Use this method with case. It is often preferable to use
* <a href=GetLengthInChar()>GetLengthInChar()</a>
* since a character string length expressed in bytes is meaningless for
* a number of languages, such as Japanese, Korean or Chinese.
*/

Copyright DASSAULT SYSTEMES 2000

1-173

Menu

VPM Programming

int GetLengthInByte() const;


// Substring Search
/**
* Searches for a character string occurrence.
* @param iStringToFind
* Character string to search for.
* @param iStartPos
* Character position to begin the search.
* @param iSearchMode
* Character search mode.
* In the forward search mode, iStartPos is a position from which
* forward searching begins.
* In the backward search mode, iStartPos is a position from which
* backward searching begins.
*
*/
enum CATSearchMode {CATSearchModeForward = 0x1, // search forward.
CATSearchModeBackward = 0x2}; // search backward.
int SearchSubString(const CATUnicodeString
&iStringToSearchFor ,
int
iStartPos = 0 ,
CATUnicodeString::CATSearchMode iSearchMode = CATSearchModeForward) const ;
//---------------------// Hash Table management
//---------------------/**
* Computes and returns a hash key.
* The hash key can be used as an entry for hash tables, such as those
* in the Collections framework.
*/
unsigned ComputeHashKey() const; // The returned value can be used as an entry
// in hash tables provided by Collections
// framework
//
//
CATUnicodeString & operator += ( const CATUnicodeString & iStringToAppend );
CATUnicodeString & operator += ( const CATUnicodeChar & iCharToAppend );
CATUnicodeString operator + (const CATUnicodeString &iStringToAppend) const ;
CATUnicodeString operator + (const char *iPtrOnCharToAppend) const ;
ExportedByNS0S3STR friend CATUnicodeString operator + (const char* cs, const
CATUnicodeString& s);
operator const char * () const ;

Copyright DASSAULT SYSTEMES 2000

1-174

Menu

VPM Programming

const char * CastToCharPtr() const;


int IsNull() const;
int FindPosition(const CATUnicodeString &iStringToFind, int iStartPos = 0) const ;
int ConvertNumToString( int iValeur, char *iFormat=%d );
int ConvertNumToString( long iValeur, char *iFormat=%ld );
int ConvertNumToString( unsigned long iValeur, char *iFormat=%uld );
int ConvertNumToString( double iValue, char *iFormat=%g );
int ConvertNumToString( long double iValue, char *iFormat=%Lg );
int operator == ( const char *iPtrOnCharToCompare ) const ;
int operator != ( const char *iPtrOnCharToCompare ) const ;
//
//
private:
CATInterUnicodeString * _StringRef ;
};
#endif

Copyright DASSAULT SYSTEMES 2000

1-175

Menu

VPM Programming

Copyright DASSAULT SYSTEMES 2000

1-176

Menu

VPM Programming

Appendix 7 - APIs and VPM version


CATDMUsrMethod.h
ExecuteUsrMethod

VPM 1.0 R1

OpenPSNWithUsrMethod

VPM 1.0 R1

GetConfNameHistory

VPM 1.0 R1

IsAValidFlagForCommit

VPM 1.0 R1

ActionFlowCheck

VPM 1.0 R1

SuccessfullyCommitInGraph

VPM 1.0 R1

SuccessfullyRollBackInGraph

VPM 1.0 R1

DefaultModValidation

VPM 1.2 GA

AuthorizedModValidation

VPM 1.0 R1

AuthorizedModPromote

VPM 1.0 R1

AuthorizedModDemote

VPM 1.0 R1

AuthorizedModDelete

VPM 1.0 R1

ModCreateOwner

VPM 1.0 R1

AuthorizedCut

VPM 1.0 R1

AuthorizedMove

VPM 1.0 R1

AuthorizedPaste

VPM 1.0 R1

AuthorizedCheckIn

VPM 1.0 R1

AuthorizedCheckOut

VPM 1.0 R1

AuthorizedDelete

VPM 1.0 R1

AuthorizedCreate

VPM 1.0 R1

AuthorizedUpdate

VPM 1.0 R1

AuthorizedReplace

VPM 1.3 GA

AuthorizedCATIASave

VPM 1.0 R1

AuthorizedPromotion

VPM 1.0 R1

AuthorizedReassign

VPM 1.0 R1

Copyright DASSAULT SYSTEMES 2000

1-177

Menu

VPM Programming

GetInputListOfValues

VPM 1.0 R1

ComputeValuesBeforeWrite

VPM 1.0 R1

CheckLFBeforeWrite

VPM 1.2 GA

GetNewVersionListOfValues

VPM 1.0 R1 PTF 4

GetNewVersionListOfValues

VPM 1.2 PTF 1 (New signature)

GetNewRevisionListOfValues

VPM 1.0 R1 PTF 4

GetNewRevisionListOfValues

VPM 1.2 PTF 1 (New signature)

IsAValidNewVersion

VPM 1.0 R1 PTF 4

IsAValidNewRevision

VPM 1.0 R1 PTF 4

IsAValidDuplicatedRevision

VPM 1.2 GA

IsAValidRevisionVersion

VPM 1.0 R1

AuthorizedNewVersion

VPM 1.0 R1

AuthorizedNewRevision

VPM 1.0 R1

BeforeCreateUserAction

VPM 1.0 R1

AfterWriteUserAction

VPM 1.0 R1

AfterCommitUserAction

VPM 1.0 R1

AfterRollbackUserAction

VPM 1.0 R1

GetBGColorForPrint

VPM 1.0 R1

FormatConfigHandlerId

VPM 1.0 R1

OptionListToDisplay

VPM 1.2 GA

AuthorizedEffModification

VPM 1.3

ConfigHandlerControl

VPM 1.3 PTF 1

Copyright DASSAULT SYSTEMES 2000

1-178

Menu

VPM Programming

CATVpmAFUsrMethod.h
ExecuteUsrCommand

VPM 1.0 R1

GetNewUsrPersonId

VPM 1.0 R1

GetUsrMessageText

VPM 1.0 R1

CheckUsrCondition

VPM 1.0 R1

CheckUsrLibraryAccess

VPM 1.0 R1

GetUsrSecondaryId

VPM 1.0 R1

ModifySecondaryId

VPM 1.2 GA

Copyright DASSAULT SYSTEMES 2000

1-179

Menu

VPM Programming

CATVpmPEUsrMethod.h
LoginVpmSession

VPM 1.0 R1

EndVpmSession

VPM 1.0 R1

ChangePasswordEnabled

VPM 1.0 R1

ChangePassword

VPM 1.0 R1

ValidateUserId

VPM 1.0 R1

ValidatePassword

VPM 1.0 R1

Copyright DASSAULT SYSTEMES 2000

1-180

Menu

VPM Programming

CATVpmSCUsrManager.h
GetLoginUserId

VPM 1.2 PTF 3

GetLoginRoleName

VPM 1.2 PTF 3

GetLoginRoleOrganizationId

VPM 1.2 PTF 3

CheckAccess

VPM 1.2 PTF 3

CheckDataAccess

VPM 1.2 PTF 3

Copyright DASSAULT SYSTEMES 2000

1-181

Menu

VPM Programming

CATCfgInterfaces.h
GetDbID

VPM 1.0 R1 PTF 6

GetCfgHandler

VPM 1.0 R1 PTF 6

GetCfgHandler

VPM 1.0 R1 PTF 6

Expand

VPM 1.0 R1 PTF 6

ExpandSTEP

VPM 1.0 R1 PTF 6

ExpandWithCSB

VPM 1.0 R1 PTF 6

ExpandSTEPWithCSB

VPM 1.0 R1 PTF 6

SetConfigurable

VPM 1.0 R1 PTF 6

UnsetConfigurable

VPM 1.2 PTF 3

CreateModifEffectivity

VPM 1.0 R1 PTF 6

CreateCurDateEffectivity

VPM 1.0 R1 PTF 6

CreateDateEffectivity

VPM 1.0 R1 PTF 6

CreateDateEffectivity

VPM 1.0 R1 PTF 6

CreateRangeEffectivity

VPM 1.0 R1 PTF 6

CreateOptEffectivity

VPM 1.0 R1 PTF 6

CreateOptEffectivity

VPM 1.2 GA (new signature: multi option effectivity)

CreateOptDateEffectivity

VPM 1.0 R1 PTF 6

CreateOptDateEffectivity

VPM 1.0 R1 PTF 6

CreateOptDateEffectivity

VPM 1.0 R1 PTF 6

CreateOptDateEffectivity

VPM 1.0 R1 PTF 6

CreateOptRangeEffectivity

VPM 1.0 R1 PTF 6

CreateOptRangeEffectivity

VPM 1.0 R1 PTF 6

DeleteOptEffectivity

VPM 1.2 PTF 1

DeleteOptDateEffectivity

VPM 1.3 GA

DeleteOptDateEffectivity

VPM 1.3 GA

DeleteOptRangeEffectivity

VPM 1.3 GA

Copyright DASSAULT SYSTEMES 2000

1-182

Menu

VPM Programming

DeleteDateEffectivity

VPM 1.3 GA

DeleteDateEffectivity

VPM 1.3 GA

DeleteRangeEffectivity

VPM 1.3 GA

CurDateReplace

VPM 1.0 R1 PTF 6

CreateDictionary

VPM 1.2 GA

DeleteDictionary

VPM 1.2 PTF 3

AddCategoryToDictionary

VPM 1.3 GA

AddOptionToDictionary

VPM 1.2 GA

RemoveOptionFromDictionary

VPM 1.3 GA

AddRuleToDictionary

VPM 1.3 GA

AddCompatibilityMatrixToDictionary

VPM 1.3 GA

AddCompatibilityRuleToMatrix

VPM 1.3 GA

GetOptFromDictionary

VPM 1.2 PTF 2

GetOptFromDictionary

VPM 1.2 PTF 2

CreateConfigHandler

VPM 1.2 GA

CreateConfigHandler

VPM 1.2 GA

AddOptionToConfigHandler

VPM 1.2 PTF 3

RemoveOptionFromConfigHandler

VPM 1.2 PTF 3

AddChildToConfigHandler

VPM 1.2 PTF 1

RemoveChildFromConfigHandler

VPM 1.3 GA

AddBrotherToConfigHandler

VPM 1.2 PTF 1

DeleteConfigHandler

VPM 1.2 PTF 2

SetAFMode

VPM 1.2 PTF 1

GetEffectivityForLink

VPM 1.3 GA

GetEffectivityForLink

VPM 1.3 GA

DeleteEffectivity

VPM 1.3 GA

UpdateDictionaryFromAssembly

VPM 1.3 PTF 1

Copyright DASSAULT SYSTEMES 2000

1-183

Menu

VPM Programming

CATVPMFilter.h
Filter

VPM 1.2 GA

CATVPMFilterManager.h
AddFilter

VPM 1.2 GA

InsertFilter

VPM 1.2 GA

RemoveFilter

VPM 1.2 GA

RemoveFilter

VPM 1.2 GA

Copyright DASSAULT SYSTEMES 2000

1-184

Menu

VPM Programming

CATLnkAPI.h
GetImpactedBy

VPM 1.2 PTF 3

GetImpactingOn

VPM 1.2 PTF 3

GetLinksBetween

VPM 1.2 PTF 3

GetEntityCount

VPM 1.2 PTF 3

DeleteLinks

VPM 1.2 PTF 3

DeleteEntities

VPM 1.2 PTF 3

IsPointedModel

VPM 1.2 PTF 3

IsPointedPart

VPM 1.2 PTF 3

ComputeRelationEnvironments

VPM 1.2 PTF 3

Copyright DASSAULT SYSTEMES 2000

1-185

Menu

VPM Programming

CATVpmPEUsrManager.h
GetUserEmail

VPM 1.2 PTF 3

GetUserOrganizationId

VPM 1.2 PTF 3

Copyright DASSAULT SYSTEMES 2000

1-186

Menu

VPM Programming

CATVpmPubSubUsrAdmin.h
OpenConnection

VPM 1.2 PTF 3

CloseConnection

VPM 1.2 PTF 3

Commit

VPM 1.2 PTF 3

Rollback

VPM 1.2 PTF 3

GetRootEvents

VPM 1.2 PTF 3

GetEvent

VPM 1.2 PTF 3

GetEventChildren

VPM 1.2 PTF 3

CreateEvent

VPM 1.2 PTF 3

DeleteEvent

VPM 1.2 PTF 3

Copyright DASSAULT SYSTEMES 2000

1-187

Menu

VPM Programming

CATVpmPubSubUsrManager.h
Subscribe

VPM 1.2 PTF 3

UnSubscribe

VPM 1.2 PTF 3

UnSubscribe

VPM 1.2 PTF 3

IsSubscriber

VPM 1.2 PTF 3

PublishEvent

VPM 1.2 PTF 3

Copyright DASSAULT SYSTEMES 2000

1-188

Menu

VPM Programming

CATDMUsrInstance.h
CATDMUsrInstance

VPM 1.3 GA

~CATDMUsrInstance

VPM 1.3 GA

operator=

VPM 1.3 GA

operator==

VPM 1.3 GA

operator!=

VPM 1.3 GA

GetValue

VPM 1.3 GA

GetRevision

VPM 1.3 GA

GetMaturity

VPM 1.3 GA

SetMaturity

VPM 1.3 GA

Promote

VPM 1.3 GA

Demote

VPM 1.3 GA

Copyright DASSAULT SYSTEMES 2000

1-189

Menu

VPM Programming

CATVpmSCUsrLogin.h
Login

VPM 1.2 PTF 5

CATDMUsrMethodContext.h
GetTaskCaller

VPM 1.2 GA (extended with new functionalities of VPM 1.3)

CATDMUSRSelect.h
CATDMUSRUpdate.h
CATDMUSRCatia.h
CATDMUSRResultPanel.h
CATCDM.h
CATUnicodeString.h
These headers and their methods are available for every version of VPM

Copyright DASSAULT SYSTEMES 2000

1-190

Menu

You might also like