///////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
// All rights reserved.
//
// This software and its documentation and related materials are owned by
// the Alliance. The software may only be incorporated into application
// programs owned by members of the Alliance, subject to a signed
// Membership Agreement and Supplemental Software License Agreement with the
// Alliance. The structure and organization of this software are the valuable
// trade secrets of the Alliance and its suppliers. The software is also
// protected by copyright law and international treaty provisions. Application
// programs incorporating this software must include the following statement
// with their copyright notices:
//
// This application incorporates Open Design Alliance software pursuant to a license
// agreement with Open Design Alliance.
// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
// All rights reserved.
//
// By use of this software, its documentation or related materials, you
// acknowledge and accept the above terms.
///////////////////////////////////////////////////////////////////////////////
#ifndef _SDAI_ADB_VALUE_H
#define _SDAI_ADB_VALUE_H
#include "daiBuildOptions.h"
#include "daiPrimitive.h"
#include "daiBinary.h"
#include "TD_PackPush.h"
/** \details
Implements the Data Access Interface (DAI) that provides functionality for manipulating data that is defined within the EXPRESS SCHEMA format.
*/
namespace OdDAI
{
class Aggr;
class Number;
/** \details
A class that implements storing and handling a value of the SELECT data type represented as an attribute data block.
*/
class DAI_EXPORT ADB_Value
{
public:
/** \details
Creates a new empty instance of the attribute data block.
*/
ADB_Value();
/** \details
Creates a new instance of the attribute data block as a copy of another instance (copy constructor).
\param rightValue [in] The value to copy from.
*/
ADB_Value(const ADB_Value& rightValue);
/** \details
Destroys the attribute data block value.
*/
~ADB_Value();
/** \details
The assignment operator for attribute data block values.
\param rightValue [in] Another attribute data block value to assign (right-hand operand of the assignment operation).
\returns A reference to the attribute data block value modified with the assignment operator.
*/
ADB_Value& operator=(const ADB_Value& rightValue);
/** \details
The comparison operator for attribute data block values.
\param rightValue [in] Another attribute data block value to compare.
\returns true if values are equal; otherwise, the operator returns false.
*/
bool operator==(const ADB_Value& rightValue) const;
/** \details
The cast to integer operator for the attribute data block value object.
\returns
The attribute data block value converted to a signed integer value.
If the attribute data block value can't be converted into the signed integer data type, the operator throws an exception.
*/
operator int() const;
/** \details
The cast to boolean operator for the attribute data block value object.
\returns
The attribute data block value converted to a boolean value.
If the attribute data block value can't be converted into the boolean data type, the operator throws an exception.
*/
operator bool() const;
/** \details
The cast to operator for the attribute data block value object.
\returns
The attribute data block value converted to an value.
If the attribute data block value can't be converted into the data type, the operator throws an exception.
*/
operator EnumValueInfo() const;
/** \details
The cast to double operator for the attribute data block value object.
\returns
The attribute data block value converted to a double value.
If the attribute data block value can't be converted into the double data type, the operator throws an exception.
*/
operator const double& () const;
/** \details
The cast to operator for the attribute data block value object.
\returns
The attribute data block value converted to a value.
If the attribute data block value can't be converted into the data type, the operator throws an exception.
*/
operator const OdDAI::Logical& () const;
/** \details
The cast to operator for the attribute data block value object.
\returns
The attribute data block value converted to a value.
If the attribute data block value can't be converted into the data type, the operator throws an exception.
*/
operator const OdDAI::Boolean& () const;
/** \details
The cast to operator for the attribute data block value object.
\returns
The attribute data block value converted to an value.
If the attribute data block value can't be converted into the data type, the operator throws an exception.
*/
operator const OdDAIObjectId& () const;
/** \details
The cast to operator for the attribute data block value object.
\returns
The attribute data block value converted to a value.
If the attribute data block value can't be converted into the data type, the operator throws an exception.
*/
operator const OdDAI::Number& () const;
/** \details
The cast to operator for the attribute data block value object.
\returns
The attribute data block value converted to a value.
If the attribute data block value can't be converted into the data type, the operator throws an exception.
*/
operator const OdDAI::Binary& () const;
/** \details
The cast to OdAnsiString operator for the attribute data block value object.
\returns
The attribute data block value converted to an OdAnsiString value.
If the attribute data block value can't be converted into the OdAnsiString data type, the operator throws an exception.
*/
operator const OdAnsiString& () const;
/** \details
The cast to a pointer to the operator for the attribute data block value object.
\returns
The attribute data block value converted to a pointer to the value.
If the attribute data block value can't be converted into a pointer to the value, the operator throws an exception.
*/
operator const OdDAI::Aggr* () const;
/** \details
Sets the new value of the attribute data block, represented with a signed integer value.
\param setFrom [in] A signed integer value that contains the new value of the attribute data block object.
\returns true if the new value was successfully set; otherwise, the method returns false.
*/
bool setValue(const int& setFrom);
/** \details
Sets the new value of the attribute data block, represented with a boolean value.
\param setFrom [in] A boolean value that contains the new value of the attribute data block object.
\returns true if the new value was successfully set; otherwise, the method returns false.
*/
bool setValue(const bool& setFrom);
/** \details
Sets the new value of the attribute data block, represented with an value.
\param setFrom [in] An value that contains the new value of the attribute data block object.
\returns true if the new value was successfully set; otherwise, the method returns false.
*/
bool setValue(const EnumValueInfo& setFrom);
/** \details
Sets the new value of the attribute data block, represented with a double value.
\param setFrom [in] A double value that contains the new value of the attribute data block object.
\returns true if the new value was successfully set; otherwise, the method returns false.
*/
bool setValue(const double& setFrom);
/** \details
Sets the new value of the attribute data block, represented with a value.
\param setFrom [in] A value that contains the new value of the attribute data block object.
\returns true if the new value was successfully set; otherwise, the method returns false.
*/
bool setValue(const OdDAI::Logical& setFrom);
/** \details
Sets the new value of the attribute data block, represented with a value.
\param setFrom [in] A value that contains the new value of the attribute data block object.
\returns true if the new value was successfully set; otherwise, the method returns false.
*/
bool setValue(const OdDAI::Boolean& setFrom);
/** \details
Sets the new value of the attribute data block, represented with an value.
\param setFrom [in] An value that contains the new value of the attribute data block object.
\returns true if the new value was successfully set; otherwise, the method returns false.
*/
bool setValue(const OdDAIObjectId& setFrom);
/** \details
Sets the new value of the attribute data block, represented with a raw pointer to an array of bytes.
\param setFrom [in] A raw pointer to the array of bytes that contains the new value of the attribute data block object.
\returns true if the new value was successfully set; otherwise, the method returns false.
*/
bool setValue(const char* setFrom);
/** \details
Sets the new value of the attribute data block, represented with an OdAnsiString value.
\param setFrom [in] An OdAnsiString object that contains the new value of the attribute data block object.
\returns true if the new value was successfully set; otherwise, the method returns false.
*/
bool setValue(const OdAnsiString& setFrom);
/** \details
Sets the new value of the attribute data block, represented with a raw pointer to an object.
\param setFrom [in] A raw pointer to the object that contains the new value of the attribute data block object.
\returns true if the new value was successfully set; otherwise, the method returns false.
*/
bool setValue(OdDAI::Aggr* setFrom);
/** \details
Sets the new value of the attribute data block, represented with a value.
\param setFrom [in] A value that contains the new value of the attribute data block object.
\returns true if the new value was successfully set; otherwise, the method returns false.
*/
bool setValue(const OdDAI::Number& setFrom);
/** \details
Sets the new value of the attribute data block, represented with a value.
\param setFrom [in] A value that contains the new value of the attribute data block object.
\returns true if the new value was successfully set; otherwise, the method returns false.
*/
bool setValue(const OdDAI::Binary& setFrom);
/** \details
Retrieves the current value of the attribute data block, represented as a signed integer value.
The method fills the passed parameter with the attribute data block value and returns it to a calling subroutine.
\param getTo [out] A placeholder for the signed integer value that contains the value of the attribute data block.
\returns true if the attribute data block value was successfully converted and returned to the calling subroutine; otherwise, the method returns false.
*/
bool getValue(int& getTo) const;
/** \details
Retrieves the current value of the attribute data block, represented as a boolean value.
The method fills the passed parameter with the attribute data block value and returns it to a calling subroutine.
\param getTo [out] A placeholder for the boolean value that contains the value of the attribute data block.
\returns true if the attribute data block value was successfully converted and returned to the calling subroutine; otherwise, the method returns false.
*/
bool getValue(bool& getTo) const;
/** \details
Retrieves the current value of the attribute data block, represented as an value.
The method fills the passed parameter with the attribute data block value and returns it to a calling subroutine.
\param getTo [out] A placeholder for the value that contains the value of the attribute data block.
\returns true if the attribute data block value was successfully converted and returned to the calling subroutine; otherwise, the method returns false.
*/
bool getValue(EnumValueInfo& getTo) const;
/** \details
Retrieves the current value of the attribute data block, represented as a double value.
The method fills the passed parameter with the attribute data block value and returns it to a calling subroutine.
\param getTo [out] A placeholder for the double value that contains the value of the attribute data block.
\returns true if the attribute data block value was successfully converted and returned to the calling subroutine; otherwise, the method returns false.
*/
bool getValue(double& getTo) const;
/** \details
Retrieves the current value of the attribute data block, represented as an value.
The method fills the passed parameter with the attribute data block value and returns it to a calling subroutine.
\param getTo [out] A placeholder for the value that contains the value of the attribute data block.
\returns true if the attribute data block value was successfully converted and returned to the calling subroutine; otherwise, the method returns false.
*/
bool getValue(OdDAI::Logical& getTo)const;
/** \details
Retrieves the current value of the attribute data block, represented as an value.
The method fills the passed parameter with the attribute data block value and returns it to a calling subroutine.
\param getTo [out] A placeholder for the value that contains the value of the attribute data block.
\returns true if the attribute data block value was successfully converted and returned to the calling subroutine; otherwise, the method returns false.
*/
bool getValue(OdDAI::Boolean& getTo)const;
/** \details
Retrieves the current value of the attribute data block, represented as an value.
The method fills the passed parameter with the attribute data block value and returns it to a calling subroutine.
\param getTo [out] A placeholder for the value that contains the value of the attribute data block.
\returns true if the attribute data block value was successfully converted and returned to the calling subroutine; otherwise, the method returns false.
*/
bool getValue(OdDAIObjectId& getTo)const;
/** \details
Retrieves the current value of the attribute data block, represented as an array of bytes.
The method fills the passed parameter with the attribute data block value and returns it to a calling subroutine.
\param getTo [out] A placeholder for the raw pointer to the array of bytes that contains the value of the attribute data block.
\returns true if the attribute data block value was successfully converted and returned to the calling subroutine; otherwise, the method returns false.
*/
bool getValue(const char*& getTo)const;
/** \details
Retrieves the current value of the attribute data block, represented as an OdAnsiString object.
The method fills the passed parameter with the attribute data block value and returns it to a calling subroutine.
\param getTo [out] A placeholder for the OdAnsiString object that contains the value of the attribute data block.
\returns true if the attribute data block value was successfully converted and returned to the calling subroutine; otherwise, the method returns false.
*/
bool getValue(OdAnsiString& getTo)const;
/** \details
Retrieves the current value of the attribute data block, represented with a raw pointer to an object.
The method fills the passed parameter with the attribute data block value and returns it to a calling subroutine.
\param getTo [out] A placeholder for the raw pointer to an object that contains the value of the attribute data block.
\returns true if the attribute data block value was successfully converted and returned to the calling subroutine; otherwise, the method returns false.
*/
bool getValue(OdDAI::Aggr*& getTo)const;
/** \details
Retrieves the current value of the attribute data block, represented as an value.
The method fills the passed parameter with the attribute data block value and returns it to a calling subroutine.
\param getTo [out] A placeholder for the value that contains the value of the attribute data block.
\returns true if the attribute data block value was successfully converted and returned to the calling subroutine; otherwise, the method returns false.
*/
bool getValue(OdDAI::Number& getTo)const;
/** \details
Retrieves the current value of the attribute data block, represented as an value.
The method fills the passed parameter with the attribute data block value and returns it to a calling subroutine.
\param getTo [out] A placeholder for the value that contains the value of the attribute data block.
\returns true if the attribute data block value was successfully converted and returned to the calling subroutine; otherwise, the method returns false.
*/
bool getValue(OdDAI::Binary& getTo)const;
/** \details
A template operator that saves specified value of different data types into the attribute data block object.
\param val [in] A value that is stored within the attribute data block object.
*/
template
void operator << (const ValueType& val)
{
setValue(val);
}
/** \details
An operator that saves specified value of the data type into the attribute data block object.
\param val [in] A object that contains the value that is stored within the attribute data block object.
*/
void operator << (const OdDAI::Boolean& val)
{
setValue(val);
}
/** \details
A template operator that saves the attribute data block value into a specified value of different data types.
\param val [in] A value where the attribute data block value is written.
\returns True if the attribute data block value is successfully saved; otherwise the method returns false.
*/
template
bool operator >> (ValueType& val) const
{
return getValue(val);
}
/** \details
An operator that saves the attribute data block value into a specified value of the data type.
\param val [in] A object where the attribute data block value is written.
\returns True if the attribute data block value is successfully saved; otherwise the method returns false.
*/
bool operator >> (OdDAI::Boolean& val) const
{
bool transitValue = false;
if (!getValue(transitValue))
{
return false;
}
val = transitValue ? OdDAI::Boolean::True : OdDAI::Boolean::False;
return true;
}
/** \details
Retrieves the type of the attribute data block value.
\returns An object that contains the current type of the attribute data block.
*/
OdTCKind type() const;
/** \details
Clears attribute data block.
*/
void clean();
//DOM-IGNORE-BEGIN
private:
static void copyADB_internal(const ADB_Value& from, ADB_Value& to);
static bool compareADB_internal(const ADB_Value& left, const ADB_Value& right);
static void unsetADB_internal(ADB_Value& unsetWhat);
private:
OdTCKind m_type;
union
{
int intValue;
EnumValueInfo enumValue;
double doubleValue;
OdDAI::Logical logicalValue;
OdDAI::Boolean booleanValue;
OdDAIObjectId objectIdValue;
OdAnsiString ansiStringValue;
OdDAI::Aggr* aggrValue;
OdDAI::Number numberValue;
OdDAI::Binary binaryValue;
};
//DOM-IGNORE-END
};
}
#include "TD_PackPop.h"
#endif