Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef GDCMPRIVATETAG_H
00016 #define GDCMPRIVATETAG_H
00017
00018 #include "gdcmTag.h"
00019 #include "gdcmSystem.h"
00020
00021 #include <iostream>
00022 #include <iomanip>
00023 #include <algorithm>
00024
00025 #include <string.h>
00026
00027 namespace gdcm
00028 {
00029
00035 class GDCM_EXPORT PrivateTag : public Tag
00036 {
00037 friend std::ostream& operator<<(std::ostream &_os, const PrivateTag &_val);
00038 public:
00039 PrivateTag(uint16_t group = 0, uint16_t element = 0, const char *owner = ""):Tag(group,element),Owner(owner) {
00040 std::transform(Owner.begin(), Owner.end(), Owner.begin(), tolower);
00041
00042 }
00043
00044 const char *GetOwner() const { return Owner.c_str(); }
00045 void SetOwner(const char *owner) { Owner = owner; }
00046
00047 bool operator<(const PrivateTag &_val) const
00048 {
00049 const Tag & t1 = *this;
00050 const Tag & t2 = _val;
00051 if( t1 == t2 )
00052 {
00053 const char *s1 = Owner.c_str();
00054 const char *s2 = _val.GetOwner();
00055 assert( s1[strlen(s1)-1] != ' ' );
00056 assert( s2[strlen(s2)-1] != ' ' );
00057 bool res = strcmp(s1, s2) < 0;
00058 #ifndef NDEBUG
00059 if( *s1 && *s2 && gdcm::System::StrCaseCmp(s1,s2) == 0 && strcmp(s1,s2) != 0 )
00060 {
00061
00062
00063
00064
00065
00066 res = gdcm::System::StrCaseCmp(s1,s2) < 0;
00067 assert(0);
00068 }
00069 #endif
00070 return res;
00071 }
00072 else return t1 < t2;
00073 }
00074
00075 bool ReadFromCommaSeparatedString(const char *str);
00076
00077 private:
00078
00079 std::string Owner;
00080 };
00081
00082 inline std::ostream& operator<<(std::ostream &os, const PrivateTag &val)
00083 {
00084
00085 os.setf( std::ios::right );
00086 os << std::hex << '(' << std::setw( 4 ) << std::setfill( '0' )
00087 << val[0] << ',' << std::setw( 4 ) << std::setfill( '0' )
00088 << val[1] << ')' << std::setfill( ' ' ) << std::dec;
00089 os << val.Owner;
00090 return os;
00091 }
00092
00093 }
00094
00095 #endif //GDCMPRIVATETAG_H
00096