~ubuntu-branches/ubuntu/saucy/3depict/saucy

« back to all changes in this revision

Viewing changes to src/filters/ionDownsample.h

  • Committer: Package Import Robot
  • Author(s): D Haley
  • Date: 2013-05-17 00:52:39 UTC
  • mfrom: (3.1.4 experimental)
  • Revision ID: package-import@ubuntu.com-20130517005239-7bl4mnhkvrhc2ba6
Tags: 0.0.13-1
Upload to unstable 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef IONDOWNSAMPLE_H
2
 
#define IONDOWNSAMPLE_H
3
 
 
4
 
#include "../filter.h"
5
 
#include "../translation.h"
6
 
//!Random picker filter
7
 
class IonDownsampleFilter : public Filter
8
 
{
9
 
        private:
10
 
                RandNumGen rng;
11
 
                //When usng fixed number output, maximum to allow out.
12
 
                size_t maxAfterFilter;
13
 
                //!Allow only a fixed number at output, alternate is random fraction (binomial dist).
14
 
                bool fixedNumOut;
15
 
                //Fraction to output
16
 
                float fraction;
17
 
        
18
 
 
19
 
                //!Should we use a per-species split or not?
20
 
                bool perSpecies;        
21
 
                //This is filter's enabled ranges. 0 if we don't have a range
22
 
                RangeStreamData *rsdIncoming;
23
 
 
24
 
                //!Fractions to output for species specific
25
 
                std::vector<float> ionFractions;
26
 
                std::vector<size_t> ionLimits;
27
 
        public:
28
 
                IonDownsampleFilter();
29
 
                //!Duplicate filter contents, excluding cache.
30
 
                Filter *cloneUncached() const;
31
 
                //!Returns FILTER_TYPE_IONDOWNSAMPLE
32
 
                unsigned int getType() const { return FILTER_TYPE_IONDOWNSAMPLE;};
33
 
                //!Initialise filter prior to tree propagation
34
 
                virtual void initFilter(const std::vector<const FilterStreamData *> &dataIn,
35
 
                                std::vector<const FilterStreamData *> &dataOut);
36
 
                
37
 
                //!Set mode, fixed num out/approximate out (fraction)
38
 
                void setControlledOut(bool controlled) {fixedNumOut=controlled;};
39
 
 
40
 
                //!Set the number of ions to generate after the filtering (when using count based fitlering).
41
 
                void setFilterCount(size_t nMax) { maxAfterFilter=nMax;};
42
 
 
43
 
                //!Get (approx) number of bytes required for cache
44
 
                virtual size_t numBytesForCache(size_t nObjects) const;
45
 
                //update filter
46
 
                unsigned int refresh(const std::vector<const FilterStreamData *> &dataIn,
47
 
                                std::vector<const FilterStreamData *> &getOut, 
48
 
                                 ProgressData &progress, bool (*callback)(bool));
49
 
 
50
 
                //!return string naming the human readable type of this class
51
 
                virtual std::string typeString() const { return std::string(TRANS("Ion Sampler"));}
52
 
 
53
 
                
54
 
                
55
 
                //!Get the properties of the filter, in key-value form. First vector is for each output.
56
 
                void getProperties(FilterProperties &propertyList) const;
57
 
 
58
 
                //!Set the properties for the nth filter
59
 
                bool setProperty(unsigned int set, unsigned int key, const std::string &value, bool &needUpdate);
60
 
                //!Get the human readable error string associated with a particular error code during refresh(...)
61
 
                std::string getErrString(unsigned int code) const;
62
 
                
63
 
                //!Dump state to output stream, using specified format
64
 
                bool writeState(std::ofstream &f,unsigned int format, 
65
 
                                                unsigned int depth=0) const;
66
 
                //!Read the state of the filter from XML file. If this
67
 
                //fails, filter will be in an undefined state.
68
 
                bool readState(xmlNodePtr &node, const std::string &packDir);
69
 
                
70
 
                //!Set internal property value using a selection binding  (Disabled, this filter has no bindings)
71
 
                void setPropFromBinding(const SelectionBinding &b) {ASSERT(false);} ;
72
 
        
73
 
                //!Get the stream types that will be dropped during ::refresh   
74
 
                unsigned int getRefreshBlockMask() const;
75
 
 
76
 
                //!Get the stream types that will be generated during ::refresh 
77
 
                unsigned int getRefreshEmitMask() const;        
78
 
                
79
 
#ifdef DEBUG
80
 
                //Fire off the unit tests for this class. returns false if *any* test fails
81
 
                bool runUnitTests();
82
 
#endif
83
 
};
84
 
 
85
 
#endif