MeVisLab Toolbox Reference
|
#include <DCMTree_Tree.h>
Public Member Functions | |
Tree () | |
ctor | |
Tree (const Tree &other) | |
copy all values from other to this uses operator= | |
Tree (Tree &&other) noexcept=default | |
Tree (Const_TreePtr parent) | |
initialize empty tree representing an incremental modification to the specified parent tree. | |
~Tree () override=default | |
dtor | |
Const_TreePtr | parent () const |
get the parent as unchangeable object | |
Const_TreePtr | root () const |
get the unchangeable root object of this | |
bool | hasParent () const |
check if this has a parent | |
bool | hasDict () const |
check if this has a pointer to a dictionary | |
Const_DictPtr | getDict () const |
returns the pointer to the dictionary, which can be NULL | |
void | setDict (Const_DictPtr dictPtr) |
sets the pointer to the dictionary. | |
Tree & | operator= (const Tree &other) |
assignment operator copy all values from other to this handles self-assignment well | |
Tree & | operator= (Tree &&other) noexcept=default |
const TagPtrMap & | tags () |
access tags map of this tree, parent tags are ignored (non-const, the map allows write access to the individual tags) | |
const TagPtrMap & | constTags_rw () const |
access tags map of this tree even if it is a const one to avoid expensive copy operations. | |
boost::uint32_t | tagsSize () const |
get size of tags map | |
TagIdVectorPtr | tagIds (TagSelector sel=AllTags) const |
get all tagids of this tree, ordered ascending | |
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 | |
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! | |
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_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 | |
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. | |
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 | |
TagPtr | getTag_rw (const TagId &tagid) |
get read/write access to the tag with the given TagId, search is restricted to owned tags returns empty pointer if not found | |
Const_TagPtrMapPtr | getTags (TagSelector sel=AllTags) const |
access tags map of this tree (const, returns a map with const pointers to the tag objects) | |
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 to the tag objects) | |
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 deep-copied | |
void | setTag (Const_TagPtr tagdata) |
Convenience function for the above - uses the tag id contained in the tagdata. | |
void | setTags (Const_TreePtr tags) |
sets / overwrites all tags in this from the given data. | |
void | addTag (const TagId &tagid, TagPtr tagdata) |
add a tag to this, tagdata is NOT copied | |
void | addTag (TagPtr tagdata) |
Convenience function for the above - uses the tag id contained in the tagdata. | |
void | addTags (TreePtr tags) |
void | removeTag (const TagId &tagid) |
drop a tag with the given Tagid | |
void | removeTags (TagIdVectorPtr tags) |
drops all given tags | |
TreePtr | copy () const |
make a deep-copy of this, including reference to parent | |
TreePtr | copy (const TagId &fromtag, const TagId &totag) const |
make a deep-copy of this including only tags between (including) fromtag and totag | |
TreePtr | copy (TagIdVectorPtr tags) const |
make a deep-copy of this including only tags whose ids are within the given vector | |
TreePtr | mergedCopy (TagSelector sel) const |
make a copy of this making a parent-less tree | |
std::string | getPrivateCreator (TagId tagId) const |
Return the private creator string for the given tag id. | |
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. | |
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 element id. | |
void | removePrivateTags (unsigned short groupId, unsigned short slot) |
remove all tags associated with a private slot in the specified group (0x10 <= slot <= 0xff) | |
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 | |
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, false assumes that no name(s) is/are in stream. | |
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, false writes no name(s) into stream. | |
void | serializeX (DCMTree_Serialization::Sink &sink) const override |
Writes data of this object to Sink. | |
void | deserializeX (DCMTree_Serialization::Source &source) override |
Overwrites data of this object with data from Source. | |
Public Member Functions inherited from DCMTree_Serialization::Serializable | |
virtual | ~Serializable () |
Empty. | |
Public Member Functions inherited from DCMTree_Serialization::Deserializable | |
virtual | ~Deserializable () |
Empty. | |
Definition at line 42 of file DCMTree_Tree.h.
DCMTree::Tree::Tree | ( | ) |
ctor
|
defaultnoexcept |
DCMTree::Tree::Tree | ( | Const_TreePtr | parent | ) |
initialize empty tree representing an incremental modification to the specified parent tree.
tags from the parent tree are inherited, tags stored or deleted in this tree overwrite information contained in the parent tree.
|
overridedefault |
dtor
add a tag to this, tagdata is NOT copied
Convenience function for the above - uses the tag id contained in the tagdata.
access tags map of this tree even if it is a const one to avoid expensive copy operations.
Use this with care, because it breaks constantness in favor of fast tag map access. Use tags() instead if possible, it is left to the programmers responsibility to avoid misuse.
bool DCMTree::Tree::convertCharacterSet | ( | const std::string & | originalcharacterset, |
const std::string & | newcharacterset ) |
convert from one character-set to another; returns false if the conversion was not possible
TreePtr DCMTree::Tree::copy | ( | ) | const |
make a deep-copy of this, including reference to parent
make a deep-copy of this including only tags between (including) fromtag and totag
TreePtr DCMTree::Tree::copy | ( | TagIdVectorPtr | tags | ) | const |
make a deep-copy of this including only tags whose ids are within the given vector
|
overridevirtual |
Overwrites data of this object with data from Source.
All the rules stated for SCR::Serializable::serializeX apply correspondingly.
Implements DCMTree_Serialization::Deserializable.
unsigned short DCMTree::Tree::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.
returns the element id of the private creator tag, or the element id of an unused private creator tag if the specified creator is not present and newOrExisting is true. returns 0 if the creator was not found, or if no unused private creator tag is available.
extract this instance from the given stream readName = true reads tag name(s) from stream, false assumes that no name(s) is/are in stream.
IMPORTANT: This method is used for file format persistence; thus stream contents must be maintained compatible.
Referenced by DCMTree::operator>>().
Const_DictPtr DCMTree::Tree::getDict | ( | ) | const |
returns the pointer to the dictionary, which can be NULL
std::string DCMTree::Tree::getPrivateCreator | ( | TagId | tagId | ) | const |
Return the private creator string for the given tag id.
If the tag is a private creator tag itself, return the tag value. If no private creator is defined or the tag is not a private tag, an empty string is returned
unsigned short DCMTree::Tree::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 element id.
if the specified creator is not present, a new private creator tag is created and its element id returned. returns 0 if the creator was not found and if no unused private creator tag is available.
Const_TagPtr DCMTree::Tree::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
Const_TagPtr DCMTree::Tree::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.
privateCreator | Shall match the respective private creator exactly, if the tag is a private tag |
privateVr | Shall be used as VR for the private tag, if set and the VR of the private tag is not known returns empty pointer if not found |
Const_TagPtr DCMTree::Tree::getTag | ( | const TagId & | tagid, |
TagSelector | sel = AllTags ) const |
get read access to the tag with the given TagId returns empty pointer if not found
get read/write access to the tag with the given TagId, search is restricted to owned tags returns empty pointer if not found
Const_TagPtrMapPtr DCMTree::Tree::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 to the tag objects)
Const_TagPtrMapPtr DCMTree::Tree::getTags | ( | TagSelector | sel = AllTags | ) | const |
access tags map of this tree (const, returns a map with const pointers to the tag objects)
bool DCMTree::Tree::hasDict | ( | ) | const |
check if this has a pointer to a dictionary
bool DCMTree::Tree::hasParent | ( | ) | const |
check if this has a parent
bool DCMTree::Tree::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!
bool DCMTree::Tree::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!
TreePtr DCMTree::Tree::mergedCopy | ( | TagSelector | sel | ) | const |
make a copy of this making a parent-less tree
assignment operator copy all values from other to this handles self-assignment well
Const_TreePtr DCMTree::Tree::parent | ( | ) | const |
get the parent as unchangeable object
remove all tags associated with a private slot in the specified group (0x10 <= slot <= 0xff)
void DCMTree::Tree::removeTags | ( | TagIdVectorPtr | tags | ) |
drops all given tags
Const_TreePtr DCMTree::Tree::root | ( | ) | const |
get the unchangeable root object of this
|
overridevirtual |
Writes data of this object to Sink.
Implementations of Serializable::serializeX should strictly follow this pattern:
class C: public SCR::Serializable { T1 _m1; T2 _m2; T3 _m3; public: void serializeX(SCR::Sink &sink) const { SCR::serializeX(sink, _m1); SCR::serializeX(sink, _m2); SCR::serializeX(sink, _m3); } };
That is you should call some overloading of SCR::serializeX for every member.
If some of the types T1, T2, T3 are not serializable, you should make them serializable.
Implements DCMTree_Serialization::Serializable.
void DCMTree::Tree::setDict | ( | Const_DictPtr | dictPtr | ) |
sets the pointer to the dictionary.
all contained sequence items get this dictionary too
void DCMTree::Tree::setTag | ( | const TagId & | tagid, |
Const_TagPtr | tagdata ) |
set the tag with the given TagId overwrites / discards a previously existing tag the given tag is deep-copied
void DCMTree::Tree::setTag | ( | Const_TagPtr | tagdata | ) |
Convenience function for the above - uses the tag id contained in the tagdata.
void DCMTree::Tree::setTags | ( | Const_TreePtr | tags | ) |
sets / overwrites all tags in this from the given data.
Source tags are copied, parent tags are ignored.
TagIdVectorPtr DCMTree::Tree::tagIds | ( | const TagId & | fromtag, |
const TagId & | totag, | ||
TagSelector | sel = AllTags ) const |
get all tagids of this tree ranging from fromtag to totag, ordered ascending
TagIdVectorPtr DCMTree::Tree::tagIds | ( | TagSelector | sel = AllTags | ) | const |
get all tagids of this tree, ordered ascending
access tags map of this tree, parent tags are ignored (non-const, the map allows write access to the individual tags)
boost::uint32_t DCMTree::Tree::tagsSize | ( | ) | const |
get size of tags map
copy this instance recursively into the given stream writeName = true writes tag name(s) to stream, false writes no name(s) into stream.
IMPORTANT: This method is used for file format persistence; thus stream contents must be maintained compatible.
Referenced by DCMTree::operator<<().