MeVisLab Toolbox Reference
DCMTree_CharacterSetConverter.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2014, 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_CHARACTER_SET_CONVERTER_H
14 #define DCM_TREE_CHARACTER_SET_CONVERTER_H
15 
16 #include "DCMTree_Lib.h"
17 #include "DCMTree_Defines.h"
18 
19 #ifdef _MSC_VER
20  #pragma warning (push)
21  #pragma warning (disable : 4251 4350)
22 #endif
23 
24 #include <string>
25 
26 namespace DCMTree_Utils
27 {
28  class LoadLibraryDelegate;
29 }
30 
31 namespace DCMTree
32 {
34  typedef boost::shared_ptr<CharacterSetConverter> CharacterSetConverterPtr;
35  typedef boost::shared_ptr<const CharacterSetConverter> Const_CharacterSetConverterPtr;
36 
43  {
44  public:
45 
55  const std::string &originalcharacterset, const std::string &newcharacterset,
56  DCMTree_Utils::LoadLibraryDelegate* delegate = nullptr);
57 
60 
65  virtual bool convert (std::string& value, const DCMTree::TagInfo& tagInfo) const = 0;
66 
67  protected:
72  {
73  public:
74  virtual ~Factory();
75 
77  const std::string &originalcharacterset, const std::string &newcharacterset) = 0;
78  };
79 
80  typedef boost::shared_ptr<Factory> FactoryPtr;
81 
83  static void setFactory(FactoryPtr factory);
84 
85  private:
86  // factory to create converters
87  static FactoryPtr _factory;
88  };
89 }
90 
91 #ifdef _MSC_VER
92  #pragma warning (pop)
93 #endif
94 
95 #endif
96 
#define DCMTREE_EXPORT
factory class must be installed by implementing DLL
virtual CharacterSetConverterPtr createConverter(const std::string &originalcharacterset, const std::string &newcharacterset)=0
class CharacterSetConverter is used for converting string values from one DICOM character set to anot...
boost::shared_ptr< Factory > FactoryPtr
static void setFactory(FactoryPtr factory)
The concrete singleton is set by the implementing DLL.
static CharacterSetConverterPtr create(const std::string &originalcharacterset, const std::string &newcharacterset, DCMTree_Utils::LoadLibraryDelegate *delegate=nullptr)
create a CharacterSetConverter for the given pair of encodings; will return an identity conversion if...
virtual ~CharacterSetConverter()
dtor
virtual bool convert(std::string &value, const DCMTree::TagInfo &tagInfo) const =0
convert the string to the new character set, returns false if the conversion had errors (but the conv...
Class to carry meta-information about a specific tag.
the delegate who is responsible for loading the specific DICOM library used in initialization,...
Definition: DCMTree_Utils.h:72
dictionary class to provide dicom-meta information
class to dump a DCMTree dicom message into a human readable file this class could be used as a starte...
boost::shared_ptr< const CharacterSetConverter > Const_CharacterSetConverterPtr
boost::shared_ptr< CharacterSetConverter > CharacterSetConverterPtr
shared-pointer to a DCMTree::CharacterSetConverter