ODIN
Public Member Functions | Protected Member Functions | Friends | List of all members

#include <ldrblock.h>

Inheritance diagram for LDRblock:
Inheritance graph
[legend]

Public Member Functions

 LDRblock (const STD_string &title="Parameter List")
 
 LDRblock (const LDRblock &block)
 
 ~LDRblock ()
 
LDRblockoperator= (const LDRblock &block)
 
LDRblockmerge (LDRblock &block, bool onlyUserPars=true)
 
LDRblockunmerge (LDRblock &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, const LDRserBase &serializer=LDRserJDX())
 
unsigned int numof_pars () const
 
LDRbaseget_parameter (const STD_string &ldrlabel)
 
bool parameter_exists (const STD_string &ldrlabel) const
 
LDRblockset_prefix (const STD_string &prefix)
 
LDRblockset_embedded (bool embedded)
 
bool is_embedded () const
 
LDRbaseoperator[] (unsigned int i)
 
const LDRbaseoperator[] (unsigned int i) const
 
LDRbaseget_parameter_by_id (int id)
 
LDRblockcreate_copy (const LDRblock &src)
 
LDRblockappend_copy (const LDRbase &src)
 
LDRblockcopy_ldr_vals (const LDRblock &src)
 
bool operator== (const LDRblock &rhs) const
 
bool operator< (const LDRblock &rhs) const
 
bool compare (const LDRblock &rhs, const STD_list< STD_string > *exclude=0, double accuracy=0.0) const
 
STD_string print (const LDRserBase &serializer=LDRserJDX()) const
 
LDRbaseset_parmode (parameterMode parameter_mode)
 
LDRbaseset_filemode (fileMode file_mode)
 
STD_string get_parx_code (parxCodeType type) const
 
STD_ostream & print2stream (STD_ostream &os, const LDRserBase &serializer) const
 
bool parsevalstring (const STD_string &, const LDRserBase *ser=0)
 
bool parse (STD_string &parstring, const LDRserBase &serializer)
 
STD_string printvalstring (const LDRserBase *ser=0) const
 
LDRbasecreate_copy () const
 
STD_string get_typeInfo (bool parx_equivtype=false) const
 
int load (const STD_string &filename, const LDRserBase &serializer=LDRserJDX())
 
int write (const STD_string &filename, const LDRserBase &serializer=LDRserJDX()) const
 
- Public Member Functions inherited from LDRbase
virtual double get_minval () const
 
virtual double get_maxval () const
 
bool has_minmax () const
 
const STD_string & get_description () const
 
LDRbaseset_description (const STD_string &descr)
 
virtual svector get_alternatives () const
 
const STD_string & get_unit () const
 
LDRbaseset_unit (const STD_string &un)
 
virtual parameterMode get_parmode () const
 
virtual fileMode get_filemode () const
 
virtual GuiProps get_gui_props () const
 
virtual LDRbaseset_gui_props (const GuiProps &)
 
JcampDxProps get_jdx_props () const
 
LDRbaseset_jdx_props (const JcampDxProps &jp)
 
- 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

LDRblockappend_member (LDRbase &ldr, const STD_string ldrlabel="")
 

Friends

class LDRwidget
 

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 ldrblock.h.

Constructor & Destructor Documentation

◆ LDRblock() [1/2]

LDRblock::LDRblock ( const STD_string &  title = "Parameter List")

Constructs an empty block of parameters with the label 'title'

◆ LDRblock() [2/2]

LDRblock::LDRblock ( const LDRblock block)

Copy constructor

◆ ~LDRblock()

LDRblock::~LDRblock ( )

Destructor

Member Function Documentation

◆ append_copy()

LDRblock& LDRblock::append_copy ( const LDRbase src)

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

◆ append_member()

LDRblock& LDRblock::append_member ( LDRbase ldr,
const STD_string  ldrlabel = "" 
)
protected

Use this functions to append members of derived classes

◆ compare()

bool LDRblock::compare ( const LDRblock 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'.

◆ copy_ldr_vals()

LDRblock& LDRblock::copy_ldr_vals ( const LDRblock src)

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

◆ create_copy() [1/2]

LDRbase* LDRblock::create_copy ( ) const
inlinevirtual

Returns a deep copy of the parameter

Implements LDRbase.

Definition at line 233 of file ldrblock.h.

◆ create_copy() [2/2]

LDRblock& LDRblock::create_copy ( const LDRblock src)

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

◆ get_parameter()

LDRbase* LDRblock::get_parameter ( const STD_string &  ldrlabel)

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

◆ get_parameter_by_id()

LDRbase& LDRblock::get_parameter_by_id ( int  id)

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

◆ get_parx_code()

STD_string LDRblock::get_parx_code ( parxCodeType  type) const
virtual

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

Reimplemented from LDRbase.

◆ get_typeInfo()

STD_string LDRblock::get_typeInfo ( bool  parx_equivtype = false) const
inlinevirtual

Returns a string describing the type of the parameter. If 'parx_equivtype' is 'true', returns the equivalent PARX parameter type

Implements LDRbase.

Definition at line 234 of file ldrblock.h.

◆ is_embedded()

bool LDRblock::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 ldrblock.h.

◆ load()

int LDRblock::load ( const STD_string &  filename,
const LDRserBase serializer = LDRserJDX() 
)
virtual

Loads the parameter(s) from a file using format 'serializer'. 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 LDRbase.

Reimplemented in OdinPulse, and Sample.

◆ merge()

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

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

◆ numof_pars()

unsigned int LDRblock::numof_pars ( ) const

Returns the current number of parameters in the block

◆ operator<()

bool LDRblock::operator< ( const LDRblock 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 ldrblock.h.

◆ operator=()

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

Assignment operator

◆ operator==()

bool LDRblock::operator== ( const LDRblock 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 ldrblock.h.

◆ operator[]() [1/2]

LDRbase& LDRblock::operator[] ( unsigned int  i)

Returns the i'th parameter in the block

◆ operator[]() [2/2]

const LDRbase& LDRblock::operator[] ( unsigned int  i) const

Returns the const i'th parameter in the block

◆ parameter_exists()

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

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

◆ parse()

bool LDRblock::parse ( STD_string &  parstring,
const LDRserBase serializer 
)
virtual

Parses the parameter using format 'serializer'. For blocks, a re-implemented 'parse' function is called. Returns 'true' if the parameter was parsed successfully.

Reimplemented from LDRbase.

◆ parseblock()

int LDRblock::parseblock ( const STD_string &  source,
const LDRserBase serializer = LDRserJDX() 
)

Parse values of this block from the string 'src' using format 'serializer', returns the number of parameters successfully parsed.

◆ parseval()

bool LDRblock::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.

◆ parsevalstring()

bool LDRblock::parsevalstring ( const STD_string &  ,
const LDRserBase ser = 0 
)
inlinevirtual

Parses and assigns the value in the given string, optionally using format 'ser'

Implements LDRbase.

Definition at line 230 of file ldrblock.h.

◆ print()

STD_string LDRblock::print ( const LDRserBase serializer = LDRserJDX()) const
virtual

This function returns the parameter in ASCII using format 'serializer'

Reimplemented from LDRbase.

◆ print2stream()

STD_ostream& LDRblock::print2stream ( STD_ostream &  os,
const LDRserBase serializer 
) const
virtual

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

Reimplemented from LDRbase.

◆ printval()

STD_string LDRblock::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'.

◆ printvalstring()

STD_string LDRblock::printvalstring ( const LDRserBase ser = 0) const
inlinevirtual

Returns the value of the parameter as a string, optionally using format 'ser'

Implements LDRbase.

Definition at line 232 of file ldrblock.h.

◆ set_embedded()

LDRblock& LDRblock::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 ldrblock.h.

◆ set_filemode()

LDRbase& LDRblock::set_filemode ( fileMode  file_mode)
virtual

Sets the fileMode

Reimplemented from LDRbase.

◆ set_parmode()

LDRbase& LDRblock::set_parmode ( parameterMode  parameter_mode)
virtual

Sets the parameterMode

Reimplemented from LDRbase.

◆ set_prefix()

LDRblock& LDRblock::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.

◆ unmerge()

LDRblock& LDRblock::unmerge ( LDRblock block)

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

◆ write()

int LDRblock::write ( const STD_string &  filename,
const LDRserBase serializer = LDRserJDX() 
) const
virtual

Writes the parameter(s) to file using format 'serializer'. 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 LDRbase.


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