00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef SEQVEC_H
00019 #define SEQVEC_H
00020
00021 #include <odinseq/seqclass.h>
00022
00023 class SeqCounter;
00024 class SeqReorderVector;
00025
00027
00037 enum encodingScheme {linearEncoding=0, reverseEncoding, centerOutEncoding, centerInEncoding, maxDistEncoding};
00038
00039
00048 enum reorderScheme {noReorder=0,rotateReorder,blockedSegmented,interleavedSegmented};
00049
00050
00051
00061 enum nestingRelation {noRelation=0, reorderInner, vecInner, unrolledLoop};
00062
00064
00070 class SeqVector : public ListItem<SeqVector>, public Handled<const SeqVector*>, public virtual SeqClass {
00071
00072 public:
00073
00077 SeqVector(const STD_string& object_label="unnamedSeqVector");
00078
00085 SeqVector(const STD_string& object_label, unsigned int nindices, int slope=1, int offset=0 );
00086
00090 SeqVector(const SeqVector& sv);
00091
00095 virtual ~SeqVector();
00096
00100 SeqVector& operator = (const SeqVector& sv);
00101
00102
00107 virtual unsigned int get_vectorsize() const {return indexvec.size();}
00108
00109
00115 virtual unsigned int get_numof_iterations() const;
00116
00117
00122 virtual bool needs_unrolling_check() const {return false;}
00123
00124
00129 virtual bool prep_iteration() const {return true;}
00130
00131
00136 virtual int get_current_index() const;
00137
00143 int get_acq_index() const;
00144
00150 virtual bool is_qualvector() const;
00151
00156 virtual bool is_acq_vector() const;
00157
00161 virtual bool is_obj_vector() const {return false;}
00162
00163
00170 virtual svector get_vector_commands(const STD_string& iterator) const {return svector();}
00171
00172
00176 virtual STD_string get_loopcommand() const {return "";}
00177
00178
00183 SeqVector& set_indexvec(const ivector& iv) {indexvec=iv; return *this;}
00184
00189 ivector get_indexvec() const {return indexvec;}
00190
00191
00195 SeqVector& set_reorder_scheme(reorderScheme scheme, unsigned int nsegments=1);
00196
00200 SeqVector& set_encoding_scheme(encodingScheme scheme);
00201
00202
00206 const SeqVector& get_reorder_vector() const;
00207
00208
00212 virtual nestingRelation get_nesting_relation() const;
00213
00214
00220 iarray get_index_matrix() const;
00221
00225 int get_current_reord_index() const;
00226
00230 STD_string get_reord_iterator(const STD_string& iterator) const;
00231
00232
00233 protected:
00234
00238 virtual svector get_reord_vector_commands(const STD_string& iterator) const {return svector();}
00239
00243 bool is_handled() const {return vechandler.get_handled();}
00244
00245 private:
00246 friend class SeqReorderVector;
00247 friend class SeqCounter;
00248 friend class SeqObjLoop;
00249 friend class SeqSimultanVector;
00250
00251 #ifdef SELF_FRIEND_CLASS
00252 friend class SeqVector;
00253 #endif
00254
00258 bool loopcounter_is_active() const;
00259
00263 int get_loopcounter() const;
00264
00265
00266 void common_int();
00267
00268
00269 virtual const SeqVector& set_vechandler(const SeqCounter *sc) const;
00270
00271 ivector indexvec;
00272
00273 Handler<const SeqCounter*> vechandler;
00274 Handler<const SeqVector*> simhandler;
00275
00276 mutable SeqReorderVector* reordvec;
00277
00278 mutable nestingRelation nr_cache;
00279 mutable bool nr_cache_up2date;
00280 };
00281
00283
00284
00285
00291 class SeqReorderVector : public SeqVector {
00292
00293 public:
00294 SeqReorderVector(const SeqVector* user, const SeqReorderVector* copy_templ=0);
00295
00296 unsigned int get_reordered_size(unsigned int vecsize) const;
00297
00298 int get_reordered_index(int counter) const {return get_reordered_index(counter,get_current_index());}
00299
00300
00301 private:
00302 friend class SeqVector;
00303
00304
00305 unsigned int get_vectorsize() const;
00306 bool needs_unrolling_check() const {return reord_scheme!=noReorder;}
00307 bool prep_iteration() const {return reorder_user->prep_iteration();}
00308 bool is_qualvector() const {return reorder_user->is_qualvector();}
00309 bool is_acq_vector() const {return reorder_user->is_acq_vector();}
00310 svector get_vector_commands(const STD_string& iterator) const;
00311
00312
00313 int get_reordered_index(int counter, int reord_iteration) const;
00314
00315 STD_string get_reordered_iterator(const STD_string& iterator) const;
00316
00317 void clear_cache() {reord_iterator_cache="";}
00318
00319 reorderScheme reord_scheme;
00320 unsigned int n_reord_segments;
00321
00322 encodingScheme encoding_scheme;
00323
00324 const SeqVector* reorder_user;
00325
00326 mutable STD_string reord_iterator_cache;
00327 };
00328
00329
00330 #endif