Public Member Functions | Protected Member Functions | Friends

JcampDxBlock Class Reference
[JCAMP-DX implementation (odinpara library)]

#include <jdxblock.h>

Inheritance diagram for JcampDxBlock:
Inheritance graph
[legend]

List of all members.

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

Protected Member Functions

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

Friends

class JDXwidget

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::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'

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.

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

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.

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'.

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.

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


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