Data Structures
ai_map.h File Reference

Key/Value storage. More...

#include "ai_node_entry.h"
#include "ai_vector.h"
#include "ai_color.h"
#include "ai_api.h"
#include "ai_string.h"

Go to the source code of this file.

Data Structures

struct  AtParamValueMapEntry
 

Functions

AtParamValueMap Methods
AI_API AtParamValueMap * AiParamValueMap ()
 Creates a new map. More...
 
AI_API void AiParamValueMapDestroy (AtParamValueMap *map)
 Destroys a map object.
 
AI_API AtParamValueMapIterator * AiParamValueMapGetIterator (const AtParamValueMap *map)
 Creates a new map iterator and resets it to the first entry. More...
 
AI_API void AiParamValueMapMerge (AtParamValueMap *target_map, const AtParamValueMap *src_map)
 Merge all contents of a map into another map. More...
 
AI_API AtParamValueMap * AiParamValueMapClone (const AtParamValueMap *src_map)
 Clones an existing param value map using shallow copy (so any pointer value will be shared) More...
 
AI_API void AiParamValueMapIteratorDestroy (AtParamValueMapIterator *iter)
 Destroys a map iterator when it is no longer needed. More...
 
AI_API const AtParamValueMapEntryAiParamValueMapIteratorGetNext (AtParamValueMapIterator *iter)
 Returns current map entry and points map iterator to the next one. More...
 
AI_API bool AiParamValueMapIteratorFinished (const AtParamValueMapIterator *iter)
 Returns true if there is no more key/values to iterate over. More...
 

Value Writing

These functions allow inserting key/value pairs into a map.

Here is an example:

AiParamValueMapSetStr(map, AtString("author"), AtString("William Shakespeare"));
AiParamValueMapSetFlt(map, AtString("temperature"), 21.0f);
Arnold String allows for fast string comparisons.
Definition: ai_string.h:46
Parameters
mapthe map to operate with
namethe key you want to insert
valuethe value you want to insert
const AtString name
 
const AtString bool value { return AiMetaDataGetBool (nentry, AtString(param), AtString(name), value)
 
 __attribute__ ((visibility("default"))) void AiParamValueMapSetBool(AtParamValueMap *map
 

Detailed Description

Key/Value storage.

Function Documentation

◆ AiParamValueMap()

AI_API AtParamValueMap * AiParamValueMap ( )

Creates a new map.

Returns
new map object

◆ AiParamValueMapGetIterator()

AI_API AtParamValueMapIterator * AiParamValueMapGetIterator ( const AtParamValueMap *  mds)

Creates a new map iterator and resets it to the first entry.

Returns
an iterator over all key/values in a map

◆ AiParamValueMapMerge()

AI_API void AiParamValueMapMerge ( AtParamValueMap *  target_map,
const AtParamValueMap *  src_map 
)

Merge all contents of a map into another map.

After merge, target map will contain all its previous attributes plus all the attributes in the source map

Parameters
target_maptarget map where the other map contents will be merged
src_mapmap which contents will be merged to the target map

◆ AiParamValueMapClone()

AI_API AtParamValueMap * AiParamValueMapClone ( const AtParamValueMap *  src_map)

Clones an existing param value map using shallow copy (so any pointer value will be shared)

  • Parameters
    src_mapmap which contents will be merged to the target map
    Returns
    new map object with the same contents as the source map

◆ AiParamValueMapIteratorDestroy()

AI_API void AiParamValueMapIteratorDestroy ( AtParamValueMapIterator *  iter)

Destroys a map iterator when it is no longer needed.

Parameters
itermap iterator that will be deallocated

◆ AiParamValueMapIteratorGetNext()

AI_API const AtParamValueMapEntry * AiParamValueMapIteratorGetNext ( AtParamValueMapIterator *  iter)

Returns current map entry and points map iterator to the next one.

This function is designed to be used inside a loop, as illustrated by the following example, which prints all the keys of a given AtNodeEntry:

AtParamValueMapIterator *iter = AiParamValueMap();
{
printf("%s\n", entry->name);
}
AI_API void AiParamValueMapIteratorDestroy(AtParamValueMapIterator *iter)
Destroys a map iterator when it is no longer needed.
Definition: ai_map.cpp:133
AI_API AtParamValueMap * AiParamValueMap()
Creates a new map.
Definition: ai_map.cpp:46
AI_API const AtParamValueMapEntry * AiParamValueMapIteratorGetNext(AtParamValueMapIterator *iter)
Returns current map entry and points map iterator to the next one.
Definition: ai_map.cpp:160
AI_API bool AiParamValueMapIteratorFinished(const AtParamValueMapIterator *iter)
Returns true if there is no more key/values to iterate over.
Definition: ai_map.cpp:171
Definition: ai_map.h:104

Consistent Ordering is not guaranteed

Parameters
itera map iterator
Returns
the current metadata entry pointed by the iterator, or NULL if there is no more metadata to iterate over

◆ AiParamValueMapIteratorFinished()

AI_API bool AiParamValueMapIteratorFinished ( const AtParamValueMapIterator *  iter)

Returns true if there is no more key/values to iterate over.

Parameters
itera map iterator
Returns
true if the map iterator has moved past the last entry

© 2022 Autodesk, Inc. · All rights reserved · www.arnoldrenderer.com