Dry
Public Member Functions | Private Attributes | List of all members
Dry::Field< T > Class Template Reference

Field template class. More...

#include <Dry/Container/Field.h>

Inheritance diagram for Dry::Field< T >:
Dry::HashMap< IntVector3, T > Dry::HashBase

Public Member Functions

 Field () noexcept
 Construct point.
 
 Field (const IntVector3 &size)
 Construct with initial size.
 
 Field (const IntVector3 &size, const T &value)
 Construct with initial size and value.
 
void Resize (unsigned width, unsigned height=0, unsigned depth=0)
 Resize field to a minimum of a single value.
 
void Resize (const IntVector3 &newSize)
 Resize field and stretch if it containts data.
 
void Resize (const IntVector3 &newSize, const T &value)
 Resize field and fill with value.
 
void Fill (const T &value)
 Fill field with value.
 
void DoResize (const IntVector3 &newSize)
 Simple field resize.
 
T & At (const IntVector3 &point)
 Return value at point in field grid.
 
T & At (const Vector3 &position)
 Return nearest value at normalized position.
 
const T * At (const IntVector3 &point) const
 Return const value at point in field grid.
 
const T * At (const Vector3 &position) const
 Return const nearest value at normalized position.
 
LerpAt (float position) const
 Return nearest value at normalized position, assuming 1D field.
 
LerpAt (const Vector2 &position) const
 Return nearest value at normalized position, assuming 2D field.
 
LerpAt (const Vector3 &position, const IntVector3 &sampleSize=IntVector3::ONE) const
 Return lerped value at normalized position.
 
Field< T > SubField (const IntVector3 &size) const
 Extract a sub field with overlapping origin.
 
Field< T > SubField (const IntVector3 &min, const IntVector3 &max) const
 Extract a sub field.
 
IntVector3 ClampPoint (const IntVector3 &point) const
 Return vector clamped to field grid.
 
IntVector3 NormToPoint (const Vector3 &position) const
 Convert normalized position to grid point.
 
IntVector3 FloorNormToPoint (const Vector3 &position) const
 Convert normalized position to grid point.
 
Vector3 NormalizedPosition (const IntVector3 &point) const
 Convert grid point to normalized position.
 
Averaged () const
 Field average value.
 
Summed () const
 The sum of all elements.
 
void Normalize ()
 Normalize the field.
 
Field< T > MapTo (const IntVector3 &resolution) const
 
IntVector3 Resolution () const
 Return field resolution.
 
- Public Member Functions inherited from Dry::HashMap< IntVector3, T >
 HashMap ()
 Construct empty.
 
 HashMap (const HashMap< IntVector3, T > &map)
 Construct from another hash map.
 
 HashMap (HashMap< IntVector3, T > &&map) noexcept
 Move-construct from another hash map.
 
 HashMap (const std::initializer_list< Pair< IntVector3, T >> &list)
 Aggregate initialization constructor.
 
 ~HashMap ()
 Destruct.
 
HashMapoperator= (const HashMap< IntVector3, T > &rhs)
 Assign a hash map.
 
HashMapoperator= (HashMap< IntVector3, T > &&rhs) noexcept
 Move-assign a hash map.
 
HashMapoperator+= (const Pair< IntVector3, T > &rhs)
 Add-assign a pair.
 
HashMapoperator+= (const HashMap< IntVector3, T > &rhs)
 Add-assign a hash map.
 
bool operator== (const HashMap< IntVector3, T > &rhs) const
 Test for equality with another hash map.
 
bool operator!= (const HashMap< IntVector3, T > &rhs) const
 Test for inequality with another hash map.
 
T & operator[] (const IntVector3 &key)
 Index the map. Create a new pair if key not found.
 
T * operator[] (const IntVector3 &key) const
 Index the map. Return null if key is not found, does not create a new pair.
 
HashMapPopulate (const IntVector3 &key, const T &value)
 Populate the map using variadic template. This handles the base case.
 
HashMapPopulate (const IntVector3 &key, const T &value, const Args &... args)
 Populate the map using variadic template.
 
Iterator Insert (const Pair< IntVector3, T > &pair)
 Insert a pair. Return an iterator to it.
 
Iterator Insert (const Pair< IntVector3, T > &pair, bool &exists)
 Insert a pair. Return iterator and set exists flag according to whether the key already existed.
 
void Insert (const HashMap< IntVector3, T > &map)
 Insert a map.
 
Iterator Insert (const ConstIterator &it)
 Insert a pair by iterator. Return iterator to the value.
 
void Insert (const ConstIterator &start, const ConstIterator &end)
 Insert a range by iterators.
 
bool Erase (const IntVector3 &key)
 Erase a pair by key. Return true if was found.
 
Iterator Erase (const Iterator &it)
 Erase a pair by iterator. Return iterator to the next pair.
 
void Clear ()
 Clear the map.
 
void Sort ()
 Sort pairs. After sorting the map can be iterated in order until new elements are inserted.
 
bool Rehash (unsigned numBuckets)
 Rehash to a specific bucket count, which must be a power of two. Return true if successful.
 
Iterator Find (const IntVector3 &key)
 Return iterator to the pair with key, or end iterator if not found.
 
ConstIterator Find (const IntVector3 &key) const
 Return const iterator to the pair with key, or end iterator if not found.
 
bool Contains (const IntVector3 &key) const
 Return whether contains a pair with key.
 
bool TryGetValue (const IntVector3 &key, T &out) const
 Try to copy value to output. Return true if was found.
 
Vector< IntVector3Keys () const
 Return all the keys.
 
Vector< T > Values () const
 Return all the values.
 
Iterator Begin ()
 Return iterator to the beginning.
 
ConstIterator Begin () const
 Return iterator to the beginning.
 
Iterator End ()
 Return iterator to the end.
 
ConstIterator End () const
 Return iterator to the end.
 
const KeyValue & Front () const
 Return first pair.
 
const KeyValue & Back () const
 Return last pair.
 
- Public Member Functions inherited from Dry::HashBase
 HashBase ()
 Construct.
 
void Swap (HashBase &rhs)
 Swap with another hash set or map.
 
unsigned Size () const
 Return number of elements.
 
unsigned NumBuckets () const
 Return number of buckets.
 
bool IsEmpty () const
 Return whether has no elements.
 

Private Attributes

IntVector3 resolution_
 

Additional Inherited Members

- Public Types inherited from Dry::HashMap< IntVector3, T >
using KeyType = IntVector3
 
using ValueType = T
 
- Static Public Attributes inherited from Dry::HashBase
static const unsigned MIN_BUCKETS = 8
 Initial amount of buckets.
 
static const unsigned MAX_LOAD_FACTOR = 4
 Maximum load factor.
 
- Protected Member Functions inherited from Dry::HashBase
void AllocateBuckets (unsigned size, unsigned numBuckets)
 Allocate bucket head pointers + room for size and bucket count variables.
 
void ResetPtrs ()
 Reset bucket head pointers.
 
void SetSize (unsigned size)
 Set new size.
 
HashNodeBase ** Ptrs () const
 Return bucket head pointers.
 
- Protected Attributes inherited from Dry::HashBase
HashNodeBasehead_
 List head node pointer.
 
HashNodeBasetail_
 List tail node pointer.
 
HashNodeBase ** ptrs_
 Bucket head pointers.
 
AllocatorBlockallocator_
 Node allocator.
 

Detailed Description

template<class T>
class Dry::Field< T >

Field template class.


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