BaseTypes.h
Go to the documentation of this file.
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2 
3 /*
4  Sonic Visualiser
5  An audio file viewer and annotation editor.
6  Centre for Digital Music, Queen Mary, University of London.
7 
8  This program is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public License as
10  published by the Free Software Foundation; either version 2 of the
11  License, or (at your option) any later version. See the file
12  COPYING included with this distribution for more information.
13 */
14 
15 #ifndef SV_BASE_TYPES_H
16 #define SV_BASE_TYPES_H
17 
18 #include <cstdint>
19 #include <complex>
20 #include <vector>
21 
22 #include <bqvec/Allocators.h>
23 
31 typedef int64_t sv_frame_t;
32 
36 template<typename T, typename C>
37 bool in_range_for(const C &container, T i)
38 {
39  if (i < 0) return false;
40  if (sizeof(T) > sizeof(typename C::size_type)) {
41  return i < static_cast<T>(container.size());
42  } else {
43  return static_cast<typename C::size_type>(i) < container.size();
44  }
45 }
46 
51 typedef double sv_samplerate_t;
52 
53 typedef std::vector<float, breakfastquay::StlAllocator<float>> floatvec_t;
54 
55 typedef std::vector<std::complex<float>,
56  breakfastquay::StlAllocator<std::complex<float>>> complexvec_t;
57 
58 typedef uint64_t sv_id_t;
59 
60 enum {
62 };
63 
64 #endif
65 
double sv_samplerate_t
Sample rate.
Definition: BaseTypes.h:51
int64_t sv_frame_t
Frame index, the unit of our time axis.
Definition: BaseTypes.h:31
std::vector< float, breakfastquay::StlAllocator< float > > floatvec_t
Definition: BaseTypes.h:53
bool in_range_for(const C &container, T i)
Check whether an integer index is in range for a container, avoiding overflows and signed/unsigned co...
Definition: BaseTypes.h:37
uint64_t sv_id_t
Definition: BaseTypes.h:58
std::vector< std::complex< float >, breakfastquay::StlAllocator< std::complex< float > > > complexvec_t
Definition: BaseTypes.h:56