COVISE Core
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\***********************************************************************/
36namespace covise
37{
38
40{
41 friend class coDoInitializer;
42 static coDistributedObject *virtualCtor(coShmArray *arr);
43
44private:
45 coIntShm size; // number of characters
46 coCharShmArray data; // characters
47
48protected:
49 int rebuildFromShm();
50 int getObjInfo(int, coDoInfo **) const;
51 coDoText *cloneObject(const coObjInfo &newinfo) const;
52
53public:
54 coDoText(const coObjInfo &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
#define DOEXPORT
Definition: coExport.h:331
GLsizeiptr size
Definition: khronos-glext.h:6610
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
Definition: covise_shm.h:482
Definition: covise_shm.h:616
Definition: coDistributedObject.h:267
Definition: coDistributedObject.h:296
Definition: coDoText.h:40
virtual ~coDoText()
Definition: coDoText.h:87
coIntShm size
Definition: coDoText.h:45
int getTextLength() const
Definition: coDoText.h:91
const char * getAddress() const
Definition: coDoText.h:99
coCharShmArray data
Definition: coDoText.h:46
coDoText(const coObjInfo &info)
Definition: coDoText.h:54
void getAddress(char **base) const
Definition: coDoText.h:95
Definition: covise_statics.cpp:55