13#ifndef DCM_TREE_TREE_H
14#define DCM_TREE_TREE_H
24 #pragma warning (push)
25 #pragma warning (disable : 4365 4548 4623)
329 std::set<RawTagId> _deletedtags;
358 template <
typename T, T (Tag::*Access)(
unsigned) const>
362 if (
const auto tag =
tree.getTag(
id);
tag && index <
tag->numberOfValues() && !
tag->isNull(index))
364 result = ((*tag).*Access)(index);
385 template <
typename T>
bool convertCharacterSet(const std::string &originalcharacterset, const std::string &newcharacterset)
convert from one character-set to another; returns false if the conversion was not possible
Const_TagPtr getTag(const TagId &tagid, const std::string &privateCreator, Vr privateVr=UN, TagSelector sel=AllTags) const
Get read access to the private tag with the given TagId.
TreePtr mergedCopy(TagSelector sel) const
make a copy of this making a parent-less tree
Const_TagPtr getTag(const std::string &tagName, TagSelector sel=AllTags) const
get read access to the tag with the given tagName returns empty pointer if not found
bool hasParent() const
check if this has a parent
void fromStream(std::istream &in, bool readName=false, size_t maxSize=0)
extract this instance from the given stream readName = true reads tag name(s) from stream,...
unsigned short getPrivateSlot(unsigned short groupid, const std::string &creator)
search for a private creator tag with specified group id and private creator string and returns its e...
void removePrivateTags(unsigned short groupId, unsigned short slot)
remove all tags associated with a private slot in the specified group (0x10 <= slot <= 0xff)
Const_TagPtr getTag(const TagId &tagid, TagSelector sel=AllTags) const
get read access to the tag with the given TagId returns empty pointer if not found
boost::uint32_t tagsSize() const
get size of tags map
std::string getPrivateCreator(TagId tagId) const
Return the private creator string for the given tag id.
void removeTag(const TagId &tagid)
drop a tag with the given Tagid
void toStream(std::ostream &out, bool writeName=false) const
copy this instance recursively into the given stream writeName = true writes tag name(s) to stream,...
Const_DictPtr getDict() const
returns the pointer to the dictionary, which can be NULL
TreePtr copy(const TagId &fromtag, const TagId &totag) const
make a deep-copy of this including only tags between (including) fromtag and totag
Const_TagPtrMapPtr getTags(const TagId &fromtag, const TagId &totag, TagSelector sel=AllTags) const
access tags map of this tree, ranging from fromtag to totag (const, returns a map with const pointers...
Tree & operator=(Tree &&other) noexcept=default
void addTag(TagPtr tagdata)
Convenience function for the above - uses the tag id contained in the tagdata.
const TagPtrMap & tags()
access tags map of this tree, parent tags are ignored (non-const, the map allows write access to the ...
Const_TreePtr parent() const
get the parent as unchangeable object
void removeTags(TagIdVectorPtr tags)
drops all given tags
Tree(Const_TreePtr parent)
initialize empty tree representing an incremental modification to the specified parent tree.
~Tree() override=default
dtor
Tree(const Tree &other)
copy all values from other to this uses operator=
unsigned short findPrivateSlot(unsigned short groupid, const std::string &creator, bool newOrExisting=false) const
search for a private creator tag with specified group id and private creator string.
TagPtr getTag_rw(const TagId &tagid)
get read/write access to the tag with the given TagId, search is restricted to owned tags returns emp...
void addTags(TreePtr tags)
void addTag(const TagId &tagid, TagPtr tagdata)
add a tag to this, tagdata is NOT copied
const TagPtrMap & constTags_rw() const
access tags map of this tree even if it is a const one to avoid expensive copy operations.
TreePtr copy() const
make a deep-copy of this, including reference to parent
void serializeX(DCMTree_Serialization::Sink &sink) const override
Writes data of this object to Sink.
bool hasTag(const TagId &tagid, TagSelector sel=AllTags) const
check if this has the given tag it searches only on the top-level, not in sequences!
void setTags(Const_TreePtr tags)
sets / overwrites all tags in this from the given data.
Tree(Tree &&other) noexcept=default
TagIdVectorPtr tagIds(TagSelector sel=AllTags) const
get all tagids of this tree, ordered ascending
Const_TagPtrMapPtr getTags(TagSelector sel=AllTags) const
access tags map of this tree (const, returns a map with const pointers to the tag objects)
bool hasTag(const std::string &tagName, TagSelector sel=AllTags) const
check if this has the given tag it searches only on the top-level, not in sequences!
Const_TreePtr root() const
get the unchangeable root object of this
bool hasDict() const
check if this has a pointer to a dictionary
void deserializeX(DCMTree_Serialization::Source &source) override
Overwrites data of this object with data from Source.
void setDict(Const_DictPtr dictPtr)
sets the pointer to the dictionary.
void setTag(const TagId &tagid, Const_TagPtr tagdata)
set the tag with the given TagId overwrites / discards a previously existing tag the given tag is dee...
Tree & operator=(const Tree &other)
assignment operator copy all values from other to this handles self-assignment well
TagIdVectorPtr tagIds(const TagId &fromtag, const TagId &totag, TagSelector sel=AllTags) const
get all tagids of this tree ranging from fromtag to totag, ordered ascending
TreePtr copy(TagIdVectorPtr tags) const
make a deep-copy of this including only tags whose ids are within the given vector
void setTag(Const_TagPtr tagdata)
Convenience function for the above - uses the tag id contained in the tagdata.
Interface which provides a method to deserialize an object.
Interface which provides a method to serialize an object.
Interface of a data sink for the serialization of objects.
Interface of a data source for the deserialization of objects.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
class to dump a DCMTree dicom message into a human readable file this class could be used as a starte...
boost::shared_ptr< const Tag > Const_TagPtr
TagSelector
constants selecting a tag subset in a chain of incrementally modified DICOM trees.
boost::shared_ptr< const CharacterSetConverter > Const_CharacterSetConverterPtr
std::ostream & operator<<(std::ostream &out, const Message &m)
std::map< TagId, TagPtr > TagPtrMap
a map from tag-id to TagPtr
boost::shared_ptr< const Tree > Const_TreePtr
std::map< TagId, Const_TagPtr > Const_TagPtrMap
boost::shared_ptr< Const_TagPtrMap > Const_TagPtrMapPtr
boost::shared_ptr< Tag > TagPtr
shared-pointer to tag
T value_or(const Tree &tree, TagId id, unsigned index, T alternative)
boost::shared_ptr< const Dict > Const_DictPtr
boost::shared_ptr< Tree > TreePtr
shared pointer to a DCMTree::Tree
boost::shared_ptr< TagIdVector > TagIdVectorPtr
a shared-pointer to a vector of TagIds
std::istream & operator>>(std::istream &in, Message &m)