WAPPArchive.h
1//-*-C++-*-
2/***************************************************************************
3 *
4 * Copyright (C) 2008 by Paul Demorest
5 * Licensed under the Academic Free License version 2.1
6 *
7 ***************************************************************************/
8
9#ifndef __WAPPArchive_h
10#define __WAPPArchive_h
11
12#include "Pulsar/BasicArchive.h"
13#include "Pulsar/Agent.h"
14
15#include "polyco.h"
16#include "wapp_headers.h"
17
18// Default to DCT if FFTW is present
19#define WAPP_USE_FFTW_DCT 1
20
21#if WAPP_USE_FFTW_DCT
22# ifdef HAVE_CONFIG_H
23# include <config.h>
24# endif
25# if HAVE_FFTW3
26# include <fftw3.h>
27# else
28# warning "WAPP_USE_FFTW_DCT requires FFTW3, falling back to general R2C"
29# undef WAPP_USE_FFTW_DCT
30# define WAPP_USE_FFTW_DCT 0
31# endif
32#endif
33
34namespace Pulsar {
35
37
41 class WAPPArchive : public BasicArchive {
42
43 public:
44
46 WAPPArchive ();
47
49 WAPPArchive (const WAPPArchive& archive);
50
52 ~WAPPArchive ();
53
55 const WAPPArchive& operator = (const WAPPArchive& archive);
56
58 WAPPArchive (const Archive& archive);
59
61 void copy (const Archive& archive);
62
64 WAPPArchive* clone () const;
65
66 protected:
67
69 virtual void load_header (const char* filename);
70
72 void load_polycos();
73
75 virtual Integration*
76 load_Integration (const char* filename, unsigned subint);
77
79 void load_extensions();
80
82 bool can_unload () const { return false; }
83
85 virtual void unload_file (const char* filename) const;
86
87 // Advocates the use of the ExampleArchive plugin
88 class Agent;
89
91 friend class Archive::Advocate<WAPPArchive>;
92
93 private:
94
96 void init ();
97
99 polyco hdr_polyco;
100
102 uint32_t wapp_hdr_version;
103 uint32_t wapp_hdr_size;
104 size_t wapp_ascii_hdr_size; // Includes terminating null byte
105 size_t wapp_file_size;
106
108 char *rawhdr;
109
111 WAPP_HEADER *hdr;
112
114 int raw_data_is_lags;
115
117#if WAPP_USE_FFTW_DCT
118 fftwf_plan fplan;
119 float *fftbuf;
120#endif
121
122 };
123
124
125 // Advocates the use of the ExampleArchive plugin
126 class WAPPArchive::Agent : public Archive::Advocate<WAPPArchive> {
127
128 public:
129
130 Agent () { }
131
133 bool advocate (const char* filename);
134
136 std::string get_name () { return "WAPP"; }
137
139 std::string get_description ();
140
141 };
142
143}
144
145#endif
The primary interface to pulsar observational data.
Definition Archive.h:46
BasicArchive()
null constructor
Definition BasicArchive.C:18
Array of Profiles integrated over the same time interval.
Definition Integration.h:37
bool can_unload() const
The unload_file method is not implemented.
Definition WAPPArchive.h:82
void load_extensions()
Fill various Archive extensions.
Definition WAPPArchive.C:615
virtual void unload_file(const char *filename) const
Unload the ExampleArchive (header and Integration data) to filename.
Definition WAPPArchive.C:649
WAPPArchive * clone() const
Return a new copy-constructed ExampleArchive instance.
Definition WAPPArchive.C:102
void copy(const Archive &archive)
Copy all of the class attributes and the selected Integration data.
Definition WAPPArchive.C:79
void load_polycos()
Load any polycos from the header.
Definition WAPPArchive.C:337
virtual Integration * load_Integration(const char *filename, unsigned subint)
Load the specified Integration from filename, returning new instance.
Definition WAPPArchive.C:395
virtual void load_header(const char *filename)
Load the Example header information from filename.
Definition WAPPArchive.C:109
const WAPPArchive & operator=(const WAPPArchive &archive)
Assignment operator.
~WAPPArchive()
Destructor.
Definition WAPPArchive.C:50
WAPPArchive()
Default constructor.
Definition WAPPArchive.C:45
Defines the PSRCHIVE library.
Definition CalSource.h:17

Generated using doxygen 1.14.0