Coin Logo Coin3D is Free Software,
published under the BSD 3-clause license.
https://bitbucket.org/Coin3D/
http://www.kongsberg.com/kogt/
RecordHolder.h
1 /**************************************************************************\
2  * Copyright (c) Kongsberg Oil & Gas Technologies AS
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met:
8  *
9  * Redistributions of source code must retain the above copyright notice,
10  * this list of conditions and the following disclaimer.
11  *
12  * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * Neither the name of the copyright holder nor the names of its
17  * contributors may be used to endorse or promote products derived from
18  * this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 \**************************************************************************/
32 
33 #ifndef DIME_RECORDHOLDER_H
34 #define DIME_RECORDHOLDER_H
35 
36 #include <dime/Base.h>
37 
38 class dimeInput;
39 class dimeMemHandler;
40 class dimeOutput;
41 class dimeRecord;
42 
43 class DIME_DLL_API dimeRecordHolder : public dimeBase
44 {
45 public:
46  dimeRecordHolder(const int separator);
47  virtual ~dimeRecordHolder();
48 
49  void setRecord(const int groupcode, const dimeParam &value,
50  dimeMemHandler * const memhandler = NULL);
51  void setRecords(const int * const groupcodes,
52  const dimeParam * const params,
53  const int numrecords,
54  dimeMemHandler * const memhandler = NULL);
55  void setIndexedRecord(const int groupcode,
56  const dimeParam &value,
57  const int index,
58  dimeMemHandler * const memhandler = NULL);
59 
60  virtual bool getRecord(const int groupcode,
61  dimeParam &param,
62  const int index = 0) const;
63 
64  virtual bool read(dimeInput * const in);
65  virtual bool write(dimeOutput * const out);
66  virtual bool isOfType(const int thetypeid) const;
67  virtual int countRecords() const;
68 
69  dimeRecord *findRecord(const int groupcode, const int index = 0);
70 
71  int getNumRecordsInRecordHolder(void) const;
72  dimeRecord * getRecordInRecordHolder(const int idx) const;
73 
74 protected:
75  virtual bool handleRecord(const int groupcode,
76  const dimeParam &param,
77  dimeMemHandler * const memhandler);
78 
79  bool copyRecords(dimeRecordHolder * const rh,
80  dimeMemHandler * const memhandler) const;
81 
82  virtual bool shouldWriteRecord(const int groupcode) const;
83 
84 protected:
85  dimeRecord **records;
86  int numRecords;
87  // int separator; // not needed ?
88 
89 private:
90  void setRecordCommon(const int groupcode, const dimeParam &param,
91  const int index, dimeMemHandler * const memhandler);
92 
93 }; // class dimeRecordHolder
94 
95 #endif // ! DIME_RECORDHOLDER_H
96 
The dimeBase class is the superclass for most classes in Dime.
Definition: Base.h:41
The dimeMemHandler class is a special-purpose memory manager.
Definition: MemHandler.h:38
The dimeRecordHolder class is a superclass for objects that store records.
Definition: RecordHolder.h:43
virtual bool isOfType(const int thetypeid) const
Definition: Base.cpp:116
The dimeInput class offers transparent file I/O for DXF and DXB.
Definition: Input.h:41
The dimeParam class is a union of the different parameter types.
Definition: Basic.h:102
The dimeRecord class is the superclass of all record classes.
Definition: Record.h:43
The dimeOutput class handles writing of DXF and DXB files.
Definition: Output.h:41