/usr/include/dcmtk/dcmsr/dsrposcn.h is in libdcmtk-dev 3.6.2-3build3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | /*
*
* Copyright (C) 2016, J. Riesmeier, Oldenburg, Germany
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation are maintained by
*
* OFFIS e.V.
* R&D Division Health
* Escherweg 2
* D-26121 Oldenburg, Germany
*
*
* Module: dcmsr
*
* Author: Joerg Riesmeier
*
* Purpose:
* classes: DSRPositionCounter
*
*/
#ifndef DSRPOSCN_H
#define DSRPOSCN_H
#include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
#include "dcmtk/dcmsr/dsdefine.h"
#include "dcmtk/ofstd/ofstring.h"
#include "dcmtk/ofstd/oflist.h"
/*---------------------*
* class declaration *
*---------------------*/
/** Class implementing a position counter to be used for iterating a tree of nodes
*/
class DCMTK_DCMSR_EXPORT DSRPositionCounter
{
public:
/** (default) constructor
** @param flags optional flags used to customize the processing of the counter.
* These flags are only stored but not evaluated by this class.
*/
DSRPositionCounter(const size_t flags = 0);
/** copy constructor
** @param counter object to be copied
*/
DSRPositionCounter(const DSRPositionCounter &counter);
/** destructor
*/
virtual ~DSRPositionCounter();
/** assignment operator
** @param counter object to be copied
** @return reference to modified cursor (this object)
*/
DSRPositionCounter &operator=(const DSRPositionCounter &counter);
/** conversion operator that returns the position on the current level
* (0 if the position counter is invalid)
*/
inline operator size_t () const
{
return Position;
}
/** pre-increment operator. Increases the position on the current level by 1.
* Also makes the position counter valid if it was invalid before.
** @return reference to modified cursor (this object)
*/
inline DSRPositionCounter &operator++()
{
++Position;
return *this;
}
/** pre-decrement operator. Decreases the position on the current level by 1.
* This makes the position counter invalid if the position was 1 before.
** @return reference to modified cursor (this object)
*/
inline DSRPositionCounter &operator--()
{
/* avoid underflow */
if (Position > 0) --Position;
return *this;
}
/** clear all member variables.
* The position counter becomes invalid afterwards (same state as after default
* construction). Also see initialize().
*/
void clear();
/** initialize the position counter
** @param valid flag specifying whether the counter should be initialized as
* valid (default) or invalid
* @param flags optional flags used to customize the processing of the counter.
* These flags are only stored but not evaluated by this class.
*/
void initialize(const OFBool valid = OFTrue,
const size_t flags = 0);
/** check whether position counter is valid (i.e.\ has been initialized)
** @return OFTrue if valid, OFFalse otherwise
*/
inline OFBool isValid() const
{
return (Position > 0);
}
/** go one level up, i.e.\ restore the position on the next upper level and forget
* about the current level
** @return OFTrue if successful, OFFalse otherwise
*/
OFBool goUp();
/** go one level down, i.e.\ store the position on the current level and start with
* 1 on the new level
** @return OFTrue if successful, OFFalse otherwise
*/
OFBool goDown();
/** get specified flags that can be used to customize the counter
** @return flags used to customize the counter
*/
inline size_t getFlags() const
{
return Flags;
}
/** get current level of the position counter.
* The top most (root) level is 1, the next lower level is 2, etc.
** @return number of the current level if valid, 0 otherwise
*/
inline size_t getLevel() const
{
/* check for valid counter */
return isValid() ? PositionList.size() + 1 : 0;
}
/** get string representing the current state of the position counter.
* See DSRTreeNodeCursor::getPosition() for details.
** @param position variable where the position string should be stored
* @param separator character used to separate the figures (default: '.')
** @return reference to the resulting position string (empty if invalid)
*/
const OFString &getString(OFString &position,
const char separator = '.') const;
private:
/// current position within the current level
size_t Position;
/// list of position counters in upper levels
OFList<size_t> PositionList;
/// flags used to customize the counter
size_t Flags;
};
#endif
|