Geddei::LxConnection Class Reference
[Geddei's core classes.]

Refinement of Connection from a local Source. More...

#include <lxconnection.h>

List of all members.

Public Member Functions

virtual BufferData makeScratchSample (bool autoPush=false)
virtual BufferData makeScratchSamples (const uint samples, bool autoPush=false)
virtual BufferData makeScratchSecond (bool autoPush=false)
virtual BufferData makeScratchSeconds (const float seconds, bool autoPush=false)
const uint maximumScratchSamples (const uint minimum=1)
const uint maximumScratchSamplesEver ()
BufferData operator+ (const uint samples)
LxConnectionoperator<< (const BufferData &data)
virtual void push (const BufferData &data)=0
virtual const SignalTypeRef type ()
 ~LxConnection ()

Protected Member Functions

 LxConnection (Source *source, const uint sourceIndex)
virtual BufferData makeScratchElements (const uint elements, bool autoPush=false)
virtual const uint maximumScratchElements (const uint minimum=1)=0
virtual const uint maximumScratchElementsEver ()=0

Protected Attributes

Source * theSource
uint theSourceIndex

Friends

class DomProcessor
class Processor
class Splitter


Detailed Description

Refinement of Connection from a local Source.

Author:
Gav Wood <gav@cs.york.ac.uk>
This class functions essentially as an abstract interface that contains some utility methods. It is the base class for connection classes that are used by the source side of the connection.

With proper use of Processor class's Processor::specifyOutputSpace() method you should only ever need to use two methods; makeScratchSamples() and push(). maximumScratchSamples() may also be useful for those concerned with efficiency.

Other methods are included for completeness to allow currently barely imagined uses.


Constructor & Destructor Documentation

Geddei::LxConnection::LxConnection ( Source *  source,
const uint  sourceIndex 
) [protected]

Simple constructor.

Geddei::LxConnection::~LxConnection (  ) 

Simple destructor.


Member Function Documentation

BufferData Geddei::LxConnection::makeScratchElements ( const uint  elements,
bool  autoPush = false 
) [protected, virtual]

Deprecated:
TODO: Kill this method Create a new scratch pad with which data may be sent efficiently.
Use push() to send the data, or set autoPush to true for it to happen automatically.

This method may block if no resource is available.

For internal note: This implementation makes an (inefficient) unassociated scratch object. Reimplement to provide a mroe efficient solution.

Parameters:
elements The size of the data chunk required in elements.
autoPush If true, then on destruction of the returned BufferData object, it will get pushed automatically. This would happen, for instance, when it goes out of semantic scope.
Returns:
The BufferData object into which data can be written.

virtual BufferData Geddei::LxConnection::makeScratchSample ( bool  autoPush = false  )  [inline, virtual]

Create a new scratch pad with which data may be sent efficiently. The scratch pad is one sample long.

Use push() to send the data, or set autoPush to true for it to happen automatically.

This method may block if no resource is available.

Parameters:
autoPush If true, then on destruction of the returned BufferData object, it will get pushed automatically. This would happen, for instance, when it goes out of semantic scope.
Returns:
The BufferData object into which data can be written.

BufferData Geddei::LxConnection::makeScratchSamples ( const uint  samples,
bool  autoPush = false 
) [virtual]

Create a new scratch pad with which data may be sent efficiently.

Use push() to send the data, or set autoPush to true for it to happen automatically.

This method may block if no resource is available.

Parameters:
samples The size of the data chunk required in samples.
autoPush If true, then on destruction of the returned BufferData object, it will get pushed automatically. This would happen, for instance, when it goes out of semantic scope.
Returns:
The BufferData object into which data can be written.

virtual BufferData Geddei::LxConnection::makeScratchSecond ( bool  autoPush = false  )  [inline, virtual]

Create a new scratch pad with which data may be sent efficiently. The scratch is exactly one second long.

Use push() to send the data, or set autoPush to true for it to happen automatically.

This method may block if no resource is available.

Parameters:
seconds The size of the data chunk required in seconds.
autoPush If true, then on destruction of the returned BufferData object, it will get pushed automatically. This would happen, for instance, when it goes out of semantic scope.
Returns:
The BufferData object into which data can be written.

BufferData Geddei::LxConnection::makeScratchSeconds ( const float  seconds,
bool  autoPush = false 
) [virtual]

Create a new scratch pad with which data may be sent efficiently.

Use push() to send the data, or set autoPush to true for it to happen automatically.

This method may block if no resource is available.

Parameters:
seconds The size of the data chunk required in seconds.
autoPush If true, then on destruction of the returned BufferData object, it will get pushed automatically. This would happen, for instance, when it goes out of semantic scope.
Returns:
The BufferData object into which data can be written.

virtual const uint Geddei::LxConnection::maximumScratchElements ( const uint  minimum = 1  )  [protected, pure virtual]

Get the maximum amount of scratch elements we can make that won't cause a deadlock if we try to create a scratch of that size. If no elements are free, will block until elements are free, rather than return zero.

Parameters:
minimum The minimum number of elements it should return. This must be less than or equal to maximumScratchElementsEver().
Returns:
Undefined (= (uint)-1) in the case of unlimited.

virtual const uint Geddei::LxConnection::maximumScratchElementsEver (  )  [protected, pure virtual]

Returns the maximum amount of scratch elements we could ever make that won't (definately) cause a deadlock.

Typically this value should be divided by two to be sure that the scratch size asked for will definately be possible.

Returns:
Undefined (= (uint)-1) in the case of unlimited.

const uint Geddei::LxConnection::maximumScratchSamples ( const uint  minimum = 1  )  [inline]

Get the maximum amount of scratch samples we can make that won't cause a deadlock if we try to create a scratch of that size. If no samples are free, will block until samples are free, rather than return zero.

Parameters:
minimum The minimum number of samples it should return. This must be less than or equal to maximumScratchSamplesEver().
Returns:
Undefined (= (uint)-1) in the case of unlimited.

const uint Geddei::LxConnection::maximumScratchSamplesEver (  )  [inline]

Returns the maximum amount of scratch samples we could ever make that won't (definately) cause a deadlock.

Typically this value should be divided by two to be sure that the scratch size asked for will definately be possible.

Returns:
Undefined (= (uint)-1) in the case of unlimited.

BufferData Geddei::LxConnection::operator+ ( const uint  samples  )  [inline]

Some syntactic sugar, if you're into that sort of thing. Equivalent to the makeScratchSamples() method.

That is, the following two statements are sematically identical:

 BufferData d = connection.makeScratchSamples(5, false);
 BufferData d = connection + 5;

Parameters:
samples The size of the data chunk required in samples.
Returns:
The BufferData object into which data can be written.

LxConnection& Geddei::LxConnection::operator<< ( const BufferData data  )  [inline]

Some syntactic sugar, if you're into that sort of thing. Equivalent to the push() method.

That is, the following two statements are sematically identical:

 connection.push(d);
 connection << d;

Parameters:
data The data to be transferred down this connection.
Returns:
A reference to this object.

virtual void Geddei::LxConnection::push ( const BufferData data  )  [pure virtual]

Transfers data down the connection to its sink.

If data is a native scratch, it becomes invalid, and any automatic cleanups it has will be removed.

This method will block until the data is sent (though not neccessarily received).

Parameters:
data The data to be transferred down this connection.

virtual const SignalTypeRef Geddei::LxConnection::type (  )  [inline, virtual]

Retrieves the type of signal this connection transfers.

Returns:
A SignalTypeRef of this conection's SignalType.


The documentation for this class was generated from the following files:
Generated on Fri Nov 10 21:58:33 2006 for Exscalibar by  doxygen 1.5.1