20 #ifndef ESSENTIA_VECTOROUTPUT_H
21 #define ESSENTIA_VECTOROUTPUT_H
23 #include "../streamingalgorithm.h"
34 template <
typename TokenType,
typename StorageType = TokenType>
38 std::vector<TokenType>*
_v;
62 int ntokens = std::min(
_data.available(),
_data.buffer().bufferInfo().maxContiguousElements);
63 ntokens = std::max(1, ntokens);
65 EXEC_DEBUG(
"acquiring " << ntokens <<
" tokens");
66 if (!
_data.acquire(ntokens)) {
71 int curSize =
_v->size();
72 _v->resize(curSize + ntokens);
74 TokenType* dest = &
_v->front() + curSize;
75 const TokenType* src = &
_data.firstToken();
78 _data.release(ntokens);
88 template <
typename TokenType,
typename StorageType>
93 template <
typename TokenType,
typename StorageType>
102 template <
typename T>
108 template <
typename T>
void setName(const std::string &name)
Definition: configurable.h:53
Definition: streamingalgorithm.h:140
void declareInput(SinkBase &sink, const std::string &name, const std::string &desc)
SinkBase & input(const std::string &name)
Definition: sourcebase.h:52
Definition: vectoroutput.h:35
std::vector< TokenType > * _v
Definition: vectoroutput.h:38
VectorOutput(std::vector< TokenType > *v=0)
Definition: vectoroutput.h:41
Sink< TokenType > _data
Definition: vectoroutput.h:37
AlgorithmStatus process()
Definition: vectoroutput.h:55
void setVector(std::vector< TokenType > *v)
Definition: vectoroutput.h:51
~VectorOutput()
Definition: vectoroutput.h:46
void declareParameters()
Definition: vectoroutput.h:49
void reset()
Definition: vectoroutput.h:83
#define EXEC_DEBUG(msg)
Definition: debugging.h:161
void operator>>(SourceBase &source, DevNullConnector devnull)
Definition: devnull.h:81
void connect(SourceBase &source, DevNullConnector devnull)
AlgorithmStatus
Definition: streamingalgorithm.h:106
@ OK
Definition: streamingalgorithm.h:107
@ NO_INPUT
Definition: streamingalgorithm.h:111
Definition: algorithm.h:28
void fastcopy(T *dest, const T *src, int n)
Definition: essentiautil.h:180