MeVisLab Toolbox Reference
DCMTree_Message.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2007, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13#ifndef DCM_TREE_MESSAGE_H
14#define DCM_TREE_MESSAGE_H
15
16#ifdef _MSC_VER
17 #pragma warning (push)
18 #pragma warning (disable : 4251 4350)
19#endif
20
21#include <string>
22
23#include <istream>
24#include <ostream>
25
26#include "DCMTree_Lib.h"
27#include "DCMTree_Tree.h"
28
29#include "DCMTree_Defines.h"
30
32
33namespace DCMTree
34{
41 {
42 public:
47
50
52 Message (const std::string &specificCharacterSet,TransferSyntax syntax);
53
55 ~Message() override;
56
60 void convertToCharacterSet (const std::string &characterset);
61
66
70 std::string specificCharacterSet();
71
75 std::string specifiedCharacterSet();
76
81
85 const TreePtr &tags();
86
90 const Const_TreePtr &tags() const;
91
95 void setTags (TreePtr tags);
96
101
108 void fromStream (std::istream &in, bool readName);
109
116 void toStream (std::ostream &out, bool writeName) const;
117
120
121 private:
122 std::string _specificcharacterset;
123 TransferSyntax _syntax;
124 TreePtr _tags;
125 Const_TreePtr _constTags;
126 };
127
128 inline std::ostream &operator << (std::ostream &out,const Message &m)
129 {
130 m.toStream (out, false);
131 return out;
132 }
133
134 inline std::istream &operator >> (std::istream &in,Message &m)
135 {
136 m.fromStream (in, false);
137 return in;
138 }
139}
140
141#ifdef _MSC_VER
142 #pragma warning (pop)
143#endif
144
145#endif
146
147
#define DCMTREE_EXPORT
class to hold data of an DICOM message, which is not part of the message itself.
void setTags(TreePtr tags)
Specify tags tree (modifiable)
std::string specifiedCharacterSet()
get the specific character set specified in the tags of this message
const Const_TreePtr & tags() const
access all the tags (const access)
void deserializeX(DCMTree_Serialization::Source &source) override
Overwrites data of this object with data from Source.
const TreePtr & tags()
access all the tags (non-const access)
TransferSyntax syntax() const
get the transfer-syntax of this message
Message(const Message &other)
copy ctor - make deep copy
void serializeX(DCMTree_Serialization::Sink &sink) const override
Writes data of this object to Sink.
void fromStream(std::istream &in, bool readName)
extract this instance from the given stream readName = true reads tag name(s) from stream,...
Message & operator=(const Message &other)
makes a deep copy of the given instance into *this
Message()
ctor default to default-character-set and implicit-little-endian
void convertToCharacterSet(const std::string &characterset)
convert the internal tag-tree(s) to the given character set
~Message() override
dtor
void setTags(Const_TreePtr tags)
Specify tags tree (non-modifiable)
void toStream(std::ostream &out, bool writeName) const
copy this instance recursively into the given stream writeName = true writes tag name(s) to stream,...
std::string specificCharacterSet()
get the specific character set of this message
Message(const std::string &specificCharacterSet, TransferSyntax syntax)
initializes the message with the given values
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...
std::ostream & operator<<(std::ostream &out, const Message &m)
boost::shared_ptr< const Tree > Const_TreePtr
Definition DCMTree_Lib.h:73
TransferSyntax
DICOM transfer syntaxes.
boost::shared_ptr< Tree > TreePtr
shared pointer to a DCMTree::Tree
Definition DCMTree_Lib.h:72
std::istream & operator>>(std::istream &in, Message &m)