This class serves as a storage for feature vectors with an option to limit the memory usage by removing old elements. More...
#include <online-feature.h>
Public Member Functions | |
RecyclingVector (int items_to_hold=-1) | |
By default it does not remove any elements. More... | |
Vector< BaseFloat > * | At (int index) const |
The ownership is being retained by this collection - do not delete the item. More... | |
void | PushBack (Vector< BaseFloat > *item) |
The ownership of the item is passed to this collection - do not delete the item. More... | |
int | Size () const |
This method returns the size as if no "recycling" had happened, i.e. More... | |
~RecyclingVector () | |
Private Attributes | |
std::deque< Vector< BaseFloat > * > | items_ |
int | items_to_hold_ |
int | first_available_index_ |
This class serves as a storage for feature vectors with an option to limit the memory usage by removing old elements.
The deleted frames indices are "remembered" so that regardless of the MAX_ITEMS setting, the user always provides the indices as if no deletion was being performed. This is useful when processing very long recordings which would otherwise cause the memory to eventually blow up when the features are not being removed.
Definition at line 50 of file online-feature.h.
RecyclingVector | ( | int | items_to_hold = -1 | ) |
By default it does not remove any elements.
Definition at line 27 of file online-feature.cc.
~RecyclingVector | ( | ) |
Definition at line 32 of file online-feature.cc.
References RecyclingVector::items_.
The ownership is being retained by this collection - do not delete the item.
Definition at line 38 of file online-feature.cc.
References RecyclingVector::first_available_index_, RecyclingVector::items_, KALDI_ERR, and RecyclingVector::Size().
Referenced by kaldi::TestRecyclingVector().
The ownership of the item is passed to this collection - do not delete the item.
Definition at line 50 of file online-feature.cc.
References RecyclingVector::first_available_index_, RecyclingVector::items_, and RecyclingVector::items_to_hold_.
Referenced by OnlineGenericBaseFeature< C >::ComputeFeatures(), and kaldi::TestRecyclingVector().
int Size | ( | ) | const |
This method returns the size as if no "recycling" had happened, i.e.
equivalent to the number of times the PushBack method has been called.
Definition at line 59 of file online-feature.cc.
References RecyclingVector::first_available_index_, and RecyclingVector::items_.
Referenced by RecyclingVector::At(), OnlineGenericBaseFeature< C >::ComputeFeatures(), and kaldi::TestRecyclingVector().
|
private |
Definition at line 70 of file online-feature.h.
Referenced by RecyclingVector::At(), RecyclingVector::PushBack(), and RecyclingVector::Size().
Definition at line 68 of file online-feature.h.
Referenced by RecyclingVector::At(), RecyclingVector::PushBack(), RecyclingVector::Size(), and RecyclingVector::~RecyclingVector().
|
private |
Definition at line 69 of file online-feature.h.
Referenced by RecyclingVector::PushBack().