Om  1.0.0
A universal framework for multimedia simulation
Public Member Functions | List of all members
om::math::Tensor Class Reference

A class that stores a generalized mathematical value of arbitrary dimension and type. More...

#include <omTensor.h>

Public Member Functions

 Tensor ()
 Create a default tensor with no value set. More...
 
 Tensor (const TensorType &newType)
 Create a tensor with the specified type and an undefined value. More...
 
 Tensor (const TensorType &newType, const UByte *valueData)
 Create a tensor with the specified type and a value from the specified opaque data source. More...
 
template<typename T >
 Tensor (const T &newValue)
 Create a tensor with the type and value of the specified parameter. More...
 
 Tensor (const Tensor &other)
 Create a copy of the specified tensor and its value. More...
 
 ~Tensor ()
 Destroy a Tensor object and deallocate the internal storage. More...
 
Tensoroperator= (const Tensor &other)
 Assign the value and type of another tensor to this tensor. More...
 
const TensorTypegetType () const
 Return the type of value that this tensor stores. More...
 
void setType (const TensorType &newType)
 Set the type of value that this tensor stores. More...
 
void set (const TensorType &newType, const UByte *valueData)
 Set this tensor to have the specified type and value from an opaque data source. More...
 
template<typename T >
void set (const T &newValue)
 Set the value of this tensor to be a copy of the specified object. More...
 
template<typename T >
Bool get (T &outputValue) const
 Get the value of this tensor as the type of the template output parameter. More...
 
Bool zero ()
 Set the entire contents of this tensor to zero. More...
 
Size getScalarCount () const
 Return the number of components that are in this attribute value. More...
 
template<typename T >
Bool getScalars (T *output) const
 Get the components of the AttributeValue in the output pointer. More...
 
template<typename T >
T * getScalars ()
 Return a pointer to the components of this Shader attribute, stored in column-major order. More...
 
template<typename T >
const T * getScalars () const
 Return a pointer to the components of this tensor. More...
 
UBytegetPointer ()
 Return a raw pointer to the underlying data storage for this tensor's value. More...
 
const UBytegetPointer () const
 Return a raw pointer to the underlying data storage for this tensor's value. More...
 
Bool isNull () const
 Return whether or not the tensor's value is not set. More...
 
Bool isSet () const
 Return whether or not the tensor has a value set. More...
 
data::String toString () const
 Return a string representation of the tensor's value. More...
 
 operator data::String () const
 Convert this tensor's value into a string representation. More...
 
Tensor operator+ (const Tensor &other) const
 Add another tensor to this one and return the result. More...
 
Tensor operator- (const Tensor &other) const
 Add another tensor to this one and return the result. More...
 
Tensor operator* (const Tensor &other) const
 Multiply this tensor and another one and return the result. More...
 
Tensor operator/ (const Tensor &other) const
 Divide this tensor by another one and return the result. More...
 
Tensoroperator+= (const Tensor &other)
 Add another tensor to this one, modifying this tensor. More...
 
Tensoroperator-= (const Tensor &other)
 Subtract another tensor from this one, modifying this tensor. More...
 
Tensoroperator*= (const Tensor &other)
 Multiply this tensor by another one, modifying this tensor. More...
 
Tensoroperator/= (const Tensor &other)
 Divide this tensor by another one, modifying this tensor. More...
 

Detailed Description

A class that stores a generalized mathematical value of arbitrary dimension and type.

A tensor is a generalized matrix. This class supports tensors up to dimension 3.

Constructor & Destructor Documentation

om::math::Tensor::Tensor ( )
inline

Create a default tensor with no value set.

om::math::Tensor::Tensor ( const TensorType newType)

Create a tensor with the specified type and an undefined value.

om::math::Tensor::Tensor ( const TensorType newType,
const UByte valueData 
)

Create a tensor with the specified type and a value from the specified opaque data source.

template<typename T >
om::math::Tensor::Tensor ( const T &  newValue)
inlineexplicit

Create a tensor with the type and value of the specified parameter.

If the new tensor value's type is undefined, the tensor is constructed with no value stored.

om::math::Tensor::Tensor ( const Tensor other)

Create a copy of the specified tensor and its value.

om::math::Tensor::~Tensor ( )
inline

Destroy a Tensor object and deallocate the internal storage.

Member Function Documentation

Tensor& om::math::Tensor::operator= ( const Tensor other)

Assign the value and type of another tensor to this tensor.

const TensorType& om::math::Tensor::getType ( ) const
inline

Return the type of value that this tensor stores.

void om::math::Tensor::setType ( const TensorType newType)

Set the type of value that this tensor stores.

The internal memory for the tensor is enlarged if necessary to contain the specified type. The contents of the value are undefined after this method is called.

void om::math::Tensor::set ( const TensorType newType,
const UByte valueData 
)

Set this tensor to have the specified type and value from an opaque data source.

If the value data is NULL, the type of the tensor is changed but it is uninitialized.

template<typename T >
void om::math::Tensor::set ( const T &  newValue)
inline

Set the value of this tensor to be a copy of the specified object.

This method is for tensor types that have a size that is known at compile time.

template<typename T >
Bool om::math::Tensor::get ( T &  outputValue) const
inline

Get the value of this tensor as the type of the template output parameter.

This method is for tensor types that have a size that is known at compile time. The method returns whether or not the tensor's type was able to be converted to the template type.

Bool om::math::Tensor::zero ( )
inline

Set the entire contents of this tensor to zero.

Size om::math::Tensor::getScalarCount ( ) const
inline

Return the number of components that are in this attribute value.

template<typename T >
Bool om::math::Tensor::getScalars ( T *  output) const
inline

Get the components of the AttributeValue in the output pointer.

If the templated type of the output pointer matches the type of the shader attribute's component type, TRUE is returned and the attribute is placed in the location specified by the output pointer. Otherwise FALSE is returned and no value is retrieved.

template<typename T >
T* om::math::Tensor::getScalars ( )
inline

Return a pointer to the components of this Shader attribute, stored in column-major order.

If the templated type of the function matches the type of the shader attribute's component type, the function is successful and the component pointer is returned. Otherwise, NULL is returned indicating failure.

template<typename T >
const T* om::math::Tensor::getScalars ( ) const
inline

Return a pointer to the components of this tensor.

If the templated type of the function matches the type of the tensor's scalar type, the function is successful and the component pointer is returned. Otherwise, NULL is returned indicating failure.

UByte* om::math::Tensor::getPointer ( )
inline

Return a raw pointer to the underlying data storage for this tensor's value.

const UByte* om::math::Tensor::getPointer ( ) const
inline

Return a raw pointer to the underlying data storage for this tensor's value.

Bool om::math::Tensor::isNull ( ) const
inline

Return whether or not the tensor's value is not set.

Bool om::math::Tensor::isSet ( ) const
inline

Return whether or not the tensor has a value set.

data::String om::math::Tensor::toString ( ) const

Return a string representation of the tensor's value.

om::math::Tensor::operator data::String ( ) const
inline

Convert this tensor's value into a string representation.

Tensor om::math::Tensor::operator+ ( const Tensor other) const
inline

Add another tensor to this one and return the result.

Tensor om::math::Tensor::operator- ( const Tensor other) const
inline

Add another tensor to this one and return the result.

Tensor om::math::Tensor::operator* ( const Tensor other) const
inline

Multiply this tensor and another one and return the result.

Tensor om::math::Tensor::operator/ ( const Tensor other) const
inline

Divide this tensor by another one and return the result.

Tensor& om::math::Tensor::operator+= ( const Tensor other)
inline

Add another tensor to this one, modifying this tensor.

Tensor& om::math::Tensor::operator-= ( const Tensor other)
inline

Subtract another tensor from this one, modifying this tensor.

Tensor& om::math::Tensor::operator*= ( const Tensor other)
inline

Multiply this tensor by another one, modifying this tensor.

Tensor& om::math::Tensor::operator/= ( const Tensor other)
inline

Divide this tensor by another one, modifying this tensor.


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