GDCM
2.0.18
|
00001 /*========================================================================= 00002 00003 Program: GDCM (Grassroots DICOM). A DICOM library 00004 00005 Copyright (c) 2006-2011 Mathieu Malaterre 00006 All rights reserved. 00007 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details. 00008 00009 This software is distributed WITHOUT ANY WARRANTY; without even 00010 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00011 PURPOSE. See the above copyright notice for more information. 00012 00013 =========================================================================*/ 00014 00015 #ifndef GDCMPREAMBLE_H 00016 #define GDCMPREAMBLE_H 00017 00018 #include "gdcmTypes.h" 00019 #include "gdcmVL.h" 00020 00021 namespace gdcm 00022 { 00023 00027 class GDCM_EXPORT Preamble 00028 { 00029 public: 00030 Preamble(); 00031 ~Preamble(); 00032 00033 friend std::ostream &operator<<(std::ostream &_os, const Preamble &_val); 00034 00035 // Clear 00036 void Clear(); 00037 00038 // Set Preamble to the default one 00039 void Valid(); 00040 void Create(); 00041 void Remove(); 00042 00043 // Read 00044 std::istream &Read(std::istream &is); 00045 00046 // Write 00047 std::ostream const &Write(std::ostream &os) const; 00048 00049 void Print(std::ostream &os) const; 00050 00051 const char *GetInternal() const { return Internal; } 00052 00053 bool IsEmpty() const { return !Internal; } 00054 00055 VL GetLength() const { return 128 + 4; } 00056 00057 Preamble(Preamble const &) 00058 { 00059 Create(); 00060 } 00061 Preamble& operator=(Preamble const &) 00062 { 00063 Create(); 00064 return *this; 00065 } 00066 protected: 00067 // 00068 bool IsValid() const { 00069 // is (IsValid == true) => Internal was read 00070 return true; 00071 } 00072 00073 00074 private: 00075 char *Internal; 00076 }; 00077 //----------------------------------------------------------------------------- 00078 inline std::ostream& operator<<(std::ostream &os, const Preamble &val) 00079 { 00080 os << val.Internal; 00081 return os; 00082 } 00083 00084 00085 } // end namespace gdcm 00086 00087 #endif //GDCMPREAMBLE_H