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

#include <TypeDef.hpp>

Public Types

using Instantiator = Item *(*)()
 

Public Member Functions

 TypeDef ()
 
 TypeDef (const TypeDef &)=delete
 
PropertyDefaddPropertyDef (string type, string name, string title)
 
string allowedIf () const
 
string base () const
 
bool concrete () const
 
string displayedIf () const
 
string insert () const
 
Instantiator instantiator () const
 
string name () const
 
int numSubProperties () const
 
TypeDefoperator= (const TypeDef &)=delete
 
const std::list< PropertyDef > & propertyDefs () const
 
void setAllowedIf (string allowedIf)
 
void setBase (string base)
 
void setConcrete ()
 
void setDisplayedIf (string displayedIf)
 
void setInsert (string insert)
 
void setInstantiator (Instantiator instantiator)
 
void setName (string name)
 
void setSubPropertyIndex (int index)
 
void setSubPropertyIndexHere ()
 
void setTitle (string title)
 
int subPropertyIndex () const
 
string title () const
 

Private Attributes

string _allowedIf
 
string _base
 
bool _concrete
 
string _displayedIf
 
string _insert
 
Instantiator _instantiator
 
string _name
 
std::list< PropertyDef_propertyDefs
 
int _subPropertyIndex
 
string _title
 

Detailed Description

The TypeDef class represents a type definition in a SMILE schema. It is essentially a structure that offers setters and getters for its data members.

Member Typedef Documentation

◆ Instantiator

using TypeDef::Instantiator = Item* (*)()

Type definition for a function that creates an instance of an Item subclass.

Constructor & Destructor Documentation

◆ TypeDef() [1/2]

TypeDef::TypeDef ( )
inline

The default (and only) constructor trivially initializes the type definition to a blank state. All string fields are empty, there are no property definitions, and the type is considered to be abstract (i.e. not concrete). Use the setters to further initialize all relevant data members.

◆ TypeDef() [2/2]

TypeDef::TypeDef ( const TypeDef )
delete

The copy constructor is deleted. TypeDef instances can't be copied or moved because of the PropertyDef instances they contain.

Member Function Documentation

◆ addPropertyDef()

PropertyDef & TypeDef::addPropertyDef ( string  type,
string  name,
string  title 
)

Add a new property definition to the list for this type with the given property type, name and title, and returns a reference to the newly constructed PropertyDef instance so that its further attributes can be initialized. Properties are stored in order of addition, which should correspond to the order of appearance in the schema definition. Ownership of the PropertyDef instance is passed to the receiving type definition.

◆ allowedIf()

string TypeDef::allowedIf ( ) const
inline

Returns a Boolean expression that indicates whether items of the type are allowed. An empty string means always allowed.

◆ base()

string TypeDef::base ( ) const
inline

Returns the name of the immediate base type, or the empty string for the root type.

◆ concrete()

bool TypeDef::concrete ( ) const
inline

Returns true if this is a concrete type, and false if this is an abstract type.

◆ displayedIf()

string TypeDef::displayedIf ( ) const
inline

Returns a Boolean expression that indicates whether the type is displayed. An empty string means always displayed.

◆ insert()

string TypeDef::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 an item of this type is added to the dataset, in addition to the names of the type and its ancestors. An empty string means that no extra names will be added.

◆ instantiator()

Instantiator TypeDef::instantiator ( ) const
inline

Returns a pointer to the function that creates an instance of the Item subclass described by this type definition. This information is available only for concrete hardcoded classes. The function returns a null pointer when using ghost items or for hardcoded abstract classes).

◆ name()

string TypeDef::name ( ) const
inline

Returns the name of the type.

◆ numSubProperties()

int TypeDef::numSubProperties ( ) const
inline

Returns the number of properties defined for the type. Properties of base types are NOT counted towards this number.

◆ operator=()

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

The assignment operator is deleted. TypeDef instances can't be copied or moved because of the PropertyDef instances they contain.

◆ propertyDefs()

const std::list< PropertyDef > & TypeDef::propertyDefs ( ) const
inline

Returns (a reference to a list of) the definitions of the type's properties, in order of appearance in the schema. Properties of base types are NOT included in the list.

◆ setAllowedIf()

void TypeDef::setAllowedIf ( string  allowedIf)
inline

Sets a Boolean expression that indicates whether items of the type are allowed. An empty string means always allowed.

◆ setBase()

void TypeDef::setBase ( string  base)
inline

Sets the name of the immediate base type (use the empty string for the root type).

◆ setConcrete()

void TypeDef::setConcrete ( )
inline

Sets the flag indicating that this is a concrete type rather than an abstract type (which is the default).

◆ setDisplayedIf()

void TypeDef::setDisplayedIf ( string  displayedIf)
inline

Sets a Boolean expression that indicates whether items of the type are displayed. An empty string means always displayed.

◆ setInsert()

void TypeDef::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 an item of this type is added to the dataset, in addition to the names of the type and its ancestors. An empty string means that no extra names will be added.

◆ setInstantiator()

void TypeDef::setInstantiator ( Instantiator  instantiator)
inline

Sets a pointer to the function that creates an instance of the Item subclass described by this type definition. This information is set only for concrete hardcoded classes (i.e. not when using ghost items or for hardcoded abstract classes).

◆ setName()

void TypeDef::setName ( string  name)
inline

Sets the name of the type.

◆ setSubPropertyIndex()

void TypeDef::setSubPropertyIndex ( int  index)
inline

Sets the index in the property list where properties of subtypes should be listed. If the index is nonnegative, properties of subtypes must be listed just before the property with the specified index. If the index is negative, properties of subtypes must be listed after the properties of the base type. This is the default behavior if this function is never called.

◆ setSubPropertyIndexHere()

void TypeDef::setSubPropertyIndexHere ( )
inline

Sets the index in the property list where properties of subtypes should be listed to the number of properties currently held by this type definition. This has the effect of listing properties of subtypes just before the next property added to the type definition (or at the end if no further properties are added).

◆ setTitle()

void TypeDef::setTitle ( string  title)
inline

Sets a description for the type that can be displayed to a user.

◆ subPropertyIndex()

int TypeDef::subPropertyIndex ( ) const
inline

Returns the index in the property list where properties of subtypes should be listed. If the index is nonnegative, properties of subtypes must be listed just before the property with the specified index. If the index is negative, properties of subtypes must be listed after the properties of the base type (the default).

◆ title()

string TypeDef::title ( ) const
inline

Returns a description for the type that can be displayed to a user.


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