gdcmMacro.h
Go to the documentation of this file.
/*=========================================================================
Program: GDCM (Grassroots DICOM). A DICOM library
Copyright (c) 2006-2011 Mathieu Malaterre
All rights reserved.
See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#ifndef GDCMMACRO_H
#define GDCMMACRO_H
#include "gdcmTypes.h"
#include "gdcmTag.h"
#include "gdcmMacroEntry.h"
#include <map>
#include <vector>
namespace gdcm
{
class DataSet;
class Usage;
class GDCM_EXPORT Macro
{
public:
typedef std::map<Tag, MacroEntry> MapModuleEntry;
typedef std::vector<std::string> ArrayIncludeMacrosType;
//typedef MapModuleEntry::const_iterator ConstIterator;
//typedef MapModuleEntry::iterator Iterator;
//ConstIterator Begin() const { return ModuleInternal.begin(); }
//Iterator Begin() { return ModuleInternal.begin(); }
//ConstIterator End() const { return ModuleInternal.end(); }
//Iterator End() { return ModuleInternal.end(); }
Macro() = default;
friend std::ostream& operator<<(std::ostream& _os, const Macro&_val);
void Clear() { ModuleInternal.clear(); }
void AddMacroEntry(const Tag& tag, const MacroEntry & module)
{
ModuleInternal.insert(
MapModuleEntry::value_type(tag, module));
}
bool FindMacroEntry(const Tag &tag) const;
const MacroEntry& GetMacroEntry(const Tag &tag) const;
void SetName( const char *name) { Name = name; }
const char *GetName() const { return Name.c_str(); }
// Verify will print on std::cerr for error
// Upon success will return true, false otherwise
bool Verify(const DataSet& ds, Usage const & usage) const;
private:
//Module &operator=(const Module &_val); // purposely not implemented
//Module(const Module &_val); // purposely not implemented
MapModuleEntry ModuleInternal;
std::string Name;
};
//-----------------------------------------------------------------------------
inline std::ostream& operator<<(std::ostream& _os, const Macro &_val)
{
_os << _val.Name << '\n';
Macro::MapModuleEntry::const_iterator it = _val.ModuleInternal.begin();
for(;it != _val.ModuleInternal.end(); ++it)
{
const Tag &t = it->first;
const MacroEntry &de = it->second;
_os << t << " " << de << '\n';
}
return _os;
}
} // end namespace gdcm
#endif //GDCMMACRO_H
gdcm::DataSet
Class to represent a Data Set (which contains Data Elements).
Definition gdcmDataSet.h:56
gdcm::Macro::GetMacroEntry
const MacroEntry & GetMacroEntry(const Tag &tag) const
gdcm::Macro::operator<<
friend std::ostream & operator<<(std::ostream &_os, const Macro &_val)
Definition gdcmMacro.h:81
gdcm::Macro::ArrayIncludeMacrosType
std::vector< std::string > ArrayIncludeMacrosType
Definition gdcmMacro.h:40
gdcm::Macro::AddMacroEntry
void AddMacroEntry(const Tag &tag, const MacroEntry &module)
Will add a ModuleEntry directly at root-level. See Macro for nested-included level.
Definition gdcmMacro.h:55
gdcm::Macro::Clear
void Clear()
Definition gdcmMacro.h:52
gdcm::Macro::SetName
void SetName(const char *name)
Definition gdcmMacro.h:66
gdcm::Macro::Verify
bool Verify(const DataSet &ds, Usage const &usage) const
gdcm::Macro::GetName
const char * GetName() const
Definition gdcmMacro.h:67
gdcm::Macro::MapModuleEntry
std::map< Tag, MacroEntry > MapModuleEntry
Definition gdcmMacro.h:39
gdcm::Macro::Macro
Macro()=default
gdcm::Macro::FindMacroEntry
bool FindMacroEntry(const Tag &tag) const
gdcm::Tag
Class to represent a DICOM Data Element (Attribute) Tag (Group, Element).
Definition gdcmTag.h:39
gdcm::Usage
Usage.
Definition gdcmUsage.h:49
gdcmMacroEntry.h
gdcmTag.h
gdcmTypes.h
GDCM_EXPORT
#define GDCM_EXPORT
Definition gdcmWin32.h:34
gdcm
Definition gdcmASN1.h:21
gdcm::MacroEntry
ModuleEntry MacroEntry
Definition gdcmModuleEntry.h:72
gdcm::operator<<
std::ostream & operator<<(std::ostream &os, const Directory &d)
Definition gdcmDirectory.h:88