Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

simth::Device Class Reference

Abstract base class of all devices used in a FreeConnectionSystem. More...

#include <basicdevice.h>

Inheritance diagram for simth::Device:

simth::CompatibleDevice List of all members.

Public Member Functions

 Device (int deviceID, DeviceSystemIntf *system, const PropertyList &pl)
virtual ~Device ()
Device information
virtual int ID () const
template<class T>
const T & getProperty (const std::string &name) const
bool hasProperty (const std::string &name) const
bool propertyIsSet (const std::string &name) const
virtual void print (std::ostream &os) const
Simulation setup and end
void connect (int fromInterfaceID, Device *toDev, int toInterfaceID)
void connectControlInterface (int interfaceNr, const std::string &globalName)
InputInterface *const acceptConnection (int interfaceID)
virtual void startOfSimulation ()
virtual void endOfSimulation ()
Running the simulation
virtual void refresh ()
void invokeProcess ()
virtual void process ()=0
virtual void acceptNewData (int interfaceID)
void resetDevice ()
void resetInterfaces ()
virtual void reset ()
Input sequence length
void setInputLength (size_t newLength, int interfaceID, bool enableUpdate=true)
void setInputLength (size_t newLength, bool enableUpdate=true)
size_t inputLength (int interfaceID) const
size_t inputLength () const
bool isInputLengthUndefined (int interfaceID) const
Output sequence length
void setOutputLength (size_t newLength, int interfaceID, bool enableUpdate=true)
void setOutputLength (size_t newLength, bool enableUpdate=true)
size_t outputLength (int interfaceID) const
size_t outputLength () const
bool isOutputLengthUndefined (int interfaceID) const
void reserveOutputLength (size_t newCapacity, int interfaceID)
void reserveOutputLength (size_t newCapacity)
size_t outputCapacity (int interfaceID) const
size_t outputCapacity () const

Protected Member Functions

Protected device information
template<class T>
void setProperty (const std::string &name, const T &value)
DeviceSystemIntfsystemPtr ()
Input interfaces and sequences
template<class T>
size_t insertInputInterface (int number=1, const typename T::value_type &default_val=typename T::value_type())
virtual InputInterfaceinputInterface (int interfaceID)
virtual const InputInterfaceinputInterface (int interfaceID) const
bool isInputInterface (int interfaceID) const
bool isInputInterfaceConnected (int interfaceID) const
bool isInputSequence (int interfaceID) const
template<class T>
T * getInputSequence (int interfaceID)
Output interfaces and sequences
template<class T>
size_t insertOutputInterface (int number=1)
virtual OutputInterfaceoutputInterface (int interfaceID)
virtual const OutputInterfaceoutputInterface (int interfaceID) const
bool isOutputInterface (int interfaceID) const
bool isOutputInterfaceConnected (int interfaceID) const
template<class T>
T * getOutputSequence (int interfaceID)
Sequence length update
virtual void updateInputLengths ()=0
virtual void updateOutputLengths ()=0
End of processing
void flushProcessedSequences ()
void flushProcessedInputSequences ()
void flushProcessedOutputSequences ()
void flushProcessedInputSequence (int interface)
void flushProcessedOutputSequence (int interface)
void releaseProcessedInputSequence (int interface)
Control interface
template<class D>
size_t insertControlInterface (D *dev, void(D::*helpFuncPtr)())
template<class T, class D>
size_t insertControlInterface (D *dev, void(D::*helpFuncPtr)(T))
template<class D>
size_t insertAndConnectControlInterface (D *dev, void(D::*helpFuncPtr)(), const std::string &globalName)
template<class T, class D>
size_t insertAndConnectControlInterface (D *dev, void(D::*helpFuncPtr)(T), const std::string &globalName)
bool isControlInterface (int interfaceID) const
virtual ControlInterfacecontrolInterface (int interfaceNr)
Signal handling
These functions send different signals to the simulation system.

void sendReadyToProcessSignal ()
void sendStopIterationSignal ()
void sendStopSimulationPrematureSignal ()
Stop watch
void startStopWatch ()
void stopStopWatch ()

Friends

class CompatibleDevice

Detailed Description

Abstract base class of all devices used in a FreeConnectionSystem.

This class is the base class for all devices (blocks) that are used in a FreeConnectionSystem.

The configuration of each Device for a concrete simulation is done through a list of simth::Propertys. These lists of Properties are created from the devicelist XML files (not from the C++ source code!) by means of the simth::DeviceManager class. See also Migration of Parameter files to the XML format

The main functionality of a Device is defined in its function process(). To get the current input data, this function needs to call the function getInputSequence<T>(interfaceID) where T is the type of the input sequence of that device an interfaceID is the number of the used interface. The sequence types are instantiations of the simth::SignalSequence template classes, e.g. simth::BitSeq or simth::ModSeq.

See also Sequence diagram of Device::Process with output and Sequence diagram of Device::Process with input .

A new or additional interface can be inserted by a constructor of a device by using the function insertInputInterface<T>() .

New blocks should inheritance this class. The pure virtual functions process(), updateInputLengths() and updateOutputLengths() have to be defined in the derived classes.


Constructor & Destructor Documentation

simth::Device::Device int  deviceID,
DeviceSystemIntf system,
const PropertyList pl
 

Constructor with identification number, pointer to the simulation environment and PropertyList of this device.

Some (old) devices need a constructor without these arguments. For that old code, the class CompatibleDevice exists. But that class is deprecated! Do not use it for new code; instead, rather try to change the existing code so that devices are directly derived from simth::Device instead through this class. In that old code, you must not forget to call the functions CompatibleDevice::setID(int ID) and CompatibleDevice::setSystemPtr(system* sPtr)! In both cases the pointer to the simulation system is used by the device to send signals to the simulation system.

virtual simth::Device::~Device  )  [virtual]
 

Virtual destructor of that device.


Member Function Documentation

template<class T>
void simth::Device::setProperty const std::string &  name,
const T &  value
[protected]
 

Set a property to the given value of type T.

This will only work if this property already exists (created by addProperty()), otherwise it will throw an error. Also, if the type in the template function does not match the type of this property.

Parameters:
name The name of the property that should be set
value The value that the property should be set to.

DeviceSystemIntf* simth::Device::systemPtr  )  [inline, protected]
 

Returns a pointer to the Simulation-Device interface.

template<class T>
size_t simth::Device::insertInputInterface int  number = 1,
const typename T::value_type &  default_val = typename T::value_type()
[inline, protected]
 

Inserts one or more new input interfaces.

The type of the input interfaces' data sequence type is determined by the template argument T. Note: This sequence type needs to have a constructor for explicit reference copies with pointer to the master sequence! This constructor is already implemented in e.g. StdSignalSequence, or llvSeq, or TimeSignalEVC, but *not* (yet) in Sequence.

The first inserted interface gets the interfaceID 0, the second the interfaceID 1 and so on. The argument number can be used to insert more interfaces with same time while calling this function just once. However, if input interfaces with different types are needed, this function has to be called several times with different template arguments.

Parameters:
number The number of interfaces that should be inserted.
default_val The default value of the sequence::value_type that should be used when creating and/or resizing the sequence. If your value_type doesn't have a default constructor, you *have* to give such a default value here.
Returns:
The resulting overall number of input interfaces of the device.

virtual InputInterface* simth::Device::inputInterface int  interfaceID  )  [protected, virtual]
 

Returns a pointer to the InputInterface specified by interfaceID. Note that the interfaceID starts by zero. If interfaceID-1 is bigger than the number of input interfaces of the device, an error is thrown.

virtual const InputInterface* simth::Device::inputInterface int  interfaceID  )  const [protected, virtual]
 

Returns a pointer to the InputInterface specified by interfaceID. Note that the interfaceID starts by zero. If interfaceID-1 is bigger than the number of input interfaces of the device, an error is thrown.

bool simth::Device::isInputInterface int  interfaceID  )  const [protected]
 

Returns true if the specified input interface exists.

bool simth::Device::isInputInterfaceConnected int  interfaceID  )  const [protected]
 

Returns true if the specified input interface exists and is connected with another interface.

bool simth::Device::isInputSequence int  interfaceID  )  const [protected]
 

Returns true if the specified input interface exists, is connected and is filled (see also inputInterface::isFilled())

template<class T>
T * simth::Device::getInputSequence int  interfaceID  )  [inline, protected]
 

Returns a pointer to the received input sequence.

Additionally, a reference counter for this sequence will be incremented, which will only be decremented when flushProcessedSequences() (or one of its more specialized versions) is called.

The sequence type of the input interface's data sequence is determined by the template argument T.

If the input buffer contains not enough data (less then the length specified by setInputLenght()) an error will be thrown. You need to check for this condition beforehand by calling isInputSequence().

template<class T>
size_t simth::Device::insertOutputInterface int  number = 1  )  [inline, protected]
 

Inserts one or more new output interfaces.

The type of the output interfaces' data sequence type is determined by the template argument T. The same restrictions apply as for insertInputInterface.

Parameters:
number The number of interfaces that should be inserted.
Returns:
The resulting overall number of output interfaces of the device.

virtual OutputInterface* simth::Device::outputInterface int  interfaceID  )  [protected, virtual]
 

Returns a pointer to the OutputInterface specified by interfaceID. Note that the interfaceID starts by zero. If interfaceID-1 is bigger than the number of output interfaces of the device, an error is thrown.

virtual const OutputInterface* simth::Device::outputInterface int  interfaceID  )  const [protected, virtual]
 

Returns a pointer to the OutputInterface specified by interfaceID. Note that the interfaceID starts by zero. If interfaceID-1 is bigger than the number of output interfaces of the device, an error is thrown.

bool simth::Device::isOutputInterface int  interfaceID  )  const [protected]
 

Returns true if the specified interface exists.

bool simth::Device::isOutputInterfaceConnected int  interfaceID  )  const [protected]
 

Returns true if the specified interface is connected with another interface.

template<class T>
T * simth::Device::getOutputSequence int  interfaceID  )  [inline, protected]
 

Returns a pointer to the output sequence. This output sequence must be used to store the processed data.

Additionally, a reference counter for this sequence will be incremented, which will only be decremented when flushProcessedSequences() (or one of its more specialized versions) is called.

The sequence type of the output interface's data sequence is determined by the template argument T.

virtual void simth::Device::updateInputLengths  )  [protected, pure virtual]
 

This method must be implemented by a derived class, and it must compute and update the input lengths of the interfaces and set them by setInputLength().

This method is called either from your own initialization code, or if the method setOutputLength() has been called from the successor device (i. e. setOutputLength() has been called "from the output side"). Also see the sequence diagram at setOutputLength().

If your derived class does not want to allow the computation and update of the input lengths to be set by the method call "from the output side", then you can implement this method as a call of the base class implementation:

void MyDerivedClass::updateInputLengths(){ Device::updateInputLengths();}.

That implementation will simply throw an exception. But in any case this method must be implemented.

To repeat: The method setOutputLength() will set the new length and then call this updateInputLengths(). The method setInputLength() will set the new length and then call the method updateOutputLengths().

virtual void simth::Device::updateOutputLengths  )  [protected, pure virtual]
 

This method must be implemented by a derived class, and it must compute and update the output lengths of the interfaces and set them by setOutputLength().

This method is called either from your own initialization code, or if the method setInputLength() has been called from the predecessor device (i. e. setInputLength() has been called "from the input side"). Also see the sequence diagram at setInputLength().

If your derived class does not want to allow the computation and update of the output lengths to be set by the method call "from the input side", then you can implement this method as a call of the base class implementation:

void MyDerivedClass::updateOutputLengths(){ Device::updateOutputLengths();}.

That implementation will simply throw an exception. But in any case this method must be implemented.

To repeat: The method setInputLength() will set the new length and then call this updateOutputLengths(). The method setOutputLength() will set the new length and then call the method updateInputLengths().

void simth::Device::flushProcessedSequences  )  [protected]
 

Flushes all input and output sequences, i.e. all reference counters will be decremented and released again.

WATCH OUT: This will decrement the reference counters of *all* sequences regardless of whether you actually referenced them by getInputSequence and getOutputSequence! If you intend to use only some sequences but not others, you *have* to use the specialized flushProcessedInputSequence(nr) and flushProcessedOutputSequence(nr) instead of this function!

One way to look at this is that this function will signal from your Device to the simulation system: "The sequences retrieved by getInputSequence and getOutputSequence have been processed now."

This function is the counter-part to getInputSequence() and getOutputSequence(). This function must be called in the function process() after input and output sequences have been retrieved by getInputSequence() and getOutputSequence(), respectivley.

See also:
Sequence diagram of Device::Process with output and Sequence diagram of Device::Process with input

void simth::Device::flushProcessedInputSequences  )  [protected]
 

Flushes all input sequences, i.e. all reference counters will be decremented and released again. In contrast to flushProcessedSequences, this function only works on all input sequences.

WATCH OUT: This will decrement the reference counters of *all* sequences regardless of whether you actually referenced them by getInputSequence! If you intend to use only some sequences but not others, you *have* to use the specialized flushProcessedInputSequence(nr) instead of this function!

This function is the counter-part to getInputSequence(). This function must be called in the function process() after input sequences have been retrieved by getInputSequence().

See also:
Sequence diagram of Device::Process with output and Sequence diagram of Device::Process with input

void simth::Device::flushProcessedOutputSequences  )  [protected]
 

Flushes all output sequences, i.e. all reference counters will be decremented and released again. In contrast to flushProcessedSequences, this function only works on all output sequences.

WATCH OUT: This will decrement the reference counters of *all* sequences regardless of whether you actually referenced them by getOutputSequence! If you intend to use only some sequences but not others, you *have* to use the specialized and flushProcessedOutputSequence(nr) instead of this function!

This function is the counter-part to getOutputSequence(). This function must be called in the function process() after output sequences have been retrieved by getOutputSequence().

See also:
Sequence diagram of Device::Process with output and Sequence diagram of Device::Process with input

void simth::Device::flushProcessedInputSequence int  interface  )  [protected]
 

Flushes one specific input sequence, i.e. all reference counters will be decremented and released again. In contrast to flushProcessedSequences, this function only works on one specific input sequence.

This function is the counter-part to getInputSequence(). This function must be called in the function process() after input sequences have been retrieved by getInputSequence().

See also:
Sequence diagram of Device::Process with output and Sequence diagram of Device::Process with input

void simth::Device::flushProcessedOutputSequence int  interface  )  [protected]
 

Flushes one specific output sequence, i.e. all reference counters will be decremented and released again. In contrast to flushProcessedSequences, this function only works on one specific output sequence.

This function is the counter-part to getOutputSequence(). This function must be called in the function process() after output sequences have been retrieved by getOutputSequence().

See also:
Sequence diagram of Device::Process with output and Sequence diagram of Device::Process with input

void simth::Device::releaseProcessedInputSequence int  interface  )  [protected]
 

"Releases" one specific input sequence, i.e. the reference counters will be decremented and released again. In contrast to any of the flush functions, this function is meant for the case when none of the data has been processed this time, but the data should still be left in the input interface for next time.

This function is the counter-part to getInputSequence(). Unlike the function flushProcessedInputSequence(), the data is kept in the input interface.

See also:
Sequence diagram of Device::Process with output and Sequence diagram of Device::Process with input

template<class D>
size_t simth::Device::insertControlInterface D *  dev,
void(D::*)()  helpFuncPtr
[inline, protected]
 

Inserts a new ControlInterface. The ControlInterface wrapps a member function of the device that takes no argument.

With connectControlInterface() the controlInterface is connected to a loop variable of the FreeConnectionSystem. Each time the loop variable enters a new iteration the wrap function is called by the control interface.

Parameters:
dev pointer to device
helpFuncPtr pointer to a function in the device pointed to by dev.
Returns:
The resulting overall number of control interfaces of the device. The index of the newly inserted control interface is one less than this returned number.

template<class T, class D>
size_t simth::Device::insertControlInterface D *  dev,
void(D::*)(T)  helpFuncPtr
[inline, protected]
 

Inserts a new ControlInterface. A ControlInterface wrapps a member function of the device that takes one argument.

With connectControlInterface() the controlInterface is connected to a loop variable of the FreeConnectionSystem. Each time the loop variable enters a new iteration the wrap function is called by the control interface. The template argument T determines the argument type of the function.

Parameters:
dev pointer to device
helpFuncPtr pointer to a function in the device pointed to by dev.
Returns:
The resulting overall number of control interfaces of the device. The index of the newly inserted control interface is one less than this returned number.

template<class D>
size_t simth::Device::insertAndConnectControlInterface D *  dev,
void(D::*)()  helpFuncPtr,
const std::string &  globalName
[inline, protected]
 

Inserts a new ControlInterface and connect it once with a loop variable of the FreeConnectionSystem.

See insertControlInterface() and connectControlInterface() for more explanation.

Parameters:
dev pointer to device
helpFuncPtr pointer to a function in the device pointed to by dev
globalName the name of loop variable in the FreeConnectionSystem
Returns:
The resulting overall number of control interfaces of the device. The index of the newly inserted control interface is one less than this returned number.

template<class T, class D>
size_t simth::Device::insertAndConnectControlInterface D *  dev,
void(D::*)(T)  helpFuncPtr,
const std::string &  globalName
[inline, protected]
 

Inserts a new ControlInterface and connect it once with a loop variable of the FreeConnectionSystem. The template argument T determines the argument type of the function.

See insertControlInterface() and connectControlInterface() for more explanation.

Parameters:
dev pointer to device
helpFuncPtr pointer to a function in the device pointed to by dev
globalName the name of loop variable in the FreeConnectionSystem
Returns:
The resulting overall number of control interfaces of the device. The index of the newly inserted control interface is one less than this returned number.

bool simth::Device::isControlInterface int  interfaceID  )  const [protected]
 

Returns true if the specified control interface exists.

virtual ControlInterface* simth::Device::controlInterface int  interfaceNr  )  [protected, virtual]
 

Returns a pointer to the specified control interface.

void simth::Device::sendReadyToProcessSignal  )  [protected]
 

I am ready to process!

See also:
Sequence diagram of Device::Process with output and Sequence diagram of Device::Process with input

void simth::Device::sendStopIterationSignal  )  [protected]
 

Stop this iteration, start next iteration (see loop_variables).

void simth::Device::sendStopSimulationPrematureSignal  )  [protected]
 

Stop this iteration and finish the simulation.

void simth::Device::startStopWatch  )  [protected]
 

This function starts the stop watch. This can be used to time the simulation run of this device.

void simth::Device::stopStopWatch  )  [protected]
 

This function stops the stop watch. This can be used to time the simulation run of this device.

virtual int simth::Device::ID  )  const [inline, virtual]
 

Returns the ID of the device. The ID is an unique integer value that addresses this devices in the FreeConnectionSystem.

template<class T>
const T & simth::Device::getProperty const std::string &  name  )  const
 

Returns the value of the specified property, of type T. Throws an error if the property doesn't exist, or if the type in the template function does not match the type of this property.

Parameters:
name The name of the property
Returns:
The value of the specified property

bool simth::Device::hasProperty const std::string &  name  )  const
 

Returns true when a property with the specified name exists.

Parameters:
name The name of the property
Returns:
True, if a property with that name exists.

bool simth::Device::propertyIsSet const std::string &  name  )  const
 

Returns true when a property with the specified name has been set to some value. Returns false if that property is still set to its default value. Throws an error if the property doesn't exist.

Parameters:
name The name of the property
Returns:
True, if the property has been set to some value.

virtual void simth::Device::print std::ostream &  os  )  const [virtual]
 

This function prints its device information (e.g. type of device, parameter, ...) to the ostream passed as argument.

void simth::Device::connect int  fromInterfaceID,
Device toDev,
int  toInterfaceID
 

The function connects the specified OutputInterface of this device with the specified InputInterface of the device pointed to by toDev.

Parameters:
fromInterfaceID interface ID of the output interface of this device
toDev pointer to the device that schould be connected with this device
toInterfaceID interface ID of the inputInterface of the device that should be connected with this device

void simth::Device::connectControlInterface int  interfaceNr,
const std::string &  globalName
 

The function connects an already existing ControlInterface of this device with a loop variable of the FreeConnectionSystem.

Parameters:
interfaceNr The index (ID, starts with zero) of the controllInterface to be connected
globalName The name of loop variable in the FreeConnectionSystem

InputInterface* const simth::Device::acceptConnection int  interfaceID  ) 
 

The function signalizes the device (FIXME: what does this mean?), that its input interface with the number interfaceID is connected with another device. If the connection is possible, the function returns a pointer to the input interface, otherwise the function throws a connection_error exception.

virtual void simth::Device::startOfSimulation  )  [inline, virtual]
 

This function can be overriden by a derived class to do something when the simulation is going to be started, e.g. write a parameter to the system wide parameter list using the function FreeConnectionSystem::writeParameter(). (Note for this example, devices that takes a pointer to the system in its constructor argument list can do this in its constructor and doesn't need this function for that example. But the class CompatibleDevices does not take a pointer to the system and hence it needs this function to write at the beginning of a simulation run to the system.)

See also:
Sequence diagram of Main Simulation Loop

virtual void simth::Device::endOfSimulation  )  [inline, virtual]
 

This function can be overriden by a derived class to do something after the simulation has been finished and before the destructor can do this, e.g. write stored error information to a file before displaying the results.

virtual void simth::Device::refresh  )  [inline, virtual]
 

A derived device can overwrite this function to do some specific refresh actions, otherwise nothing is happens when the function is called.

In a StreamDrivenSystem this function is called by the system when the device has sent a refresh signal to the system.

void simth::Device::invokeProcess  ) 
 

The function calls the procedure startProcess(), then the main functionality function process() (see below) and finally the function stopProcess().

Basically this function only calls the virtual function process() and nothing else happens here.

See also:
Sequence diagram of Main Simulation Loop

virtual void simth::Device::process  )  [pure virtual]
 

This pure virtual function has to be overwritten by derived devices. It is called by the function invokeProcess().

In a StreamDrivenSystem invokeProcess() is called when the interfaces contain enough data for processing. Then the function get data from the input interfaces (use getInputSequence(interfaceID)), process this data and put the result to the output interfaces (use getOutputSequence(interfaceID)). This is repeated until the device contains not enough data to proceed processing.

See also:
Sequence diagram of Device::Process with output and Sequence diagram of Device::Process with input

virtual void simth::Device::acceptNewData int  interfaceID  )  [virtual]
 

Tells the devices to accept new data at the specified input interface. The standard implementation will check whether the stored input data of all input interfaces exceeds the input length set by setInputLength(), and if it does, it will call sendReadyToProcessSignal() to the FreeConnectionSystem to let this device be queued for process().

See also:
Sequence diagram of Device::Process with output and Sequence diagram of Device::Process with input

void simth::Device::resetDevice  ) 
 

Resets the device by calling resetInterfaces() and reset(). In the StreamDrivenSimulationSystem this fucntion is called at the beginning of each iteration step. Do *NOT* override this function in derived classes since it is not declared as virtual function.

The virtual function reset() that will be called by this function can be used in derived classes to specify some specific actions.

See also:
Sequence diagram of Main Simulation Loop

void simth::Device::resetInterfaces  ) 
 

Flushes the sequences stored in the interfaces.

virtual void simth::Device::reset  )  [virtual]
 

This function is called by resetDevice(). It will be called in all devices at each innermost iteration step, right before Device::process() of the first device will be called to start a new iteration step.

A derived class can overwrite this function to do some device specific reset actions. In a StreamDrivenSystem resetDevice() (and within reset()) is called at the beginning of each new iteration step, i.e. when a loop variable is set to a new value.

The implementation in this class does nothing, i.e. the definition body of reset() is empty.

See also:
Sequence diagram of Main Simulation Loop

void simth::Device::setInputLength size_t  newLength,
int  interfaceID,
bool  enableUpdate = true
 

Sets the sequence length of the specified input interface and calls updateOutputLengths() if (and only if) the new length differs from the current sequence length of that interface and 'enableUpdate' equals true.

Parameters:
newLength new input length of the specified input interface
interfaceID index of the input interface (starts by zero!)
enableUpdate if 'true' the function updateOutputLength() will be called by this function if (and only if) the new length differs from the current sequence length of that interface
A sequence diagram of this method is shown below.

DevicesetInputLength.png

void simth::Device::setInputLength size_t  newLength,
bool  enableUpdate = true
 

Sets the sequence length of all input interfaces and calls updateOutputLengths() if (and only if) the new length differs from the current sequence length of at least one input interface and 'enableUpdate' equals true.

Parameters:
newLength new input length of the specified input interface
enableUpdate if 'true' the function updateOutputLength() will be called by this function if (and only if) the new length differs from the current sequence length of that interface
A sequence diagram of this method is shown below.

DevicesetInputLength.png

size_t simth::Device::inputLength int  interfaceID  )  const
 

Returns the sequence length of the specified input interface.

Parameters:
interfaceID index of the input interface (starts by zero!)
Returns:
sequence length

size_t simth::Device::inputLength  )  const
 

Returns the sequence length of the input interfaces. The sequence lengths of all input interfaces have to be equal. Otherwise an error is thrown.

Returns:
sequence length

bool simth::Device::isInputLengthUndefined int  interfaceID  )  const
 

Returns true if the sequence length of the specified input interface is undefined.

void simth::Device::setOutputLength size_t  newLength,
int  interfaceID,
bool  enableUpdate = true
 

Sets the sequence length of the specified output interface and calls updateInputLengths() if (and only if) the new length differs from the current sequence length of that interface. and 'enableUpdate' equals true.

Parameters:
newLength new input length of the specified output interface
interfaceID specifies the ID of the interface (note, index starts with 0!)
enableUpdate if 'true' the function updateOutputLength() will be called by this function if (and only if) the new length differs from the current sequence length of that interface
A sequence diagram of this method is shown below.

DevicesetOutputLength.png

void simth::Device::setOutputLength size_t  newLength,
bool  enableUpdate = true
 

Sets the sequence length of all output interfaces and calls updateInputLengths() if (and only if) the new length differs from the current sequence length of at least one output interface.

Parameters:
newLength new sequence length of all output interface
enableUpdate if 'true' the function updateOutputLength() will be called by this function if (and only if) the new length differs from the current sequence length of that interface
A sequence diagram of this method is shown below.

DevicesetOutputLength.png

size_t simth::Device::outputLength int  interfaceID  )  const
 

Returns the sequence length of the specified output interface.

Parameters:
interfaceID index of the output interface (starts by zero!)
Returns:
sequence length

size_t simth::Device::outputLength  )  const
 

Returns the sequence length of the output interfaces. The sequence lengths of all output interfaces have to be equal. Otherwise an error is thrown.

Returns:
sequence length

bool simth::Device::isOutputLengthUndefined int  interfaceID  )  const
 

Returns true if the sequence length of the specified output interface is undefined.

void simth::Device::reserveOutputLength size_t  newCapacity,
int  interfaceID
 

Sets the sequence capacity of the specified output interface (see The C++ Programming Language, S. 485 for explanation of the capacity of a vector).

This could be useful, if a device needs for example an output length of 100, but for internal computation the length growth intermediate to 102. In this case the capacity should had been set to 102. This enables resizing the sequence intermediate to 102 - avoid an extra buffer - and resize it finally to the output length of 100. Note, if the new capacity is smaller than the output length this function has no effect.

Parameters:
newCapacity new capacity of the specified output interface
interfaceID index of the output interface (starts by zero!)

void simth::Device::reserveOutputLength size_t  newCapacity  ) 
 

Sets the sequence capacity of each output interface (see The C++ Programming Language, S. 485 for explanation of the capacity of a vector).

This could be useful, if a device needs for example an output length of 100, but for internal computation the length growth intermediate to 102. In this case the capacity should had been set to 102. This enables resizing the sequence intermediate to 102 - avoid an extra buffer - and resize it finally to the output length of 100. Note, if the new capacity is smaller than the output length this function has no effect.

Parameters:
newCapacity new capacity of the specified output interface

size_t simth::Device::outputCapacity int  interfaceID  )  const
 

Returns the capacity of the specified output interface. (see The C++ Programming Language, S. 485 for explanation of the capacity of a vector)

Parameters:
interfaceID index of the output interface (starts by zero!)

size_t simth::Device::outputCapacity  )  const
 

Returns the capacity of the output interfaces. The cpacity of all input interfaces have to be equal. Otherwise an error is thrown. (see The C++ Programming Language, S. 485 for explanation of the capacity of a vector)


Friends And Related Function Documentation

friend class CompatibleDevice [friend]
 


Generated on Mon Apr 24 21:19:19 2006 for simthetic by  doxygen 1.4.1