forqs module reference
Forward simulation of Recombination, Quantitative traits, and Selection
 All Classes Groups Pages
VariantIndicator.hpp
1 //
2 // VariantIndicator.hpp
3 //
4 // Created by Darren Kessner with John Novembre
5 //
6 // Copyright (c) 2013 Regents of the University of California
7 // All rights reserved.
8 //
9 // Redistribution and use in source and binary forms, with or without
10 // modification, are permitted provided that the following conditions are met:
11 //
12 // * Redistributions of source code must retain the above copyright notice,
13 // this list of conditions and the following disclaimer.
14 //
15 // * Redistributions in binary form must reproduce the above copyright notice,
16 // this list of conditions and the following disclaimer in the documentation
17 // and/or other materials provided with the distribution.
18 //
19 // * Neither UCLA nor the names of its contributors may be used to endorse or
20 // promote products derived from this software without specific prior
21 // written permission.
22 //
23 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
24 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
27 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
31 // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 //
34 
35 
36 #ifndef _VARIANTINDICATOR_HPP_
37 #define _VARIANTINDICATOR_HPP_
38 
39 
40 #include "Configurable.hpp"
41 #include "Locus.hpp"
42 #include "MSFormat.hpp"
43 #include "Reporter.hpp"
44 #include "Simulator.hpp"
45 #include "boost/filesystem.hpp"
46 #include "boost/filesystem/fstream.hpp"
47 
48 
54 
55 
56 //
57 // VariantIndicator
58 //
59 
63 
64 class VariantIndicator : public virtual Configurable
65 {
66  public:
67 
68  virtual unsigned int operator()(unsigned int chunk_id, const Locus& locus) const = 0;
69  virtual void write_file(const std::string& filename) const;
70  virtual unsigned int mutate(unsigned int old_chunk_id, const Locus& locus, unsigned int value); // returns new chunk id
71  virtual ~VariantIndicator() {}
72 
73  // Configurable interface
74 
75  virtual std::string class_name() const;
76  virtual Parameters parameters() const;
77  virtual void configure(const Parameters& parameters, const Registry& registry);
78 
79  protected:
80 
81  // Note: the compiler needs this because Configurable has no default
82  // constructor (by design). However, this call to Configurable(id) never
83  // actually happens. Configurable is a virtual base, so derived classes
84  // must call Configurable(id) directly in their constructors, and this
85  // call is ignored by compiler.
86  VariantIndicator() : Configurable("dummy_id_variant_indicator") {}
87 };
88 
89 
90 typedef shared_ptr<VariantIndicator> VariantIndicatorPtr;
91 
92 
93 #endif // _VARIANTINDICATOR_HPP_
94