Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/vis15/src/lib/include/diderot/dynseq.hxx
ViewVC logotype

Diff of /branches/vis15/src/lib/include/diderot/dynseq.hxx

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3987, Fri Jun 17 03:08:25 2016 UTC revision 3988, Fri Jun 17 17:26:51 2016 UTC
# Line 20  Line 20 
20    
21  namespace diderot {  namespace diderot {
22    
23    // QUESTION: can we use some type-level hacking to connect the base element type, shape,
24    // and sequence element type together (would help with resolving loading too)?
25    
26      template <typename T>      template <typename T>
27      class dynseq {      class dynseq {
28        public:        public:
# Line 30  Line 33 
33          dynseq (uint32_t n, const T *data);          dynseq (uint32_t n, const T *data);
34        //! construct a sequence from an array initializer (e.g., `dynseq{1, 2, 3}`)        //! construct a sequence from an array initializer (e.g., `dynseq{1, 2, 3}`)
35          dynseq (std::initializer_list<T> il);          dynseq (std::initializer_list<T> il);
       //! construct a sequence from a nrrd  
         dynseq (const Nrrd *nin);  
36        //! construct a sequence for a range lo..hi (integer types only)        //! construct a sequence for a range lo..hi (integer types only)
37          dynseq (T const &lo, T const &hi);          dynseq (T const &lo, T const &hi);
38        //! copy constructor; this just copies the reference        //! copy constructor; this just copies the reference
# Line 76  Line 77 
77              return result.concat(seq2);              return result.concat(seq2);
78          }          }
79    
80            void *data () const { return this->_seq->data(); }
81    
82        private:        private:
83          std::shared_ptr<std::vector<T>> _seq;          std::shared_ptr<std::vector<T>> _seq;
84      };      };
# Line 100  Line 103 
103          : _seq(std::make_shared<std::vector<T>>(std::vector<T>(il)))          : _seq(std::make_shared<std::vector<T>>(std::vector<T>(il)))
104      { }      { }
105    
106      /***** functions for loading sequences from nrrd files and objects *****/
107    
108      //! load from nrrd; type-specialized versions of this function are generated by the compiler
109      //
110        template <typename T>
111        dynseq<T> load_dynseq_from_nrrd (const Nrrd *nin, bool &sts);
112    
113        template <typename T>
114        dynseq<T> load_dynseq_from_file (world_base *wrld, std::string const &file, bool &sts);
115    
116  } // namespace diderot  } // namespace diderot
117    
118  #include "dynseq-inst.hxx"  #include "dynseq-inst.hxx"

Legend:
Removed from v.3987  
changed lines
  Added in v.3988

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0