FEDEM Model Database  R8.0
Source code of the FEDEM model database
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
FiDACFile Class Reference

#include <FiDACFile.H>

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

Public Member Functions

 FiDACFile (const char *devicename=NULL, Endianness format=LittleEndian)
 
virtual size_t getValueCount () const
 Returns the number of (x,y) pairs for this device. More...
 
virtual void getValueRange (double &min, double &max) const
 Calculates the function value range for this device. More...
 
virtual double getXAxisOrigin () const
 Returns the function argument origin for this device. More...
 
virtual double getValue (double x, int=0, bool zeroAdjust=false, double vertShift=0.0, double scaleFac=1.0)
 Evaluates the function for a given x value. More...
 
virtual bool getValues (double x0, double x1, Doubles &x, Doubles &y, int channel=0, bool zeroAdjust=false, double shift=0.0, double scale=1.0)
 Evaluates the function at all points within specified interval. More...
 
virtual void getRawData (Doubles &x, Doubles &y, double minX=0.0, double maxX=-1.0, int=0)
 Extracts all function data point values within specified interval. More...
 
virtual void setValue (double x, double y)
 Assigns a function value for a single-channel function. More...
 
virtual bool setData (const Doubles &x, const Doubles &y)
 Adds a complete set of x,y-pair values for a new channel. More...
 
- Public Member Functions inherited from FiDeviceFunctionBase
virtual ~FiDeviceFunctionBase ()
 The destructor closes the device function file. More...
 
bool open (const char *devicename, FileStatus status=Read_Only)
 Opens the specified device function file for reading or writing. More...
 
bool open (FileStatus status=Read_Only)
 Opens the file myDatasetDevice for reading or writing. More...
 
bool close (bool noHeader=false)
 Closes the device function file. More...
 
const std::string & getDevicename () const
 Returns the myDatasetDevice of this device function. More...
 
void setExtrapolationPolicy (InterpolationPolicy policy=Constant)
 Defines the extrapolation policy to be used. More...
 
void setInterpolationPolicy (InterpolationPolicy policy=Linear)
 Defines the interpolation policy to be used. More...
 
virtual bool getChannelList (Strings &)
 Gets the list channel names for a multi-channel device. More...
 
virtual bool isChannelPresentInFile (int)
 Checks if an indexed channel is present in the device. More...
 
virtual int isChannelPresentInFile (const std::string &)
 Checks if a nameed channel is present in the device. More...
 
virtual void setTimeSpan (double)
 Sets the maximum time span for the device function. More...
 
virtual void setPrecision (int)
 Sets the precision to be used when writing the device to file. More...
 
virtual void getData (Doubles &x, Doubles &y, const std::string &, double minX=0.0, double maxX=-1.0)
 Extracts all function data point values within specified interval. More...
 
double integrate (double x, int order=1, int channel=0, double vertShift=0.0, double scaleFac=1.0)
 Computes the integral of this device over the interval [0,x]. More...
 
int getRefCount () const
 Returns the current reference count for this device. More...
 
int ref ()
 Increments the reference count fir this device. More...
 
int unref ()
 Decrements the reference count for this device. More...
 
double getStep () const
 returns the constant sampling time increment. More...
 
double getFrequency () const
 returns the constant sampling frequency. More...
 
void setStep (double aStep)
 Sets the sampling increment for devices with constant sampling. More...
 
void setFrequency (double aFreqency)
 Sets the sampling frequency for devices with constant sampling. More...
 
virtual void setDescription (const std::string &)
 Assigns a name to the (last) channel in the device. More...
 
virtual void setEmptyChannel (const std::string &)
 Flags an empty channel for multi-channel devices. More...
 
void setParent (const std::string &modelfile)
 Sets the model file name associated with this device. More...
 
bool isReadOnly () const
 Returns whether this is a read-only device or not. More...
 
FileStatus getFileStatus () const
 Returns the myFileStatus of this device function. More...
 
void getAxisUnit (int axis, char *unitText, size_t n) const
 Gets the axis unit. More...
 
void getAxisTitle (int axis, char *titleText, size_t n) const
 Gets the axis title. More...
 
void setAxisUnit (int axis, const char *unitText)
 Sets the axis unit. More...
 
void setAxisTitle (int axis, const char *titleText)
 Sets the axis title. More...
 

Protected Member Functions

virtual bool initialDeviceRead ()
 Reads the file content, or at least its meta data. More...
 
virtual bool preliminaryDeviceWrite ()
 Writes the meta data for this device function to file. More...
 
virtual bool concludingDeviceWrite (bool)
 Writes the content of this device function to file. More...
 
void updateStatistics (double val)
 
- Protected Member Functions inherited from FiDeviceFunctionBase
 FiDeviceFunctionBase (const char *devicename=NULL)
 The default constructor initialize the data members. More...
 
 FiDeviceFunctionBase (const FiDeviceFunctionBase &)=delete
 Deleted copy constructor. More...
 
FiDeviceFunctionBase & operator= (const FiDeviceFunctionBase &)=delete
 Deleted assignment operator. More...
 
double interpolate (double x, double x0, double f0, double x1, double f1) const
 Calculates the function value at x by interpolation. More...
 
double extrapolate (double x, double x0, double f0, double x1, double f1) const
 Calculates the function value at x by extrapolation. More...
 
bool writeString (const char *str)
 Convenience method for a writing text header. More...
 
bool writeString (const char *lab, const std::string &val)
 Convenience method for writing text headers. More...
 

Protected Attributes

unsigned long myNumDatavals
 
double myXaxisOrigin
 
double myFirstReadValue
 
double myLastXVal
 
double myLastYVal
 
double myMean
 
double myMS
 
double myMaxVal
 
double myMinVal
 
unsigned long maxPos
 
unsigned long minPos
 
- Protected Attributes inherited from FiDeviceFunctionBase
FT_FILE myFile
 File handle of this device function. More...
 
std::string myParent
 Name of FEDEM model that owns this function. More...
 
std::string myDatasetDevice
 Name of file associated with myFile. More...
 
Endianness myOutputEndian
 Endianness assumed for binary output. More...
 
Endianness myInputEndian
 Endianness assumed for binary input. More...
 
double myStep
 Time series information. More...
 
std::array< AxisInfo, 2 > myAxisInfo
 

Private Member Functions

double getValueAt (unsigned long pos)
 
float readFloat (int pos)
 
short readInt16 (int pos)
 
int readInt32 (int pos)
 
std::string readString (int start, int end, int startOffset=0, int endoffset=0)
 
void writeFloat (int pos, float val)
 
void writeInt16 (int pos, int val)
 
void writeInt32 (int pos, int val)
 
int writeString (int start, int end, const std::string &val, int startOffset=0, int endoffset=0)
 

Private Attributes

bool isDataWriteInited
 

Additional Inherited Members

- Public Types inherited from FiDeviceFunctionBase
enum  Endianness { LittleEndian , BigEndian }
 Enumerator for endianness values. More...
 
enum  FileFormat { ascii , binary }
 Enumerator for the file formats. More...
 
enum  FileStatus { Not_Loaded =-1 , Not_Open =0 , Read_Only =1 , Write_Only =2 }
 Enumerator for file opening statuses. More...
 
enum  InterpolationPolicy { Constant , Linear , Previous_Value , Next_Value }
 Enumerator for interpolation and extrapolation policies. More...
 
- Protected Types inherited from FiDeviceFunctionBase
using Doubles = std::vector< double >
 Convenience type alias. More...
 
using Strings = std::vector< std::string >
 Convenience type alias. More...
 
- Static Protected Attributes inherited from FiDeviceFunctionBase
static Endianness myMachineEndian
 Endianness for the running computer. More...
 

Constructor & Destructor Documentation

◆ FiDACFile()

FiDACFile::FiDACFile ( const char *  devicename = NULL,
Endianness  format = LittleEndian 
)
explicit

Member Function Documentation

◆ concludingDeviceWrite()

bool FiDACFile::concludingDeviceWrite ( bool  noHeader)
protectedvirtual

Writes the content of this device function to file.

Implements FiDeviceFunctionBase.

◆ getRawData()

void FiDACFile::getRawData ( Doubles &  x,
Doubles &  y,
double  minX = 0.0,
double  maxX = -1.0,
int  channel = 0 
)
virtual

Extracts all function data point values within specified interval.

Implements FiDeviceFunctionBase.

◆ getValue()

double FiDACFile::getValue ( double  x,
int  channel = 0,
bool  zeroAdjust = false,
double  vertShift = 0.0,
double  scaleFac = 1.0 
)
virtual

Evaluates the function for a given x value.

Implements FiDeviceFunctionBase.

◆ getValueAt()

double FiDACFile::getValueAt ( unsigned long  pos)
private

◆ getValueCount()

virtual size_t FiDACFile::getValueCount ( ) const
inlinevirtual

Returns the number of (x,y) pairs for this device.

Implements FiDeviceFunctionBase.

◆ getValueRange()

void FiDACFile::getValueRange ( double &  mn,
double &  mx 
) const
virtual

Calculates the function value range for this device.

Reimplemented from FiDeviceFunctionBase.

◆ getValues()

bool FiDACFile::getValues ( double  x0,
double  x1,
Doubles &  x,
Doubles &  y,
int  channel = 0,
bool  zeroAdjust = false,
double  shift = 0.0,
double  scale = 1.0 
)
virtual

Evaluates the function at all points within specified interval.

Implements FiDeviceFunctionBase.

◆ getXAxisOrigin()

virtual double FiDACFile::getXAxisOrigin ( ) const
inlinevirtual

Returns the function argument origin for this device.

Reimplemented from FiDeviceFunctionBase.

◆ initialDeviceRead()

bool FiDACFile::initialDeviceRead ( )
protectedvirtual

Reads the file content, or at least its meta data.

Implements FiDeviceFunctionBase.

◆ preliminaryDeviceWrite()

bool FiDACFile::preliminaryDeviceWrite ( )
protectedvirtual

Writes the meta data for this device function to file.

Implements FiDeviceFunctionBase.

◆ readFloat()

float FiDACFile::readFloat ( int  pos)
private

◆ readInt16()

short FiDACFile::readInt16 ( int  pos)
private

◆ readInt32()

int FiDACFile::readInt32 ( int  pos)
private

◆ readString()

std::string FiDACFile::readString ( int  start,
int  end,
int  startOffset = 0,
int  endoffset = 0 
)
private

◆ setData()

bool FiDACFile::setData ( const Doubles &  x,
const Doubles &  y 
)
virtual

Adds a complete set of x,y-pair values for a new channel.

Implements FiDeviceFunctionBase.

◆ setValue()

void FiDACFile::setValue ( double  x,
double  y 
)
virtual

Assigns a function value for a single-channel function.

Implements FiDeviceFunctionBase.

◆ updateStatistics()

void FiDACFile::updateStatistics ( double  val)
protected

◆ writeFloat()

void FiDACFile::writeFloat ( int  pos,
float  val 
)
private

◆ writeInt16()

void FiDACFile::writeInt16 ( int  pos,
int  val 
)
private

◆ writeInt32()

void FiDACFile::writeInt32 ( int  pos,
int  val 
)
private

◆ writeString()

int FiDACFile::writeString ( int  start,
int  end,
const std::string &  val,
int  startOffset = 0,
int  endoffset = 0 
)
private

Member Data Documentation

◆ isDataWriteInited

bool FiDACFile::isDataWriteInited
private

◆ maxPos

unsigned long FiDACFile::maxPos
protected

◆ minPos

unsigned long FiDACFile::minPos
protected

◆ myFirstReadValue

double FiDACFile::myFirstReadValue
protected

◆ myLastXVal

double FiDACFile::myLastXVal
protected

◆ myLastYVal

double FiDACFile::myLastYVal
protected

◆ myMaxVal

double FiDACFile::myMaxVal
protected

◆ myMean

double FiDACFile::myMean
protected

◆ myMinVal

double FiDACFile::myMinVal
protected

◆ myMS

double FiDACFile::myMS
protected

◆ myNumDatavals

unsigned long FiDACFile::myNumDatavals
protected

◆ myXaxisOrigin

double FiDACFile::myXaxisOrigin
protected

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