# gdcmPreamble.h

Go to the documentation of this file.

    00001 /*=========================================================================
    00002
    00003   Program: GDCM (Grassroots DICOM). A DICOM library
    00004   Module:  $URL$
    00005
    00006   Copyright (c) 2006-2009 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 &preamble)
    00059     {
    00060     (void)preamble;
    00061     }
    00062 protected:
    00063   //
    00064   bool IsValid() const {
    00065     // is (IsValid == true) => Internal was read
    00066     return true;
    00067   }
    00068
    00069
    00070 private:
    00071   char *Internal;
    00072 };
    00073 //-----------------------------------------------------------------------------
    00074 inline std::ostream& operator<<(std::ostream &os, const Preamble &val)
    00075 {
    00076   os << val.Internal;
    00077   return os;
    00078 }
    00079
    00080
    00081 } // end namespace gdcm
    00082
    00083 #endif //__gdcmPreamble_h
    00084