IntegrationManager.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2003 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // psrchive/Base/Classes/Pulsar/IntegrationManager.h
10 
11 #ifndef __Pulsar_IntegrationManager_h
12 #define __Pulsar_IntegrationManager_h
13 
14 #include "Pulsar/Container.h"
15 
16 #include <algorithm>
17 
18 namespace Pulsar {
19 
20  class Integration;
21 
22  bool temporal_order (const Reference::To<Integration>& A,
24 
26 
28  class IntegrationManager : public Container {
29 
30  public:
31 
33  static unsigned verbose;
34 
37 
39  IntegrationManager (const IntegrationManager& archive);
40 
43 
45  virtual ~IntegrationManager ();
46 
48  Integration* get_Integration (unsigned subint);
49 
52 
55 
57  const Integration* get_Integration (unsigned subint) const;
58 
60  const Integration* get_last_Integration () const;
61 
63  const Integration* get_first_Integration () const;
64 
66  virtual Integration* new_Integration (const Integration* copy = 0) = 0;
67 
69  virtual Integration* use_Integration (Integration* use) = 0;
70 
72  virtual Integration* load_Integration (unsigned isubint) = 0;
73 
75 
76  virtual unsigned get_nsubint () const = 0;
77 
79  template<class StrictWeakOrdering>
80  void sort (StrictWeakOrdering comp = temporal_order)
81  {
82  load_all ();
83  std::sort (subints.begin(), subints.begin()+get_nsubint(), comp);
84  }
85 
87  void shuffle ();
88 
90  class Expert;
91 
93  Expert* expert ();
94 
95  protected:
96 
97  friend class TimeSortedOrder;
98  friend class Expert;
99 
101 
102  virtual void set_nsubint (unsigned num_sub) = 0;
103 
105  virtual void _resize (unsigned nsubint, bool instances=true);
106 
108  void append (const IntegrationManager* more_subints);
109 
111  void manage (IntegrationManager* more_subints);
112 
114  void manage (Integration* integration);
115 
117  void insert (unsigned isubint, Integration* integration);
118 
120  void unmanage (const Integration*);
121 
123  void unmanage (unsigned isubint);
124 
126  void load_all ();
127 
128  private:
129 
131 
135  std::vector< Reference::To<Integration> > subints;
136 
138  Reference::To<Expert> expert_interface;
139 
140  };
141 
142 }
143 
144 #endif
145 
void insert(unsigned isubint, Integration *integration)
Insert the Integration instance into the specified location.
Definition: IntegrationManager.C:129
Provides access to private and protected members of IntegrationManager.
Definition: IntegrationManagerExpert.h:36
Expert * expert()
Provide access to the expert interface.
Definition: IntegrationManager.C:233
virtual void resize(unsigned npol=0, unsigned nchan=0, unsigned nbin=0)
Set the dimensions of the data container.
Definition: Integration_resize.C:20
virtual void set_nsubint(unsigned num_sub)=0
Set the number of sub-integrations.
const Integration * get_Integration(const Archive *data, Index subint)
Return the requested profile, cloning and integrating when needed.
Definition: Index.C:118
void load_all()
Load all sub-integrations.
Definition: IntegrationManager.C:226
virtual unsigned get_nsubint() const =0
Get the number of sub-integrations stored in the file.
Integration * get_last_Integration()
Return a pointer to the last Integration.
Definition: IntegrationManager.C:75
virtual Integration * use_Integration(Integration *use)=0
Use the given Integration instance.
void manage(IntegrationManager *more_subints)
Append use_Integration modifications of Integration objects to self.
Definition: IntegrationManager.C:113
virtual Integration * new_Integration(const Integration *copy=0)=0
Construct new Integration instance.
IntegrationManager()
null constructor
Definition: IntegrationManager.C:16
void shuffle()
Randomly rearrange the sub-integrations.
Definition: IntegrationManager.C:220
virtual void _resize(unsigned nsubint, bool instances=true)
Resize the Integration vector.
Definition: IntegrationManager.C:194
void unmanage(const Integration *)
Remove the Integration instance.
Definition: IntegrationManager.C:158
void append(const IntegrationManager *more_subints)
Append new_Integration copies of Integration objects to self.
Definition: IntegrationManager.C:102
Integration * get_Integration(unsigned subint)
Return pointer to the specified Integration.
Definition: IntegrationManager.C:41
Integration * get_first_Integration()
Return a pointer to the first Integration.
Definition: IntegrationManager.C:69
Array of Profiles integrated over the same time interval.
Definition: Integration.h:37
virtual Integration * load_Integration(unsigned isubint)=0
Load new Integration instance.
void sort(StrictWeakOrdering comp=temporal_order)
Sort the Integrations according to the specified order.
Definition: IntegrationManager.h:85
virtual ~IntegrationManager()
destructor
Definition: IntegrationManager.C:30
IntegrationManager & operator=(const IntegrationManager &archive)
operator =
static unsigned verbose
A verbosity flag that can be set for debugging purposes.
Definition: IntegrationManager.h:38
Manages a vector of Integration instances.
Definition: IntegrationManager.h:33
Defines the PSRCHIVE library.
Definition: CalSource.h:17

Generated using doxygen 1.8.17