OFFIS DCMTK  Version 3.6.0
dcfcache.h
1 /*
2  *
3  * Copyright (C) 1994-2010, OFFIS e.V.
4  * All rights reserved. See COPYRIGHT file for details.
5  *
6  * This software and supporting documentation were developed by
7  *
8  * OFFIS e.V.
9  * R&D Division Health
10  * Escherweg 2
11  * D-26121 Oldenburg, Germany
12  *
13  *
14  * Module: dcmdata
15  *
16  * Author: Marco Eichelberg
17  *
18  * Purpose: file cache facility for DcmElement::getPartialValue
19  *
20  * Last Update: $Author: joergr $
21  * Update Date: $Date: 2010-10-14 13:15:41 $
22  * CVS/RCS Revision: $Revision: 1.3 $
23  * Status: $State: Exp $
24  *
25  * CVS/RCS Log at end of file
26  *
27  */
28 
29 #ifndef DCFCACHE_H
30 #define DCFCACHE_H
31 
32 #include "dcmtk/config/osconfig.h"
33 #include "dcmtk/ofstd/offile.h" /* for offile_off_t */
34 #include "dcmtk/dcmdata/dcistrma.h" /* for class DcmInputStream */
35 
43 {
44 public:
45 
48  : stream_(NULL)
49  , offset_(0)
50  , user_(NULL)
51  {
52  }
53 
56  {
57  delete stream_;
58  }
59 
64  OFBool isUser(void *object) const
65  {
66  return object == user_;
67  }
68 
70  void clear()
71  {
72  delete stream_;
73  stream_ = NULL;
74  offset_ = 0;
75  user_ = NULL;
76  }
77 
83  void init(DcmInputStream *stream, void *user)
84  {
85  clear();
86  stream_ = stream;
87  user_ = user;
88  if (stream_) offset_ = stream_->tell();
89  }
90 
93  {
94  return stream_;
95  }
96 
98  offile_off_t getOffset() const { return offset_; }
99 
100 private:
101 
103  DcmFileCache(const DcmFileCache& arg);
104 
106  DcmFileCache& operator=(const DcmFileCache& arg);
107 
110 
112  offile_off_t offset_;
113 
115  const void *user_;
116 };
117 
118 #endif
119 
120 /*
121  * CVS/RCS Log:
122  * $Log: dcfcache.h,v $
123  * Revision 1.3 2010-10-14 13:15:41 joergr
124  * Updated copyright header. Added reference to COPYRIGHT file.
125  *
126  * Revision 1.2 2009-11-04 09:58:07 uli
127  * Switched to logging mechanism provided by the "new" oflog module
128  *
129  * Revision 1.1 2007-07-11 08:50:23 meichel
130  * Initial release of new method DcmElement::getPartialValue which gives access
131  * to partial attribute values without loading the complete attribute value
132  * into memory, if kept in file.
133  *
134  *
135  */


Generated on Thu Dec 20 2012 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.2