📄 dsrdoctn.h
字号:
/* * * Copyright (C) 2000-2005, OFFIS * * This software and supporting documentation were developed by * * Kuratorium OFFIS e.V. * Healthcare Information and Communication Systems * Escherweg 2 * D-26121 Oldenburg, Germany * * THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND OFFIS MAKES NO WARRANTY * REGARDING THE SOFTWARE, ITS PERFORMANCE, ITS MERCHANTABILITY OR * FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES OR * ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND * PERFORMANCE OF THE SOFTWARE IS WITH THE USER. * * Module: dcmsr * * Author: Joerg Riesmeier * * Purpose: * classes: DSRDocumentTreeNode * * Last Update: $Author: meichel $ * Update Date: $Date: 2005/12/08 16:05:00 $ * CVS/RCS Revision: $Revision: 1.21 $ * Status: $State: Exp $ * * CVS/RCS Log at end of file * */#ifndef DSRDOCTN_H#define DSRDOCTN_H#include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */#include "dcmtk/dcmsr/dsrtree.h"#include "dcmtk/dcmsr/dsrcodvl.h"#include "dcmtk/dcmdata/dcitem.h"/*-----------------------* * forward declaration * *-----------------------*/class DSRIODConstraintChecker;/*---------------------* * class declaration * *---------------------*//** Base class for content items */class DSRDocumentTreeNode : public DSRTreeNode{ // allow access to getConceptNamePtr() friend class DSRContentItem; public: /** constructor. * The 'relationshipType' and 'valueType' can never be changed after the tree node * has been created (therefore, the corresponding member variables are declared * "const"). ** @param relationshipType type of relationship to the parent tree node. * Should not be RT_invalid and RT_isRoot only for the * root node. * @param valueType value type of the associated content item. * Should not be VT_invalid. */ DSRDocumentTreeNode(const E_RelationshipType relationshipType, const E_ValueType valueType); /** destructor */ virtual ~DSRDocumentTreeNode(); /** clear all member variables. * This does not apply to the relationship and value type since they are never changed. */ virtual void clear(); /** check whether the content item is valid. * The content item is valid if the relationship type and the value type are both not * invalid. ** @return OFTrue if tree node is valid, OFFalse otherwise */ virtual OFBool isValid() const; /** check whether the content is short. * This method is used to check whether the rendered output of this content item can be * expanded inline or not (used for renderHTML()). This base class always returns OFTrue. ** @param flags flag used to customize the output (see DSRTypes::HF_xxx) ** @return OFTrue if the content is short, OFFalse otherwise */ virtual OFBool isShort(const size_t flags) const; /** print content item. * The output of a content item depends on its value type. This general method prints * only those parts which all derived classes (= value types) do have in common, i.e. the * type of relationship, the value type and the (optional) concept name. * A typical output looks like this: has concept mod CODE: (,,"Concept") ** @param stream output stream to which the content item should be printed * @param flags flag used to customize the output (see DSRTypes::PF_xxx) ** @return status, EC_Normal if successful, an error code otherwise */ virtual OFCondition print(ostream &stream, const size_t flags) const; /** read content item from dataset. * A number of readXXX() methods are called (see "protected" part) in order to retrieve all * possibly nested content items from the dataset. ** @param dataset DICOM dataset from which the content item should be read * @param constraintChecker checks relationship content constraints of the associated IOD * @param flags flag used to customize the reading process (see DSRTypes::RF_xxx) * @param logStream pointer to error/warning output stream (output disabled if NULL) ** @return status, EC_Normal if successful, an error code otherwise */ virtual OFCondition read(DcmItem &dataset, const DSRIODConstraintChecker *constraintChecker, const size_t flags, OFConsole *logStream = NULL); /** write content item to dataset. * A number of writeXXX() methods are called (see "protected" part) in order to write all * possibly nested content items to the dataset. ** @param dataset DICOM dataset to which the content item should be written * @param markedItems optional stack where pointers to all 'marked' content items * (DICOM datasets/items) are added to during the write process. * Can be used to digitally sign parts of the document tree. * @param logStream pointer to error/warning output stream (output disabled if NULL) ** @return status, EC_Normal if successful, an error code otherwise */ virtual OFCondition write(DcmItem &dataset, DcmStack *markedItems = NULL, OFConsole *logStream = NULL); /** read general XML document tree node data ** @param doc document containing the XML file content * @param cursor cursor pointing to the starting node * @param documentType type of the document to be read (used for debug output only) * @param flags optional flag used to customize the reading process * (see DSRTypes::XF_xxx) ** @return status, EC_Normal if successful, an error code otherwise */ virtual OFCondition readXML(const DSRXMLDocument &doc, DSRXMLCursor cursor, const E_DocumentType documentType, const size_t flags); /** write content item in XML format ** @param stream output stream to which the XML document is written * @param flags flag used to customize the output (see DSRTypes::XF_xxx) * @param logStream pointer to error/warning output stream (output disabled if NULL) ** @return status, EC_Normal if successful, an error code otherwise */ virtual OFCondition writeXML(ostream &stream, const size_t flags, OFConsole *logStream = NULL) const; /** render content item in HTML format. * After rendering the current content item all child nodes (if any) are also rendered (see * renderHTMLChildNodes() for details). ** @param docStream output stream to which the main HTML document is written * @param annexStream output stream to which the HTML document annex is written * @param nestingLevel current nesting level. Used to render section headings. * @param annexNumber reference to the variable where the current annex number is stored. * Value is increased automatically by 1 after a new entry has been added. * @param flags flag used to customize the output (see DSRTypes::HF_xxx) * @param logStream pointer to error/warning output stream (output disabled if NULL) ** @return status, EC_Normal if successful, an error code otherwise */ virtual OFCondition renderHTML(ostream &docStream, ostream &annexStream, const size_t nestingLevel, size_t &annexNumber, const size_t flags, OFConsole *logStream = NULL) const; /** check whether content item is digitally signed. * A content item is signed if the DigitalSignaturesSequence exists. This sequence is read * from the dataset if present and the 'signature' flag for the 'read' method is turned on. ** @return OFTrue if content item is signed, OFFalse otherwise */ inline OFBool isSigned() { return (DigitalSignatures.card() > 0); } /** check whether content item is marked. * Use method 'setMark' to mark and unmark the current content item. * Pointers to the DICOM dataset/item of marked content items are added to the optional * stack when calling the 'write' method. This mechanism can e.g. be used to digitally * sign particular content items. ** @return OFTrue if content item is marked, OFFalse otherwise */ inline OFBool isMarked() const { return MarkFlag; } /** mark/unmark the current content item. * See explanation for method 'isMarked' for details. * @param flag mark item if OFTrue, unmark otherwise */ inline void setMark(const OFBool flag) { MarkFlag = flag; } /** check whether the current content item is target of an by-reference relationship ** @return OFTrue if the content item is target, OFFalse otherwise */ inline OFBool isReferenceTarget() const { return ReferenceTarget; } /** specify whether the current content item is target of an by-reference relationship ** @param isTarget OFTrue if the content item is target (default), OFFalse otherwise */ inline void setReferenceTarget(const OFBool isTarget = OFTrue) { ReferenceTarget = isTarget; } /** check whether the current content item has any children ** @return OFTrue if there are any child nodes, OFFalse otherwise */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -