GDCM 2.2.1

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

gdcmPreamble.h
Go to the documentation of this file.
1 /*=========================================================================
2
3 Program: GDCM (Grassroots DICOM). A DICOM library
4
5 Copyright (c) 2006-2011 Mathieu Malaterre
6 All rights reserved.
7 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notice for more information.
12
13 =========================================================================*/
14
15 #ifndef GDCMPREAMBLE_H
16 #define GDCMPREAMBLE_H
17
18 #include "gdcmTypes.h"
19 #include "gdcmVL.h"
20
21 namespace gdcm
22 {
23
27 class GDCM_EXPORT Preamble
28 {
29 public:
30 Preamble();
31 ~Preamble();
32
33 friend std::ostream &operator<<(std::ostream &_os, const Preamble &_val);
34
35 // Clear
36 void Clear();
37
38 // Set Preamble to the default one
39 void Valid();
40 void Create();
41 void Remove();
42
43 // Read
44 std::istream &Read(std::istream &is);
45
46 // Write
47 std::ostream const &Write(std::ostream &os) const;
48
49 void Print(std::ostream &os) const;
50
51 const char *GetInternal() const { return Internal; }
52
53 bool IsEmpty() const { return !Internal; }
54
55 VL GetLength() const { return 128 + 4; }
56
57 Preamble(Preamble const &)
58 {
59 Create();
60 }
61 Preamble& operator=(Preamble const &)
62 {
63 Create();
64 return *this;
65 }
66 protected:
67 //
68 bool IsValid() const {
69 // is (IsValid == true) => Internal was read
70 return true;
71 }
72
73
74 private:
75 char *Internal;
76 };
77 //-----------------------------------------------------------------------------
78 inline std::ostream& operator<<(std::ostream &os, const Preamble &val)
79 {
80 os << val.Internal;
81 return os;
82 }
83
84
85 } // end namespace gdcm
86
87 #endif //GDCMPREAMBLE_H