COVISE Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
coDoIntArr.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_INTARR_H
9 #define CO_DO_INTARR_H
10 
11 #include "coDistributedObject.h"
12 
13 /****************************************************************
14  ** **
15  ** Integer Array Class Version: 1.1 **
16  ** **
17  ** **
18  ** Description : Classes for multi-dimensional Integer **
19  ** Arrays **
20  ** **
21  ** Classes : coDoIntArr **
22  ** **
23  ** Copyright (C) 1997 by University of Stuttgart **
24  ** Computer Center (RUS) **
25  ** Allmandring 30a **
26  ** 70550 Stuttgart **
27  ** **
28  ** **
29  ** Author : A. Werner (RUS) **
30  ** **
31  ** History : 26.06.97 Implementation **
32  ** **
33 \****************************************************************/
34 namespace covise
35 {
36 
38 {
39  friend class coDoInitializer;
40  static coDistributedObject *virtualCtor(coShmArray *arr);
41 
42 private:
43  coIntShm numDim; // number of dimensions
44  coIntShmArray dimension; // size in each dimension
46 
47 protected:
48  int rebuildFromShm();
49  int getObjInfo(int, coDoInfo **) const;
50  coDoIntArr *cloneObject(const coObjInfo &newinfo) const;
51 
52 public:
53  coDoIntArr(const coObjInfo &info)
54  : coDistributedObject(info, "INTARR")
55  {
56  if (info.getName())
57  {
58  if (getShmArray() != 0)
59  {
60  if (rebuildFromShm() == 0)
61  {
62  print_comment(__LINE__, __FILE__, "rebuildFromShm == 0");
63  }
64  }
65  else
66  {
67  print_comment(__LINE__, __FILE__, "object %s doesn't exist", name);
68  new_ok = 0;
69  }
70  }
71  };
72 
73  coDoIntArr(const coObjInfo &info, coShmArray *arr);
74 
75  coDoIntArr(const coObjInfo &info,
76  int numDim,
77  const int *dimArray,
78  const int *initdata = NULL);
79 
80  int getNumDimensions() const
81  {
82  return numDim;
83  }
84  int getDimension(int i) const
85  {
86  if ((i >= 0) && (i < numDim))
87  return dimension[i];
88  else
89  return -1;
90  }
91 
92  int getSize() const
93  {
94  return (data.get_length());
95  }
96 
97  int *getAddress() const
98  {
99  return (int *)(data.getDataPtr());
100  }
101  int *getDimensionPtr() const
102  {
103  return (int *)(dimension.getDataPtr());
104  }
105 
106  void getAddress(int **res) const
107  {
108  *res = (int *)data.getDataPtr();
109  }
110 
112 };
113 }
114 #endif
const char * getName() const
Definition: coObjID.h:308
int * getAddress() const
Definition: coDoIntArr.h:97
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: khronos-glext.h:6354
int getNumDimensions() const
Definition: coDoIntArr.h:80
coIntShmArray dimension
Definition: coDoIntArr.h:44
#define DOEXPORT
Definition: coExport.h:319
~coDoIntArr()
Definition: coDoIntArr.h:111
coIntShm numDim
Definition: coDoIntArr.h:43
int getDimension(int i) const
Definition: coDoIntArr.h:84
GLuint const GLchar * name
Definition: khronos-glext.h:6722
Definition: coDoIntArr.h:37
int * getDimensionPtr() const
Definition: coDoIntArr.h:101
Definition: coObjID.h:230
Definition: covise_statics.cpp:54
Definition: covise_shm.h:481
int getSize() const
Definition: coDoIntArr.h:92
void getAddress(int **res) const
Definition: coDoIntArr.h:106
coDoIntArr(const coObjInfo &info)
Definition: coDoIntArr.h:53
void print_comment(int line, const char *filename, const char *fmt,...)
Definition: coLog.cpp:25
GLuint res
Definition: khronos-glext.h:10588
Definition: coDistributedObject.h:295
#define NULL
Definition: covise_list.h:22
coIntShmArray data
Definition: coDoIntArr.h:45
Definition: coDistributedObject.h:266
static coShmArray * getShmArray(const char *name)
Definition: coDistributedObject.cpp:60