Scratch.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2007 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // dspsr/Kernel/Classes/dsp/Scratch.h
10 
11 #ifndef __dsp_Scratch_h
12 #define __dsp_Scratch_h
13 
14 #include "OwnStream.h"
15 #include "Memory.h"
16 
17 namespace dsp
18 {
20 
22  class Scratch : public OwnStream
23  {
24 
25  public:
26 
28  Scratch ();
29 
31  ~Scratch ();
32 
34  template<typename T>
35  T* space (size_t ndat)
36  { return reinterpret_cast<T*>( space (ndat * sizeof(T)) ); }
37 
39  void* space (size_t nbytes);
40 
42  static Scratch* get_default_scratch();
43 
45  virtual void set_memory (Memory*);
46 
47  protected:
48 
51 
52  char* working_space;
53  size_t working_size;
54 
55  };
56 
57 }
58 
59 #endif
Contains all Baseband Data Reduction Library classes.
Definition: ASCIIObservation.h:17
Scratch space that can be shared between Operations.
Definition: Scratch.h:27
virtual void set_memory(Memory *)
Set the memory manager.
Definition: Scratch.C:36
Scratch()
Default constructor.
Definition: Scratch.C:24
~Scratch()
Destructor.
Definition: Scratch.C:31
T * space(size_t ndat)
Return typed pointer to shared memory resource.
Definition: Scratch.h:45
Reference::To< Memory > memory
The memory manager.
Definition: Scratch.h:60
Pure virtual base class of objects that manage memory allocation and destruction.
Definition: Memory.h:23
static Scratch * get_default_scratch()
Default scratch space.
Definition: Scratch.C:17

Generated using doxygen 1.8.17