The SKIRT project
advanced radiative transfer for astrophysics
GhostItem Class Referencefinal

#include <GhostItem.hpp>

Inheritance diagram for GhostItem:

Public Member Functions

 GhostItem (string type)
void clearItemListProperty (const PropertyDef *property) override
bool getBoolProperty (const PropertyDef *property) const override
vector< double > getDoubleListProperty (const PropertyDef *property) const override
double getDoubleProperty (const PropertyDef *property) const override
string getEnumProperty (const PropertyDef *property) const override
int getIntProperty (const PropertyDef *property) const override
vector< Item * > getItemListProperty (const PropertyDef *property) const override
ItemgetItemProperty (const PropertyDef *property) const override
string getStringProperty (const PropertyDef *property) const override
void insertIntoItemListProperty (const PropertyDef *property, int index, Item *item) override
void removeFromItemListProperty (const PropertyDef *property, int index) override
void setBoolProperty (const PropertyDef *property, bool value) override
void setDoubleListProperty (const PropertyDef *property, vector< double > value) override
void setDoubleProperty (const PropertyDef *property, double value) override
void setEnumProperty (const PropertyDef *property, string value) override
void setIntProperty (const PropertyDef *property, int value) override
void setItemProperty (const PropertyDef *property, Item *item) override
void setStringProperty (const PropertyDef *property, string value) override
string type () const override
Public Member Functions inherited from Item
 Item (const Item &)=delete
virtual ~Item ()
void addChild (Item *child)
const vector< Item * > & children () const
void destroyChild (Item *child)
int getUtilityProperty (string name) const
Itemoperator= (const Item &)=delete
Itemparent () const
void setUtilityProperty (string name, int value)

Private Attributes

std::unordered_map< string, bool > _boolProperties
std::unordered_map< string, vector< double > > _doubleListProperties
std::unordered_map< string, double > _doubleProperties
std::unordered_map< string, string_enumProperties
std::unordered_map< string, int > _intProperties
std::unordered_map< string, vector< Item * > > _itemListProperties
std::unordered_map< string, Item * > _itemProperties
std::unordered_map< string, string_stringProperties
string _type

Additional Inherited Members

Protected Member Functions inherited from Item
 Item ()

Detailed Description

An instance of the GhostItem class represents an arbitrary item in any dataset described by a SMILE schema. The GhostItem class does not provide any actual item-specific functionality: the intention is to represent and manipulate a SMILE dataset in an abstract way without expecting it to actually do something. To this end, the GhostItem class implements the setters and getters for property values of the various supported property types, just like the Item base class. However, the property values are stored in generic dictionaries rather than in custom data members tailored to the type being represented.

Constructor & Destructor Documentation

◆ GhostItem()

GhostItem::GhostItem ( string type)
inline

The constructor sets the item's type, which should match one of the concrete types defined in the SMILE schema describing the dataset to which the item belongs. The item's parent is initialized to the null pointer. For all items other than the root node, the parent is set later on by handing the item to an item or item list property of another item (which calls the private setParent() function). The constructor further initializes the item's state so that no properties have been setup, which also implies that the item has no children.

Member Function Documentation

◆ clearItemListProperty()

void GhostItem::clearItemListProperty ( const PropertyDef * property)
overridevirtual

Sets the specified item list property to the empty list, removing any items that were present.

Reimplemented from Item.

◆ getBoolProperty()

bool GhostItem::getBoolProperty ( const PropertyDef * property) const
overridevirtual

Returns the value of the specified Boolean property. If the property does not exist, the function throws an error.

Reimplemented from Item.

◆ getDoubleListProperty()

vector< double > GhostItem::getDoubleListProperty ( const PropertyDef * property) const
overridevirtual

Returns the value of the specified floating point list property. If the property does not exist, the function throws an error.

Reimplemented from Item.

◆ getDoubleProperty()

double GhostItem::getDoubleProperty ( const PropertyDef * property) const
overridevirtual

Returns the value of the specified floating point property. If the property does not exist, the function throws an error.

Reimplemented from Item.

◆ getEnumProperty()

string GhostItem::getEnumProperty ( const PropertyDef * property) const
overridevirtual

Returns the value of the specified enumeration property. If the property does not exist, the function throws an error.

Reimplemented from Item.

◆ getIntProperty()

int GhostItem::getIntProperty ( const PropertyDef * property) const
overridevirtual

Returns the value of the specified integer property. If the property does not exist, the function throws an error.

Reimplemented from Item.

◆ getItemListProperty()

vector< Item * > GhostItem::getItemListProperty ( const PropertyDef * property) const
overridevirtual

Returns the value of the specified item list property. Ownership for the returned items is not handed over. If the property does not exist, the function throws an error.

Reimplemented from Item.

◆ getItemProperty()

Item * GhostItem::getItemProperty ( const PropertyDef * property) const
overridevirtual

Returns the value of the specified item property. Ownership for the returned item is not handed over. If the property does not exist, the function throws an error.

Reimplemented from Item.

◆ getStringProperty()

string GhostItem::getStringProperty ( const PropertyDef * property) const
overridevirtual

Returns the value of the specified string property. If the property does not exist, the function throws an error.

Reimplemented from Item.

◆ insertIntoItemListProperty()

void GhostItem::insertIntoItemListProperty ( const PropertyDef * property,
int index,
Item * item )
overridevirtual

Adds the specified item to the specified item list property, and sets the parent of the specified item to the receiving item so that ownership is handed over to the receiving item. Assume that the item list property has N items when this function is called (i.e. before anything is changed). If the specified zero-based index is in the range [0,N-1], the new item is inserted at the specified index (i.e. just before the item that was there previously). If the index is out of this range (i.e. it is negative or at least N), the new item is added at the end of the list.

Reimplemented from Item.

◆ removeFromItemListProperty()

void GhostItem::removeFromItemListProperty ( const PropertyDef * property,
int index )
overridevirtual

Removes the item at the specified index from the specified item list property and deletes it. If the index is out of range, nothing happens.

Reimplemented from Item.

◆ setBoolProperty()

void GhostItem::setBoolProperty ( const PropertyDef * property,
bool value )
overridevirtual

Sets the specified Boolean property to the specified value.

Reimplemented from Item.

◆ setDoubleListProperty()

void GhostItem::setDoubleListProperty ( const PropertyDef * property,
vector< double > value )
overridevirtual

Sets the specified floating point list property to the specified value.

Reimplemented from Item.

◆ setDoubleProperty()

void GhostItem::setDoubleProperty ( const PropertyDef * property,
double value )
overridevirtual

Sets the specified floating point property to the specified value.

Reimplemented from Item.

◆ setEnumProperty()

void GhostItem::setEnumProperty ( const PropertyDef * property,
string value )
overridevirtual

Sets the specified enumeration property to the specified value.

Reimplemented from Item.

◆ setIntProperty()

void GhostItem::setIntProperty ( const PropertyDef * property,
int value )
overridevirtual

Sets the specified integer property to the specified value.

Reimplemented from Item.

◆ setItemProperty()

void GhostItem::setItemProperty ( const PropertyDef * property,
Item * item )
overridevirtual

Sets the specified item property to the specified item, and sets the parent of the specified item to the receiving item so that ownership is handed over to the receiving item. If the specified property already holds another item, that item is destructed.

Reimplemented from Item.

◆ setStringProperty()

void GhostItem::setStringProperty ( const PropertyDef * property,
string value )
overridevirtual

Sets the specified string property to the specified value.

Reimplemented from Item.

◆ type()

string GhostItem::type ( ) const
overridevirtual

Returns the name of the item's type.

Reimplemented from Item.


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