GDCM: gdcmPreamble.h Source File

GDCM 3.2.10

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#ifndef GDCMPREAMBLE_H
15#define GDCMPREAMBLE_H
16
17#include "gdcmTypes.h"
18#include "gdcmVL.h"
19
20namespace gdcm
21{
22
26 class GDCM_EXPORT Preamble
27{
28public:
29 Preamble();
30 ~Preamble();
31
32 friend std::ostream &operator<<(std::ostream &_os, const Preamble &_val);
33
35 void Clear();
36
38 void Valid();
39 void Create();
40 void Remove();
41
43 std::istream &Read(std::istream &is);
44
46 std::ostream const &Write(std::ostream &os) const;
47
49 void Print(std::ostream &os) const;
50
52 const char *GetInternal() const { return Internal; }
53
55 bool IsEmpty() const { return !Internal; }
56
58 VL GetLength() const { return 128 + 4; }
59
60 Preamble(Preamble const &):Internal(nullptr)
61 {
62 Create();
63 }
64 Preamble& operator=(Preamble const &)
65 {
66 Create();
67 return *this;
68 }
69protected:
70 //
71 bool IsValid() const {
72 // is (IsValid == true) => Internal was read
73 return true;
74 }
75
76private:
77 char *Internal;
78};
79//-----------------------------------------------------------------------------
80 inline std::ostream& operator<<(std::ostream &os, const Preamble &val)
81{
82 os << val.Internal;
83 return os;
84}
85
86} // end namespace gdcm
87
88#endif //GDCMPREAMBLE_H
gdcm::Preamble::Preamble
Preamble(Preamble const &)
Definition gdcmPreamble.h:60
gdcm::Preamble::IsValid
bool IsValid() const
Definition gdcmPreamble.h:71
gdcm::Preamble::Preamble
Preamble()
gdcm::Preamble::Clear
void Clear()
Clear.
gdcm::Preamble::Print
void Print(std::ostream &os) const
Print Preamble.
gdcm::Preamble::Remove
void Remove()
gdcm::Preamble::Valid
void Valid()
Set Preamble to the default one.
gdcm::Preamble::IsEmpty
bool IsEmpty() const
Check if Preamble is empty.
Definition gdcmPreamble.h:55
gdcm::Preamble::Write
std::ostream const & Write(std::ostream &os) const
Write Preamble.
gdcm::Preamble::Read
std::istream & Read(std::istream &is)
Read Preamble.
gdcm::Preamble::Create
void Create()
gdcm::Preamble::operator=
Preamble & operator=(Preamble const &)
Definition gdcmPreamble.h:64
gdcm::Preamble::GetLength
VL GetLength() const
Return size of Preamble.
Definition gdcmPreamble.h:58
gdcm::Preamble::~Preamble
~Preamble()
gdcm::Preamble::operator<<
friend std::ostream & operator<<(std::ostream &_os, const Preamble &_val)
Definition gdcmPreamble.h:80
gdcm::Preamble::GetInternal
const char * GetInternal() const
Get internal pointer to preamble.
Definition gdcmPreamble.h:52
gdcm::VL
Value Length.
Definition gdcmVL.h:30
gdcmTypes.h
gdcmVL.h
GDCM_EXPORT
#define GDCM_EXPORT
Definition gdcmWin32.h:34
gdcm
Definition gdcmASN1.h:21
gdcm::operator<<
std::ostream & operator<<(std::ostream &os, const Directory &d)
Definition gdcmDirectory.h:88