Ardour  9.0-pre0-582-g084a23a80d
PBD::SequenceProperty< Container > Class Template Referenceabstract

#include <sequence_property.h>

Inheritance diagram for PBD::SequenceProperty< Container >:
[legend]

Classes

struct  ChangeRecord
 

Public Types

typedef std::set< typename Container::value_type > ChangeContainer
 

Public Member Functions

 SequenceProperty (PropertyID id, const std::function< void(const ChangeRecord &)> &update)
 
void invert ()
 
void get_changes_as_xml (XMLNode *history_node) const
 
virtual void get_content_as_xml (typename ChangeContainer::value_type, XMLNode &) const =0
 
bool set_value (XMLNode const &)
 
void get_value (XMLNode &node) const
 
bool changed () const
 
void clear_changes ()
 
void apply_change (PropertyBase const *p)
 
void update (const ChangeRecord &cr)
 
void get_changes_as_properties (PBD::PropertyList &changes, Command *cmd) const
 
SequenceProperty< Container > * clone_from_xml (XMLNode const &node) const
 
virtual Container::value_type get_content_from_xml (XMLNode const &node) const =0
 
void clear_owned_changes ()
 
void rdiff (std::vector< PBD::Command * > &cmds) const
 
Container rlist () const
 
Container::iterator begin ()
 
Container::iterator end ()
 
Container::const_iterator begin () const
 
Container::const_iterator end () const
 
Container::reverse_iterator rbegin ()
 
Container::reverse_iterator rend ()
 
Container::const_reverse_iterator rbegin () const
 
Container::const_reverse_iterator rend () const
 
Container::iterator insert (typename Container::iterator i, const typename Container::value_type &v)
 
Container::iterator erase (typename Container::iterator i)
 
Container::iterator erase (typename Container::iterator f, typename Container::iterator l)
 
void remove (const typename Container::value_type &v)
 
void push_back (const typename Container::value_type &v)
 
void push_front (const typename Container::value_type &v)
 
void pop_front ()
 
void pop_back ()
 
void clear ()
 
Container::size_type size () const
 
bool empty () const
 
Container & operator= (const Container &other)
 
Container::reference front ()
 
Container::const_reference front () const
 
Container::reference back ()
 
Container::const_reference back () const
 
void sort ()
 
template<class BinaryPredicate >
void sort (BinaryPredicate comp)
 
const ChangeRecordchanges () const
 
- Public Member Functions inherited from PBD::PropertyBase
 PropertyBase (PropertyID pid)
 
virtual ~PropertyBase ()
 
virtual PropertyBaseclone () const =0
 
const gchar * property_name () const
 
PropertyID property_id () const
 
bool operator== (PropertyID pid) const
 

Protected Member Functions

 SequenceProperty (SequenceProperty< Container > const &p)
 
- Protected Member Functions inherited from PBD::PropertyBase
 PropertyBase (PropertyBase const &b)
 

Protected Attributes

Container _val
 our actual container of things More...
 
ChangeRecord _changes
 changes to the container (adds/removes) that have happened since clear_changes() was last called More...
 
std::function< void(const ChangeRecord &)> _update_callback
 

Private Member Functions

virtual SequenceProperty< Container > * create () const =0
 

Detailed Description

template<typename Container>
class PBD::SequenceProperty< Container >

A base class for properties whose state is a container of other things. Its behaviour is ‘specialised’ for this purpose in that it holds state changes as additions to and removals from the container, which is more efficient than storing entire state after any change.

Definition at line 47 of file sequence_property.h.

Member Typedef Documentation

◆ ChangeContainer

template<typename Container >
typedef std::set<typename Container::value_type> PBD::SequenceProperty< Container >::ChangeContainer

Definition at line 50 of file sequence_property.h.

Constructor & Destructor Documentation

◆ SequenceProperty() [1/2]

template<typename Container >
PBD::SequenceProperty< Container >::SequenceProperty ( PropertyID  id,
const std::function< void(const ChangeRecord &)> &  update 
)
inline

Definition at line 83 of file sequence_property.h.

◆ SequenceProperty() [2/2]

template<typename Container >
PBD::SequenceProperty< Container >::SequenceProperty ( SequenceProperty< Container > const &  p)
inlineprotected

Definition at line 352 of file sequence_property.h.

Member Function Documentation

◆ apply_change()

template<typename Container >
void PBD::SequenceProperty< Container >::apply_change ( PropertyBase const *  )
inlinevirtual

Set this property's current state from another

Implements PBD::PropertyBase.

Definition at line 141 of file sequence_property.h.

◆ back() [1/2]

template<typename Container >
Container::reference PBD::SequenceProperty< Container >::back ( )
inline

Definition at line 331 of file sequence_property.h.

◆ back() [2/2]

template<typename Container >
Container::const_reference PBD::SequenceProperty< Container >::back ( ) const
inline

Definition at line 335 of file sequence_property.h.

◆ begin() [1/2]

template<typename Container >
Container::iterator PBD::SequenceProperty< Container >::begin ( )
inline

Definition at line 240 of file sequence_property.h.

◆ begin() [2/2]

template<typename Container >
Container::const_iterator PBD::SequenceProperty< Container >::begin ( ) const
inline

Definition at line 242 of file sequence_property.h.

◆ changed()

template<typename Container >
bool PBD::SequenceProperty< Container >::changed ( ) const
inlinevirtual
Returns
true if this property has changed in value since construction or since the last call to clear_changes (), whichever was more recent.

Implements PBD::PropertyBase.

Definition at line 132 of file sequence_property.h.

◆ changes()

template<typename Container >
const ChangeRecord& PBD::SequenceProperty< Container >::changes ( ) const
inline

Definition at line 347 of file sequence_property.h.

◆ clear()

template<typename Container >
void PBD::SequenceProperty< Container >::clear ( )
inline

Definition at line 298 of file sequence_property.h.

◆ clear_changes()

template<typename Container >
void PBD::SequenceProperty< Container >::clear_changes ( )
inlinevirtual

Forget about any old changes to this property's value

Implements PBD::PropertyBase.

Definition at line 136 of file sequence_property.h.

◆ clear_owned_changes()

template<typename Container >
void PBD::SequenceProperty< Container >::clear_owned_changes ( )
inlinevirtual

Tell any things we own to forget about their old values

Reimplemented from PBD::PropertyBase.

Definition at line 220 of file sequence_property.h.

◆ clone_from_xml()

template<typename Container >
SequenceProperty<Container>* PBD::SequenceProperty< Container >::clone_from_xml ( XMLNode const &  ) const
inlinevirtual

Look in an XML node written by get_changes_as_xml and, if XML from this property is found, create a property with the changes from the XML.

Reimplemented from PBD::PropertyBase.

Definition at line 180 of file sequence_property.h.

◆ create()

template<typename Container >
virtual SequenceProperty<Container>* PBD::SequenceProperty< Container >::create ( ) const
privatepure virtual

Implemented in ARDOUR::RegionListProperty.

◆ empty()

template<typename Container >
bool PBD::SequenceProperty< Container >::empty ( ) const
inline

Definition at line 309 of file sequence_property.h.

◆ end() [1/2]

template<typename Container >
Container::iterator PBD::SequenceProperty< Container >::end ( )
inline

Definition at line 241 of file sequence_property.h.

◆ end() [2/2]

template<typename Container >
Container::const_iterator PBD::SequenceProperty< Container >::end ( ) const
inline

Definition at line 243 of file sequence_property.h.

◆ erase() [1/2]

template<typename Container >
Container::iterator PBD::SequenceProperty< Container >::erase ( typename Container::iterator  f,
typename Container::iterator  l 
)
inline

Definition at line 262 of file sequence_property.h.

◆ erase() [2/2]

template<typename Container >
Container::iterator PBD::SequenceProperty< Container >::erase ( typename Container::iterator  i)
inline

Definition at line 255 of file sequence_property.h.

◆ front() [1/2]

template<typename Container >
Container::reference PBD::SequenceProperty< Container >::front ( )
inline

Definition at line 323 of file sequence_property.h.

◆ front() [2/2]

template<typename Container >
Container::const_reference PBD::SequenceProperty< Container >::front ( ) const
inline

Definition at line 327 of file sequence_property.h.

◆ get_changes_as_properties()

template<typename Container >
void PBD::SequenceProperty< Container >::get_changes_as_properties ( PBD::PropertyList changes,
Command  
) const
inlinevirtual

If this Property has changed, clone it and add it to a given list. Used for making StatefulDiffCommands.

Implements PBD::PropertyBase.

Definition at line 157 of file sequence_property.h.

◆ get_changes_as_xml()

template<typename Container >
void PBD::SequenceProperty< Container >::get_changes_as_xml ( XMLNode ) const
inlinevirtual

Get any changes in this property as XML and add them to a StatefulDiffCommand node.

Implements PBD::PropertyBase.

Definition at line 90 of file sequence_property.h.

◆ get_content_as_xml()

template<typename Container >
virtual void PBD::SequenceProperty< Container >::get_content_as_xml ( typename ChangeContainer::value_type  ,
XMLNode  
) const
pure virtual

Get a representation of one of our items as XML. The representation must be sufficient to restore the item's state later; an ID is ok if someone else is storing the item state, otherwise it needs to be the full state. The supplied node is an <Add> or <Remove> which this method can either add properties or children to.

◆ get_content_from_xml()

template<typename Container >
virtual Container::value_type PBD::SequenceProperty< Container >::get_content_from_xml ( XMLNode const &  node) const
pure virtual

Given an <Add> or <Remove> node as passed into get_content_to_xml, obtain an item

Implemented in ARDOUR::RegionListProperty.

◆ get_value()

template<typename Container >
void PBD::SequenceProperty< Container >::get_value ( XMLNode node) const
inlinevirtual

Get this property's value and put it into a Stateful node

Implements PBD::PropertyBase.

Definition at line 126 of file sequence_property.h.

◆ insert()

template<typename Container >
Container::iterator PBD::SequenceProperty< Container >::insert ( typename Container::iterator  i,
const typename Container::value_type &  v 
)
inline

Definition at line 250 of file sequence_property.h.

◆ invert()

template<typename Container >
void PBD::SequenceProperty< Container >::invert ( )
inlinevirtual

Invert the changes in this property

Implements PBD::PropertyBase.

Definition at line 86 of file sequence_property.h.

◆ operator=()

template<typename Container >
Container& PBD::SequenceProperty< Container >::operator= ( const Container &  other)
inline

Definition at line 313 of file sequence_property.h.

◆ pop_back()

template<typename Container >
void PBD::SequenceProperty< Container >::pop_back ( )
inline

Definition at line 291 of file sequence_property.h.

◆ pop_front()

template<typename Container >
void PBD::SequenceProperty< Container >::pop_front ( )
inline

Definition at line 284 of file sequence_property.h.

◆ push_back()

template<typename Container >
void PBD::SequenceProperty< Container >::push_back ( const typename Container::value_type &  v)
inline

Definition at line 274 of file sequence_property.h.

◆ push_front()

template<typename Container >
void PBD::SequenceProperty< Container >::push_front ( const typename Container::value_type &  v)
inline

Definition at line 279 of file sequence_property.h.

◆ rbegin() [1/2]

template<typename Container >
Container::reverse_iterator PBD::SequenceProperty< Container >::rbegin ( )
inline

Definition at line 245 of file sequence_property.h.

◆ rbegin() [2/2]

template<typename Container >
Container::const_reverse_iterator PBD::SequenceProperty< Container >::rbegin ( ) const
inline

Definition at line 247 of file sequence_property.h.

◆ rdiff()

template<typename Container >
void PBD::SequenceProperty< Container >::rdiff ( std::vector< PBD::Command * > &  ) const
inlinevirtual

Collect StatefulDiffCommands for changes to anything that we own

Reimplemented from PBD::PropertyBase.

Definition at line 226 of file sequence_property.h.

◆ remove()

template<typename Container >
void PBD::SequenceProperty< Container >::remove ( const typename Container::value_type &  v)
inline

Definition at line 269 of file sequence_property.h.

◆ rend() [1/2]

template<typename Container >
Container::reverse_iterator PBD::SequenceProperty< Container >::rend ( )
inline

Definition at line 246 of file sequence_property.h.

◆ rend() [2/2]

template<typename Container >
Container::const_reverse_iterator PBD::SequenceProperty< Container >::rend ( ) const
inline

Definition at line 248 of file sequence_property.h.

◆ rlist()

template<typename Container >
Container PBD::SequenceProperty< Container >::rlist ( ) const
inline

Definition at line 235 of file sequence_property.h.

◆ set_value()

template<typename Container >
bool PBD::SequenceProperty< Container >::set_value ( XMLNode const &  )
inlinevirtual

Set the value of this property from a Stateful node.

Returns
true if the value was set.

Implements PBD::PropertyBase.

Definition at line 120 of file sequence_property.h.

◆ size()

template<typename Container >
Container::size_type PBD::SequenceProperty< Container >::size ( ) const
inline

Definition at line 305 of file sequence_property.h.

◆ sort() [1/2]

template<typename Container >
void PBD::SequenceProperty< Container >::sort ( )
inline

Definition at line 339 of file sequence_property.h.

◆ sort() [2/2]

template<typename Container >
template<class BinaryPredicate >
void PBD::SequenceProperty< Container >::sort ( BinaryPredicate  comp)
inline

Definition at line 343 of file sequence_property.h.

◆ update()

template<typename Container >
void PBD::SequenceProperty< Container >::update ( const ChangeRecord cr)
inline

Given a record of changes to this property, pass it to a callback that will update the property in some appropriate way.

This exists because simply using std::sequence methods to add/remove items from the property is far too simplistic - the semantics of add/remove may be much more complex than that.

Definition at line 153 of file sequence_property.h.

Member Data Documentation

◆ _changes

template<typename Container >
ChangeRecord PBD::SequenceProperty< Container >::_changes
protected

changes to the container (adds/removes) that have happened since clear_changes() was last called

Definition at line 360 of file sequence_property.h.

◆ _update_callback

template<typename Container >
std::function<void(const ChangeRecord&)> PBD::SequenceProperty< Container >::_update_callback
protected

Definition at line 361 of file sequence_property.h.

◆ _val

template<typename Container >
Container PBD::SequenceProperty< Container >::_val
protected

our actual container of things

Definition at line 359 of file sequence_property.h.


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