OOF2: The Manual
Name
OutputValue — Wrapper for OutputVal classes
Synopses
C++ Synopsis
#include "engine/outputval.h"
class OutputValue {const OutputVal& valueRef() const;
const OutputVal* valuePtr() const;
OutputValue* valueClone() const;
const OutputValue& operator+=(const OutputValue& other);
const OutputValue& operator-=(const OutputValue& other);
const OutputValue& operator*=(double x);
double operator[](const IndexP& index) const;
double& operator[](const IndexP& index);
}
OutputValue operator+(const OutputValue &a, const OutputValue &b); OutputValue operator-(const OutputValue &a, const OutputValue &b); OutputValue operator*(double x, const OutputValue &ov); OutputValue operator*(const OutputValue &ov, double x); OutputValue operator/(const OutputValue &ov, double x);
Python Synopsis
from oof2.SWIG.engine import outputval
class OutputValue:def valuePtr(self)
def valueClone(self)
def __getitem__(self, index)
Description
The OuputValue
class is a reference
counting wrapper for the various OutputVal
classes. That means that an
OutputValue
contains a pointer to an
OutputVal
,
and takes care of deleting the
OutputVal
when no more
OutputValues
are using it.
OutputValues
should not be created
explicitly, except by functions like Field::output
.
They should never be created in Python at all, since that
confuses the reference counting.
Methods
const OutputVal& valueRef() const
valueRef
returns a reference to the
OutputVal
wrapped inside the OutputValue
. This
call does not increment the reference
count of the OutputVal
, so the
programmer must ensure that the returned
OutputVal
reference does not outlive
the OutputValue
object.
const OutputVal* valuePtr() const
valuePtr
is just like valueRef, except
that it returns a pointer instead of a reference. This can
be more convenient in some situations.
OutputVal *valueClone() const
valueClone
is like valuePtr
and valueRef
,
except that it returns a pointer to a new
copy of the underlying OutputVal
.
It is the programmers responsibility to ensure that the
pointer is eventually deallocated.
valueClone
should be use in
situations in which the OutputValue
might be deallocated before the program is finished with the
OutputVal
.
const OutputValue& operator+=(const OutputValue&)
etc.
The majority of the arithmetic operators available for OutputVals
are also available for OutputValues
,
but only in C++. (The restriction to C++ is because
OutputValues
are converted to
OutputVals
by
swig typemaps when being passed
from C++ to Python, at least in all of the cases in which
they're used in Outputs
.)