# gdcmTable.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-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 #ifndef GDCMTABLE_H
    00016 #define GDCMTABLE_H
    00017
    00018 #include "gdcmTableEntry.h"
    00019 #include "gdcmTag.h"
    00020
    00021 #include <map>
    00022
    00023 namespace gdcm
    00024 {
    00025
    00029 class Table
    00030 {
    00031 public:
    00032   typedef std::map<Tag, TableEntry> MapTableEntry;
    00033   Table() {}
    00034   ~Table() {}
    00035
    00036   friend std::ostream& operator<<(std::ostream& _os, const Table &_val);
    00037
    00038   void InsertEntry(Tag const &tag, TableEntry const &te)
    00039     {
    00040 #ifndef NDEBUG
    00041     MapTableEntry::size_type s = TableInternal.size();
    00042 #endif
    00043     TableInternal.insert(
    00044       MapTableEntry::value_type(tag, te));
    00045     assert( s < TableInternal.size() );
    00046     }
    00047
    00048   const TableEntry &GetTableEntry(const Tag &tag) const
    00049     {
    00050     MapTableEntry::const_iterator it =
    00051       TableInternal.find(tag);
    00052     if (it == TableInternal.end())
    00053       {
    00054       assert( 0 && "Impossible" );
    00055       return GetTableEntry(Tag(0,0));
    00056       }
    00057     return it->second;
    00058     }
    00059
    00060 private:
    00061   Table &operator=(const Table &_val); // purposely not implemented
    00062   Table(const Table&_val); // purposely not implemented
    00063
    00064   MapTableEntry TableInternal;
    00065 };
    00066
    00067 } // end namespace gdcm
    00068
    00069 #endif //GDCMTABLE_H