The BLOCKS SDK
TouchList< Type > Class Template Reference

Description

template<typename Type>
class TouchList< Type >

Utility class to hold a list of TouchSurface::Touch objects with different indices and blockUIDs, where each touch has a mapping to some kind of user-supplied data value.

The Type template is a user-defined type of object that will be stored for each touch element. The type must be default-constructable and copyable.

Public Member Functions

 TouchList ()
 Creates an empty touch list. More...
 
 ~TouchList ()
 Destructor. More...
 
int size () const noexcept
 Returns the number of entries in the touch list. More...
 
Type & getValue (const TouchSurface::Touch &touch)
 Returns the user data object that corresponds to the given touch. More...
 
bool contains (const TouchSurface::Touch &touch) const noexcept
 Returns true if a touch is already in the list. More...
 
void updateTouch (const TouchSurface::Touch &touch)
 Updates the entry for the given touch, copying in the new state. More...
 
TouchEntryfind (const TouchSurface::Touch &touch) const noexcept
 If a touch is in the list, returns a pointer to the TouchEntry. More...
 
TouchEntrybegin () const noexcept
 Allows iterator access to the list of touch entries. More...
 
TouchEntryend () const noexcept
 Allows iterator access to the list of touch entries. More...
 
TouchEntryoperator[] (const int index)
 Retrieve a reference to particular item in the list of touch entires. More...
 
void clear () noexcept
 Resets all contents, doest not generate any call-backs. More...
 

Classes

struct  TouchEntry
 Holds the current state of a touch, along with the user-data associated with it. More...
 

Constructor & Destructor Documentation

§ TouchList()

template<typename Type >
TouchList< Type >::TouchList ( )

Creates an empty touch list.

§ ~TouchList()

template<typename Type >
TouchList< Type >::~TouchList ( )

Destructor.

Member Function Documentation

§ size()

template<typename Type >
int TouchList< Type >::size ( ) const
noexcept

Returns the number of entries in the touch list.

§ getValue()

template<typename Type >
Type& TouchList< Type >::getValue ( const TouchSurface::Touch touch)

Returns the user data object that corresponds to the given touch.

This will also update the stored state of the TouchEntry::touch value for this touch index.

References TouchList< Type >::find().

§ contains()

template<typename Type >
bool TouchList< Type >::contains ( const TouchSurface::Touch touch) const
noexcept

Returns true if a touch is already in the list.

References TouchList< Type >::find().

Referenced by TouchList< Type >::updateTouch().

§ updateTouch()

template<typename Type >
void TouchList< Type >::updateTouch ( const TouchSurface::Touch touch)

Updates the entry for the given touch, copying in the new state.

If no entry with the same index and blockUID exists then a new entry is created. If given a touch which is a touch-end, this will remove any corresponding entries from the list.

References TouchList< Type >::contains(), TouchList< Type >::find(), TouchSurface::Touch::isTouchEnd, and jassert.

§ find()

template<typename Type >
TouchEntry* TouchList< Type >::find ( const TouchSurface::Touch touch) const
noexcept

If a touch is in the list, returns a pointer to the TouchEntry.

Otherwise, returns nullptr.

References TouchList< Type >::TouchEntry::touch.

Referenced by TouchList< Type >::contains(), TouchList< Type >::getValue(), and TouchList< Type >::updateTouch().

§ begin()

template<typename Type >
TouchEntry* TouchList< Type >::begin ( ) const
noexcept

Allows iterator access to the list of touch entries.

§ end()

template<typename Type >
TouchEntry* TouchList< Type >::end ( ) const
noexcept

Allows iterator access to the list of touch entries.

§ operator[]()

template<typename Type >
TouchEntry& TouchList< Type >::operator[] ( const int  index)

Retrieve a reference to particular item in the list of touch entires.

§ clear()

template<typename Type >
void TouchList< Type >::clear ( )
noexcept

Resets all contents, doest not generate any call-backs.

References TouchSurface::Touch::blockUID, TouchSurface::Touch::index, and JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR.


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