COVISE Core
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
13namespace covise
14{
15
17{
18 friend class coDoInitializer;
19 static coDistributedObject *virtualCtor(coShmArray *arr);
20
21private:
22 coIntShm numDim; // number of dimensions
23 coIntShmArray dimension; // size in each dimension
25
26protected:
27 int rebuildFromShm();
28 int getObjInfo(int, coDoInfo **) const;
29 coDoDoubleArr *cloneObject(const coObjInfo &newinfo) const;
30
31public:
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
#define DOEXPORT
Definition: coExport.h:331
#define NULL
Definition: covise_list.h:22
GLuint res
Definition: khronos-glext.h:10588
GLuint const GLchar * name
Definition: khronos-glext.h:6722
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: khronos-glext.h:6354
list of all chemical elements
Definition: coConfig.h:27
static coShmArray * getShmArray(const char *name)
Definition: coDistributedObject.cpp:60
void print_comment(int line, const char *filename, const char *fmt,...)
Definition: coLog.cpp:25
Definition: coObjID.h:231
const char * getName() const
Definition: coObjID.h:308
Definition: covise_shm.h:482
void * getDataPtr() const
Definition: covise_shm.h:543
Definition: coDistributedObject.h:267
Definition: coDistributedObject.h:296
Definition: coDoDoubleArr.h:17
int * getDimensionPtr() const
Definition: coDoDoubleArr.h:80
coDoubleShmArray data
Definition: coDoDoubleArr.h:24
coIntShmArray dimension
Definition: coDoDoubleArr.h:23
int getSize() const
Definition: coDoDoubleArr.h:71
double * getAddress() const
Definition: coDoDoubleArr.h:76
void getAddress(double **res) const
Definition: coDoDoubleArr.h:85
int getDimension(int i) const
Definition: coDoDoubleArr.h:63
coIntShm numDim
Definition: coDoDoubleArr.h:22
coDoDoubleArr(const coObjInfo &info)
Definition: coDoDoubleArr.h:32
~coDoDoubleArr()
Definition: coDoDoubleArr.h:90
int getNumDimensions() const
Definition: coDoDoubleArr.h:59
Definition: covise_statics.cpp:55