The SKIRT project
advanced radiative transfer for astrophysics
Public Member Functions | Private Member Functions | List of all members
AbstractDoublePropertyHandler Class Reference

#include <AbstractDoublePropertyHandler.hpp>

Inheritance diagram for AbstractDoublePropertyHandler:
Inheritance graph
[legend]

Public Member Functions

bool isInRange (const vector< double > &value) const
 
bool isInRange (double value) const
 
bool isValidDouble (string value) const
 
bool isValidDoubleList (string value) const
 
 PropertyHandler (const PropertyHandler &)=delete
 
 PropertyHandler (Item *target, const PropertyDef *property, const SchemaDef *schema, NameManager *nameMgr)
 
string quantity () const
 
string rangeDescription () const
 
double toDouble (string value) const
 
vector< double > toDoubleList (string value) const
 
string toString (double value) const
 
string toString (vector< double > value) const
 
- Public Member Functions inherited from PropertyHandler
 PropertyHandler (const PropertyHandler &)=delete
 
 PropertyHandler (Item *target, const PropertyDef *property, const SchemaDef *schema, NameManager *nameMgr)
 
virtual ~PropertyHandler ()=default
 
virtual void acceptVisitor (PropertyHandlerVisitor *visitor)=0
 
virtual vector< Item * > children () const
 
bool hasChanged () const
 
bool hasDefaultValue () const
 
virtual void insertNames ()=0
 
virtual bool isCompound () const
 
bool isConfigured ()
 
bool isConfiguredByUser ()
 
bool isDisplayed () const
 
bool isRelevant () const
 
bool isRequired () const
 
bool isSilent () const
 
virtual bool isValidValue (string value) const =0
 
string name () const
 
NameManagernameManager () const
 
PropertyHandleroperator= (const PropertyHandler &)=delete
 
void rebuildNames ()
 
Itemroot () const
 
const SchemaDefschema () const
 
void setConfiguredByUser (bool valid=true)
 
void setConfiguredToDefault ()
 
void setNotConfigured ()
 
string title () const
 
string type () const
 

Private Member Functions

bool maxOpen () const
 
double maxValue () const
 
bool minOpen () const
 
double minValue () const
 
string unitStyle () const
 
string unitSystem () const
 

Additional Inherited Members

- Protected Member Functions inherited from PropertyHandler
const PropertyDefproperty () const
 
void setChanged ()
 
Itemtarget () const
 

Detailed Description

AbstractDoublePropertyHandler serves as an abstract base class for handling SMILE data item properties of floating point types with an optional unit specification. It offers common functionality for derived classes supporting a single floating point value (DoublePropertyHandler) or a list of values (DoubleListPropertyHandler).

Member Function Documentation

◆ isInRange() [1/2]

bool AbstractDoublePropertyHandler::isInRange ( const vector< double > &  value) const

Returns true if all values in the given double list are finite and within the permitted value range for the handled property, and false otherwise.

◆ isInRange() [2/2]

bool AbstractDoublePropertyHandler::isInRange ( double  value) const

Returns true if the given double value is finite and within the permitted value range for the handled property, and false otherwise.

◆ isValidDouble()

bool AbstractDoublePropertyHandler::isValidDouble ( string  value) const

Returns true if the specified string is non-empty and contains a valid string representation of a floating point number with an optional unit specification. Otherwise returns false. If present, the unit specification must follow the number, separated by one or more spaces. The allowed set of unit specifications is derived from the physical quantity attribute of the handled property; the default unit specification is determined from the unit system associated with the simulation hierarchy in which the handled property resides.

◆ isValidDoubleList()

bool AbstractDoublePropertyHandler::isValidDoubleList ( string  value) const

Returns true if the specified string is non-empty and contains a comma separated list, with each item in the list representing a valid floating point number with an optional unit specification, according to the format described for the isValidDouble() function. Otherwise returns false.

◆ maxOpen()

bool AbstractDoublePropertyHandler::maxOpen ( ) const
private

Returns true if the maximum value for the handled property is excluded from the permitted range (indicated by a trailing "["), or if no maximum value is specified in the schema definition.

◆ maxValue()

double AbstractDoublePropertyHandler::maxValue ( ) const
private

Returns the maximum value for the handled property. If no maximum value is specified in the schema definition, the function returns positive infinity.

◆ minOpen()

bool AbstractDoublePropertyHandler::minOpen ( ) const
private

Returns true if the minimum value for the handled property is excluded from the permitted range (indicated by a leading "]"), or if no minimum value is specified in the schema definition.

◆ minValue()

double AbstractDoublePropertyHandler::minValue ( ) const
private

Returns the minimum value for the handled property. If no minimum value is specified in the schema definition, the function returns negative infinity.

◆ PropertyHandler() [1/2]

PropertyHandler::PropertyHandler ( const PropertyHandler )
delete

Constructs a property handler for the specified target item and property, with a given schema definition.

◆ PropertyHandler() [2/2]

PropertyHandler::PropertyHandler ( Item target,
const PropertyDef property,
const SchemaDef schema,
NameManager nameMgr 
)

Constructs a property handler for the specified target item and property, with a given schema definition.

◆ quantity()

string AbstractDoublePropertyHandler::quantity ( ) const

Returns the physical quantity name for the handled property, as described in the schema definition class, or the empty string if the handled property is a dimensionless quantity. If the value of the "quantity" attribute in the schema definition starts with an at sign, the quantity is determined instead as the string value of the indicated enumeration property. In that case, because the string value of an enumeration property can't be empty, a value representing an unknown quantity is silently replaced by the empty string to represent a dimensionless quantity.

◆ rangeDescription()

string AbstractDoublePropertyHandler::rangeDescription ( ) const

Returns a human-readable description of the permitted value range for the handled property. The description includes brackets indicating an open or closed range on either side, and default unit specifications for physical quantities. If no minimum/maximum value is specified in the schema definition, the description uses negative/positive infinity.

◆ toDouble()

double AbstractDoublePropertyHandler::toDouble ( string  value) const

Returns the double value represented by the specified string, or zero if the string is empty or contains an invalid representation. See isValid() for more information.

◆ toDoubleList()

vector< double > AbstractDoublePropertyHandler::toDoubleList ( string  value) const

Returns the list of double values represented by the specified string. If the string is empty, or any of the comma-separated items in the specified string are invalid, the function returns an empty list. See isValidDoubleList() for more information.

◆ toString() [1/2]

string AbstractDoublePropertyHandler::toString ( double  value) const

Returns a string representation of the specified double value, including an appropriate unit specification. See isValid() for more information.

◆ toString() [2/2]

string AbstractDoublePropertyHandler::toString ( vector< double >  value) const

Returns a string representation of the specified list of double values, each item including an appropriate unit specification, and commas seperating the items. See isValidDoubleList() for more information.

◆ unitStyle()

string AbstractDoublePropertyHandler::unitStyle ( ) const
private

Returns the name of the unit style associated with the dataset in which the handled property resides. If the schema definition does not provide a unit system, the function throws an error. If the schema definition provides one or more unit systems, the function searches the hierarchy of the target dataset for a SMILE data item that inherits the common unit system base type (or is of the sole unit system type). If such a data item is found, the function returns the value of this item's first enumeration property (in schema definition order). If no such data item is found, or the item does not have an enumeration property, the function returns the empty string.

◆ unitSystem()

string AbstractDoublePropertyHandler::unitSystem ( ) const
private

Returns the name of the unit system associated with the dataset in which the handled property resides. If the schema definition does not provide a unit system, the function throws an error. If the schema definition provides a single unit system, the function returns the name of that unit system. If the schema definition provides two or more unit systems, the function searches the hierarchy of the target dataset for a SMILE data item that inherits the common unit system base type, and returns the actual type of that item. If no such data item can be found, the function throws an error.


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