Software Factory 
(Component Description Language) 
User’s Guide 
 
 
 
CDL 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Version 6.5.3 / April 2012 
 
 
 
 
 
 
 
1 
 
Copyright © 2012, by OPEN CASCADE S.A.S. 
 
PROPRIETARY RIGHTS NOTICE: All rights reserved. Verbatim copying and distribution of this 
entire document are permitted worldwide, without royalty, in any medium, provided the copyright 
notice and this permission notice are preserved. 
 
The information in this document is subject to change without notice and should not be construed 
as a commitment by OPEN CASCADE S.A.S.  
 
OPEN  CASCADE  S.A.S.  assures  no  responsibility  for  any  errors  that  may  appear  in  this 
document. 
 
The software described in this document is furnished under a license and may be used or copied 
only in accordance with the terms of such a license. 
 
CAS.CADE, Open CASCADE and Open CASCADE Technology are registered trademarks of 
OPEN CASCADE S.A.S. Other brand or product names are trademarks or registered trademarks 
of their respective holders. 
 
 
NOTICE FOR USERS: 
This  User  Guide  is  a  general  instruction  for  Open  CASCADE  Technology  study.  It  may  be 
incomplete and even contain occasional mistakes, particularly in examples, samples, etc. 
 
OPEN CASCADE S.A.S.  bears  no  responsibility  for  such  mistakes.  If  you  find  any  mistakes  or 
imperfections in this document, or if you have suggestions for improving this document, please, 
contact  us  and  contribute  your  share  to  the  development  of  Open  CASCADE  Technology: 
bugmaster@opencascade.com 
  
 
 
 
 
 
 
 
http://www.opencascade.com/contact/ 
  
1 
 
 
TABLE OF CONTENTS 
 
2 
 
TTAABBLLEE  OOFF  CCOONNTTEENNTTSS  
TABLE OF CONTENTS ............................................................................................................................. 2 
1. CDL AND APPLICATION ARCHITECTURE .................................................................................... 4 
2. INTRODUCTION TO CDL .................................................................................................................... 6 
2.1 PURPOSES OF THE LANGUAGE ............................................................................................................... 6 
2. 2 OVERVIEW OF CDL .............................................................................................................................. 7 
2. 2. 1 Classes ......................................................................................................................................... 7 
2. 2. 2 Categories of Types ..................................................................................................................... 8 
2. 2. 3 Persistence ................................................................................................................................... 9 
2. 2. 4 Packages .....................................................................................................................................10 
2. 2. 5 Inheritance ..................................................................................................................................10 
2. 2. 6 Genericity ...................................................................................................................................11 
2. 2. 7 Exceptions...................................................................................................................................11 
2. 2. 8 Completeness ..............................................................................................................................12 
2. 3 LEXICAL CONVENTIONS ......................................................................................................................12 
2. 3. 1 Syntax notation ...........................................................................................................................12 
2. 3. 2 Lexical elements .........................................................................................................................13 
2. 3. 3 Comments ...................................................................................................................................13 
2. 3. 4 Identifiers ....................................................................................................................................14 
2. 3. 5 Keywords ....................................................................................................................................14 
2. 3. 6 Constants ....................................................................................................................................14 
3. SOFTWARE COMPONENTS ...............................................................................................................16 
3. 1 PREDEFINED RESOURCES .....................................................................................................................16 
3. 1. 1 Primitive types ............................................................................................................................16 
3. 1. 2 Manipulating types by reference (by handle) .............................................................................16 
3. 1. 3 Manipulating types by value .......................................................................................................17 
3. 1. 4 Summary of properties ................................................................................................................18 
3. 2 CLASSES ..............................................................................................................................................18 
3. 2. 1 Class declaration ........................................................................................................................18 
3. 2. 2 Categories of classes ..................................................................................................................20 
3. 3 PACKAGES ...........................................................................................................................................21 
3. 3. 1 Package declaration ...................................................................................................................21 
3. 3. 2 Name space .................................................................................................................................24 
3. 3. 3 Declaration of classes ................................................................................................................25 
3. 4 OTHER DATA TYPES ............................................................................................................................26 
3. 4. 1 Enumerations ..............................................................................................................................26 
3. 4. 2 Imports ........................................................................................................................................27 
3. 4. 3 Aliases ........................................................................................................................................28 
3. 4. 4 Exceptions...................................................................................................................................28 
3. 5 SCHEMAS .............................................................................................................................................29 
3. 6 EXECUTABLES .....................................................................................................................................29 
4. DEFINING THE SOFTWARE COMPONENTS ................................................................................31 
4. 1 BEHAVIOR ...........................................................................................................................................31 
4. 1. 1 Object Constructors ....................................................................................................................31 
4. 1. 2 Instance Methods ........................................................................................................................33 
4. 1. 3 Class Methods ............................................................................................................................34 
4. 1. 4 Package Methods ........................................................................................................................35 
4. 1. 5 Sensitivity to Overloading...........................................................................................................35 
4. 2 INTERNAL REPRESENTATION ...............................................................................................................36 
 
2 
 
4. 3 EXCEPTIONS ........................................................................................................................................36 
4. 4 INHERITANCE .......................................................................................................................................37 
4. 4. 1 Overview .....................................................................................................................................37 
4. 4. 2 Redefining methods.....................................................................................................................38 
4. 4. 3 Non-redefinable methods ............................................................................................................39 
4. 4. 4 Deferred Classes and Methods ...................................................................................................39 
4. 4. 5 Declaration by Association ........................................................................................................40 
4. 4. 6 Redefinition of Fields ..................................................................................................................42 
4. 5 GENERICITY .........................................................................................................................................42 
4. 5. 1 Overview .....................................................................................................................................42 
4. 5. 2 Declaration of a Generic Class ..................................................................................................43 
4. 5. 3 Instantiation of a Generic Class .................................................................................................45 
4. 5. 4 Nested Generic Classes ..............................................................................................................45 
4. 6 VISIBILITY ...........................................................................................................................................47 
4. 6. 1 Overview .....................................................................................................................................47 
4. 6. 2 Visibility of Fields .......................................................................................................................47 
4. 6. 3 Visibility of Methods ...................................................................................................................48 
4. 6. 4 Visibility of Classes, Exceptions, & Enumerations .....................................................................49 
4. 6. 5 Friend Classes & Methods .........................................................................................................49 
APPENDIX A. SYNTAX SUMMARY ......................................................................................................51 
APPENDIX B. ..............................................................................................................................................56 
5. 1 COMPARISON OF CDL & C++ SYNTAX FOR DATA TYPES MANIPULATED BY HANDLE AND BY VALUE
 ...................................................................................................................................................................56 
  
 
 
 
 
 
 
 
3 
3 
 
 
1. CDL and Application Architecture 
 
4 
 
11..  CCDDLL  aanndd  AApppplliiccaattiioonn  
AArrcchhiitteeccttuurree  
 
 
 
 
CDL  is  the  component  definition  language  of  the  Open  CASCADE  programming 
platform. Some components, which CDL allows you to create, are specific to Open 
CASCADE  application  architecture.  These  and  other  components,  which  you  can 
define using CDL include the following: 
 
•  Class (including enumeration, exception) 
•  Package 
•  Schema 
•  Executable 
•  Client. 
 
A  class  is  the  fundamental  software  component  in  object-oriented  development. 
Because of a very large number of resources used in large-scale applications, the 
class itself is too small to be used as a basic management unit. 
 
So, while the class is the basic data component defined in CDL, this language also 
provides  a  way  to  group  classes,  enumerations,  and  exceptions  together  –  the 
package.  A  package  groups  together  a  number  of  classes,  which  have  semantic 
links.  For  example,  a  geometry  package  would  contain  Point,  Line,  and  Circle 
classes.  A  package  can  also  contain  enumerations,  exceptions,  and  package 
methods.  In  practice,  a  class  name  is  prefixed  with  the  name  of  its  package  e.g. 
Geom_Circle. 
 
Using  the  services  described  in  the  packages,  you  can  construct  an  executable. 
You can also group together services provided by packages.  
 
To save data in a file, you need to define persistent classes. Then, you group these 
classes in a schema, which provides the necessary read/write tools. 
 
 
4 
 
 
 
1. CDL and Application Architecture 
 
5 
 
Figure 1. Building an Open CASCADE application 
 
5 
 
 
2. Introduction to CDL 
 
6 
 
22..  IInnttrroodduuccttiioonn  ttoo  CCDDLL  
 
 
 
 
 
2.1 Purposes of the Language 
 
You can use CDL to define data in the Open CASCADE environment. CDL allows 
you to define various kinds of data types supporting the application architecture and 
development  methodology,  which  you  envision.  CDL  is  neither  an  analysis 
formalism (e.g. Booch methodology) nor a data manipulation language (e.g. C++). 
 
You  use  CDL  in  the  design  phase  of  a  development  process  to  define  a  set  of 
software  components  which  best  model  the  concepts  stated  in  the  application 
specification. 
 
 
 
 
Figure 2. The Development Process 
 
 
 
From a structural point of view, CDL is an object-oriented language. It is centered on 
the notion of the class - a data type, which represents an elementary concept. CDL 
offers various means of organizing classes, mostly under the fundamental form of 
packages.  A  package  contains  a  set  of  classes,  which  share  some  semantic 
relationship.  This  greatly  simplifies  your  task  of managing  individual  classes  when 
confronted with a very large number of them. 
 
 
6 
 
 
2. Introduction to CDL 
 
7 
 
Once you have defined the classes and packages using CDL, you can implement 
their methods - i.e., their functionality - in one of the data manipulation languages 
supported by the Open CASCADE environment (currently C++). 
 
Even though you can describe classes directly in C++ and save them as header files 
(.hxx), to do so would forfeit all the advantages of using CDL. These are: 
 
•  Precise,  complete,  and  easy-to-read  description  of 
the  software 
components. 
•  Creation of a link with the database; object persistence forms part of the 
predefined environment of the language. 
•  Multi-language  access  to  the  services  of  an  application  engine  –  a 
specific architectural form created using the CDL tools, which serves as 
the motor of an application. 
 
 
2. 2 Overview of CDL 
 
CDL is an object-oriented language. In other words, it structures a system around 
data  types  rather  than  around  the  actions  carried  out  on  them.  In  this  context,  an 
object is an instance of a data type, and its definition determines how you can use 
it. Each data type is implemented by one or more classes, which make up the basic 
elements of the system. 
 
2. 2. 1 Classes 
 
A  class  is  an  implementation  of  a  data  type.  It  defines  its  behavior  and  its 
representation. 
 
The  behavior  of  a  class  is  its  programming  interface  -  the  services  offered  by  its 
methods. The representation of a class is its data structure - the fields, which store 
its data. 
 
Every object is an instance of its class. For example, the object p of the data type 
Point is an instance of the class Point. 
 
The class Point could be defined as in the example below: 
 
 
 
Example 
 
class Point from GeomPack 
---Purpose: represents a point in 3D space. 
is 
Create returns Point; 
fields 
x, y, z : Real; 
end Point;  
 
 
7