Model.h
1 /**************************************************************************\
2  *
3  * FILE: Model.h
4  *
5  * This source file is part of DIME.
6  * Copyright (C) 1998-1999 by Systems In Motion. All rights reserved.
7  *
8  * This library is free software; you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License, version 2, as
10  * published by the Free Software Foundation.
11  *
12  * This library is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * General Public License (the accompanying file named COPYING) for more
16  * details.
17  *
18  **************************************************************************
19  *
20  * If you need DIME for a non-GPL project, contact Systems In Motion
21  * to acquire a Professional Edition License:
22  *
23  * Systems In Motion http://www.sim.no/
24  * Prof. Brochs gate 6 sales@sim.no
25  * N-7030 Trondheim Voice: +47 22114160
26  * NORWAY Fax: +47 67172912
27  *
28 \**************************************************************************/
29 
30 #ifndef DIME_MODEL_H
31 #define DIME_MODEL_H
32 
33 #include <dime/Basic.h>
34 #include <dime/util/Array.h>
35 #include <dime/util/Linear.h>
36 #include <dime/Base.h>
37 #include <dime/Layer.h>
38 #include <stdlib.h>
39 
40 class dimeInput;
41 class dimeOutput;
42 class dimeDict;
43 class dimeMemHandler;
44 class dimeSection;
46 class dimeBlocksSection;
47 class dimeBlock;
48 class dimeEntity;
49 class dimeRecord;
50 
51 class DIME_DLL_API dimeModel
52 {
53 public:
54  dimeModel(const bool usememhandler = false);
55  ~dimeModel();
56 
57  dimeModel *copy() const;
58 
59  bool init();
60  bool read(dimeInput * const in);
61  bool write(dimeOutput * const out);
62 
63  int countRecords() const;
64 
65  bool traverseEntities(dimeCallback callback,
66  void *userdata = NULL,
67  bool traverseBlocksSection = false,
68  bool explodeInserts = true,
69  bool traversePolylineVertices = false);
70 
71  const char *addReference(const char * const name, void *id);
72  void *findReference(const char * const name) const;
73  const char *findRefStringPtr(const char * const name) const;
74  void removeReference(const char * const name);
75  class dimeMemHandler *getMemHandler();
76 
77  int getNumLayers() const;
78  const class dimeLayer *getLayer(const int idx) const;
79  const class dimeLayer *getLayer(const char * const layername) const;
80  const class dimeLayer *addLayer(const char * const layername,
81  const int16 colnum = 7,
82  const int16 flags = 0);
83 
84  const char * getDxfVersion() const;
85 
86  static const char *getVersionString();
87  static void getVersion(int &major, int &minor);
88  const char *addBlock(const char * const blockname, dimeBlock * const block);
89  class dimeBlock *findBlock(const char * const blockname);
90 
91  class dimeSection *findSection(const char * const sectionname);
92  const class dimeSection *findSection(const char * const sectionname) const;
93 
94  int getNumSections() const;
95  class dimeSection *getSection(const int idx);
96  void insertSection(dimeSection * const section, const int idx = -1);
97  void removeSection(const int idx);
98 
99  void registerHandle(const int handle);
100  void registerHandle(const char * const handle);
101  int getUniqueHandle();
102  const char *getUniqueHandle(char *buf, const int bufsize);
103  void addEntity(dimeEntity *entity);
104 
105 private:
106  class dimeDict *refDict;
107  class dimeDict *layerDict;
108  class dimeMemHandler *memoryHandler;
111  dimeArray <dimeRecord*> headerComments;
112 
113  int largestHandle;
114  bool usememhandler;
115 }; // class dimeModel
116 
117 #endif // ! DIME_MODEL_H
118 

Copyright © 1998-1999, Systems In Motion <sales@sim.no>. All rights reserved.
System documentation was generated using doxygen.