Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

portArray Class Reference

A simple array of ports, indexed from 1..length. More...

#include <port.h>

List of all members.

Public Methods

 portArray ()
 Create an empty (length 0) array. More...

 portArray (int l)
 Create an array of length l. More...

 portArray (const portArray &p)
 Copy array p. More...

 ~portArray ()
 Free memory in destructor. More...

int len ()
void set (int index, port value)
 Set an array element. More...

void zero ()
 Set all array values to zero. More...

port get (int index) const
 Get a port from the array. More...

portArray& operator= (const portArray &)
 We must overload the = operator because we use dynamic memory. More...


Private Attributes

int length
 The length of the array. More...

portdata
 The actual list of ports. More...


Detailed Description

A simple array of ports, indexed from 1..length.

class portArray takes care of dynamic memory allocation and deallocation, provides copy and assignment functions, and handles indexing errors.

A nice future improvement might be to overload the [] operator.

Definition at line 95 of file port.h.


Constructor & Destructor Documentation

portArray::portArray ( )
 

Create an empty (length 0) array.

Definition at line 58 of file port.cc.

portArray::portArray ( int l )
 

Create an array of length l.

Definition at line 64 of file port.cc.

portArray::portArray ( const portArray & a )
 

Copy array p.

Definition at line 70 of file port.cc.

portArray::~portArray ( )
 

Free memory in destructor.

Definition at line 78 of file port.cc.


Member Function Documentation

port portArray::get ( int index ) const
 

Get a port from the array.

Parameters:
index   the index of the element to be returned
Returns:
the port

Definition at line 102 of file port.cc.

Referenced by circuit::build_tree(), and connection::get_port().

int portArray::len ( )
 

Returns:
array length

Definition at line 83 of file port.cc.

Referenced by portStack::push().

portArray & portArray::operator= ( const portArray & a )
 

We must overload the = operator because we use dynamic memory.

Definition at line 113 of file port.cc.

void portArray::set ( int index,
port value )
 

Set an array element.

Parameters:
index   the index of the element to be set
value   the new value

Definition at line 88 of file port.cc.

Referenced by circuit::connect(), connection::connection(), and zero().

void portArray::zero ( )
 

Set all array values to zero.

Definition at line 96 of file port.cc.


Member Data Documentation

port * portArray::data [private]
 

The actual list of ports.

Definition at line 102 of file port.h.

int portArray::length [private]
 

The length of the array.

Definition at line 99 of file port.h.


The documentation for this class was generated from the following files:

Please direct comments and corrections to supermix@submm.caltech.edu
Go to the supermix home page
Generated by doxygen1.2.7