/usr/include/dcmtk/dcmsr/dsrctpl.h is in libdcmtk-dev 3.6.1~20150924-5.
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 170 171 172 173 174 175 176 177 178 179 180 181 182 | /*
*
* Copyright (C) 2015, 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: DSRTemplateCommon
*
*/
#ifndef DSRCTPL_H
#define DSRCTPL_H
#include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
#include "dcmtk/dcmsr/dsrtypes.h"
/*-----------------------*
* forward declaration *
*-----------------------*/
class DSRDocumentSubTree;
/*---------------------*
* class declaration *
*---------------------*/
/** Class managing common information on an SR template.
* This class is used as a base class only.
*/
class DCMTK_DCMSR_EXPORT DSRTemplateCommon
{
public:
/** check whether template identification is set
** @return OFTrue if set, OFFalse otherwise
*/
virtual OFBool hasTemplateIdentification() const;
/** check whether template identification is valid
** @param check check internally stored values for conformance with VR and VM
* if enabled
** @return OFTrue if valid, OFFalse otherwise
*/
virtual OFBool isTemplateIdentificationValid(const OFBool check = OFTrue) const;
/** check whether template is extensible
** @return OFTrue if extensible, OFFalse otherwise
*/
virtual OFBool isExtensible() const
{
return ExtensibleMode;
}
/** get template identifier
** @return identifier of the template
*/
inline const OFString &getTemplateIdentifier() const
{
return TemplateIdentifier;
}
/** get mapping resource
** @return mapping resource that defines the template
*/
inline const OFString &getMappingResource() const
{
return MappingResource;
}
/** get optional mapping resource UID
** @return unique identifier of the mapping resource (might be empty)
*/
inline const OFString &getMappingResourceUID() const
{
return MappingResourceUID;
}
/** change mode specifying whether the template is extensible or non-extensible
** @param mode set template type to extensible if OFTrue (default)
*/
virtual void setExtensible(const OFBool mode = OFTrue)
{
ExtensibleMode = mode;
}
protected:
/** constructor
** @param templateIdentifier identifier of the template
* @param mappingResource mapping resource that defines the template
* @param mappingResourceUID uniquely identifies the mapping resource (optional)
*/
DSRTemplateCommon(const OFString &templateIdentifier,
const OFString &mappingResource,
const OFString &mappingResourceUID = "");
/** destructor
*/
virtual ~DSRTemplateCommon();
/** reserve a certain number of entries in the list of node IDs. Using this method
* can help to avoid unwanted memory allocations and copying of list entries.
** @param count number of entries to be reserved (for later use)
*/
void reserveEntriesInNodeList(const size_t count);
/** store given entry at a certain position in the list of node IDs
** @param pos index of the list entry to use for storage (starting from 0)
* @param nodeID ID of the node that should be stored at the given position
*/
void storeEntryInNodeList(const size_t pos,
const size_t nodeID);
/** get a particular entry from the list of node IDs
** @param pos index of the list entry to retrieve (starting from 0)
** @return node ID that is stored at the given position, 0 if not found or set
*/
size_t getEntryFromNodeList(const size_t pos) const;
/** set internal cursor of a given document tree to a specific node
** @param tree pointer to document tree where nodes and cursor are stored
* @param pos index of the list entry that stores the ID of the node
** @return ID of the new current node within the tree if successful, 0 otherwise
*/
size_t gotoEntryFromNodeList(DSRDocumentSubTree *tree,
const size_t pos);
/** set internal cursor of a given document tree to a particular node.
* The node is determined from the list of node IDs, starting from the entry
* specified by the parameter 'lastPos'. The reverse search stops if either an
* entry with a non-zero value (valid node ID) is found or the first list entry
* is reached. This approach in particular supports handling of template tables
* where the order of content items is significant.
** @param tree pointer to document tree where nodes and cursor are stored
* @param lastPos index of the last node list entry to start searching from
** @return ID of the new current node within the tree if successful, 0 otherwise
*/
size_t gotoLastEntryFromNodeList(DSRDocumentSubTree *tree,
const size_t lastPos);
private:
/// template identifier (VR=CS, mandatory)
const OFString TemplateIdentifier;
/// mapping resource (VR=CS, mandatory)
const OFString MappingResource;
/// mapping resource UID (VR=UI, optional)
const OFString MappingResourceUID;
/// mode indicating whether template is extensible (default: false)
OFBool ExtensibleMode;
/// list of node IDs used to remember certain positions in the template
OFVector<size_t> NodeList;
// --- declaration of default constructor and assignment operator
// --- (the assignment operator is defined implicitly)
DSRTemplateCommon();
DSRTemplateCommon &operator=(const DSRTemplateCommon &);
};
#endif
|