http://iet.metastore.ingenta.com
1887

Composition and a Simple Container Class

Composition and a Simple Container Class

For access to this article, please select a purchase option:

Buy chapter PDF
£10.00
(plus tax if applicable)
Buy Knowledge Pack
10 chapters for £75.00
(plus taxes if applicable)

IET members benefit from discounts to all IET publications and free access to E&T Magazine. If you are an IET member, log in to your account and the discounts will automatically be applied.

Learn more about IET membership 

Recommend Title Publication to library

You must fill out fields marked with: *

Librarian details
Name:*
Email:*
Your details
Name:*
Email:*
Department:*
Why are you recommending this title?
Select reason:
 
 
 
 
 
A Guide to MATLAB® Object-Oriented Programming — Recommend this title to your library

Thank you

Your recommendation has been sent to your librarian.

As a further demonstration of composition, there is an initial foray into designing and implementing a general container class. A general container is different from an array because it can hold different types. A general container is different from a cell array because all objects must descend from the same parent. For example, a general cShape container can hold both cStar and cDiamond objects because they both use cShape as a parent. A container is also different from a cell array because a container has a structure-like interface. The interface makes a container behave a lot like an object array. Rather than looping over each element in the container, clients can use vector syntax. Often the loop still exists; however, it is now hidden behind the container's interface. Developing a set of standard containers compatible with the general computer-engineering literature or with National Institute of Standards (NISI) definitions would be an enormous undertaking. The primary goal of the paper is to demonstrate one potential use of composition. A secondary goal is to produce a container that might be useful as is, or at least produce a container that can be easily improved.

Chapter Contents:

  • 19.1 Building Containers
  • 19.2 Container Implementation
  • 19.2.1 The Standard Framework and the Group of Eight
  • 19.2.1.1 Container Modifications to fieldnames
  • 19.2.1.2 Container Modifications to subsref
  • 19.2.1.3 Container Modifications to subsasgn
  • 19.2.1.4 Container Modifications to get
  • 19.2.1.5 Container Modifications to set
  • 19.2.2 Tailoring Built-in Behavior
  • 19.2.2.1 Container-Tailored end
  • 19.2.2.2 Container-Tailored cat, horzcat, vertcat
  • 19.2.2.3 Container-Tailored length, ndims, reshape, and size
  • 19.2.3 cShapeArray and numel
  • 19.2.3.1 Container-Tailored num2cell and mat2cell
  • 19.2.4 Container Functions That Are Specific to cShape Objects
  • 19.2.4.1 cShapeArray times and mtimes
  • 19.2.4.2 cShapeArray draw
  • 19.2.4.3 cShapeArray reset
  • 19.3 Test Drive
  • 19.4 Summary
  • 19.5 Independent Investigations

Inspec keywords: object-oriented programming

Other keywords: NISI definition; Matlab; cStar container; container composition; vector syntax; object array; cDiamond container; cShape container; container class; cell array; National Institute of Standards

Subjects: Object-oriented programming

Preview this chapter:
Zoom in
Zoomout

Composition and a Simple Container Class, Page 1 of 2

| /docserver/preview/fulltext/books/pc/sbpc001e/SBPC001E_ch19-1.gif /docserver/preview/fulltext/books/pc/sbpc001e/SBPC001E_ch19-2.gif

Related content

content/books/10.1049/sbpc001e_ch19
pub_keyword,iet_inspecKeyword,pub_concept
6
6
Loading
This is a required field
Please enter a valid email address