struct P1::CameraSdk::PropertyValue

Overview

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

#include <C_P1CameraCommonCameraTypes.h>

struct PropertyValue
{
    // fields

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

    // construction

    PropertyValue();
    PropertyValue(std::string const& fromString);
    PropertyValue(char const* fromCString);
    PropertyValue(int64_t const& fromInteger);
    PropertyValue(int32_t const& fromInteger);
    PropertyValue(uint32_t const& fromUInteger);
    PropertyValue(uint64_t const& fromUInteger);
    PropertyValue(double const& fromDouble);

    // methods

    MSVC_ALLOW_PUBLIC_STL(std::string mString);
    MSVC_ALLOW_PUBLIC_STL(std::string mPresentationString);
    uint32_t IntegerAsU32() const;
    int32_t IntegerAsI32() const;
    uint64_t IntegerAsU64() const;
    int64_t IntegerAsI64() const;
    std::string StringValue() const;
    std::string ToString() const;
    std::string TypeString() const;
    bool operator == (PropertyValue const& other) const;
    bool operator != (PropertyValue const& other) const;
    static PropertyValue CreateEnum(uint32_t enumValue);
};

Detailed Documentation

Holds 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 as this class.

See also:

PropertyType

Camera::GetProperty

Fields

PropertyType mType = kPropertyTypeUndefined

Indicates 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)

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.

Construction

PropertyValue()

Create an empty property value (no data)

PropertyValue(std::string const& fromString)

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

PropertyValue(char const* fromCString)

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

PropertyValue(int64_t const& fromInteger)

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

PropertyValue(int32_t const& fromInteger)

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

PropertyValue(uint32_t const& fromUInteger)

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

PropertyValue(uint64_t const& fromUInteger)

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

PropertyValue(double const& fromDouble)

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

Methods

MSVC_ALLOW_PUBLIC_STL(std::string mString)

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

MSVC_ALLOW_PUBLIC_STL(std::string mPresentationString)

This is a human readable representation of the value.

uint32_t IntegerAsU32() const

Return the this property’s value as an unsigned Int32.

int32_t IntegerAsI32() const

Return the this property’s value as a signed Int32.

uint64_t IntegerAsU64() const

Return the this property’s value as an unsigned Int64.

int64_t IntegerAsI64() const

Return the this property’s value as a signed Int64.

std::string StringValue() const

Returns a simple string representation of this property.

This method uses the “RepresentationString”, if present.

Returns:

A string value that describes the PropertyValue ‘s value

std::string ToString() const

Returns a description of the property value, including its type name.

This method is equivalent to using the std::ostream << operator

std::string TypeString() const

Return a human readable name of this property’s type.

bool operator == (PropertyValue const& other) const

Compare type and value.

static PropertyValue CreateEnum(uint32_t enumValue)

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