File: gdcmServiceClassApplicationInformation.cxx

package info (click to toggle)
gdcm 2.4.4-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 32,868 kB
  • sloc: cpp: 188,481; ansic: 124,526; xml: 41,799; sh: 7,162; python: 3,667; cs: 2,128; java: 1,344; lex: 1,290; tcl: 677; php: 128; makefile: 116
file content (113 lines) | stat: -rw-r--r-- 4,339 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*=========================================================================

  Program: GDCM (Grassroots DICOM). A DICOM library

  Copyright (c) 2006-2011 Mathieu Malaterre
  All rights reserved.
  See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
#include "gdcmServiceClassApplicationInformation.h"

namespace gdcm
{
namespace network
{

ServiceClassApplicationInformation::ServiceClassApplicationInformation()
{
  InternalArray[0] = 3; // Level of Support
  InternalArray[1] = 0; // Reserved
  InternalArray[2] = 0; // Level of Digital Signature support
  InternalArray[3] = 0; // Reserved
  InternalArray[4] = 2; // Element coercion
  InternalArray[5] = 0; // Reserved
}

std::istream &ServiceClassApplicationInformation::Read(std::istream &is)
{
  is.read( (char*)InternalArray, sizeof(InternalArray) );
  return is;
}

const std::ostream &ServiceClassApplicationInformation::Write(std::ostream &os) const
{
  assert( InternalArray[0] < 4 );
  assert( InternalArray[1] == 0 );
  assert( InternalArray[2] < 4 );
  assert( InternalArray[3] == 0 );
  assert( InternalArray[4] < 3 );
  assert( InternalArray[5] == 0 );
  os.write( (char*)InternalArray, sizeof(InternalArray) );
  return os;
}

size_t ServiceClassApplicationInformation::Size() const
{
  assert( sizeof(InternalArray) == 6 );
  return 6;
}

void ServiceClassApplicationInformation::Print(std::ostream &os) const
{
  os << "ServiceClassApplicationInformation: " << std::endl;
  os << " Level of Support: " << (int)InternalArray[0] << std::endl;
  os << " Level of Digital Signature support: " << (int)InternalArray[2] << std::endl;
  os << " Element coercion: " << (int)InternalArray[4] << std::endl;
}

/*
Level of support This byte field defines the supported storage level of the
                 Association-acceptor. It shall be encoded as an
                 unsigned binary integer and shall use one of the
                 following values:
                  0 - level 0 SCP
                  1 - level 1 SCP
                  2 - level 2 SCP
                  3 - N/A - Association-acceptor is SCU only
                 If extended negotiation is not supported, no
                 assumptions shall be made by the Association-
                 requester about the capabilities of the Association-
                 acceptor based upon this extended negotiation.

 Level of Digital A Level 2 SCP may further define its behavior in this
Signature support byte field.
                   0 – The signature level is unspecified, the AE is an
                  SCU only, or the AE is not a level 2 SCP
                   1 – signature level 1
                   2 – signature level 2
                   3 – signature level 3
                  If extended negotiation is not supported, no
                  assumptions shall be made by the Association-
                  requester about the capabilities of the Association-
                  acceptor based upon this extended negotiation.

Element Coercion This byte field defines whether the Association-acceptor
                 may coerce Data Elements. It shall be encoded as an
                 unsigned binary integer and shall use one of the
                 following values:
                  0 - does not coerce any Data Element
                  1 - may coerce Data Elements
                  2 - N/A - Association-acceptor is SCU only
                 If extended negotiation is not supported, no
                 assumptions shall be made by the Association-
                 requester about the capabilities of the Association-
                 acceptor based upon this extended negotiation.
*/

void ServiceClassApplicationInformation::SetTuple(uint8_t levelofsupport, uint8_t levelofdigitalsig, uint8_t elementcoercion)
{
  if( levelofsupport < 4 )
    InternalArray[0] = levelofsupport;
  if( levelofdigitalsig < 4 )
    InternalArray[2] = levelofdigitalsig;
  if( elementcoercion < 3 )
    InternalArray[4] = elementcoercion;
}

} // end namespace network
} // end namespace gdcm