Skip to content

Commit 3144954

Browse files
committed
Getting closer
1 parent 4002796 commit 3144954

File tree

8 files changed

+198
-202
lines changed

8 files changed

+198
-202
lines changed

src/Core/Datatypes/Legacy/Nrrd/NrrdData.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ class SCISHARE NrrdData : public Core::Datatypes::Datatype
6868
Nrrd*& getNrrd() { return nrrd_; }
6969
const Nrrd* getNrrd() const { return nrrd_; }
7070

71-
// void set_filename( const std::string &f )
72-
// { nrrd_fname_ = f; embed_object_ = false; }
73-
// const std::string get_filename() const { return nrrd_fname_; }
71+
void set_filename( const std::string &f )
72+
{ nrrd_fname_ = f; embed_object_ = false; }
73+
const std::string get_filename() const { return nrrd_fname_; }
7474

7575
// As parts of TEEM are by design not thread safe we need to enforce thread-safety
7676
// on certain functionality by forcing it to run single threaded.

src/Core/Matlab/matfiledata.cc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ void matfiledata::newdatabuffer(int bytesize,mitype type)
158158
}
159159

160160

161-
matfiledata matfiledata::clone()
161+
matfiledata matfiledata::clone() const
162162
{
163163
matfiledata mfd;
164164

@@ -168,7 +168,7 @@ matfiledata matfiledata::clone()
168168
return(mfd);
169169
}
170170

171-
void *matfiledata::databuffer()
171+
void *matfiledata::databuffer() const
172172
{
173173
if (m_ == 0)
174174
{
@@ -179,7 +179,7 @@ void *matfiledata::databuffer()
179179
return(m_->dataptr_);
180180
}
181181

182-
void matfiledata::type(mitype type)
182+
void matfiledata::setType(mitype type)
183183
{
184184
if (m_ == 0)
185185
{
@@ -189,7 +189,7 @@ void matfiledata::type(mitype type)
189189
m_->type_ = type;
190190
}
191191

192-
int matfiledata::bytesize()
192+
int matfiledata::bytesize() const
193193
{
194194
if (m_ == 0)
195195
{
@@ -200,7 +200,7 @@ int matfiledata::bytesize()
200200
return(m_->bytesize_);
201201
}
202202

203-
matfiledata::mitype matfiledata::type()
203+
matfiledata::mitype matfiledata::type() const
204204
{
205205
if (m_ == 0)
206206
{
@@ -210,7 +210,7 @@ matfiledata::mitype matfiledata::type()
210210
return(m_->type_);
211211
}
212212

213-
int matfiledata::elsize(matfiledata::mitype type)
213+
int matfiledata::elsize(matfiledata::mitype type) const
214214
{
215215
int elsize = 1;
216216
switch (type)
@@ -229,7 +229,7 @@ int matfiledata::elsize(matfiledata::mitype type)
229229
return(elsize);
230230
}
231231

232-
int matfiledata::elsize()
232+
int matfiledata::elsize() const
233233
{
234234
if (m_ == 0)
235235
{
@@ -239,7 +239,7 @@ int matfiledata::elsize()
239239
return(elsize(m_->type_));
240240
}
241241

242-
int matfiledata::size()
242+
int matfiledata::size() const
243243
{
244244
if (m_ == 0)
245245
{
@@ -250,7 +250,7 @@ int matfiledata::size()
250250
}
251251

252252

253-
std::string matfiledata::getstring()
253+
std::string matfiledata::getstring() const
254254
{
255255
std::string str;
256256

src/Core/Matlab/matfiledata.h

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -146,51 +146,51 @@ namespace SCIRun
146146
// clone the current object
147147
// i.e create a new databuffer and copy the actual data
148148
// the normal assignment operator only copies the pointer
149-
matfiledata clone();
149+
matfiledata clone() const;
150150

151151
// get/set type information
152152
// setting type information using type()
153153
// will not result in casting the data
154154
// contained in the databuffer
155155

156-
void type(mitype type);
157-
mitype type();
156+
void setType(mitype type);
157+
mitype type() const;
158158

159159
// get size information.
160-
int size(); // size in elements
161-
int bytesize(); // size in bytes
162-
int elsize(); // size of the elements in the array
163-
int elsize(mitype type); // element size of a type
160+
int size() const; // size in elements
161+
int bytesize() const; // size in bytes
162+
int elsize() const; // size of the elements in the array
163+
int elsize(mitype type) const; // element size of a type
164164

165165
// Direct access to data
166-
void getdata(void *dataptr,int bytesize);
167-
void putdata(void *dataptr,int bytesize,mitype type);
166+
void getdata(void *dataptr,int bytesize) const;
167+
void putdata(const void *dataptr,int bytesize,mitype type);
168168

169169
// copying and casting templates
170170

171171
// copy and cast the data in a user defined memory space
172172
// dataptr and size specify the data block and the number of elements
173173
// that can be stored in this data block.
174-
template<class T> void getandcast(T *dataptr,int size);
175-
template<class T> void getandcast(T **dataptr,int dim1, int dim2);
176-
template<class T> void getandcast(T ***dataptr,int dim1, int dim2, int dim3);
177-
template<class T> void putandcast(T *dataptr,int size,mitype type);
178-
template<class T> void putandcast(T **dataptr,int dim1, int dim2, mitype type);
179-
template<class T> void putandcast(T ***dataptr,int dim1, int dim2, int dim3, mitype type);
174+
template<class T> void getandcast(T *dataptr,int size) const;
175+
template<class T> void getandcast(T **dataptr,int dim1, int dim2) const;
176+
template<class T> void getandcast(T ***dataptr,int dim1, int dim2, int dim3) const;
177+
template<class T> void putandcast(const T *dataptr,int size,mitype type);
178+
template<class T> void putandcast(const T **dataptr,int dim1, int dim2, mitype type);
179+
template<class T> void putandcast(const T ***dataptr,int dim1, int dim2, int dim3, mitype type);
180180

181181

182182
// For smaller arrays use the STL and put the data in a vector. These
183183
// vectors are copied and hence are less efficient. However using STL
184184
// there is no need to do memory management
185185

186-
template<class T> void getandcastvector(std::vector<T> &vec);
186+
template<class T> void getandcastvector(std::vector<T> &vec) const;
187187
template<class T> void putandcastvector(const std::vector<T> &vec,mitype type);
188188

189189
template<class ITERATOR> void putandcast(ITERATOR is,ITERATOR ie,mitype type);
190190

191191

192192
// Access functions per element.
193-
template<class T> T getandcastvalue(int index);
193+
template<class T> T getandcastvalue(int index) const;
194194
template<class T> void putandcastvalue(T value,int index);
195195

196196
// string functions
@@ -231,7 +231,7 @@ namespace SCIRun
231231
////////////////////////////////////////
232232

233233

234-
template<class T> void matfiledata::getandcast(T *dataptr,int dsize)
234+
template<class T> void matfiledata::getandcast(T *dataptr,int dsize) const
235235
{
236236
// This function copies and casts the data in the matfilebuffer into
237237
// a new buffer specified by dataptr (address of this new buffer) with
@@ -291,7 +291,7 @@ namespace SCIRun
291291
}
292292

293293

294-
template<class T> void matfiledata::getandcast(T **dataptr,int dim1, int dim2)
294+
template<class T> void matfiledata::getandcast(T **dataptr,int dim1, int dim2) const
295295
{
296296
// This function copies and casts the data in the matfilebuffer into
297297
// a new buffer specified by dataptr (address of this new buffer) with
@@ -366,7 +366,7 @@ namespace SCIRun
366366
}
367367

368368

369-
template<class T> void matfiledata::getandcast(T ***dataptr,int dim1, int dim2, int dim3)
369+
template<class T> void matfiledata::getandcast(T ***dataptr,int dim1, int dim2, int dim3) const
370370
{
371371
// This function copies and casts the data in the matfilebuffer into
372372
// a new buffer specified by dataptr (address of this new buffer) with
@@ -444,7 +444,7 @@ namespace SCIRun
444444
}
445445

446446

447-
template<class T> void matfiledata::getandcastvector(std::vector<T> &vec)
447+
template<class T> void matfiledata::getandcastvector(std::vector<T> &vec) const
448448
{
449449

450450
// This function copies and casts the data into a vector container
@@ -503,7 +503,7 @@ namespace SCIRun
503503
}
504504

505505

506-
template<class T> T matfiledata::getandcastvalue(int index)
506+
template<class T> T matfiledata::getandcastvalue(int index) const
507507
{
508508
// direct access to the data
509509

@@ -554,7 +554,7 @@ namespace SCIRun
554554
// functions inserting data
555555

556556

557-
template<class T> void matfiledata::putandcast(T *dataptr,int dsize,mitype dtype)
557+
template<class T> void matfiledata::putandcast(const T *dataptr,int dsize,mitype dtype)
558558
{
559559
// This function copies and casts the data in the matfilebuffer into
560560
// a new buffer specified by dataptr (address of this new buffer) with
@@ -613,7 +613,7 @@ namespace SCIRun
613613
}
614614

615615

616-
template<class T> void matfiledata::putandcast(T **dataptr,int dim1, int dim2 ,mitype dtype)
616+
template<class T> void matfiledata::putandcast(const T **dataptr,int dim1, int dim2 ,mitype dtype)
617617
{
618618
// This function copies and casts the data in the matfilebuffer into
619619
// a new buffer specified by dataptr (address of this new buffer) with
@@ -681,7 +681,7 @@ namespace SCIRun
681681
}
682682
}
683683

684-
template<class T> void matfiledata::putandcast(T ***dataptr,int dim1, int dim2, int dim3 ,mitype dtype)
684+
template<class T> void matfiledata::putandcast(const T ***dataptr,int dim1, int dim2, int dim3 ,mitype dtype)
685685
{
686686
// This function copies and casts the data in the matfilebuffer into
687687
// a new buffer specified by dataptr (address of this new buffer) with

src/Core/Matlab/matlabarray.h

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -367,17 +367,17 @@ class SCISHARE matlabarray : public matfilebase
367367
// C-style access to the data. Specify the address of the databuffer
368368
// and the number of elements it can hold and the data will be
369369
// copied and casted to the right format.
370-
template<class T> void getnumericarray(const T *data,int size);
371-
template<class T> void getimagnumericarray(const T *data,int size);
370+
template<class T> void getnumericarray(T *data,int size) const;
371+
template<class T> void getimagnumericarray(T *data,int size) const;
372372

373-
template<class T> void getnumericarray(const T **data,int dim1, int dim2);
374-
template<class T> void getimagnumericarray(const T **data,int dim1, int dim2);
375-
template<class T> void getnumericarray(const T ***data,int dim1, int dim2, int dim3);
376-
template<class T> void getimagnumericarray(const T ***data,int dim1, int dim2, int dim3);
373+
template<class T> void getnumericarray(T **data,int dim1, int dim2) const;
374+
template<class T> void getimagnumericarray(T **data,int dim1, int dim2) const;
375+
template<class T> void getnumericarray(T ***data,int dim1, int dim2, int dim3) const;
376+
template<class T> void getimagnumericarray(T ***data,int dim1, int dim2, int dim3) const;
377377

378378

379-
template<class T> void getnumericarray(std::vector<T> &vec);
380-
template<class T> void getimagnumericarray(std::vector<T> &vec);
379+
template<class T> void getnumericarray(std::vector<T> &vec) const;
380+
template<class T> void getimagnumericarray(std::vector<T> &vec) const;
381381

382382
// C-style write access. The data will be copied out of the
383383
// databuffer and casted to the format of the Matlab file. If a type
@@ -418,9 +418,9 @@ class SCISHARE matlabarray : public matfilebase
418418

419419
// sparse functions
420420
int getnnz() const;
421-
template<class T> void getrowsarray(T *rows,int size);
421+
template<class T> void getrowsarray(T *rows,int size) const;
422422
template<class T> void setrowsarray(T *rows,int size);
423-
template<class T> void getcolsarray(T *cols,int size);
423+
template<class T> void getcolsarray(T *cols,int size) const;
424424
template<class T> void setcolsarray(T *cols,int size);
425425

426426
std::string getinfotext() const;
@@ -463,51 +463,51 @@ class SCISHARE matlabarray : public matfilebase
463463
};
464464

465465

466-
template<class T> inline void matlabarray::getnumericarray(const T *data,int size)
466+
template<class T> inline void matlabarray::getnumericarray(T *data,int size) const
467467
{
468468
if(m_ == 0) throw empty_matlabarray();
469469
m_->preal_.getandcast(data,size);
470470
}
471471

472-
template<class T> inline void matlabarray::getimagnumericarray(const T *data,int size)
472+
template<class T> inline void matlabarray::getimagnumericarray(T *data,int size) const
473473
{
474474
if(m_ == 0) throw empty_matlabarray();
475475
m_->pimag_.getandcast(data,size);
476476
}
477477

478-
template<class T> inline void matlabarray::getnumericarray(const T **data,int dim1,int dim2)
478+
template<class T> inline void matlabarray::getnumericarray(T **data,int dim1,int dim2) const
479479
{
480480
if(m_ == 0) throw empty_matlabarray();
481481
m_->preal_.getandcast(data,dim1,dim2);
482482
}
483483

484-
template<class T> inline void matlabarray::getimagnumericarray(const T **data,int dim1,int dim2)
484+
template<class T> inline void matlabarray::getimagnumericarray(T **data,int dim1,int dim2) const
485485
{
486486
if(m_ == 0) throw empty_matlabarray();
487487
m_->pimag_.getandcast(data,dim1,dim2);
488488
}
489489

490-
template<class T> inline void matlabarray::getnumericarray(const T ***data,int dim1,int dim2,int dim3)
490+
template<class T> inline void matlabarray::getnumericarray(T ***data,int dim1,int dim2,int dim3) const
491491
{
492492
if(m_ == 0) throw empty_matlabarray();
493493
m_->preal_.getandcast(data,dim1,dim2,dim3);
494494
}
495495

496-
template<class T> inline void matlabarray::getimagnumericarray(const T ***data,int dim1,int dim2,int dim3)
496+
template<class T> inline void matlabarray::getimagnumericarray(T ***data,int dim1,int dim2,int dim3) const
497497
{
498498
if(m_ == 0) throw empty_matlabarray();
499499
m_->pimag_.getandcast(data,dim1,dim2,dim3);
500500
}
501501

502502

503503

504-
template<class T> inline void matlabarray::getnumericarray(std::vector<T> &vec)
504+
template<class T> inline void matlabarray::getnumericarray(std::vector<T> &vec) const
505505
{
506506
if(m_ == 0) throw empty_matlabarray();
507507
m_->preal_.getandcastvector(vec);
508508
}
509509

510-
template<class T> inline void matlabarray::getimagnumericarray(std::vector<T> &vec)
510+
template<class T> inline void matlabarray::getimagnumericarray(std::vector<T> &vec) const
511511
{
512512
if(m_ == 0) throw empty_matlabarray();
513513
m_->pimag_.getandcastvector(vec);
@@ -917,7 +917,7 @@ template<class T> inline void matlabarray::setimagnumericarray(const std::vector
917917
m_->pimag_.putandcastvector(vec,type);
918918
}
919919

920-
template<class T> inline void matlabarray::getrowsarray(T *rows,int size)
920+
template<class T> inline void matlabarray::getrowsarray(T *rows,int size) const
921921
{
922922
if (m_ == 0)
923923
{
@@ -939,7 +939,7 @@ template<class T> inline void matlabarray::setrowsarray(T *rows,int size)
939939
m_->prows_.putandcast(rows,size,miINT32);
940940
}
941941

942-
template<class T> inline void matlabarray::getcolsarray(T *cols,int size)
942+
template<class T> inline void matlabarray::getcolsarray(T *cols,int size) const
943943
{
944944
if (m_ == 0)
945945
{

0 commit comments

Comments
 (0)