Regina Calculation Engine
|
Stores a calculable property of an object.
More...
#include <utilities/property.h>
Public Types | |
typedef Storage< T >::InitType | InitType |
The type by which new values for the underlying property are passed. More... | |
typedef Storage< T >::QueryType | QueryType |
The type by which the property value is returned to the user. More... | |
Public Member Functions | |
Property () | |
Constructor. More... | |
Property (const Property< T, Storage > &newValue) | |
Makes a new clone of the given property. More... | |
bool | known () const |
Returns whether or not this property is currently marked as known. More... | |
QueryType | value () const |
Returns the current value of this property. More... | |
void | clear () |
Marks this property as unknown. More... | |
QueryType | operator= (InitType newValue) |
Assigns a new value to this property. More... | |
Property & | operator= (const Property &newValue) |
Copies the given property into this property. More... | |
void | swap (Property< T, Storage > &other) |
Swaps this with the given property. More... | |
Stores a calculable property of an object.
The property may be marked as known or unknown, and its value may be set or retrieved.
The template parameter Storage specifies how the property will be internally stored. Storage options range from simple storage by value (see class StoreValue) to more intelligent storage options that include memory management of pointers (see class StoreManagedPtr).
typedef Storage<T>::InitType regina::Property< T, Storage >::InitType |
The type by which new values for the underlying property are passed.
typedef Storage<T>::QueryType regina::Property< T, Storage >::QueryType |
The type by which the property value is returned to the user.
|
inline |
Constructor.
This property is initially marked as unknown.
|
inline |
Makes a new clone of the given property.
If the given property is marked as known, its value will be copied and this property will also be marked as known. Otherwise this property will be marked as unknown.
This copy constructor is slightly inefficient, in that it first default-constructs its own held value, and then if newValue is known it will copy that value across.
For storage policies that do not allow copying (such as StoreManagedPtr), any attempt to use this copy constructor will generate a compile error.
newValue | the property to clone. |
|
inline |
Marks this property as unknown.
|
inline |
Returns whether or not this property is currently marked as known.
|
inline |
Assigns a new value to this property.
The property will be marked as known.
newValue | the new value to assign to this property. |
|
inline |
Copies the given property into this property.
If the given property is marked as known, its value will be copied and this property will also be marked as known. Otherwise this property will be marked as unknown.
For storage policies that do not allow copying (such as StoreManagedPtr), any attempt to use this assignment operator will generate a compile error.
newValue | the property to copy into this property. |
|
inline |
Swaps this with the given property.
Both the known status and the values (if known) will swapped in the most efficient manner that the compiler is aware of.
other | the property to swap with this. |
|
inline |
Returns the current value of this property.
If this property is marked as unknown then the results are undefined.