COVISE Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
coDoText.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_TEXT_H
9 #define CO_DO_TEXT_H
10 
11 #include "coDistributedObject.h"
12 
13 /***********************************************************************\
14  ** **
15  ** Text class Version: 1.0 **
16  ** **
17  ** **
18  ** Description : Classes for the handling of text data **
19  ** in a distributed manner. **
20  ** **
21  ** Classes : coDoText **
22  ** **
23  ** Copyright (C) 1993 by University of Stuttgart **
24  ** Computer Center (RUS) **
25  ** Allmandring 30 **
26  ** 7000 Stuttgart 80 **
27  ** **
28  ** **
29  ** Author : Uwe Woessner **
30  ** **
31  ** History : **
32  ** 14.02.95 Ver 1.0 **
33  ** **
34  ** **
35 \***********************************************************************/
36 namespace covise
37 {
38 
40 {
41  friend class coDoInitializer;
42  static coDistributedObject *virtualCtor(coShmArray *arr);
43 
44 private:
45  coIntShm size; // number of characters
46  coCharShmArray data; // characters
47 
48 protected:
49  int rebuildFromShm();
50  int getObjInfo(int, coDoInfo **) const;
51  coDoText *cloneObject(const coObjInfo &newinfo) const;
52 
53 public:
54  coDoText(const coObjInfo &info)
55  : coDistributedObject(info)
56  {
57  setType("DOTEXT", "TEXT");
58  if (name)
59  {
60  if (getShmArray() != 0)
61  {
62  if (rebuildFromShm() == 0)
63  {
64  print_comment(__LINE__, __FILE__, "rebuildFromShm == 0");
65  }
66  }
67  else
68  {
69  print_comment(__LINE__, __FILE__, "object %s doesn't exist", name);
70  new_ok = 0;
71  }
72  }
73  }
74 
75  // internally used c'tor
76  coDoText(const coObjInfo &info, coShmArray *arr);
77 
78  // create empty object with 'size' elements
79  coDoText(const coObjInfo &info, int size);
80 
81  // create object with 'size' elements and copy 'size' elements from 'data'
82  coDoText(const coObjInfo &info, int size, const char *data);
83 
84  // create object with 'strlen(text)' elements and copy 'text' into object
85  coDoText(const coObjInfo &info, const char *text);
86 
87  virtual ~coDoText()
88  {
89  }
90 
91  int getTextLength() const
92  {
93  return (int)size;
94  }
95  void getAddress(char **base) const
96  {
97  *base = (char *)data.getDataPtr();
98  }
99  const char *getAddress() const
100  {
101  return static_cast<char *>(data.getDataPtr());
102  }
103 };
104 }
105 #endif
const char * getAddress() const
Definition: coDoText.h:99
GLuint const GLchar * name
Definition: khronos-glext.h:6722
virtual ~coDoText()
Definition: coDoText.h:87
Definition: covise_shm.h:481
Definition: covise_statics.cpp:54
Definition: covise_shm.h:615
Definition: coObjID.h:230
GLsizeiptr size
Definition: khronos-glext.h:6610
coDoText(const coObjInfo &info)
Definition: coDoText.h:54
Definition: coDistributedObject.h:266
coIntShm size
Definition: coDoText.h:45
#define DOEXPORT
Definition: coExport.h:307
int getTextLength() const
Definition: coDoText.h:91
Definition: coDoText.h:39
void print_comment(int line, const char *filename, const char *fmt,...)
Definition: coLog.cpp:25
Definition: coDistributedObject.h:295
static coShmArray * getShmArray(const char *name)
Definition: coDistributedObject.cpp:60
coCharShmArray data
Definition: coDoText.h:46
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: khronos-glext.h:6354
void getAddress(char **base) const
Definition: coDoText.h:95