Public Member Functions | Protected Member Functions | Friends | List of all members
JcampDxBlock Class Reference

#include <jdxblock.h>

Inheritance diagram for JcampDxBlock:
Inheritance graph
[legend]

Public Member Functions

 JcampDxBlock (const STD_string &title="Parameter List", compatMode mode=notBroken)
 JcampDxBlock (const JcampDxBlock &block)
 ~JcampDxBlock ()
JcampDxBlockoperator= (const JcampDxBlock &block)
JcampDxBlockmerge (JcampDxBlock &block, bool onlyUserPars=true)
JcampDxBlockunmerge (JcampDxBlock &block)
STD_string printval (const STD_string &parameterName, bool append_unit=false) const
bool parseval (const STD_string &parameterName, const STD_string &value)
int parseblock (const STD_string &source)
unsigned int numof_pars () const
JcampDxClassget_parameter (const STD_string &ldrlabel)
bool parameter_exists (const STD_string &ldrlabel) const
JcampDxBlockset_prefix (const STD_string &prefix)
JcampDxBlockset_embedded (bool embedded)
bool is_embedded () const
JcampDxClassoperator[] (unsigned int i)
const JcampDxClassoperator[] (unsigned int i) const
JcampDxClassget_parameter_by_id (int id)
JcampDxBlockcreate_copy (const JcampDxBlock &src)
JcampDxBlockappend_copy (const JcampDxClass &src)
JcampDxBlockcopy_ldr_vals (const JcampDxBlock &src)
bool operator== (const JcampDxBlock &rhs) const
bool operator< (const JcampDxBlock &rhs) const
bool compare (const JcampDxBlock &rhs, const STD_list< STD_string > *exclude=0, double accuracy=0.0) const
STD_string print () const
JcampDxClassset_compatmode (compatMode compat_mode)
JcampDxClassset_parmode (parameterMode parameter_mode)
JcampDxClassset_filemode (fileMode file_mode)
STD_string get_parx_code (parxCodeType type, const ParxEquiv &equiv=ParxEquiv()) const
STD_ostream & print2stream (STD_ostream &os) const
bool parsevalstring (const STD_string &)
bool parse (STD_string &parstring)
STD_string printvalstring () const
JcampDxClasscreate_copy () const
const char * get_typeInfo () const
int load (const STD_string &filename)
int write (const STD_string &filename) const
- Public Member Functions inherited from JcampDxClass
virtual compatMode get_compatmode () const
virtual double get_minval () const
virtual double get_maxval () const
bool has_minmax () const
JcampDxClassset_userDefParameter (bool userDef)
bool isUserDefParameter () const
const STD_string & get_description () const
JcampDxClassset_description (const STD_string &descr)
virtual svector get_alternatives () const
const STD_string & get_unit () const
JcampDxClassset_unit (const STD_string &un)
virtual parameterMode get_parmode () const
virtual fileMode get_filemode () const
virtual GuiProps get_gui_props () const
virtual JcampDxClassset_gui_props (const GuiProps &)
virtual ParxEquiv get_parx_equiv () const
- Public Member Functions inherited from Labeled
 Labeled (const STD_string &label="unnamed")
Labeledset_label (const STD_string &label)
const STD_string & get_label () const
Labeledoperator= (const Labeled &l)
- Public Member Functions inherited from List< I, P, R >
 List ()
 ~List ()
Listoperator= (const List &l)
Listclear ()
Listappend (R item)
Listremove (R item)
unsigned int size () const
iter get_begin ()
iter get_end ()
constiter get_const_begin () const
constiter get_const_end () const

Protected Member Functions

JcampDxBlockappend_member (JcampDxClass &ldr, const STD_string ldrlabel="")

Friends

class JDXwidget

Additional Inherited Members

- Public Types inherited from List< I, P, R >
typedef STD_list< P >::iterator iter
typedef STD_list< P >
::const_iterator 
constiter

Detailed Description

This class represents a block of parameters. Parameters can be added or removed from the list of parameters within the block. The whole block may be written to or read from a file.

Definition at line 42 of file jdxblock.h.

Constructor & Destructor Documentation

JcampDxBlock::JcampDxBlock ( const STD_string &  title = "Parameter List",
compatMode  mode = notBroken 
)

Constructs an empty block of parameters with the label 'title' and the specified mode

JcampDxBlock::JcampDxBlock ( const JcampDxBlock block)

Copy constructor

JcampDxBlock::~JcampDxBlock ( )

Destructor

Member Function Documentation

JcampDxBlock& JcampDxBlock::append_copy ( const JcampDxClass src)

Appends a deep copy of src (not a reference). This copy will be deleted automatically upon destruction.

JcampDxBlock& JcampDxBlock::append_member ( JcampDxClass ldr,
const STD_string  ldrlabel = "" 
)
protected

Use this functions to append members of derived classes

bool JcampDxBlock::compare ( const JcampDxBlock rhs,
const STD_list< STD_string > *  exclude = 0,
double  accuracy = 0.0 
) const

Equivalent to operator <. In addition, a list of parameters can be given in 'exclude' which are excluded from the comparison. When comparing float or double numbers, parametrs are considered equal if they differe by no more than the given 'accuracy'.

JcampDxBlock& JcampDxBlock::copy_ldr_vals ( const JcampDxBlock src)

Copy parameter values from 'src' to the equivalent parameters in this block

JcampDxBlock& JcampDxBlock::create_copy ( const JcampDxBlock src)

Makes this become a copy of 'src', including its parameters by creating temporary objects. These temporary objects will be deleted automatically upon destruction.

JcampDxClass* JcampDxBlock::create_copy ( ) const
inlinevirtual

Returns a deep copy of the parameter

Implements JcampDxClass.

Definition at line 234 of file jdxblock.h.

JcampDxClass* JcampDxBlock::get_parameter ( const STD_string &  ldrlabel)

Returns a pointer to parameter 'label', or zero if not found

JcampDxClass& JcampDxBlock::get_parameter_by_id ( int  id)

Returns the first parameter in the block with the given 'id'

STD_string JcampDxBlock::get_parx_code ( parxCodeType  type,
const ParxEquiv equiv = ParxEquiv() 
) const
virtual

Returns C code that can be used together with the PARX(Bruker) compiler.

Reimplemented from JcampDxClass.

const char* JcampDxBlock::get_typeInfo ( ) const
inlinevirtual

Returns a string describing the type of the parameter

Implements JcampDxClass.

Definition at line 235 of file jdxblock.h.

bool JcampDxBlock::is_embedded ( ) const
inline

Returns whether the block's widget will be displayed in a subwidget or an 'Edit' button that will open a subdialog is generated

Definition at line 147 of file jdxblock.h.

int JcampDxBlock::load ( const STD_string &  filename)
virtual

Loads the parameter(s) from a JCAMP-DX file. In case of calling this function of a single paramter, the file is searched for this parameter and the value is assigned. In case of a parameter block, all parameter values are taken from the file. The return value is the number of parameters which are successfully parsed. If an error occurs, -1 is returned.

Reimplemented from JcampDxClass.

Reimplemented in OdinPulse, Sample, and ImageSet.

JcampDxBlock& JcampDxBlock::merge ( JcampDxBlock block,
bool  onlyUserPars = true 
)

Merges all parameters found in the specified 'block' into this block

unsigned int JcampDxBlock::numof_pars ( ) const

Returns the current number of parameters in the block

bool JcampDxBlock::operator< ( const JcampDxBlock rhs) const
inline

Comparison operator which

  • (1st) compares number of parameters
  • (2nd) the type of parameters existing in both blocks
  • (3rd) the value of parameters existing in both blocks

Definition at line 201 of file jdxblock.h.

JcampDxBlock& JcampDxBlock::operator= ( const JcampDxBlock block)

Assignment operator

bool JcampDxBlock::operator== ( const JcampDxBlock rhs) const
inline

Compares 'rhs' with 'this' with respect to whether all parameters with the same label mutually exist in the other block and whether these parameters have the same type, label and value.

Definition at line 191 of file jdxblock.h.

JcampDxClass& JcampDxBlock::operator[] ( unsigned int  i)

Returns the i'th parameter in the block

const JcampDxClass& JcampDxBlock::operator[] ( unsigned int  i) const

Returns the const i'th parameter in the block

bool JcampDxBlock::parameter_exists ( const STD_string &  ldrlabel) const

Returns true if a parameter with the given label already exists in the block

bool JcampDxBlock::parse ( STD_string &  parstring)
virtual

Parses the JCAMP-DX parameter. Except for blocks, this is done by stripping the label (e.g. "##$MyParameter=" ) from the string and passing the result to the function 'parsevalstring' of the underlying data type. For blocks, a re-implemented 'parse' function is called. Returns 'true' if the parameter was parsed successfully.

Reimplemented from JcampDxClass.

int JcampDxBlock::parseblock ( const STD_string &  source)

Parse values of thius block from the string 'src' in JCAMP-DX format, returns the number of parameters sucessfully parsed.

bool JcampDxBlock::parseval ( const STD_string &  parameterName,
const STD_string &  value 
)

Set the value of the parameter that has the label 'parameterName' to 'value'. Returns 'true' if sucessful.

bool JcampDxBlock::parsevalstring ( const STD_string &  )
inlinevirtual

Parses and assigns the value in the given string

Implements JcampDxClass.

Definition at line 231 of file jdxblock.h.

STD_string JcampDxBlock::print ( ) const
virtual

This function returns the parameter in JcampDx-ASCII-format

Reimplemented from JcampDxClass.

STD_ostream& JcampDxBlock::print2stream ( STD_ostream &  os) const
virtual

Passes the parameter in ASCII format to the ostream 'os'

Reimplemented from JcampDxClass.

STD_string JcampDxBlock::printval ( const STD_string &  parameterName,
bool  append_unit = false 
) const

Print the value of the parameter that has the label 'parameterName' as a formated string. If applicable, append the unit of the number in case 'append_unit' is set to 'true'.

STD_string JcampDxBlock::printvalstring ( ) const
inlinevirtual

Returns the value of the parameter as a string

Implements JcampDxClass.

Definition at line 233 of file jdxblock.h.

JcampDxClass& JcampDxBlock::set_compatmode ( compatMode  compat_mode)
virtual

Sets the compatability mode. See the documentation to 'compatMode'

Reimplemented from JcampDxClass.

JcampDxBlock& JcampDxBlock::set_embedded ( bool  embedded)
inline

If embedded is true, the block's widget will be displayed in a subwidget otherwise an 'Edit' button that will open a subdialog is generated

Definition at line 140 of file jdxblock.h.

JcampDxClass& JcampDxBlock::set_filemode ( fileMode  file_mode)
virtual

Sets the fileMode

Reimplemented from JcampDxClass.

JcampDxClass& JcampDxBlock::set_parmode ( parameterMode  parameter_mode)
virtual

Sets the parameterMode

Reimplemented from JcampDxClass.

JcampDxBlock& JcampDxBlock::set_prefix ( const STD_string &  prefix)

Prefixes all parameters labels with the given string. If the prefix is already at the beginning of the label, it is not added again.

JcampDxBlock& JcampDxBlock::unmerge ( JcampDxBlock block)

Removes all parameters found in the specified 'block' from this block

int JcampDxBlock::write ( const STD_string &  filename) const
virtual

Writes the parameter(s) to a JCAMP-DX file. In case of calling this function of a single paramter, the file will consist of only this parameter. In case of a parameter block, all parameter values are written to the file. If an error occurs, -1 is returned.

Reimplemented from JcampDxClass.

Reimplemented in OdinPulse.


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