struct P1::CameraSdk::PropertyValue

Overview

Hold a single property value, and acts like a wrapper of different property types. More…

#include <P1CameraTypes.hpp>

struct PropertyValue
{
    // fields

    PropertyType mType = kPropertyTypeUndefined;
    int64_t mInt = 0;
    double mDouble = 0.0;
    std::string mString;
    ValuePoint mPoint;
    ValueColorFloat mColor;
    ValueArea mArea;
    ValueAreaFloat mAreaFloat;
    ValueRect mRect;
    ValueRange mRange { 0, 0 };
    ValueRangeFloat mRangeFloat { 0.0, 0.0 };
    std::string mPresentationString;

    // construction

    PropertyValue();
    PropertyValue(const std::string& fromString);
    PropertyValue(const int64_t& fromInteger);
    PropertyValue(const int32_t& fromInteger);
    PropertyValue(const double& fromDouble);

    // methods

    std::string ToString() const;
    std::string StringValue() const;
    static PropertyValue CreateEnum(uint32_t enumValue);
};

Detailed Documentation

Hold a single property value, and acts like a wrapper of different property types.

This class holds only the value of a property. It does not know about the property itself, for that we have the PropertySpecification class. PropertyValue can hold value of type: integer, floating point, string, point, color, area and rect.

A propertyValue also have a PropertyValue::mPresentationString, that is a string representation of its value.

Preferrably you should not create PropertyValues yourself. Rather you should obtains them from a camera and modify them.

If you are familiar with Qt, the QVariant class achieves the same goal is this class.

See also:

PropertyType

Camera::GetProperty

Fields

PropertyType mType = kPropertyTypeUndefined

Indicate the type of the value contained in this PropertyValue object.

int64_t mInt = 0

All integer based values are contained in this member (enum, int, uint, time, etc.)

double mDouble = 0.0

All floating point values are contained in this member. (float 32 and 64)

std::string mString

If this PropertyValue is a string type, the string is contained here.

ValuePoint mPoint

If this PropertyValue is a point type, it is contained here.

ValueColorFloat mColor

If this PropertyValue is a color type, it is contained here.

ValueArea mArea

If this PropertyValue is a area type, it is contained here.

ValueAreaFloat mAreaFloat

If this PropertyValue is a floating point area type, it is contained here.

ValueRect mRect

If this PropertyValue is a rectangle type, it is contained here.

ValueRange mRange { 0, 0 }

If this PropertyValue is a integer range type, it is contained here.

ValueRangeFloat mRangeFloat { 0.0, 0.0 }

If this PropertyValue is a floating point range type, it is contained here.

std::string mPresentationString

This is a human readable representation of the value.

Construction

PropertyValue()

Create an empty property value (no data)

PropertyValue(const std::string& fromString)

Create a string type property value, based on the provided string.

PropertyValue(const int64_t& fromInteger)

Create a Int64 type property value, based on the provided integer.

PropertyValue(const int32_t& fromInteger)

Create a Int32 type property value, based on the provided integer.

PropertyValue(const double& fromDouble)

Create a float64 type property value, based on the provided double.

Methods

std::string ToString() const

Returns a simple string representation of this property.

Returns:

A string value that describes the PropertyValue ‘s value

static PropertyValue CreateEnum(uint32_t enumValue)

Create a enum type property value, based on the provided integer.