File: Flatten.h

package info (click to toggle)
js8call 2.5.2%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 24,720 kB
  • sloc: cpp: 562,651; sh: 898; python: 132; ansic: 102; makefile: 4
file content (32 lines) | stat: -rw-r--r-- 698 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef FLATTEN_HPP__
#define FLATTEN_HPP__

#include <memory>

// Functor by which to flatten (or not, by default) a spectrum; not
// reentrant, but serially reusable.

class Flatten {
  public:
    // Constructor
    explicit Flatten(bool = false);

    // Destructor
    ~Flatten();

    // Turn flattening on or off
    void operator()(bool value);

    // Process (or not) the supplied spectrum data
    void operator()(float *data, std::size_t size);

    // Return active / inactive flattening status
    explicit operator bool() const noexcept { return !!m_impl; }
    bool live() const noexcept { return !!m_impl; }

  private:
    class Impl;
    std::unique_ptr<Impl> m_impl;
};

#endif