Relacs  0.9.8
Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
Attenuate Class Referenceabstract

#include <attenuate.h>

Inheritance diagram for Attenuate:
Inheritance graph
[legend]
Collaboration diagram for Attenuate:
Collaboration graph
[legend]

Public Member Functions

 Attenuate (void)
 
 Attenuate (const string &deviceclass, const string &intensityname="intensity", const string &intensityunit="dB", const string &intensityformat="%6.2f", const string &frequencyname="", const string &frequencyunit="Hz", const string &frequencyformat="%7.0f")
 
virtual ~Attenuate (void)
 
int open (Device &att, int line)
 
virtual int open (Device &att) override
 
virtual int open (const string &device) override
 
virtual bool isOpen (void) const
 
virtual void close (void)
 
void clear (void)
 
double minIntensity (double frequency=0.0) const
 
double maxIntensity (double frequency=0.0) const
 
void intensities (vector< double > &ints, double frequency=0.0) const
 
virtual void init (void)
 
virtual void save (const string &path) const
 
int write (double &intensity, double frequency, double &level)
 
int testWrite (double &intensity, double frequency, double &level)
 
int mute (void)
 
int testMute (void)
 
int attenuate (double &level)
 
int testAttenuate (double &level)
 
string intensityName (void) const
 
void setIntensityName (const string &name)
 
string intensityUnit (void) const
 
void setIntensityUnit (const string &unit)
 
string intensityFormat (void) const
 
void setIntensityFormat (const string &format)
 
string frequencyName (void) const
 
void setFrequencyName (const string &name)
 
string frequencyUnit (void) const
 
void setFrequencyUnit (const string &unit)
 
string frequencyFormat (void) const
 
void setFrequencyFormat (const string &format)
 
int aoChannel (void) const
 
void setAOChannel (int channel)
 
string aoDevice (void) const
 
void setAODevice (const string &deviceid)
 
Attenuatorattenuator (void)
 
const Attenuatorattenuator (void) const
 
bool noAttenuator (void) const
 
- Public Member Functions inherited from Device
 Device (int type=MiscellaneousType)
 
 Device (const string &deviceclass, int type=MiscellaneousType)
 
virtual ~Device (void)
 
virtual int reset (void)
 
virtual const Optionsinfo (void) const
 
virtual const Optionssettings (void) const
 
int deviceType (void) const
 
string deviceTypeStr (void) const
 
string deviceClass (void) const
 
string deviceFile (void) const
 
string deviceName (void) const
 
string deviceVendor (void) const
 
string deviceIdent (void) const
 
virtual void setDeviceIdent (const string &ident)
 
virtual void clearError (void)
 
virtual string errorStr (void) const
 
void setErrorStr (const string &strg)
 
void addErrorStr (const string &strg)
 
void setErrorStr (int errnum)
 
void addErrorStr (int errnum)
 
virtual bool success (void) const
 
virtual bool failed (void) const
 
- Public Member Functions inherited from Options
 Options (void)
 
 Options (const Options &o)
 
 Options (const Options &o, int flags)
 
 Options (const string &name, const string &type, int flags, int style)
 
 Options (const Str &opttxt, const string &assignment=":=", const string &separator=",;")
 
 Options (const StrQueue &sq, const string &assignment=":=")
 
 Options (istream &str, const string &assignment=":=", const string &comment="#", const string &stop="", string *line=0)
 
virtual ~Options (void)
 
Optionsoperator= (const Options &o)
 
Optionsassign (const Options &o)
 
Optionsappend (const Options &o)
 
Optionsadd (const Options &o)
 
Optionsinsert (const Options &o, const string &atname="")
 
Optionsassign (const Options &o, int flags)
 
Optionscopy (Options &o, int flags)
 
Optionsappend (const Options &o, int flags)
 
Optionsadd (const Options &o, int flags)
 
Optionsinsert (const Options &o, int flags, const string &atname="")
 
Parameterassign (const string &name, const string &value)
 
OptionsparentSection (void)
 
const OptionsparentSection (void) const
 
void setParentSection (Options *parentsection)
 
void resetParents (void)
 
OptionsrootSection (void)
 
const OptionsrootSection (void) const
 
string name (void) const
 
virtual void setName (const string &name)
 
virtual void setName (const string &name, const string &type)
 
string type (void) const
 
void setType (const string &type)
 
string include (void) const
 
void setInclude (const string &include)
 
void setInclude (const string &url, const string &name)
 
int flag (void) const
 
bool flag (int selectflag) const
 
OptionssetFlag (int flag)
 
OptionsaddFlag (int flag)
 
OptionsdelFlag (int flag)
 
OptionsclearFlag (void)
 
int style (void) const
 
OptionssetStyle (int style)
 
OptionsaddStyle (int style)
 
OptionsdelStyle (int style)
 
OptionsclearStyle (void)
 
bool checkType (int mask) const
 
Str warning (void) const
 
iterator begin (void)
 
iterator end (void)
 
const_iterator begin (void) const
 
const_iterator end (void) const
 
section_iterator sectionsBegin (void)
 
section_iterator sectionsEnd (void)
 
const_section_iterator sectionsBegin (void) const
 
const_section_iterator sectionsEnd (void) const
 
const_iterator find (const string &pattern, int level=-1) const
 
iterator find (const string &pattern, int level=-1)
 
const_iterator rfind (const string &pattern, int level=-1) const
 
iterator rfind (const string &pattern, int level=-1)
 
const_section_iterator findSection (const string &pattern, int level=-1) const
 
section_iterator findSection (const string &pattern, int level=-1)
 
const_section_iterator rfindSection (const string &pattern, int level=-1) const
 
section_iterator rfindSection (const string &pattern, int level=-1)
 
const Parameteroperator[] (int i) const
 
Parameteroperator[] (int i)
 
const Parameteroperator[] (const string &name) const
 
Parameteroperator[] (const string &name)
 
const Optionssection (int i) const
 
Optionssection (int i)
 
const Optionssection (const string &name) const
 
Optionssection (const string &name)
 
Str request (const string &name) const
 
ParametersetRequest (const string &name, const string &request)
 
Parameter::ValueType valueType (const string &name) const
 
ParametersetValueType (const string &name, Parameter::ValueType type)
 
int flags (const string &name) const
 
bool flags (const string &name, int flag) const
 
ParametersetFlags (const string &name, int flags)
 
ParameteraddFlags (const string &name, int flags)
 
ParameterdelFlags (const string &name, int flags)
 
ParameterclearFlags (const string &name)
 
bool changed (const string &name)
 
int style (const string &name) const
 
ParametersetStyle (const string &name, int style)
 
ParameteraddStyle (const string &name, int style)
 
ParameterdelStyle (const string &name, int style)
 
Str format (const string &name) const
 
ParametersetFormat (const string &name, int width=0, int prec=-1, char fmt='g')
 
ParametersetFormat (const string &name, const string &format)
 
int formatWidth (const string &name) const
 
int size (const string &name) const
 
Parameteradd (const Parameter &np)
 
Parameterinsert (const Parameter &np, const string &atname="")
 
ParameteraddText (const string &name, const string &request, const string &dflt, int flags=0, int style=0)
 
ParameteraddText (const string &name, const string &dflt="", int flags=0, int style=0)
 
ParameterinsertText (const string &name, const string &atname, const string &request, const string &dflt, int flags=0, int style=0)
 
ParameterinsertText (const string &name, const string &atname="", const string &dflt="", int flags=0, int style=0)
 
Str text (const string &name, int index, const string &dflt="", const string &format="", const string &unit="") const
 
Str text (const string &name, const string &dflt="", const string &format="", const string &unit="") const
 
void texts (const string &name, vector< string > &s, const string &format="", const string &unit="") const
 
Str allText (const string &name, const string &dflt="", const string &format="", const string &unit="", const string &separator=", ") const
 
ParametersetText (const string &name, const string &strg)
 
ParametersetText (const string &name, const Parameter &p)
 
ParameterpushText (const string &name, const string &strg)
 
Str defaultText (const string &name, const string &format="", const string &unit="") const
 
ParametersetDefaultText (const string &name, const string &dflt)
 
ParameteraddSelection (const string &name, const string &request, const string &selection, int flags=0, int style=0)
 
ParameteraddSelection (const string &name, const string &selection="", int flags=0, int style=0)
 
ParameterinsertSelection (const string &name, const string &atname, const string &request, const string &selection, int flags=0, int style=0)
 
ParameterinsertSelection (const string &name, const string &atname="", const string &selection="", int flags=0, int style=0)
 
ParameterselectText (const string &name, const string &strg, int add=0)
 
ParameterselectText (const string &name, int index)
 
int index (const string &name) const
 
int index (const string &name, const string &strg) const
 
ParameteraddNumber (const string &name, const string &request, double dflt, double minimum, double maximum=MAXDOUBLE, double step=1.0, const string &unit="", const string &outputunit="", const string &format="", int flags=0, int style=0)
 
ParameteraddNumber (const string &name, const string &request, double dflt, const string &unit="", const string &format="", int flags=0, int style=0)
 
ParameteraddNumber (const string &name, double dflt, const string &unit="", const string &format="", int flags=0, int style=0)
 
ParameteraddNumber (const string &name, double dflt, const string &unit, int flags, int style=0)
 
ParameteraddNumber (const string &name, double dflt, double error, const string &unit="", const string &format="", int flags=0, int style=0)
 
ParameteraddNumber (const string &name, const string &unit="", const string &format="", int flags=0, int style=0)
 
ParameterinsertNumber (const string &name, const string &atname, const string &request, double dflt, double minimum, double maximum=MAXDOUBLE, double step=1.0, const string &unit="", const string &outputunit="", const string &format="", int flags=0, int style=0)
 
ParameterinsertNumber (const string &name, const string &atname, const string &request, double dflt, const string &unit="", const string &format="", int flags=0, int style=0)
 
ParameterinsertNumber (const string &name, const string &atname, double dflt, const string &unit="", const string &format="", int flags=0, int style=0)
 
ParameterinsertNumber (const string &name, const string &atname, const string &unit="", const string &format="", int flags=0, int style=0)
 
double number (const string &name, double dflt=0.0, const string &unit="", int index=0) const
 
double number (const string &name, const string &unit, double dflt=0.0, int index=0) const
 
double number (const string &name, int index, double dflt=0.0, const string &unit="") const
 
double number (const string &name, int index, const string &unit, double dflt=0.0) const
 
void numbers (const string &name, vector< double > &n, const string &unit="") const
 
double error (const string &name, const string &unit="", int index=0) const
 
double error (const string &name, int index, const string &unit="") const
 
void errors (const string &name, vector< double > &n, const string &unit="") const
 
ParametersetNumber (const string &name, double number, double error, const string &unit="")
 
ParametersetNumber (const string &name, double number, const string &unit="")
 
ParameterpushNumber (const string &name, double number, double error=-1.0, const string &unit="")
 
ParameterpushNumber (const string &name, double number, const string &unit)
 
ParametersetNumber (const string &name, const Parameter &p)
 
double defaultNumber (const string &name, const string &unit="") const
 
ParametersetDefaultNumber (const string &name, double dflt, const string &unit="")
 
double minimum (const string &name, const string &unit="") const
 
double maximum (const string &name, const string &unit="") const
 
double step (const string &name, const string &unit="") const
 
ParametersetStep (const string &name, double step, const string &unit="")
 
ParametersetMinMax (const string &name, double minimum=-MAXDOUBLE, double maximum=MAXDOUBLE, double step=1.0, const string &unit="")
 
Str unit (const string &name) const
 
Str outUnit (const string &name) const
 
ParametersetUnit (const string &name, const string &internunit, const string &outunit="")
 
ParametersetOutUnit (const string &name, const string &outputunit)
 
ParameterchangeUnit (const string &name, const string &internunit)
 
ParameteraddInteger (const string &name, const string &request, long dflt, long minimum=LONG_MIN, long maximum=LONG_MAX, long step=1, const string &unit="", const string &outputunit="", int width=0, int flags=0, int style=0)
 
ParameteraddInteger (const string &name, long dflt, const string &unit="", int width=0, int flags=0, int style=0)
 
ParameteraddInteger (const string &name, const string &unit="")
 
ParameterinsertInteger (const string &name, const string &atname, const string &request, long dflt, long minimum=LONG_MIN, long maximum=LONG_MAX, long step=1, const string &unit="", const string &outputunit="", int width=0, int flags=0, int style=0)
 
ParameterinsertInteger (const string &name, const string &atname, long dflt, const string &unit="", int width=0, int flags=0, int style=0)
 
ParameterinsertInteger (const string &name, const string &atname, const string &unit="", int width=0, int flags=0, int style=0)
 
long integer (const string &name, const string &unit="", long dflt=0, int index=0) const
 
long integer (const string &name, int index, long dflt=0, const string &unit="") const
 
long integer (const string &name, int index, const string &unit, long dflt=0) const
 
void integers (const string &name, vector< long > &n, const string &unit="") const
 
void integers (const string &name, vector< int > &n, const string &unit="") const
 
ParametersetInteger (const string &name, long number, long error, const string &unit="")
 
ParametersetInteger (const string &name, long number, const string &unit="")
 
ParameterpushInteger (const string &name, long number, long error, const string &unit="")
 
ParameterpushInteger (const string &name, long number, const string &unit="")
 
ParametersetInteger (const string &name, const Parameter &p)
 
long defaultInteger (const string &name, const string &unit="") const
 
ParametersetDefaultInteger (const string &name, long dflt, const string &unit="")
 
ParametersetMinMax (const string &name, long minimum=LONG_MIN, long maximum=LONG_MAX, long step=1, const string &unit="")
 
ParametersetMinMax (const string &name, int minimum, int maximum, int step=1, const string &unit="")
 
ParameteraddBoolean (const string &name, const string &request, bool dflt, int flags=0, int style=0)
 
ParameteraddBoolean (const char *name, const char *request, bool dflt, int flags=0, int style=0)
 
ParameteraddBoolean (const string &name, bool dflt, int flags=0, int style=0)
 
ParameteraddBoolean (const char *name, bool dflt, int flags=0, int style=0)
 
ParameterinsertBoolean (const string &name, const string &atname="", const string &request="", bool dflt=false, int flags=0, int style=0)
 
ParameterinsertBoolean (const string &name, const string &atname, int flags=0, int style=0)
 
bool boolean (const string &name, bool dflt=false, int index=0) const
 
bool boolean (const string &name, int index, bool dflt=false) const
 
void booleans (const string &name, vector< bool > &n) const
 
ParametersetBoolean (const string &name, bool b)
 
ParametersetBoolean (const string &name, const Parameter &p)
 
bool defaultBoolean (const string &name) const
 
ParametersetDefaultBoolean (const string &name, bool dflt)
 
ParameteraddDate (const string &name, const string &request, int year=0, int month=0, int day=0, int flags=0, int style=0)
 
ParameteraddDate (const string &name, int year, int month, int day, int flags=0, int style=0)
 
ParameteraddDate (const string &name, int flags=0, int style=0)
 
ParameterinsertDate (const string &name, const string &atname="", const string &request="", int year=0, int month=0, int day=0, int flags=0, int style=0)
 
ParameterinsertDate (const string &name, const string &atname, int year=0, int month=0, int day=0, int flags=0, int style=0)
 
ParameterinsertDate (const string &name, const string &atname, int flags=0, int style=0)
 
const Parameterdate (const string &name, int index, int &year, int &month, int &day) const
 
ParametersetDate (const string &name, int year, int month, int day)
 
ParametersetDate (const string &name, const string &date)
 
ParametersetDate (const string &name, const struct tm &date)
 
ParametersetDate (const string &name, const time_t &time)
 
ParametersetCurrentDate (const string &name)
 
ParametersetDate (const string &name, const Parameter &p)
 
const ParameterdefaultDate (const string &name, int index, int &year, int &month, int &day) const
 
ParametersetDefaultDate (const string &name, int year, int month, int day)
 
ParameteraddTime (const string &name, const string &request, int hour=0, int minutes=0, int seconds=0, int milliseconds=0, int flags=0, int style=0)
 
ParameteraddTime (const string &name, int hour, int minutes, int seconds, int milliseconds=0, int flags=0, int style=0)
 
ParameteraddTime (const string &name, int flags=0, int style=0)
 
ParameterinsertTime (const string &name, const string &atname="", const string &request="", int hour=0, int minutes=0, int seconds=0, int milliseconds=0, int flags=0, int style=0)
 
ParameterinsertTime (const string &name, const string &atname, int hour=0, int minutes=0, int seconds=0, int milliseconds=0, int flags=0, int style=0)
 
ParameterinsertTime (const string &name, const string &atname, int flags=0, int style=0)
 
const Parametertime (const string &name, int index, int &hour, int &minutes, int &seconds, int &milliseconds) const
 
ParametersetTime (const string &name, int hour, int minutes, int seconds, int milliseconds=0)
 
ParametersetTime (const string &name, const string &time)
 
ParametersetTime (const string &name, const struct tm &time)
 
ParametersetTime (const string &name, const time_t &time)
 
ParametersetCurrentTime (const string &name)
 
ParametersetTime (const string &name, const Parameter &p)
 
const ParameterdefaultTime (const string &name, int index, int &hour, int &minutes, int &seconds, int &milliseconds) const
 
ParametersetDefaultTime (const string &name, int hour, int minutes, int seconds, int milliseconds=0)
 
OptionsnewSection (int level, const string &name, const string &type="", int flag=0, int style=0)
 
OptionsnewSection (int level, const string &name, int flag, int style=0)
 
OptionsnewSection (const string &name, const string &type="", int flag=0, int style=0)
 
OptionsnewSection (const string &name, int flag, int style=0)
 
OptionsnewSubSection (const string &name, const string &type="", int flag=0, int style=0)
 
OptionsnewSubSection (const string &name, int flag, int style=0)
 
OptionsnewSubSubSection (const string &name, const string &type="", int flag=0, int style=0)
 
OptionsnewSubSubSection (const string &name, int flag, int style=0)
 
OptionsaddSection (const string &name, const string &type="", int flag=0, int style=0)
 
OptionsaddSection (const string &name, int flag, int style=0)
 
OptionsinsertSection (const string &name, const string &atpattern, const string &type="", int flag=0, int style=0)
 
OptionsinsertSection (const string &name, const string &atpattern, int flag, int style=0)
 
OptionsnewSection (int level, const Options &opt, int selectmask, const string &name="", const string &type="", int flag=0, int style=0)
 
OptionsnewSection (int level, const Options &opt, const string &name="", const string &type="", int flag=0, int style=0)
 
OptionsnewSection (int level, const Options &opt, const string &name, int flag, int style=0)
 
OptionsnewSection (const Options &opt, int selectmask, const string &name="", const string &type="", int flag=0, int style=0)
 
OptionsnewSection (const Options &opt, const string &name="", const string &type="", int flag=0, int style=0)
 
OptionsnewSection (const Options &opt, const string &name, int flag, int style=0)
 
OptionsnewSubSection (const Options &opt, int selectmask, const string &name="", const string &type="", int flag=0, int style=0)
 
OptionsnewSubSection (const Options &opt, const string &name="", const string &type="", int flag=0, int style=0)
 
OptionsnewSubSection (const Options &opt, const string &name, int flag, int style=0)
 
OptionsnewSubSubSection (const Options &opt, int selectmask, const string &name="", const string &type="", int flag=0, int style=0)
 
OptionsnewSubSubSection (const Options &opt, const string &name="", const string &type="", int flag=0, int style=0)
 
OptionsnewSubSubSection (const Options &opt, const string &name, int flag, int style=0)
 
OptionsaddSection (const Options &opt, int selectmask, const string &name="", const string &type="", int flag=0, int style=0)
 
OptionsaddSection (const Options &opt, const string &name="", const string &type="", int flag=0, int style=0)
 
OptionsaddSection (const Options &opt, const string &name, int flag, int style=0)
 
OptionsinsertSection (const Options &opt, int selectmask, const string &name, const string &atpattern, const string &type="", int flag=0, int style=0)
 
OptionsinsertSection (const Options &opt, const string &name, const string &atpattern, const string &type="", int flag=0, int style=0)
 
OptionsinsertSection (const Options &opt, const string &name, const string &atpattern, int flag, int style=0)
 
OptionsnewSection (Options *opt, bool newparent=false)
 
OptionsaddSection (Options *opt, bool newparent=false)
 
OptionsinsertSection (Options *opt, const string &atpattern, bool newparent=false)
 
OptionsnewSections (Options *opt, bool newparent=false)
 
void endSection (void)
 
void clearSections (void)
 
void setSection (Options &opt)
 
void lastSection (void)
 
int up (void)
 
int down (void)
 
ParametersetDefault (const string &name)
 
OptionssetDefaults (int flags=0)
 
ParametersetToDefault (const string &name)
 
OptionssetToDefaults (int flags=0)
 
Optionserase (iterator p)
 
Optionserase (section_iterator p)
 
Optionserase (Options *s)
 
Optionserase (const string &pattern)
 
Optionserase (int selectflag)
 
Optionspop (void)
 
OptionspopSection (void)
 
Optionsflatten (Options *root=0)
 
Optionsclear (bool revert=true)
 
int size (void) const
 
int size (int selectflag) const
 
bool empty (void) const
 
int parameterSize (void) const
 
int parameterSize (int flags) const
 
int sectionsSize (void) const
 
int sectionsSize (int flags) const
 
bool exist (const string &pattern) const
 
bool existSection (const string &pattern) const
 
OptionssetFlags (int flags, int selectflag=0)
 
OptionsaddFlags (int flags, int selectflag=0)
 
OptionsdelFlags (int flags, int selectflag=0)
 
OptionssetValueTypeFlags (int flags, int typemask)
 
OptionsaddValueTypeFlags (int flags, int typemask)
 
OptionsdelValueTypeFlags (int flags, int typemask)
 
OptionssetStyles (int style, int selectflag=0)
 
OptionsaddStyles (int style, int selectflag=0)
 
OptionsdelStyles (int style, int selectflag=0)
 
int styleSize (int style) const
 
OptionssetValueTypeStyles (int style, int typemask)
 
OptionsaddValueTypeStyles (int style, int typemask)
 
OptionsdelValueTypeStyles (int style, int typemask)
 
int nameWidth (int selectmask=0, bool detailed=false, bool escape=false) const
 
string save (int selectmask=0, int flags=0) const
 
ostream & save (ostream &str, const string &start="", int selectmask=0, int flags=0, int width=-1) const
 
ostream & save (ostream &str, const string &textformat, const string &numberformat, const string &boolformat="%i=%b", const string &dateformat="%i=%04Y-%02m-%02d", const string &timeformat="%i=%02H:%02M:%02S", const string &sectionformat="%i", int selectmask=0, const string &start="") const
 
ostream & saveXML (ostream &str, int selectmask=0, int flags=0, int level=0, int indent=4) const
 
Optionsread (const string &opttxt, int flag, const string &assignment=":=", const string &separator=",;", int *indent=0)
 
Optionsread (const string &opttxt, const string &assignment=":=", const string &separator=",;")
 
istream & read (istream &str, int flag, const string &assignment=":=", const string &comment="#", const string &stop="", Str *line=0)
 
istream & read (istream &str, const string &assignment=":=", const string &comment="#", const string &stop="", Str *line=0)
 
Optionsread (const StrQueue &sq, int flag=0, const string &assignment=":=")
 
bool read (const Parameter &p, int flag=0)
 
Optionsread (const Options &o, int flags=0, int flag=0)
 
bool readAppend (const Parameter &p)
 
OptionsreadAppend (const Options &o, int flags=0)
 
Optionsload (const Str &opttxt, const string &assignment=":=", const string &separator=",;", int *indent=0, int *indentspacing=0, int *level=0)
 
istream & load (istream &str, const string &assignment=":=", const string &comment="#", const string &stop="", string *line=0)
 
Optionsload (const StrQueue &sq, const string &assignment=":=")
 
virtual void notify (void)
 
void callNotifies (void)
 
bool setNotify (bool notify=true)
 
bool unsetNotify (void)
 
bool notifying (void) const
 

Static Public Attributes

static const double MuteAttenuationLevel = Attenuator::MuteAttenuationLevel
 
static const double MuteIntensity = -1.0e37
 
static const int NotOpen = Attenuator::NotOpen
 
static const int InvalidDevice = Attenuator::InvalidDevice
 
static const int ReadError = Device::ReadError
 
static const int WriteError = Device::WriteError
 
static const int Underflow = Attenuator::Underflow
 
static const int Overflow = Attenuator::Overflow
 
static const int IntensityUnderflow = -7
 
static const int IntensityOverflow = -8
 
static const int IntensityError = -9
 
- Static Public Attributes inherited from Device
static const int NotOpen = -1
 
static const int InvalidDevice = -2
 
static const int ReadError = -3
 
static const int WriteError = -4
 
static const int InvalidParam = -5
 
- Static Public Attributes inherited from Options
static const int NonDefault = Parameter::NonDefault
 
static const long TabSection = 0x04000000
 

Protected Member Functions

virtual int decibel (double intensity, double frequency, double &db) const =0
 
virtual void intensity (double &intens, double frequency, double decibel) const =0
 
virtual void initOptions () override
 
- Protected Member Functions inherited from Device
void setDeviceType (int type)
 
void setDeviceClass (const string &deviceclass)
 
void setDeviceFile (const string &devicefile)
 
void setDeviceName (const string &devicename)
 
void setDeviceVendor (const string &devicevendor)
 
void addInfo (void)
 
void lock (void) const
 
void unlock (void) const
 
QMutex * mutex (void) const
 

Additional Inherited Members

- Public Types inherited from Device
enum  DeviceTypes {
  MiscellaneousType = 0, AnalogInputType = 1, AnalogOutputType = 2, DigitalIOType = 3,
  TriggerType = 4, AttenuatorType = 5, AttenuateType = 6, ManipulatorType = 7,
  TemperatureType = 8, CameraType = 9
}
 
- Public Types inherited from Options
enum  SaveFlags {
  NoName = 1, NoType = 2, NoInclude = 4, SwitchNameType = 8,
  Embrace = 16, PrintRequest = 32, FirstOnly = 64, PrintType = 128,
  PrintStyle = 256, DontCloseSection = 512, AlwaysQuote = 1024, EscapeQuotes = 2048
}
 
typedef deque< Parameter >
::iterator 
iterator
 
typedef deque< Parameter >
::const_iterator 
const_iterator
 
typedef deque< Options * >
::iterator 
section_iterator
 
typedef deque< Options * >
::const_iterator 
const_section_iterator
 
- Static Public Member Functions inherited from Device
static int deviceTypes (void)
 
static string deviceTypeStr (int type)
 
static string getErrorStr (int ern)
 
- Static Public Member Functions inherited from Options
static double floorLog10 (double v)
 
static double floor10 (double v, double scale=1.0)
 
static double ceil10 (double v, double scale=1.0)
 
- Protected Attributes inherited from Device
Options Info
 
Options Settings
 

Detailed Description

Attenuates a single output channel.

Author
Jan Benda
Todo:
check whether we really need the init() function (versus config()!)

This class is an interface for attenuating a single output line. It allows to convert a requested intensity into an attenuation level for the attenuator device. The carrier frequency of the output signal can be used as a parameter for the conversion. You have to reimplement decibel() and intensity() with the required transformation of the intensity into an attenuation level. What physical quantities the intensity and the carrier frequency are depends on the specific implementation of the Attenuate class. The names, units, and formats of the intensity and the frequency can be retrieved by intensityName(), intensityUnit(), intensityFormat(), frequencyName(), frequencyUnit(), and frequencyFormat().

The open() function recognizes the following options:

The function init() is called before the attenuator is used. You can reimplement this function to load calibration data from a file, for example. save() may be called to save some (calibration) data into a file.

Via a constructor or the open()-function a specific attenuation device for a single output line is assigned to the Attenuate-class. The isOpen()-function checks whether the attenuator is valid and opened. With clear() Attenuate can be disconnected from the attenuator. close() additionally closes the associated attenuator. The aoChannel() function returns the number of the channel of the analog output device aoDevice() where the attenuator is connected to.

The attenuation is set by requesting an intensity using write(). This intensity is mapped into an attenuation level in decibel by the function decibel(). The intensity can be any quantity which is most usefull for your application. What exactly the intensity specifies is determined by the implementation of the decibel() function. The decibel() function gets as a second argument a frequency. This second argument can be used as an parameter for the conversion from intensites to attenuation levels. For example, if your output generates a sound wave via a loadspeaker, the necessary attenuation for getting a specific sound intensity depends on the carrierfrequency of your signal.

Attenuators usually can be set to discrete attenuation levels only. If you request a specific intensity via write(), then it is very likely that the actually set attenuation level results in a slightly different intensity. To make this intensity known to the user, write() sets the intensity variable to the actually set intensity. To be able to compute the intensity from the attenuation level you have to implement the intensity()-function as the inverse function of decibel().

To check whether a requested intensity is possible and what intensity would be set without setting the attenuation level, you can use the testWrite()-function. minIntensity() and maxIntensity() return the minimum and maximum possible intensities given the capabilities of the attenuator device. All possible intensities are returned by intensities().

The mute()-function can be used to mute the output line. testMute() checks whether muting of the output line is possible.

Possible return values of write(), testWrite() and mute() are:

In case you want to use a attenuate interface within RELACS, your Attenuate implementation needs to provide a void default constructor (i.e. with no parameters) that does not open the device. Also, include the header file <relacs/relacsplugin.h> and make the Attenuate device known to RELACS with the addAttenuate( ClassNameOfYourAttenuateImplementation, PluginSetName ) macro.

Constructor & Destructor Documentation

Attenuate ( void  )

Constructor.

Attenuate ( const string &  deviceclass,
const string &  intensityname = "intensity",
const string &  intensityunit = "dB",
const string &  intensityformat = "%6.2f",
const string &  frequencyname = "",
const string &  frequencyunit = "Hz",
const string &  frequencyformat = "%7.0f" 
)

Construct Attenuate with device class deviceclass. The Attenuate implementation defines the intensity as intensityname with unit intensityunit and format intensityformat and uses for the conversion a frequency with name frequencyname, unit freqencyunit and format frequencyformat. An empty frequencyname indicates that a frequency is not used for the conversion of intensity to an attenuation level.

See Also
setDeviceClass()
~Attenuate ( void  )
virtual

Destructor.

References Attenuate::close().

Member Function Documentation

int open ( Device att,
int  line 
)

Assign output line line of the attenuator att to this. Returns zero on success, or InvalidDevice (or any other negative number indicating the error).

See Also
isOpen(), init(), setAODevice(), setAOChannel()

References Options::clear(), Device::deviceIdent(), Device::Info, Attenuate::InvalidDevice, Device::isOpen(), relacs::line(), Attenuate::NotOpen, and Device::setDeviceFile().

Referenced by Attenuate::open().

int open ( Device att)
overridevirtual

Evaluates opts, calls open(Device&,int,const Options&), and sets name, unit, and format of intensity and frequency. You certainly do not need to reimplement this function.

Reimplemented from Device.

References Options::exist(), Options::integer(), relacs::line(), Attenuate::open(), Attenuate::setAOChannel(), Attenuate::setAODevice(), Attenuate::setFrequencyFormat(), Attenuate::setFrequencyName(), Attenuate::setFrequencyUnit(), Attenuate::setIntensityFormat(), Attenuate::setIntensityName(), Attenuate::setIntensityUnit(), and Options::text().

int open ( const string &  device)
overridevirtual
bool isOpen ( void  ) const
virtual

True if the hardware driver is open and the device index is supported.

See Also
open()

Implements Device.

References Device::isOpen(), and Attenuator::lines().

Referenced by Acquire::addAttLine().

void close ( void  )
virtual

Close the attenuator wrapper and the associated attenuator device.

See Also
clear(), open(), isOpen()

Implements Device.

References Options::clear(), Device::close(), Device::Info, and Device::isOpen().

Referenced by Attenuate::~Attenuate().

void clear ( void  )

Close the attenuator wrapper without closing the associated attenuator device.

See Also
close(), open(), isOpen()

References Options::clear(), and Device::Info.

double minIntensity ( double  frequency = 0.0) const

Returns the minimum possible intensity that can be set by the current attenuator device at the given stimulus frequency.

See Also
maxIntensity(), intensities()

References Attenuate::intensity(), Attenuator::maxLevel(), and Attenuator::minLevel().

Referenced by Attenuate::init().

double maxIntensity ( double  frequency = 0.0) const

Returns the maximum possible intensity that can be set by the current attenuator device at the given stimulus frequency.

See Also
minIntensity(), intensities()

References Attenuate::intensity(), Attenuator::maxLevel(), and Attenuator::minLevel().

Referenced by Attenuate::init().

void intensities ( vector< double > &  ints,
double  frequency = 0.0 
) const

Returns in ints all possible intensities that can be set by the current attenuator device at the given stimulus frequency sorted by increasing intensities.

See Also
minIntensity(), maxIntensity(), lines()

References Attenuate::intensity(), and Attenuator::levels().

void init ( void  )
virtual

This function is called after an attenuator is assigned to this class and before the attenuator is used. The default implementation sets the info(). You can reimplement this function to load calibration data, for example. Don't forget to call Attenuate::init() or set info() yourself.

See Also
open()

References Device::addInfo(), Options::addInteger(), Options::addNumber(), Options::addText(), Attenuate::aoChannel(), Attenuate::aoDevice(), Options::clear(), Device::deviceIdent(), Device::Info, Attenuate::maxIntensity(), and Attenuate::minIntensity().

Referenced by Acquire::addAttLine().

void save ( const string &  path) const
virtual

Save some data into a file in directory path. The default implementation does nothing. However, you can reimplement this function to save calibration data, for example.

Referenced by SaveFiles::RelacsFiles::writeStimulus().

int write ( double &  intensity,
double  frequency,
double &  level 
)

Set intensity to intensity. The parameter frequency may be used for calculating the right attenuation level. In most cases frequency might be the carrier frequency of the signal. See intensityName(), intensityUnit(), intensityFormat(), frequencyName(), frequencyUnit(), and frequencyFormat() for the names and the corresponding units and formats of intensity and frequency. The function decibel() is used to calculate the attenuation level. This function might also define an intensity (in addition to MuteIntensity) for which the attenuator is muted. Since attenuators have a certain resolution, the actually set intensity may differ from the requested intensity intensity. The set intensity is returned in intensity and the set attenuation level in level. If you want to mute the output line, call mute().

Returns
  • 0 on success
  • NotOpen: The device driver for the attenuator is not open.
  • InvalidDevice: An invalid device index is requested, i.e. the requested output line is not supported by the attenuator device.
  • WriteError: Failed in setting the attenuation level.
  • Underflow: The requested attenuation level is too high, i.e. the requested signal amplitude is too small. In this case, the minimum possible intensity is returned.
  • Overflow: The requested attenuation level is too low, i.e. the requested signal amplitude is too large. In this case, the maximum possible intensity is returned.
  • IntensityUnderflow: The requested intensity is too small to be converted into an attenuation level by the decibel()-function. In this case, the minimum possible intensity is returned.
  • IntensityOverflow: The requested intensity is too large to be converted into an attenuation level by the decibel()-function. In this case, the maximum possible intensity is returned.
  • IntensityError: Another error occured during conversion of an intensity into an attenuation level by the decibel()-function.
See Also
testWrite(), mute(), attenuate(), intensityName(), intensityUnit(), intensityFormat(), frequencyName(), frequencyUnit(), frequencyFormat()

References Options::addNumber(), Attenuator::attenuate(), Options::clear(), Attenuate::decibel(), Attenuate::intensity(), Device::isOpen(), and Device::NotOpen.

int testWrite ( double &  intensity,
double  frequency,
double &  level 
)

Does the same as write() except setting the attenuator. Using this function it can be checked whether the intensities are valid and to what value the intensity will be actually adjusted.

Returns
  • 0 on success
  • NotOpen: The device driver for the attenuator is not open.
  • InvalidDevice: An invalid device index is requested, i.e. the requested output line is not supported by the attenuator device.
  • Underflow: The requested attenuation level is too high, i.e. the requested signal amplitude is too small. In this case, the minimum possible intensity is returned.
  • Overflow: The requested attenuation level is too low, i.e. the requested signal amplitude is too large. In this case, the maximum possible intensity is returned.
  • IntensityUnderflow: The requested intensity is too small to be converted into an attenuation level by the decibel()-function. In this case, the minimum possible intensity is returned.
  • IntensityOverflow: The requested intensity is too large to be converted into an attenuation level by the decibel()-function. In this case, the maximum possible intensity is returned.
  • IntensityError: Another error occured during conversion of an intensity into an attenuation level by the decibel()-function.
See Also
write(), testMute(), testAttenuate(), intensityName(), intensityUnit(), intensityFormat(), frequencyName(), frequencyUnit(), frequencyFormat()

References Attenuate::decibel(), Attenuate::intensity(), Device::isOpen(), Device::NotOpen, Attenuate::Overflow, Attenuator::testAttenuate(), and Attenuate::Underflow.

int mute ( void  )

Mute the output channel.

Returns
  • 0 on success
  • NotOpen: The device driver for the attenuator is not open.
  • InvalidDevice: An invalid device index is requested, i.e. the requested output line is not supported by the attenuator device.
  • WriteError: Failed in setting the attenuation level.
See Also
testMute(), write(), testWrite()

References Options::addText(), Options::clear(), Device::isOpen(), Attenuator::mute(), and Device::NotOpen.

int testMute ( void  )

Test muting the output channel.

Returns
  • 0 on success
  • NotOpen: The device driver for the attenuator is not open.
  • InvalidDevice: An invalid device index is requested, i.e. the requested output line is not supported by the attenuator device.
  • WriteError: Failed in setting the attenuation level.
See Also
mute(), write(), testWrite()

References Device::isOpen(), Device::NotOpen, and Attenuator::testMute().

int attenuate ( double &  level)

Set the attenuation level directly to level decibel. level can also be set to MuteAttenuationLevel for requesting to mute the attenuator. Returns the actually set level in level. In case the attenuator was muted, MuteAttenuationLevel is returned in level. If the requested attenuation level is too high or too low (Underflow or Overflow), then the maximum or minimum possible attenuation level is set and returned in level.

Returns
  • 0 on success
  • NotOpen: The device driver for the attenuator is not open.
  • InvalidDevice: An invalid device index is requested, i.e. the requested output line is not supported by the attenuator device.
  • WriteError: Failed in setting the attenuation level.
  • Underflow: The requested attenuation level is too high, i.e. the requested signal amplitude is too small.
  • Overflow: The requested attenuation level is too low, i.e. the requested signal amplitude is too large.
See Also
testAttenuate(), write(), mute()

References Attenuator::attenuate(), Options::clear(), Device::isOpen(), and Device::NotOpen.

int testAttenuate ( double &  level)

Tests setting the attenuation level directly to level decibel. level can also be set to MuteAttenuationLevel for requesting to mute the attenuator. Returns the level that would be set in level. In case the attenuator would be muted, MuteAttenuationLevel is returned in level. If the requested attenuation level is too high or too low (Underflow or Overflow), then the maximum or minimum possible attenuation level is returned in level.

Returns
  • 0 on success
  • NotOpen: The device driver for the attenuator is not open.
  • InvalidDevice: An invalid device index is requested, i.e. the requested output line is not supported by the attenuator device.
  • Underflow: The requested attenuation level is too high, i.e. the requested signal amplitude is too small.
  • Overflow: The requested attenuation level is too low, i.e. the requested signal amplitude is too large.
See Also
attenuate(), testWrite(), testMute()

References Device::isOpen(), Device::NotOpen, Attenuate::Overflow, Attenuator::testAttenuate(), and Attenuate::Underflow.

string intensityName ( void  ) const

The name of the intensity the specific implementation of Attenuate is using.

See Also
setIntensityName(), intensityUnit(), intensityFormat(), frequencyName(), write(), decibel()

Referenced by SaveFiles::RelacsFiles::openStimulusFiles(), and SaveFiles::writeStimulus().

void setIntensityName ( const string &  name)

Set the name of the intensity the specific implementation of Attenuate is using to name.

See Also
intensityName(), setIntensityUnit(), setIntensityFormat(), setFrequencyName(), write(), decibel()

References Options::name().

Referenced by Attenuate::open().

string intensityUnit ( void  ) const

The unit of the intensity the specific implementation of Attenuate is using.

See Also
setIntensityUnit(), intensityName(), intensityFormat(), frequencyUnit(), write(), decibel()

Referenced by SaveFiles::RelacsFiles::openStimulusFiles(), and SaveFiles::writeStimulus().

void setIntensityUnit ( const string &  unit)

Set the unit of the intensity the specific implementation of Attenuate is using to unit.

See Also
intensityUnit(), setIntensityName(), setIntensityFormat(), setFrequencyUnit(), write(), decibel()

References Options::unit().

Referenced by Attenuate::open().

string intensityFormat ( void  ) const

A C-style format string to be used for formatting the intensity the specific implementation of Attenuate is using.

See Also
setIntensityFormat(), intensityName(), intensityUnit(), frequencyFormat(), write(), decibel()

Referenced by SaveFiles::RelacsFiles::openStimulusFiles(), and SaveFiles::writeStimulus().

void setIntensityFormat ( const string &  format)

Set the format of the intensity the specific implementation of Attenuate is using to format.

See Also
intensityFormat(), setIntensityName(), setIntensityUnit(), setFrequencyFormat(), write(), decibel()

References Options::format().

Referenced by Attenuate::open().

string frequencyName ( void  ) const

The name of the frequency the specific implementation of Attenuate is using for computing the intensity. An empty frequencyName() indicates that a frequency is not used for the conversion of intensity in an attenuation level.

See Also
setFrequencyName(), frequencyUnit(), intensityName(), write(), decibel()

Referenced by SaveFiles::RelacsFiles::openStimulusFiles(), SaveFiles::writeStimulus(), and SaveFiles::RelacsFiles::writeStimulus().

void setFrequencyName ( const string &  name)

Set the name of the frequency the specific implementation of Attenuate is using for computing the intensity to name.

See Also
frequencyName(), setFrequencyUnit(), setIntensityName(), write(), decibel()

References Options::name().

Referenced by Attenuate::open().

string frequencyUnit ( void  ) const

The unit of the frequency the specific implementation of Attenuate is using for computing the intensity.

See Also
setFrequencyUnit(), frequencyName(), intensityUnit(), write(), decibel()

Referenced by SaveFiles::RelacsFiles::openStimulusFiles(), and SaveFiles::writeStimulus().

void setFrequencyUnit ( const string &  unit)

Set the unit of the frequency the specific implementation of Attenuate is using for computing the intensity to unit.

See Also
frequencyUnit(), setFrequencyName(), setIntensityUnit(), write(), decibel()

References Options::unit().

Referenced by Attenuate::open().

string frequencyFormat ( void  ) const

A C-style format string to be used for formatting the frequency the specific implementation of Attenuate is using for computing the intensity.

See Also
setFrequencyFormat(), frequencyName(), frequencyUnit(), intensityFormat(), write(), decibel()

Referenced by SaveFiles::RelacsFiles::openStimulusFiles(), and SaveFiles::writeStimulus().

void setFrequencyFormat ( const string &  format)

Set the format of the frequency the specific implementation of Attenuate is using for computing the intensity to format.

See Also
frequencyFormat(), setFrequencyName(), setFrequencyUnit(), setIntensityFormat(), write(), decibel()

References Options::format().

Referenced by Attenuate::open().

int aoChannel ( void  ) const

Returns the channel number of the analog output device which is attenuated by this instance of the Attenuate class.

See Also
setAOChannel(), aoDevice(), open()

Referenced by Attenuate::init().

void setAOChannel ( int  channel)

Set the channel number for the analog output device which should be attenuated by this instance of the Attenuate class to channel.

See Also
aoChannel(), setAODevice(), open()

Referenced by Acquire::addAttLine(), and Attenuate::open().

string aoDevice ( void  ) const

Returns the identifier string of the analog output device which is attenuated by this instance of the Attenuate class.

See Also
setAODevice(), aoChannel(), open()

Referenced by Acquire::addAttLine(), and Attenuate::init().

void setAODevice ( const string &  deviceid)

Set the identifier string for the analog output device which should be attenuated by this instance of the Attenuate class to channel.

See Also
aoDevice(), setAOChannel(), open()

Referenced by Acquire::addAttLine(), and Attenuate::open().

Attenuator * attenuator ( void  )

Returns the attenuator device that is used by this Attenuate class.

const Attenuator * attenuator ( void  ) const

Returns the attenuator device that is used by this Attenuate class.

bool noAttenuator ( void  ) const

Returns true if no attenuator is actually used.

virtual int decibel ( double  intensity,
double  frequency,
double &  db 
) const
protectedpure virtual

Transforms the requested intensity intensity for the carrier frequency frequency of the signal into an attenuation level db for the attenuator. This function is used by write() to set the attenuator to the requested intensity. The implementation of this function must set db to MuteAttenuationLevel in case intensity equals MuteIntensity. For certain other values of intensity db might be also set to MuteAttenuationLevel for muting the attenuator. If the computation of db fails, db should be set to a meaningful value.

Returns
  • 0 on success
  • IntensityUnderflow: The requested intensity is too small to be converted into an attenuation level. In this case, the attenuation db corresponding to the minimum possible intensity is returned.
  • IntensityOverflow: The requested intensity is too large to be converted into an attenuation level. In this case, the attenuation db corresponding to the maximum possible intensity is returned.
  • IntensityError: Another error occured during conversion of an intensity into an attenuation level.
See Also
write(), testWrite(), intensity(), intensityName(), intensityUnit(), intensityFormat(), frequencyName(), frequencyUnit(), frequencyFormat()

Referenced by Attenuate::testWrite(), and Attenuate::write().

virtual void intensity ( double &  intens,
double  frequency,
double  decibel 
) const
protectedpure virtual

Transform the attenuation level decibel for the carrier frequency frequency of the signal into the intensity intens. This function should be the inverse function of decibel() and is used by write() to return the actually set intensity from the set attenuation level. If the attenuator was muted (decibel equals MuteAttenuationLevel), intens is set to MuteIntensity.

See Also
write(), testWrite(), decibel(), intensityName(), intensityUnit(), intensityFormat(), frequencyName(), frequencyUnit(), frequencyFormat()

Referenced by Attenuate::intensities(), Attenuate::maxIntensity(), Attenuate::minIntensity(), Attenuate::testWrite(), and Attenuate::write().

void initOptions ( void  )
overrideprotectedvirtual

Initzializes default Attenuate options

Reimplemented from Device.

References Options::addInteger(), Options::addText(), and Device::initOptions().

Member Data Documentation

const double MuteAttenuationLevel = Attenuator::MuteAttenuationLevel
static

The attenuation level for which an outputline is muted.

Referenced by Acquire::directWrite(), and Acquire::write().

const double MuteIntensity = -1.0e37
static

The intensity for which an outputline is muted.

const int NotOpen = Attenuator::NotOpen
static

Return code indicating that the device driver is not opened.

Referenced by Attenuate::open().

const int InvalidDevice = Attenuator::InvalidDevice
static

Return code indicating an invalid output line of the attenuator.

Referenced by Attenuate::open().

const int ReadError = Device::ReadError
static

Return code indicating a failure in reading the attenuation level from the device.

Referenced by DaqError::addAttError().

const int WriteError = Device::WriteError
static

Return code indicating a failure in writing the attenuation level to the device.

const int Underflow = Attenuator::Underflow
static

Return code indicating a too high requested attenuation level, i.e. the requested signal amplitude is too small.

Referenced by Attenuate::testAttenuate(), and Attenuate::testWrite().

const int Overflow = Attenuator::Overflow
static

Return code indicating a too low requested attenuation level, i.e. the requested signal amplitude is too large.

Referenced by Attenuate::testAttenuate(), and Attenuate::testWrite().

const int IntensityUnderflow = -7
static

Return code indicating an underflow in calculating the level, i.e. the requested intensity is too small.

const int IntensityOverflow = -8
static

Return code indicating an overflow in calculating the level, i.e. the requested intensity is too large.

const int IntensityError = -9
static

Return code indicating an unspecific error in calculating the level.

Referenced by DaqError::addAttError().


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