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

TSE3::EventTrack< etype > Class Template Reference

A simple track containing Event objects. More...

#include <EventTrack.h>

Inheritance diagram for TSE3::EventTrack< etype >:

Inheritance graph
[legend]
Collaboration diagram for TSE3::EventTrack< etype >:

Collaboration graph
[legend]
List of all members.

Public Types

typedef Event< etype > event_type

Public Member Functions

 EventTrack (bool allowDuplicates=false)
 ~EventTrack ()
size_t size () const
event_type const & operator[] (const size_t n) const
int index (const Clock c, bool roundup=true)
size_t insert (const event_type &event)
void erase (const event_type &event)
void erase (size_t index)

Protected Attributes

std::vector< event_typedata

Detailed Description

template<class etype>
class TSE3::EventTrack< etype >

A simple track containing Event objects.

The EventTrack provides a simple track containing a given type of events.

It is used with instantiations of the Event generic class.

The EventTrack is used as a base class for other types of TSE3 track, for example the TimeSigTrack and TempoTrack.

The contained Event objects are held by value.

The EventTrack has two modes of operating, specified as a boolean parameter in the constructor. The normal operation (as used by most subclasses) is to prevent the insertion of two events with the same time. For example, you don't want to have two different time signatures at the same time. The second mode of operation allows this time duplication.

Author:
Pete Goodliffe
Version:
3.00
See also:
Event

EventTrackListener


Member Typedef Documentation

template<class etype>
typedef Event<etype> TSE3::EventTrack< etype >::event_type
 


Constructor & Destructor Documentation

template<class etype>
TSE3::EventTrack< etype >::EventTrack bool  allowDuplicates = false  )  [inline]
 

Creates an EventTrack.

The parameter specifies whether or not duplicate time values are allowed in the EventTrack. When false, you may not insert two events with the same time.

Parameters:
allowDuplicates Whether to allow duplicate time values

template<class etype>
TSE3::EventTrack< etype >::~EventTrack  )  [inline]
 


Member Function Documentation

template<class etype>
size_t TSE3::EventTrack< etype >::size  )  const [inline]
 

Returns the number of events in this track.

Returns:
The number of events in this track

template<class etype>
event_type const& TSE3::EventTrack< etype >::operator[] const size_t  n  )  const [inline]
 

Returns the nth event in the track.

The value returned for an index that is out of range is undefined. The size method describes the valid values.

Parameters:
n Index
Returns:
Event at index n

template<class etype>
int TSE3::EventTrack< etype >::index const Clock  c,
bool  roundup = true
 

Returns the index of the event at a given Clock.

Parameters:
c Clock value to search for.
roundup If true index returns the event at or after the specified Clock. If false, returns the event at of before the specified Clock.
Returns:
Index of event. If past the end of the data then returns 'size'.

template<class etype>
size_t TSE3::EventTrack< etype >::insert const event_type event  ) 
 

Inserts an Event into the EventTrack, and returns the index of the insertion point.

If duplicate times are not allowed (see EventTrack::EventTrack) then the new Event will replace the existing Event at this time.

If duplicate times are allowed then the new Event is inserted after any other events with the same time.

Parameters:
event The event to insert
Returns:
Index of new event
See also:
erase

template<class etype>
void TSE3::EventTrack< etype >::erase const event_type event  ) 
 

Erase an event.

If the event is not in this track then no error is raised.

Parameters:
event The event to erase
See also:
insert

template<class etype>
void TSE3::EventTrack< etype >::erase size_t  index  ) 
 

Erase an event.

If the index is invalid then no error is raised.

Parameters:
index Index of the event to erase
See also:
insert


Member Data Documentation

template<class etype>
std::vector<event_type> TSE3::EventTrack< etype >::data [protected]
 


The documentation for this class was generated from the following file:
Generated on Wed May 25 14:46:10 2005 for TSE3 by doxygen 1.3.2