DataDictionaryInterface Class Reference Data Types

#include <datadictionary.h>

详细描述

Class to store and find any data type under any type of key.

DataDictionary values; values.Set(Data( "MachineName" _s), Data( Application::GetMachineInfo (). Get (MACHINEINFO::COMPUTERNAME))); values.Set(Data( Int (100)), Data( Application::GetMachineInfo (). Get (MACHINEINFO::OSVERSION))); values.Set(Data( 向量 (1, 0, 0)), Data( String::IntToString ( Application::GetMachineInfo (). Get (MACHINEINFO::NUMBEROFPROCESSORS))));

Public Types

using  Iterator = DataDictionaryIterator
using  ConstIterator = DataDictionaryIterator

公共成员函数

MAXON_METHOD Result < void >  SetData ( ForwardingDataPtr &&key, const 数据 &data)
MAXON_METHOD Result < void >  SetData ( ForwardingDataPtr &&key, 数据 &&data)
MAXON_METHOD Result < void >  SetData ( ForwardingDataPtr &&key, ForwardingDataPtr &&data)
MAXON_METHOD Result < 数据 GetData (const ConstDataPtr &key) const
template<typename KEY >
MAXON_FUNCTION Bool   Contains (KEY &&key) const
MAXON_METHOD Result < void >  EraseData (const ConstDataPtr &key)
MAXON_METHOD void  重置 ()
MAXON_METHOD Bool   IsEmpty () const
MAXON_FUNCTION Bool   IsPopulated () const
MAXON_METHOD String   ToString (const FormatStatement *formatStatement=nullptr) const
MAXON_METHOD Bool   IsEqual (const DataDictionaryInterface *other, EQUALITY equality) const
MAXON_METHOD HashInt   GetHashCode () const
template<typename T = void, typename KEY >
MAXON_FUNCTION Result < typename std::conditional< std::is_void< T >::value, typename IsFidClass< KEY >::type, T >::type >  Get (KEY &&key) const
template<typename T , typename KEY >
MAXON_FUNCTION std::conditional< IsFidClass< KEY >::value && GetCollectionKind < T >::value != COLLECTION_KIND::ARRAY , typename IsFidClass< KEY >::type, T >::type  Get (KEY &&key, const T &defaultValue) const
template<typename T , typename KEY >
MAXON_FUNCTION std::conditional< IsFidClass< KEY >::value && GetCollectionKind < T >::value != COLLECTION_KIND::ARRAY , typename IsFidClass< KEY >::type, T >::type  Get (KEY &&key, T &&defaultValue) const
template<typename T = void, typename KEY >
MAXON_FUNCTION std::conditional< std::is_void< T >::value, typename IsFidClass< KEY >::type, T >::type  GetOrDefault (KEY &&key) const
template<typename T , typename KEY >
MAXON_FUNCTION Result < void >  Set (KEY &&key, T &&data)
template<typename KEY >
MAXON_FUNCTION Result < void >  Erase (KEY &&key)
template<typename T , typename KEY >
MAXON_FUNCTION Result < void >  GetCopy (KEY &&key, T &dst) const
MAXON_METHOD void  InitIterator ( DataDictionaryIteratorInterface *iterator, Bool end ) const
MAXON_FUNCTION ConstIterator   Begin () const
MAXON_FUNCTION ConstIterator   End () const
const MAXON_METHOD 数据 PrivateGetData (const ConstDataPtr &key) const
template<typename T , typename KEY >
std::conditional< std::is_void< T >::value, typename IsFidClass< KEY >::type, T >::type  GetOrDefault (KEY &&key) const

静态公共成员函数

static MAXON_METHOD Result < void >  DescribeIO (const DataSerializeInterface &stream)

私有成员函数

  MAXON_INTERFACE_NONVIRTUAL ( DataDictionaryInterface , MAXON_REFERENCE_COPY_ON_WRITE , "net.maxon.interface.datadictionary")
template<typename T >
Result < void >  GetCopyHelper (const 数据 &data, T &dst, OverloadRank0 ) const
template<typename T >
std::enable_if< GetCollectionKind < T >::value== COLLECTION_KIND::ARRAY , Result < void > >::type  GetCopyHelper (const 数据 &data, T &dst, OverloadRank1 ) const

Member Typedef Documentation

◆  Iterator

using Iterator = DataDictionaryIterator

◆  ConstIterator

using ConstIterator = DataDictionaryIterator

成员函数文档编制

◆  MAXON_INTERFACE_NONVIRTUAL()

MAXON_INTERFACE_NONVIRTUAL ( DataDictionaryInterface   ,
MAXON_REFERENCE_COPY_ON_WRITE   ,
"net.maxon.interface.datadictionary"   
)
private

◆  SetData() [1/3]

MAXON_METHOD Result <void> SetData ( ForwardingDataPtr &&  key ,
const 数据 data  
)

Set 数据 under a specific id.

参数
[in] key Key under which the data is stored.
[in] data Reference to the data.
返回
OK on success. @MAXON_ANNOTATION{returnsThis}

◆  SetData() [2/3]

MAXON_METHOD Result <void> SetData ( ForwardingDataPtr &&  key ,
数据 &&  data  
)

Set 数据 under a specific id.

参数
[in] key Key under which the data should be stored.
[in] data Reference to the data.
返回
OK on success. @MAXON_ANNOTATION{returnsThis}

◆  SetData() [3/3]

MAXON_METHOD Result <void> SetData ( ForwardingDataPtr &&  key ,
ForwardingDataPtr &&  data  
)

Set 数据 under a specific id.

参数
[in] key Key under which the data should be stored.
[in] data Reference to the data.
返回
OK on success. @MAXON_ANNOTATION{returnsThis}

◆  GetData()

MAXON_METHOD Result < 数据 > GetData ( const ConstDataPtr key ) const

Get data stored under a specific id.

参数
[in] key Key under which the data should be stored.
返回
数据 as 数据 class.

◆  Contains()

MAXON_FUNCTION Bool Contains ( KEY &&  key ) const

Check if there is data stored under a specific key.

参数
[in] key Key under which the data should be stored.
返回
True if existent.

◆  EraseData()

MAXON_METHOD Result <void> EraseData ( const ConstDataPtr key )

Remove a data entry from the dictionary. This function doesn't check if the dictionary contained the key.

参数
[in] key Key under which the data is stored.
返回
OK on success. This function doesn't check if the dictionary contained the key.

◆  Reset()

MAXON_METHOD void Reset ( )

Frees the entire dictionary. After this call the DataDictionary is empty.

◆  IsEmpty()

MAXON_METHOD Bool IsEmpty ( ) const

Checks if the dictionary is empty.

返回
True if the dictionary does not contain any elements.

◆  IsPopulated()

MAXON_FUNCTION Bool IsPopulated ( ) const

Checks if the dictionary contains anything.

返回
True if the dictionary contains any elements.

◆  ToString()

MAXON_METHOD String ToString ( const FormatStatement formatStatement = nullptr ) const

Returns a readable string of the content.

参数
[in] formatStatement Nullptr or additional formatting instruction. Currently no additional formatting instructions are supported.
返回
The converted result.

◆  DescribeIO()

static MAXON_METHOD Result <void> DescribeIO ( const DataSerializeInterface stream )
static

Describe all elements of this class for I/O operations.

参数
[in] stream The stream that is used to register the class members.
返回
OK on success.

◆  IsEqual()

MAXON_METHOD Bool IsEqual ( const DataDictionaryInterface other ,
EQUALITY   equality  
) const

Compares this DataDictionary with another if both are identical.

参数
[in] other The other DataDictionary to compare this object with.
返回
True if the object is identical.

◆  GetHashCode()

MAXON_METHOD HashInt GetHashCode ( ) const

Returns a hash code for this DataDictionary which depends on the content.

返回
Hash code for the dictionary.

◆  Get() [1/3]

MAXON_FUNCTION Result <typename std::conditional<std::is_void<T>::value, typename IsFidClass<KEY>::type, T>::type> Get ( KEY &&  key ) const

Get data stored under a specific key. If the key is not found an error will be returned. This functions offers 2 possible calls. First using an FId "dict.Get(MAXCHINEINFO::COMPUTERNAME)" or second using any type directly together with the result type "dict.Get<String>(Int32(5))". The data type needs to be registered.

参数
[in] key Key under which the data is stored.
返回
数据 converted to the right type on success.

◆  Get() [2/3]

MAXON_FUNCTION std::conditional<IsFidClass<KEY>::value&& GetCollectionKind <T>::value != COLLECTION_KIND::ARRAY , typename IsFidClass<KEY>::type, T>::type Get ( KEY &&  key ,
const T &  defaultValue  
) const

Get data stored under a specific key. If the key is not found the given default value will be returned. This functions offers 2 possible calls. First using an FId "dict.Get(MAXCHINEINFO::COMPUTERNAME, String())" or second using any type directly together with the result type "dict.Get(Int32(5), String())". The data type needs to be registered.

参数
[in] key Key under which the data is stored.
[in] defaultValue Default value which should be returned if the key cannot be found.
返回
数据 converted to the right type if found in the dictionary, otherwise the default value.

◆  Get() [3/3]

MAXON_FUNCTION std::conditional<IsFidClass<KEY>::value&& GetCollectionKind <T>::value != COLLECTION_KIND::ARRAY , typename IsFidClass<KEY>::type, T>::type Get ( KEY &&  key ,
T &&  defaultValue  
) const

Get data stored under a specific key. If the key is not found the given default value will be returned. This functions offers 2 possible calls. First using an FId "dict.Get(MAXCHINEINFO::COMPUTERNAME, String())" or second using any type directly together with the result type "dict.Get(Int32(5), String())". The data type needs to be registered.

参数
[in] key Key under which the data is stored.
[in] defaultValue Default value which should be returned if the key cannot be found.
返回
数据 converted to the right type if found in the dictionary, otherwise the default value.

◆  GetOrDefault()

MAXON_FUNCTION std::conditional<std::is_void<T>::value, typename IsFidClass<KEY>::type, T>::type GetOrDefault ( KEY &&  key ) const

Get data stored under a specific key. If the key is not found the given default value will be returned. This functions offers 2 possible calls. First using an FId "dict.Get(MAXCHINEINFO::COMPUTERNAME, String())" or second using any type directly together with the result type "dict.Get(Int32(5), String())". The data type needs to be registered.

参数
[in] key Key under which the data is stored.
返回
数据 converted to the right type if found in the dictionary, otherwise the default value.

◆  Set()

MAXON_FUNCTION Result <void> Set ( KEY &&  key ,
T &&  data  
)

Set data under a specific id. this function is template to allow implicit Set calls for each data type. This functions offers 2 possible calls. First using an FId "dict.Set(MAXCHINEINFO::COMPUTERNAME, "data"_s)" or second using any type directly "dict.Set(Int32(5), "data"_s)". The data type needs to be registered.

参数
[in] key Key under which the data is stored.
[in] data 数据 to be stored in the dictionary.
返回
OK on success. @MAXON_ANNOTATION{returnsThis}

◆  Erase()

MAXON_FUNCTION Result <void> Erase ( KEY &&  key )

Erase data stored under a specific key. This function doesn't check if the dictionary contained the key. This functions offers 2 possible calls. First using an FId "dict.Erase(MAXCHINEINFO::COMPUTERNAME)" or second using any type directly "dict.Erase(Int32(5))". The data type needs to be registered.

参数
[in] key Key under which the data is stored.
返回
OK on success. This function doesn't check if the dictionary contained the key.

◆  GetCopy()

MAXON_FUNCTION Result <void> GetCopy ( KEY &&  key ,
T &  dst  
) const

Returns a copy of the data stored under a specific id. Can be used for types that do no support copy assignment.

参数
[in] key Key under which the data is stored.
[out] dst Used to return the data.
返回
OK on success.

◆  InitIterator()

MAXON_METHOD void InitIterator ( DataDictionaryIteratorInterface iterator ,
Bool   end  
) const

Helper functions for iterator.

◆  Begin()

MAXON_FUNCTION ConstIterator Begin ( ) const

Returns the begin iterator of the DataDictionary. You can use the Iterator to run through all elements of the DataDictionary.

◆  End()

MAXON_FUNCTION ConstIterator End ( ) const

Returns the end iterator of the DataDictionary. You can use the Iterator to run through all elements of the DataDictionary.

◆  PrivateGetData()

const MAXON_METHOD 数据 * PrivateGetData ( const ConstDataPtr key ) const

Get data stored under a specific id.

参数
[in] key Key under which the data should be stored.
返回
Pointer to internal data, or nullptr if there is no value for key.

◆  GetCopyHelper() [1/2]

Result <void> GetCopyHelper ( const 数据 data ,
T &  dst ,
OverloadRank0    
) const
private

◆  GetCopyHelper() [2/2]

std::enable_if< GetCollectionKind <T>::value == COLLECTION_KIND::ARRAY , Result <void> >::type GetCopyHelper ( const 数据 data ,
T &  dst ,
OverloadRank1    
) const
private
maxon::Application::GetMachineInfo
static MAXON_METHOD DataDictionary GetMachineInfo()
String::IntToString
static String IntToString(Int32 v)
定义: c4d_string.h:495
maxon::DataDictionaryInterface::Get
MAXON_FUNCTION Result< typename std::conditional< std::is_void< T >::value, typename IsFidClass< KEY >::type, T >::type > Get(KEY &&key) const
定义: datadictionary.h:142
maxon::Int
Int64 Int
signed 32/64 bit int, size depends on the platform
定义: apibase.h:184
maxon::Vector
Vec3< Float, 1 > Vector
定义: vector.h:58