The SKIRT project
advanced radiative transfer for astrophysics
Public Member Functions | Private Attributes | List of all members
PropertyDef Class Referencefinal

#include <PropertyDef.hpp>

Public Member Functions

 PropertyDef (const PropertyDef &)=delete
 
 PropertyDef (string type, string name, string title)
 
 ~PropertyDef ()
 
const PropertyAccessoraccessor () const
 
void addEnumeration (string name, string title)
 
string base () const
 
string defaultValue () const
 
string displayedIf () const
 
const vector< string > & enumNames () const
 
string enumTitle (string enumName) const
 
const vector< string > & enumTitles () const
 
string insert () const
 
string maxValue () const
 
string minValue () const
 
string name () const
 
PropertyDefoperator= (const PropertyDef &)=delete
 
string quantity () const
 
string relevantIf () const
 
string requiredIf () const
 
void setAccessor (const PropertyAccessor *accessor)
 
void setBase (string value)
 
void setDefaultValue (string value)
 
void setDisplayedIf (string value)
 
void setInsert (string insert)
 
void setMaxValue (string value)
 
void setMinValue (string value)
 
void setQuantity (string value)
 
void setRelevantIf (string value)
 
void setRequiredIf (string value)
 
string title () const
 
string type () const
 

Private Attributes

std::unique_ptr< const PropertyAccessor_accessor
 
string _base
 
string _default
 
string _displayedIf
 
vector< string > _enumNames
 
vector< string > _enumTitles
 
string _insert
 
string _max
 
string _min
 
string _name
 
string _quantity
 
string _relevantIf
 
string _requiredIf
 
string _title
 
string _type
 

Detailed Description

The PropertyDef class represents SMILE schema property definitions. It is essentially a structure that offers setters and getters for its data members. A PropertyDef instance can hold the definition for any property type; attributes that are not relevant for a particular property type are simply ignored by the corresponding property handler.

Constructor & Destructor Documentation

◆ PropertyDef() [1/2]

PropertyDef::PropertyDef ( string  type,
string  name,
string  title 
)

The constructor sets the property definition's type (one of the supported property type names, e.g. "IntProperty", "ItemListProperty"), its name (for use by a program) and its description (for display to a user). All other property attributes are initialized to the value that corresponds to an empty string or container (depending on its data type). Use the setters to further initialize any relevant data members as desired.

◆ ~PropertyDef()

PropertyDef::~PropertyDef ( )

The destructor releases any resources being held, such as the accessor info block.

◆ PropertyDef() [2/2]

PropertyDef::PropertyDef ( const PropertyDef )
delete

The copy constructor is deleted. PropertyDef instances can't be copied or moved because they contain a unique pointer to a PropertyAccessor instance.

Member Function Documentation

◆ accessor()

const PropertyAccessor * PropertyDef::accessor ( ) const
inline

Returns a pointer to the property accessor block for the property definition, or nullptr if no accessor block was set; ownership stays with the propery definition.

◆ addEnumeration()

void PropertyDef::addEnumeration ( string  name,
string  title 
)

Adds a name/title pair for one of the enumeration values defined for this property. Enumeration values must be added in order of occurrence in the schema definition. This information is relevant only for enumeration properties, and for those properties the list of enumeration values should not be left empty.

◆ base()

string PropertyDef::base ( ) const
inline

Returns the name of the base type for the instances of this property. This must match one of the type names defined in this schema. This information is relevant only for compound properties (i.e. properties containing other items of some type).

◆ defaultValue()

string PropertyDef::defaultValue ( ) const
inline

Returns the default value for the property in case the property is missing, in a format compatible with the particular property type. If the string is empty, there is no default value.

◆ displayedIf()

string PropertyDef::displayedIf ( ) const
inline

Returns the Boolean expression indicating whether this property is displayed. If the Boolean expression is empty, the property is always displayed.

◆ enumNames()

const vector< string > & PropertyDef::enumNames ( ) const
inline

Returns a list of all enumeration names defined for this property, in order of occurrence in the schema. For properties other than enumeration properties, this function returns an empty list.

◆ enumTitle()

string PropertyDef::enumTitle ( string  enumName) const

Returns the title corresponding to the specified enumeration name, as defined for this property. If the specified enumeration name is not defined for the property, the function returns the empty string.

◆ enumTitles()

const vector< string > & PropertyDef::enumTitles ( ) const
inline

Returns a list of the titles corresponding to all enumeration names defined for this property, in the order corresponding to the list returned by enumNames(). For properties other than enumeration properties, this function returns an empty list.

◆ insert()

string PropertyDef::insert ( ) const
inline

Returns a conditional value expression providing a list of extra names to be inserted in the global and/or local name set when a value of this item is entered into the dataset, in addition to the name automatically associated with the property. An empty string means that no extra names will be added.

◆ maxValue()

string PropertyDef::maxValue ( ) const
inline

Returns the maximum value for the property, in a format compatible with the particular property type. If the string is empty, the maximum value is determined by the implementation of the property type.

◆ minValue()

string PropertyDef::minValue ( ) const
inline

Returns the minimum value for the property, in a format compatible with the particular property type. If the string is empty, the minimum value is determined by the implementation of the property type.

◆ name()

string PropertyDef::name ( ) const
inline

Returns the name of the property for use by a program.

◆ operator=()

PropertyDef & PropertyDef::operator= ( const PropertyDef )
delete

The assignment operator is deleted. PropertyDef instances can't be copied or moved because they contain a unique pointer to a PropertyAccessor instance.

◆ quantity()

string PropertyDef::quantity ( ) const
inline

Returns the name of the physical quantity represented by this property. This must match one of the quantity names defined in this schema and determines the allowed and default units for the property values. If the string is empty, the property values are dimensionless.

◆ relevantIf()

string PropertyDef::relevantIf ( ) const
inline

Returns the Boolean expression indicating whether this property is relevant. If the Boolean expression is empty, the property is always relevant.

◆ requiredIf()

string PropertyDef::requiredIf ( ) const
inline

Returns the Boolean expression indicating whether this property is required. If the Boolean expression is empty, the property is always required.

◆ setAccessor()

void PropertyDef::setAccessor ( const PropertyAccessor accessor)

Hands a property accessor block to the property definition; ownership is passed to the property definition.

◆ setBase()

void PropertyDef::setBase ( string  value)
inline

Sets the name of the base type for the instances of this property. This must match one of the type names defined in this schema. This information is relevant only for compound properties (i.e. properties containing other items of some type), and for those properties it should not be left empty.

◆ setDefaultValue()

void PropertyDef::setDefaultValue ( string  value)
inline

Sets the conditional value expression defining the default value for the property in case the property is missing. If the string is empty, there is no default value.

◆ setDisplayedIf()

void PropertyDef::setDisplayedIf ( string  value)
inline

Sets the Boolean expression indicating whether this property is displayed. If the Boolean expression is empty, the property is always displayed.

◆ setInsert()

void PropertyDef::setInsert ( string  insert)
inline

Sets a conditional value expression providing a list of extra names to be inserted in the global and/or local name set when a value of this item is entered into the dataset, in addition to the name automatically associated with the property. An empty string means that no extra names will be added.

◆ setMaxValue()

void PropertyDef::setMaxValue ( string  value)
inline

Sets the maximum value for the property, in a format compatible with the particular property type. If the string is empty, the maximum value is determined by the implementation of the property type.

◆ setMinValue()

void PropertyDef::setMinValue ( string  value)
inline

Sets the minimum value for the property, in a format compatible with the particular property type. If the string is empty, the minimum value is determined by the implementation of the property type.

◆ setQuantity()

void PropertyDef::setQuantity ( string  value)
inline

Sets the name of the physical quantity represented by this property. This must match one of the quantity names defined in this schema and determines the allowed and default units for the property values. If the string is empty, the property values are dimensionless.

◆ setRelevantIf()

void PropertyDef::setRelevantIf ( string  value)
inline

Sets the Boolean expression indicating whether this property is relevant. If the Boolean expression is empty, the property is always relevant.

◆ setRequiredIf()

void PropertyDef::setRequiredIf ( string  value)
inline

Sets the Boolean expression indicating whether the property is required. If the Boolean expression is empty, the property is always required.

◆ title()

string PropertyDef::title ( ) const
inline

Returns the description for the property for display to a user.

◆ type()

string PropertyDef::type ( ) const
inline

Returns the type of the property as one of the supported property type names, e.g. "IntProperty", "ItemListProperty".


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