Go to the documentation of this file.00001 #ifndef msm_curve_h_
00002 #define msm_curve_h_
00003
00004
00005
00006
00007
00008 #include <vcl_cassert.h>
00009 #include <vcl_cstddef.h>
00010 #include <vcl_iosfwd.h>
00011 #include <vcl_string.h>
00012 #include <vsl/vsl_fwd.h>
00013 #include <vcl_vector.h>
00014
00015
00016
00017
00018
00019
00020
00021
00022 class msm_curve
00023 {
00024 private:
00025
00026 vcl_string name_;
00027
00028
00029 bool open_;
00030
00031
00032 vcl_vector<unsigned> index_;
00033 public:
00034
00035 msm_curve();
00036
00037
00038 msm_curve(unsigned lo, unsigned hi,
00039 bool open=true, vcl_string name="");
00040
00041
00042 ~msm_curve() {}
00043
00044
00045 vcl_size_t size() const { return index_.size(); }
00046
00047 void set(const vcl_vector<unsigned>& index,
00048 bool open=true, vcl_string name="");
00049
00050
00051 void set(unsigned lo, unsigned hi,
00052 bool open=true, vcl_string name="");
00053
00054
00055 const vcl_string& name() const { return name_; }
00056
00057
00058 bool open() const { return open_; }
00059
00060
00061 void set_open(bool b) { open_=b; }
00062
00063
00064 vcl_vector<unsigned>& index() { return index_; }
00065
00066
00067 const vcl_vector<unsigned>& index() const { return index_; }
00068
00069 unsigned operator[](unsigned i) const
00070 { assert(i<index_.size()); return index_[i]; }
00071
00072
00073 unsigned max_index() const;
00074
00075
00076
00077 void add_index_offset(int offset);
00078
00079
00080
00081
00082
00083
00084
00085
00086 void config_from_stream(vcl_istream&);
00087
00088
00089 void print_summary(vcl_ostream& os) const;
00090
00091
00092 void b_write(vsl_b_ostream& bfs) const;
00093
00094
00095 void b_read(vsl_b_istream& bfs);
00096
00097
00098 bool operator==(const msm_curve& curve) const;
00099 };
00100
00101
00102
00103 void vsl_b_write(vsl_b_ostream& bfs, const msm_curve& c);
00104
00105
00106
00107 void vsl_b_read(vsl_b_istream& bfs, msm_curve& c);
00108
00109
00110 vcl_ostream& operator<<(vcl_ostream& os,const msm_curve& c);
00111
00112
00113 void vsl_print_summary(vcl_ostream& os,const msm_curve& c);
00114
00115
00116 class msm_curves : public vcl_vector<msm_curve>
00117 {
00118 public:
00119
00120 msm_curves();
00121
00122
00123 msm_curves(unsigned lo, unsigned hi,
00124 bool open=true, vcl_string name="");
00125
00126
00127 int which_curve(const vcl_string& name) const;
00128
00129
00130 unsigned max_index() const;
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140 void config_from_stream(vcl_istream&);
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150 bool write_text_file(const vcl_string& path);
00151
00152
00153 bool read_text_file(const vcl_string& path);
00154 };
00155
00156
00157 vcl_ostream& operator<<(vcl_ostream& os,const msm_curves& c);
00158
00159
00160 void vsl_b_write(vsl_b_ostream& bfs, const msm_curves& c);
00161
00162
00163
00164 void vsl_b_read(vsl_b_istream& bfs, msm_curves& c);
00165
00166
00167 #endif // msm_curve_h_