Open 3D Engine ScriptCanvas Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
ScriptCanvas::Datum Class Referencefinal

#include <Datum.h>

Inherits ScriptCanvas::SerializationListener.

Public Types

enum class  eOriginality : int { Original , Copy }
 
enum class  TypeChange { Forced , Requested }
 

Public Member Functions

 AZ_RTTI (Datum, "{8B836FC0-98A8-4A81-8651-35C7CA125451}", SerializationListener)
 
 AZ_CLASS_ALLOCATOR (Datum, AZ::SystemAllocator)
 
 Datum (const Datum &object)
 
 Datum (Datum &&object)
 
 Datum (const Data::Type &type, eOriginality originality)
 
 Datum (const Data::Type &type, eOriginality originality, const void *source, const AZ::Uuid &sourceTypeID)
 
 Datum (const AZ::BehaviorParameter &parameterDesc, eOriginality originality, const void *source)
 
 Datum (BehaviorContextResultTag, const AZ::BehaviorParameter &resultType)
 
 Datum (const AZStd::string &behaviorClassName, eOriginality originality)
 
 Datum (const AZ::BehaviorArgument &value)
 
void ReconfigureDatumTo (Datum &&object)
 
void ReconfigureDatumTo (const Datum &object)
 
void CopyDatumTypeAndValue (const Datum &object)
 
void DeepCopyDatum (const Datum &object)
 
const AZStd::any & ToAny () const
 
template<typename t_Value , typename = AZStd::enable_if_t<!AZStd::is_same<AZStd::decay_t<t_Value>, Datum>::value && !AZStd::is_same<AZStd::decay_t<t_Value>, AZ::BehaviorArgument>::value>>
 Datum (t_Value &&value)
 
AZ_INLINE bool Empty () const
 
template<typename t_Value >
const t_Value * GetAs () const
 use RARELY, this is dangerous. Use ONLY to read the value contained by this Datum, never to modify
 
AZ_INLINE const void * GetAsDanger () const
 
const Data::TypeGetType () const
 
void SetType (const Data::Type &dataType, TypeChange typeChange=TypeChange::Requested)
 
template<typename T >
void SetAZType ()
 
AZ_INLINE bool IsConvertibleFrom (const AZ::Uuid &typeID) const
 
AZ_INLINE bool IsConvertibleFrom (const Data::Type &type) const
 
AZ_INLINE bool IsConvertibleTo (const AZ::Uuid &typeID) const
 
AZ_INLINE bool IsConvertibleTo (const Data::Type &type) const
 
bool IsConvertibleTo (const AZ::BehaviorParameter &parameterDesc) const
 
bool IsDefaultValue () const
 
template<typename t_Value >
bool IS_A () const
 
AZ_INLINE bool IS_A (const Data::Type &type) const
 
template<typename t_Value >
t_Value * ModAs ()
 use RARELY, this is dangerous as it circumvents ScriptCanvas execution. Use to initialize values more simply in unit testing, or assist debugging.
 
AZ_INLINE void * ModAsDanger ()
 
Datumoperator= (const Datum &other)
 
Datumoperator= (Datum &&other)
 
ComparisonOutcome operator== (const Datum &other) const
 
ComparisonOutcome operator!= (const Datum &other) const
 
ComparisonOutcome operator< (const Datum &other) const
 
ComparisonOutcome operator<= (const Datum &other) const
 
ComparisonOutcome operator> (const Datum &other) const
 
ComparisonOutcome operator>= (const Datum &other) const
 
template<typename t_Value >
AZ_INLINE bool Set (const t_Value &value)
 
void SetToDefaultValueOfType ()
 
void SetNotificationsTarget (AZ::EntityId notificationId)
 
bool ToBehaviorContext (AZ::BehaviorArgument &destination) const
 
AZ::BehaviorArgument ToBehaviorContext (AZ::BehaviorClass *&behaviorClass)
 
AZ::Outcome< AZ::BehaviorArgument, AZStd::string > ToBehaviorValueParameter (const AZ::BehaviorParameter &description) const
 
AZ_INLINE AZStd::string ToString () const
 
bool ToString (Data::StringType &result) const
 
void SetLabel (AZStd::string_view name)
 
AZStd::string GetLabel () const
 
void SetVisibility (AZ::Crc32 visibility)
 
AZ::Crc32 GetVisibility () const
 
void ResolveSelfEntityReferences (const AZ::EntityId &graphOwnerId)
 
AZ::Outcome< AZ::BehaviorArgument, AZStd::string > ToBehaviorValueParameterResult (const AZ::BehaviorParameter &description, const AZStd::string_view className, const AZStd::string_view methodName)
 
void ConvertBehaviorContextMethodResult (const AZ::BehaviorParameter &resultType)
 
template<typename t_Value >
bool Set (const t_Value &value)
 
- Public Member Functions inherited from ScriptCanvas::SerializationListener
 AZ_RTTI (SerializationListener, "{CA4EE281-30B3-4928-BCD8-9305CE75E463}")
 
virtual void OnSerialize ()
 
virtual void OnDeserialize ()
 

Static Public Member Functions

static AZ::Outcome< Datum, AZStd::string > CallBehaviorContextMethodResult (const AZ::BehaviorMethod *method, const AZ::BehaviorParameter *resultType, AZ::BehaviorArgument *params, unsigned int numExpectedArgs, const AZStd::string_view context)
 
static AZ::Outcome< void, AZStd::string > CallBehaviorContextMethod (const AZ::BehaviorMethod *method, AZ::BehaviorArgument *params, unsigned int numExpectedArgs)
 
static bool IsValidDatum (const Datum *datum)
 
static void Reflect (AZ::ReflectContext *reflectContext)
 

Friends

class AZ::DatumSerializer
 
class SerializeContextEventHandler
 

Detailed Description

A Datum is used to provide generic storage for all data types in ScriptCanvas, and provide a common interface to accessing, modifying, and displaying them in the editor, regardless of their actual ScriptCanvas or BehaviorContext type.

Constructor & Destructor Documentation

◆ Datum()

template<typename t_Value , typename >
ScriptCanvas::Datum::Datum ( t_Value &&  value)
explicit

If t_Value is a ScriptCanvas value type, regardless of pointer/reference, this will create datum with a copy of that value. That is, Datum<AZ::Vector3>(source), Datum<AZ::Vector3&>(source), Datum<AZ::Vector3*>(&source), will all produce a copy of source. If t_Value is a ScriptCanvas reference type, passing in a pointer or reference will created a datum that REFERS to the source, and passing in a value will create a datum with a new, Script-owned, copy from the source.

Member Function Documentation

◆ GetAsDanger()

const void * ScriptCanvas::Datum::GetAsDanger ( ) const
Note
Directly modifying the data circumvents all of the runtime (and even the edit time) handling of script canvas data. This is dangerous in that one may not be properly handling values, like converting numeric types to the supported numeric type, or modifying objects without notifying systems whose correctness depends on changes in those values. Use with extreme caution. This will made clearer and easier in a future API change.

The documentation for this class was generated from the following file: