]> Creatis software - gdcm.git/blob - src/gdcmPixelWriteConvert.cxx
Summer nights are really too hot to sleep.
[gdcm.git] / src / gdcmPixelWriteConvert.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmPixelWriteConvert.cxx,v $
5   Language:  C++
6   Date:      $Date: 2005/06/24 10:55:59 $
7   Version:   $Revision: 1.9 $
8                                                                                 
9   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10   l'Image). All rights reserved. See Doc/License.txt or
11   http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
12                                                                                 
13      This software is distributed WITHOUT ANY WARRANTY; without even
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15      PURPOSE.  See the above copyright notices for more information.
16                                                                                 
17 =========================================================================*/
18
19 #include "gdcmDebug.h"
20 #include "gdcmPixelWriteConvert.h"
21
22 namespace gdcm
23 {
24 //-----------------------------------------------------------------------------
25 // Constructor / Destructor
26 /**
27  * \brief Constructor
28  */
29 PixelWriteConvert::PixelWriteConvert() 
30 {
31    ReadData     = 0;
32    ReadDataSize = 0;
33
34    UserData     = 0;
35    UserDataSize = 0;
36 }
37
38 /**
39  * \brief Destructor
40  */
41 PixelWriteConvert::~PixelWriteConvert() 
42 {
43 }
44
45 //-----------------------------------------------------------------------------
46 // Public
47 /**
48  * \brief   SetReadData
49  * @param   data data (uint8_t is for prototyping. if your data is not uint8_t
50  *                     just cast the pointer for calling the method)
51  * @param   size size in bytes
52  */
53 void PixelWriteConvert::SetReadData(uint8_t *data, size_t size)
54 {
55    ReadData = data;
56    ReadDataSize = size;
57 }
58
59 /**
60  * \brief   Sets User Data
61  * @param   data data (uint8_t is for prototyping. if your data is not uint8_t
62  *                     just cast the pointer for calling the method)
63  * @param   size size in bytes
64  */
65 void PixelWriteConvert::SetUserData(uint8_t *data, size_t size)
66 {
67    UserData = data;
68    UserDataSize = size;
69 }
70
71 /**
72  * \brief   Get Data (UserData or ReadData)
73  * @return  data data data (uint8_t is for prototyping. if your data is not uint8_t
74  *                     just cast the returned pointer)
75  */
76 uint8_t *PixelWriteConvert::GetData()
77 {
78    if ( UserData )
79    {
80       return UserData;
81    }
82    else
83    {
84       return ReadData;
85    }
86 }
87
88 /**
89  * \brief   Get Data Size (UserData or ReadData)
90  * @return  size size in bytes
91  */
92 size_t PixelWriteConvert::GetDataSize()
93 {
94    if ( UserData )
95    {
96       return UserDataSize;
97    }
98    else
99    {
100       return ReadDataSize;
101    }
102 }
103
104 //-----------------------------------------------------------------------------
105 // Protected
106
107 //-----------------------------------------------------------------------------
108 // Private
109
110 //-----------------------------------------------------------------------------
111 // Print
112
113 //-----------------------------------------------------------------------------
114 } // end namespace gdcm