/usr/include/dcmtk/dcmdata/dcstack.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 | /*
*
* Copyright (C) 1994-2011, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
*
* OFFIS e.V.
* R&D Division Health
* Escherweg 2
* D-26121 Oldenburg, Germany
*
*
* Module: dcmdata
*
* Author: Gerd Ehlers
*
* Purpose: stack class
*
*/
#ifndef DCSTACK_H
#define DCSTACK_H
#include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
#include "dcmtk/ofstd/oftypes.h"
#include "dcmtk/dcmdata/dcdefine.h"
class DcmObject; // forward declaration
/** helper class used by DcmStack. Maintains a single stack entry.
*/
class DCMTK_DCMDATA_EXPORT DcmStackNode
{
public:
/** constructor.
* @param obj object pointer for this stack entry
*/
DcmStackNode(DcmObject *obj);
/// destructor, non virtual.
~DcmStackNode();
/** return pointer maintained by this entry
* @return object pointer
*/
DcmObject *value() const;
private:
/// private undefined copy constructor
DcmStackNode(const DcmStackNode &);
/// private undefined copy assignment operator
DcmStackNode &operator=(const DcmStackNode &);
/// pointer to next stack entry, NULL if last one
DcmStackNode *link;
/// pointer to object referenced by this stack entry
DcmObject *objNodeValue;
/// class DcmStack directly manipulates the pointer chain
friend class DcmStack;
};
/** this class manages a stack of pointers to DcmObject instances.
* The objects pointed to are never touched, e.g. deleted.
*/
class DCMTK_DCMDATA_EXPORT DcmStack
{
public:
/// default constructor, creates empty stack
DcmStack();
/** copy constructor. Only pointers to objects are copied,
* the DcmObject instances are not duplicated.
* @param arg stack to copy from
*/
DcmStack(const DcmStack& arg);
/// destructor, not virtual. Do not derive from this class.
~DcmStack();
/** copy assignment operator. Only pointers to objects are copied,
* the DcmObject instances are not duplicated.
* @param arg object to assign from
* @return reference to this object
*/
DcmStack& operator=(const DcmStack &arg);
/** comparison operator, needed for MSVC5.
* @param arg stack to compare to
* @return true if stacks are equal, false otherwise
*/
OFBool operator==(const DcmStack& arg) const;
/** dummy comparison operator, needed for MSVC5.
* @param arg stack to compare to
* @return true if the cardinality of this stack is smaller than the
* cardinality of arg, or if the cardinality is equal and pointer
* comparison, from the top to the bottom of the stack results
* in a smaller pointer for this stack.
*/
OFBool operator<(const DcmStack& arg) const;
/** push new pointer do DcmObject instance on stack
* @param obj object pointer to push on stack
* @return pointer passed as obj
*/
DcmObject* push( DcmObject *obj );
/** removes uppermost entry from stack and returns it.
* @return uppermost stack entry
*/
DcmObject* pop();
/** returns uppermost entry of stack without removing it.
* @returns uppermost stack entry
*/
DcmObject* top() const;
/** returns n-th element from stack without removing it.
* @return n-th element from stack
*/
DcmObject* elem(const unsigned long number) const;
/** checks if the stack is empty
* @return true if stack is empty, false otherwise
*/
OFBool empty() const;
/** returns cardinality (number of entries) of the stack
* @return cardinality of stack
*/
unsigned long card() const;
/** returns the stack to default-constructed state, i.e. empty state.
*/
void clear();
private:
/// pointer to the upmost stack entry, NULL if empty
DcmStackNode *topNode_;
/// current cardinality of the stack
unsigned long cardinality_;
};
#endif // DCSTACK_H
|