|
oevislib_net
0.14.3.0
|
Container used to wrap optional input and outputs. More...
Public Member Functions | |
| Optional () | |
| Constructs an Optional object. | |
| Optional (T value) | |
| Constructs a new Optional object copying the value of the specified reference. | |
| T | Get () |
| Returns the value being wrapped. | |
| T | GetValueOr (T defaultValue) |
| Returns the value being wrapped or a default value if Optional does not contain one. | |
| bool | HasValue () |
| Checks if the current object is wrapping a value or is Null. | |
| override object | Clone () |
| override void | Dispose () |
| bool | Equals (Optional< T > other) |
| override bool | Equals (object obj) |
| override int | GetHashCode () |
Static Public Member Functions | |
| static bool | operator== (Optional< T > inOptional1, Optional< T > inOptional2) |
| static bool | operator!= (Optional< T > inOptional1, Optional< T > inOptional2) |
| static implicit | operator Optional< T > (T value) |
Protected Attributes | |
| Type | elementType |
Container used to wrap optional input and outputs.
Optional inputs are useful in two cases:
When a parameter has a default value that cannot be pre-determined. In this case, passing ov::Null to the parameter will tell the function to compute its value according to the other parameters. When a feature of the algorithm can be disabled. In this case, passing a value will tell the function to activate some specific computation, while passing ov::Null will skip that computation entirely.
Optional outputs, on the other hand, are useful to tell the function to compute some additional data in addition to its main output. When a null Optional is passed to the parameter, the output will not be computed (default value). When the parameter is required, a non-Null object must be passed. ExampleOne of the most popular optional input is inRoi, usually available as a parameter of type const Optional<Region>& inRoi.
When the user wants to specify a region of interest for an image processing function, a Region object can be passed to the parameter. In that case, the computation will be faster and localized to the provided area. On the other hand, if ov::Null is passed, the function will apply the algorithm to the entire image.
T
Type of the objects wrapped by the Optional. It cannot be a reference type.
|
inline |
Returns the value being wrapped.
|
inline |
Returns the value being wrapped or a default value if Optional does not contain one.
| defaultValue | Default value. |
|
inline |
Checks if the current object is wrapping a value or is Null.
|
inline |
Constructs an Optional object.
|
inline |
Constructs a new Optional object copying the value of the specified reference.
| value | Value to wrap. |