/usr/include/dcmtk/dcmdata/dcfcache.h is in libdcmtk-dev 3.6.1~20160216-4.
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 | /*
*
* 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: Marco Eichelberg
*
* Purpose: file cache facility for DcmElement::getPartialValue
*
*/
#ifndef DCFCACHE_H
#define DCFCACHE_H
#include "dcmtk/config/osconfig.h"
#include "dcmtk/ofstd/offile.h" /* for offile_off_t */
#include "dcmtk/dcmdata/dcistrma.h" /* for class DcmInputStream */
/** This class implements a simple container that stores an input stream,
* the position of that input stream corresponding to the start of a DICOM
* element value field contained in the stream and the current "owner" object.
* It is used to keep a single file handle open during multiple calls to
* DcmElement::getPartialValue(), thus speeding up the reading.
*/
class DCMTK_DCMDATA_EXPORT DcmFileCache
{
public:
/// default constructor
DcmFileCache()
: stream_(NULL)
, offset_(0)
, user_(NULL)
{
}
/// destructor
~DcmFileCache()
{
delete stream_;
}
/** checks if the given object is the current user of this cache
* returns true if so, false otherwise
* @param object pointer to "user object"
*/
OFBool isUser(void *object) const
{
return object == user_;
}
/// returns object to default constructed state
void clear()
{
delete stream_;
stream_ = NULL;
offset_ = 0;
user_ = NULL;
}
/** initializes the file cache with the given stream object
* and user.
* @param stream stream object
* @param user user object
*/
void init(DcmInputStream *stream, void *user)
{
clear();
stream_ = stream;
user_ = user;
if (stream_) offset_ = stream_->tell();
}
/// return input stream
DcmInputStream *getStream()
{
return stream_;
}
/// return initial stream offset
offile_off_t getOffset() const { return offset_; }
private:
/// private undefined copy constructor
DcmFileCache(const DcmFileCache& arg);
/// private undefined copy assignment operator
DcmFileCache& operator=(const DcmFileCache& arg);
/// input stream, may be NULL
DcmInputStream *stream_;
/// offset within stream for initial position
offile_off_t offset_;
/// object that currently uses the file cache, i.e. has created the stream
const void *user_;
};
#endif
|