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