Google OR-Tools v9.12
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::CommittableVector< T > Class Template Reference

#include <routing_filter_committables.h>

Public Member Functions

 CommittableVector (size_t num_elements, const T &value)
 Makes a vector with initial elements all committed to value.
 
size_t Size () const
 Return the size of the vector.
 
Get (size_t index) const
 
void Set (size_t index, const T &value)
 Set the value stored at index in the current state to given value.
 
void Revert ()
 Changes the values of the vector to those in the last Commit().
 
void Commit ()
 Makes the current state committed, clearing all changes.
 
void SetAllAndCommit (const T &value)
 
GetCommitted (size_t index) const
 Returns a copy of the value stored at index in the last committed state.
 
bool HasChanged (size_t index) const
 
const std::vector< size_t > & ChangedIndices () const
 

Detailed Description

template<typename T>
class operations_research::CommittableVector< T >

Definition at line 58 of file routing_filter_committables.h.

Constructor & Destructor Documentation

◆ CommittableVector()

template<typename T>
operations_research::CommittableVector< T >::CommittableVector ( size_t num_elements,
const T & value )
inline

Makes a vector with initial elements all committed to value.

Definition at line 54 of file routing_filter_committables.h.

Member Function Documentation

◆ ChangedIndices()

template<typename T>
const std::vector< size_t > & operations_research::CommittableVector< T >::ChangedIndices ( ) const
inline

Returns the set of indices that have been Set() since the last Commit() or Revert().

Definition at line 118 of file routing_filter_committables.h.

◆ Commit()

template<typename T>
void operations_research::CommittableVector< T >::Commit ( )
inline

Makes the current state committed, clearing all changes.

Definition at line 92 of file routing_filter_committables.h.

◆ Get()

template<typename T>
T operations_research::CommittableVector< T >::Get ( size_t index) const
inline

Returns a copy of the value stored at index in the current state. Does not return a reference, because the class needs to know when elements are modified.

Definition at line 70 of file routing_filter_committables.h.

◆ GetCommitted()

template<typename T>
T operations_research::CommittableVector< T >::GetCommitted ( size_t index) const
inline

Returns a copy of the value stored at index in the last committed state.

Definition at line 107 of file routing_filter_committables.h.

◆ HasChanged()

template<typename T>
bool operations_research::CommittableVector< T >::HasChanged ( size_t index) const
inline

Return true iff the value at index has been Set() since the last Commit() or Revert(), even if the current value is the same as the committed value.

Definition at line 114 of file routing_filter_committables.h.

◆ Revert()

template<typename T>
void operations_research::CommittableVector< T >::Revert ( )
inline

Changes the values of the vector to those in the last Commit().

Definition at line 84 of file routing_filter_committables.h.

◆ Set()

template<typename T>
void operations_research::CommittableVector< T >::Set ( size_t index,
const T & value )
inline

Set the value stored at index in the current state to given value.

Definition at line 76 of file routing_filter_committables.h.

◆ SetAllAndCommit()

template<typename T>
void operations_research::CommittableVector< T >::SetAllAndCommit ( const T & value)
inline

Sets all elements of this vector to given value, and commits to this state. Supposes that there are no changes since the last Commit() or Revert().

Definition at line 101 of file routing_filter_committables.h.

◆ Size()

template<typename T>
size_t operations_research::CommittableVector< T >::Size ( ) const
inline

Return the size of the vector.

Definition at line 65 of file routing_filter_committables.h.


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