Introduction to Objects

Embedded IDE Link™ CC software uses objects that apply object-oriented programming techniques. Along with the object you use to connect MATLAB to your target hardware, Embedded IDE Link CC provides many objects for creating, accessing (reading from and writing to), and manipulating (changing the contents of in MATLAB) all the symbols in the symbol table for a program loaded on your signal processor.

Within the following table, each object in the Class Name column provides access to objects as described.

Class NameInherits FromDescription

bitfield

memoryobj class

Access the contents of a bitfield defined in your code

enum

numeric class

Contents of an enumerated data type stored in memory defined in your code

function

None

Contents of a function in your source code, or used in your project as a library function. Can also represent new functions you develop and add to your project.

numeric

memoryobj class

Access the contents of a numeric data type stored in memory defined in your code

pointer

numeric class

Contents of a pointer stored in a memory location on your target

renum

rnumeric class

Contents of an enumerated data type stored in a register on your target

rnumeric

registerobj class

Contents of register that contains a numeric data type

rpointer

rnumeric class

Contents of a pointer stored in a register on your target

rstring

rnumeric class

Contents of a string stored in a register on your target

string

numeric class

Contents of a string stored in a memory location on your target

structure

None

Contents of a structure stored in memory on your target

type

None

Typedefs stored in memory on your target after you add them to the type object

In the Inherits From column you see the name of another class. Classes that inherit from another class contain all the properties and methods of the Inherited From class as well as their own unique properties. Note that although object and class seem to be interchangeable, objects are instances of classes—the properties of a class are the properties of an instance of the class, an object. This guide treats the distinction fairly loosely, using object in most instances.

For example, the String object has the properties and methods of the Numeric class, and its own properties and methods.

By using the objects provided, you can modify and view any and all symbols from MATLAB.

Each of the objects has properties and methods specific to its use, although many of the objects use the same methods and properties, as you see in the next sections.

While you can use Embedded IDE Link CC software without knowing about its object-oriented design and implementation, you might find the next sections about objects useful to gain a better understanding of the objects.

Some Object-Oriented Programming Terms

As an object-oriented software package, describing how to use Embedded IDE Link CC requires discussing the objects, classes, properties, and methods you use to manipulate and access data. To ensure we use the same terms and understand them in the same way, this section provides definitions of some terms commonly used throughout the this guide.

For more information about objects and working with their properties and methods (or functions), refer to Constructing Objects.

Definitions of Object-Oriented Terms

Abstract class

A class without instances. Abstract classes expect that their concrete subclasses will add to their structure and behavior.

Aggregation

The part-of relationship between two objects. For example, a bicycle has wheels, so wheels are part of a bicycle. Note that the wheels can exist separately from the bicycle. Compare to composition.

Base class

The most general class in a class structure. Also called root classes, most applications or systems have more than one base class.

Behavior

How an object reacts to its methods. How the object state changes in response to one of its methods acting on it.

Class

A set of abstract objects that share a common structure and behavior. A class forms the prototype that defines the properties and methods common to all objects of the class. Types and classes are not quite the same, but are used interchangeably in this guide.

Class diagram

Used to show the existence of classes and their relationships. Class diagrams can represent part or all of the class structure of a system.

Composition

A relationship between objects where one part object exists only as part of the whole object. The parts live and die together. You create and destroy them as one.

Constructor

A function that creates an object and initializes its state. Constructors can also initialize the state without creating the object.

Container Class

A class whose instances are collections of other objects in the system. Also called a package.

Function

Same as method. Used in MATLAB for consistency with other functions. Functions and methods are not quite the same, but are used interchangeably.

Handle

A means to access any object that Embedded IDE Link CC creates. Not used in this guide to refer to the object. Often the handle is the name you assign when you create the object. For example, cc is the object and handle when you create a ticcs object.

Inheritance

A relationship between classes. One class shares the structure (properties) and behavior (methods) defined in one or more other classes. Subclasses inherit from one or more superclasses, typically augmenting the superclass with their own properties and methods.

Instance

Something you can operate on. Instance and object are synonyms and this guide uses them interchangeably. Instantiate is the verb form — to create an instance of a class or object.

Instantiation

To create an object — an instance of a class.

Method

An operation on an object, defined as part of the class of the object. We call this a function.

Object

Something you can operate on. Objects that are the same class share similar structure and behavior. An object is a collection of properties and methods. Some programming sources call properties "variables." In all cases, an object is an instance of a class. Classes are abstract; objects are not.

Object Diagram

Shows the existence of objects and their relationships in the logical design of a system. Object diagrams can represent part or all of the class structure of a system.

Object-based Programming

Programming style that organizes programs as cooperative collections of objects.

Each object represents an instances of a type; where the types are members of an hierarchy, united through relationships that are not inheritance relationships. Compare to object-oriented programming.

Object-oriented Programming

Programming implementation that organizes programs as cooperative collections of objects.

Each object represents an instance of some class, and the classes are members of an hierarchy of classes united through inheritance relationships. Compare to object-based programming.

Property

Part of an object — treated as a variable at times. Also called attribute, it is part of the structure that defines the state of an object.

Subclass

A class that inherits from one or more classes, called its superclasses.

Superclass

A class that other classes inherit from. The inheriting classes are called subclasses.

State

The accumulated results of the behavior of an object. At any time, the state of an object encompasses the properties of the object and the values for each of the properties.

Structure

The concrete representation of the state of an object.

Determining an Object Class

After you create an object, use whos to determine the class for your new object (although you should know the class from the input argument you provided to createobj). Being able to query the class for an object is particularly important in this case because the constructor createobj determines the class of the object created — you cannot specify the object class. Depending on the input symbol name you provide to createobj, the returned class changes. So you need to be able to determine the class. whos lets you do this.

If you use the MATLAB Workspace browser, your object appears in the list of the contents of your workspace, indicating the object type and class — just like whos.

Alternatively, using createobj or ticcs without the closing semicolon (;) at the end of the command directs MATLAB to display the properties of your new object in the MATLAB window when you create the object.

About the Relationships Between Objects

Embedded IDE Link CC uses objects exclusively to access and manipulate complex data structures and functions, among other programming constructs, in your project and code. Many of the objects inherit properties and functions, also called methods, from other objects. The class diagrams and tables presented in the next sections discuss and show the relationships between the objects that you create when you use createobj.

The Base Classes

Class NameDescription

Memoryobj

An abstract class. The numeric and bitfield classes inherit properties and methods from this class, making this a superclass. You cannot create an instance of this class. Subclasses of the memoryobj class always describe objects that reside in DSP memory on your target.

Registerobj

An abstract class. The rnumeric class inherits properties and methods from this class, making this a superclass. You cannot create an instance of this class. Subclasses of the registerobj class always describe objects that reside in DSP registers on your target.

The Subclasses

Class NameDescription

Numeric

A superclass from which the enum, pointer, and string subclasses inherit properties and methods. You can create an object of this class using createobj. Numeric inherits from the abstract class memoryobj.

Enum

A subclass of the numeric class. You can create an object of this class using createobj.

Pointer

A subclass of the numeric class. You can create an object of this class using createobj.

String

A subclass of the numeric class. You can create an object of this class using createobj.

Bitfield

A subclass of the memoryobj class. You can use createobj to make a bitfield object.

Rnumeric

A superclass from which the renum, rpointer, and rstring subclasses inherit properties and methods. You can create an object of this class using createobj. Rnumeric inherits from the abstract class registerobj.

Renum

A subclass of the registerobj class. You can create an object of this class using createobj.

Rpointer

A subclass of the registerobj class. You can create an object of this class using createobj.

Rstring

A subclass of the registerobj class. You can create an object of this class using createobj.

Other Classes

Class NameDescription

Function

A class containing information about a function in your project. createobj constructs this class directly.

Structure

A class containing information about a structure in memory on your target. createobj constructs this class directly.

Type

A class containing information about C type definitions in the source code for your project. Type objects are composition objects to ticcs objects. When you create a ticcs object, it includes a type object.

Class Diagrams for Embedded IDE Link™ CC

One of the most important features of object-oriented programming is the relationship between the classes that compose the system. Class relationships lend themselves to a graphical layout like a tree structure, where the structure of the tree shows clearly the super classes and subclasses, the base classes, and the other classes. In addition, the diagrams can show the properties and methods for each class, and where a subclass adds properties and methods to those it inherits from its superclass.

The following figures show the methods and properties of each class or object. For short descriptions about the properties for each class, refer to the tables in the following sections:

Detailed descriptions of the properties appear in the section Reference for the Properties of Embedded Objects.

Class Diagram of the Memory Class

Class Diagram of the Structure, Function, and Type Classes

Class Diagram of the Register Class

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS
 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS