OFFIS DCMTK  Version 3.6.0
dsrtree.h
1 /*
2  *
3  * Copyright (C) 2000-2010, OFFIS e.V.
4  * All rights reserved. See COPYRIGHT file for details.
5  *
6  * This software and supporting documentation were developed by
7  *
8  * OFFIS e.V.
9  * R&D Division Health
10  * Escherweg 2
11  * D-26121 Oldenburg, Germany
12  *
13  *
14  * Module: dcmsr
15  *
16  * Author: Joerg Riesmeier
17  *
18  * Purpose:
19  * classes: DSRTreeNode, DSRTree
20  *
21  * Last Update: $Author: joergr $
22  * Update Date: $Date: 2010-10-14 13:16:33 $
23  * CVS/RCS Revision: $Revision: 1.10 $
24  * Status: $State: Exp $
25  *
26  * CVS/RCS Log at end of file
27  *
28  */
29 
30 
31 #ifndef DSRTREE_H
32 #define DSRTREE_H
33 
34 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
35 
36 #include "dcmtk/dcmsr/dsrtypes.h"
37 #include "dcmtk/dcmsr/dsrtncsr.h"
38 
39 
40 /*---------------------*
41  * class declaration *
42  *---------------------*/
43 
47  : protected DSRTypes
48 {
49  // allow direct access to member variables
50  friend class DSRTreeNodeCursor;
51  friend class DSRTree;
52 
53  public:
54 
58  : Prev(NULL),
59  Next(NULL),
60  Down(NULL),
61  Ident(IdentCounter++) // MT-safe?
62  {
63  }
64 
67  virtual ~DSRTreeNode()
68  {
69  }
70 
71 
72  protected:
73 
80 
82  const size_t Ident;
83 
84 
85  private:
86 
88  static size_t IdentCounter;
89 
90 
91  // --- declaration of copy constructor and assignment operator
92 
93  DSRTreeNode(const DSRTreeNode &);
94  DSRTreeNode &operator=(const DSRTreeNode &);
95 };
96 
97 
100 class DSRTree
101  : public DSRTreeNodeCursor,
102  protected DSRTypes
103 {
104 
105  public:
106 
109  DSRTree();
110 
113  virtual ~DSRTree();
114 
117  virtual void clear();
118 
122  OFBool isEmpty() const;
123 
127  size_t gotoRoot();
128 
135  size_t gotoNode(const size_t searchID,
136  const OFBool startFromRoot = OFTrue);
137 
146  size_t gotoNode(const OFString &reference,
147  const OFBool startFromRoot = OFTrue);
148 
158  virtual size_t addNode(DSRTreeNode *node,
159  const E_AddMode addMode = AM_afterCurrent);
160 
168  virtual size_t removeNode();
169 
170 
171  protected:
172 
176  inline DSRTreeNode *getRoot() const
177  {
178  return RootNode;
179  }
180 
181 
182  private:
183 
186 
187 
188  // --- declaration of copy constructor and assignment operator
189 
190  DSRTree(const DSRTree &);
191  DSRTree &operator=(const DSRTree &);
192 };
193 
194 
195 #endif
196 
197 
198 /*
199  * CVS/RCS Log:
200  * $Log: dsrtree.h,v $
201  * Revision 1.10 2010-10-14 13:16:33 joergr
202  * Updated copyright header. Added reference to COPYRIGHT file.
203  *
204  * Revision 1.9 2005-12-08 16:05:29 meichel
205  * Changed include path schema for all DCMTK header files
206  *
207  * Revision 1.8 2003/12/17 17:40:17 meichel
208  * Changed order of inheritance to avoid internal compiler error on Borland Builder.
209  *
210  * Revision 1.7 2003/08/07 12:56:22 joergr
211  * Updated documentation to get rid of doxygen warnings.
212  *
213  * Revision 1.6 2002/04/11 13:02:34 joergr
214  * Corrected typo and/or enhanced documentation.
215  *
216  * Revision 1.5 2001/06/01 15:51:06 meichel
217  * Updated copyright header
218  *
219  * Revision 1.4 2000/11/01 16:22:11 joergr
220  * Now derive "protected" from base class DSRTypes instead of "public".
221  *
222  * Revision 1.3 2000/10/18 17:09:29 joergr
223  * Made some functions inline.
224  *
225  * Revision 1.2 2000/10/16 11:56:10 joergr
226  * Added doc++ comments.
227  *
228  * Revision 1.1 2000/10/13 07:49:35 joergr
229  * Added new module 'dcmsr' providing access to DICOM structured reporting
230  * documents (supplement 23). Doc++ documentation not yet completed.
231  *
232  *
233  */
virtual ~DSRTreeNode()
destructor
Definition: dsrtree.h:67
static size_t IdentCounter
global counter used to create the unique identifiers
Definition: dsrtree.h:88
OFBool isEmpty() const
check whether tree has any nodes
DSRTree()
default constructor
virtual void clear()
clear all member variables
size_t gotoNode(const size_t searchID, const OFBool startFromRoot=OFTrue)
set internal cursor to specified node
DSRTreeNode()
default constructor
Definition: dsrtree.h:57
virtual size_t removeNode()
remove current node from tree.
DSRTreeNode * Down
pointer to first child node (if any)
Definition: dsrtree.h:79
E_AddMode
Add node mode.
Definition: dsrtypes.h:627
Class managing a tree of nodes.
Definition: dsrtree.h:100
size_t gotoRoot()
set internal cursor to root node
DSRTreeNode * getRoot() const
get pointer to root node
Definition: dsrtree.h:176
virtual size_t addNode(DSRTreeNode *node, const E_AddMode addMode=AM_afterCurrent)
add new node to the current one.
Class for tree nodes.
Definition: dsrtree.h:46
const size_t Ident
unique identifier (created automatically)
Definition: dsrtree.h:82
virtual ~DSRTree()
destructor
add new node after current one (sibling)
Definition: dsrtypes.h:630
DSRTreeNode * Prev
pointer to previous tree node (if any)
Definition: dsrtree.h:75
DSRTreeNode * Next
pointer to next tree node (if any)
Definition: dsrtree.h:77
General purpose class hiding global functions, constants and types from the global namespace...
Definition: dsrtypes.h:150
a simple string class that implements a subset of std::string.
Definition: ofstring.h:86
Class implementing a tree node cursor.
Definition: dsrtncsr.h:62
DSRTreeNode * RootNode
pointer to the root tree node
Definition: dsrtree.h:185


Generated on Wed Jan 4 2017 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.6