COVISE Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
coDoDoubleArr.h
Go to the documentation of this file.
1 /* This file is part of COVISE.
2 
3  You can use it under the terms of the GNU Lesser General Public License
4  version 2.1 or later, see lgpl-2.1.txt.
5 
6  * License: LGPL 2+ */
7 
8 #ifndef CO_DO_DBLARR_H
9 #define CO_DO_DBLARR_H
10 
11 #include "coDistributedObject.h"
12 
13 namespace covise
14 {
15 
17 {
18  friend class coDoInitializer;
19  static coDistributedObject *virtualCtor(coShmArray *arr);
20 
21 private:
22  coIntShm numDim; // number of dimensions
23  coIntShmArray dimension; // size in each dimension
25 
26 protected:
27  int rebuildFromShm();
28  int getObjInfo(int, coDoInfo **) const;
29  coDoDoubleArr *cloneObject(const coObjInfo &newinfo) const;
30 
31 public:
32  coDoDoubleArr(const coObjInfo &info)
33  : coDistributedObject(info, "DBLARR")
34  {
35  if (info.getName())
36  {
37  if (getShmArray() != 0)
38  {
39  if (rebuildFromShm() == 0)
40  {
41  print_comment(__LINE__, __FILE__, "rebuildFromShm == 0");
42  }
43  }
44  else
45  {
46  print_comment(__LINE__, __FILE__, "object %s doesn't exist", name);
47  new_ok = 0;
48  }
49  }
50  };
51 
52  coDoDoubleArr(const coObjInfo &info, coShmArray *arr);
53 
54  coDoDoubleArr(const coObjInfo &info,
55  int numDim,
56  const int *dimArray,
57  const double *initdata = NULL);
58 
59  int getNumDimensions() const
60  {
61  return numDim;
62  }
63  int getDimension(int i) const
64  {
65  if ((i >= 0) && (i < numDim))
66  return dimension[i];
67  else
68  return -1;
69  }
70 
71  int getSize() const
72  {
73  return (data.get_length());
74  }
75 
76  double *getAddress() const
77  {
78  return (double *)(data.getDataPtr());
79  }
80  int *getDimensionPtr() const
81  {
82  return (int *)(dimension.getDataPtr());
83  }
84 
85  void getAddress(double **res) const
86  {
87  *res = (double *)data.getDataPtr();
88  }
89 
91 };
92 }
93 #endif
Definition: coDoDoubleArr.h:16
const char * getName() const
Definition: coObjID.h:308
GLuint const GLchar * name
Definition: khronos-glext.h:6722
void getAddress(double **res) const
Definition: coDoDoubleArr.h:85
Definition: covise_shm.h:481
coIntShmArray dimension
Definition: coDoDoubleArr.h:23
~coDoDoubleArr()
Definition: coDoDoubleArr.h:90
Definition: covise_statics.cpp:54
GLuint res
Definition: khronos-glext.h:10588
#define NULL
Definition: covise_list.h:22
int getNumDimensions() const
Definition: coDoDoubleArr.h:59
int getSize() const
Definition: coDoDoubleArr.h:71
Definition: coObjID.h:230
double * getAddress() const
Definition: coDoDoubleArr.h:76
Definition: coDistributedObject.h:266
int * getDimensionPtr() const
Definition: coDoDoubleArr.h:80
#define DOEXPORT
Definition: coExport.h:307
coDoDoubleArr(const coObjInfo &info)
Definition: coDoDoubleArr.h:32
void print_comment(int line, const char *filename, const char *fmt,...)
Definition: coLog.cpp:25
coIntShm numDim
Definition: coDoDoubleArr.h:22
coDoubleShmArray data
Definition: coDoDoubleArr.h:24
Definition: coDistributedObject.h:295
static coShmArray * getShmArray(const char *name)
Definition: coDistributedObject.cpp:60
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: khronos-glext.h:6354
int getDimension(int i) const
Definition: coDoDoubleArr.h:63