Essentia  2.1-beta5-dev
streamconnector.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2016 Music Technology Group - Universitat Pompeu Fabra
3  *
4  * This file is part of Essentia
5  *
6  * Essentia is free software: you can redistribute it and/or modify it under
7  * the terms of the GNU Affero General Public License as published by the Free
8  * Software Foundation (FSF), either version 3 of the License, or (at your
9  * option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14  * details.
15  *
16  * You should have received a copy of the Affero GNU General Public License
17  * version 3 along with this program. If not, see http://www.gnu.org/licenses/
18  */
19 
20 #ifndef ESSENTIA_STREAMCONNECTOR_H
21 #define ESSENTIA_STREAMCONNECTOR_H
22 
23 
24 namespace essentia {
25 namespace streaming {
26 
35  public:
36 
38 
39  virtual ~StreamConnector() {}
40 
44  virtual int available() const = 0;
45 
49  inline bool acquire() { return acquire(_acquireSize); }
50 
54  virtual bool acquire(int n) = 0;
55 
59  inline void release() { release(_releaseSize); }
60 
64  virtual void release(int n) = 0;
65 
69  virtual int acquireSize() const { return _acquireSize; }
70 
74  virtual int releaseSize() const { return _releaseSize; }
75 
79  virtual void setAcquireSize(int n) { _acquireSize = n; }
80 
84  virtual void setReleaseSize(int n) { _releaseSize = n; }
85 
89  virtual void reset() = 0;
90 
91  protected:
94 };
95 
96 } // namespace streaming
97 } // namespace essentia
98 
99 #endif // ESSENTIA_STREAMCONNECTOR_H
Definition: streamconnector.h:34
virtual int acquireSize() const
Definition: streamconnector.h:69
bool acquire()
Definition: streamconnector.h:49
int _acquireSize
Definition: streamconnector.h:92
virtual int available() const =0
void release()
Definition: streamconnector.h:59
int _releaseSize
Definition: streamconnector.h:93
Definition: algorithm.h:28
virtual void setReleaseSize(int n)
Definition: streamconnector.h:84
StreamConnector()
Definition: streamconnector.h:37
virtual void setAcquireSize(int n)
Definition: streamconnector.h:79
virtual int releaseSize() const
Definition: streamconnector.h:74
virtual ~StreamConnector()
Definition: streamconnector.h:39