]> Creatis software - gdcm.git/blob - src/gdcmRLEFramesInfo.cxx
* Remove friend between PixelReadConverter and RLEFramesInfo,
[gdcm.git] / src / gdcmRLEFramesInfo.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmRLEFramesInfo.cxx,v $
5   Language:  C++
6   Date:      $Date: 2005/01/28 15:42:22 $
7   Version:   $Revision: 1.7 $
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 "gdcmRLEFramesInfo.h"
20 #include "gdcmDebug.h"
21
22 namespace gdcm 
23 {
24
25 RLEFramesInfo::~RLEFramesInfo()
26 {
27    for(RLEFrameList::iterator it = Frames.begin(); it != Frames.end(); ++it)
28    {
29       delete (*it);
30    }
31    Frames.clear();
32 }
33
34 /**
35  * \brief        Print self.
36  * @param indent Indentation string to be prepended during printing.
37  * @param os     Stream to print to.
38  */
39 void RLEFramesInfo::Print( std::ostream &os, std::string indent )
40 {
41    os << std::endl;
42    os << indent
43       << "----------------- RLE frames --------------------------------"
44       << std::endl;
45    os << indent
46       << "Total number of Frames : " << Frames.size()
47       << std::endl;
48    int frameNumber = 0;
49    for(RLEFrameList::iterator it = Frames.begin(); it != Frames.end(); ++it)
50    {
51       os << indent
52          << "   frame number :" << frameNumber++
53          << std::endl;
54       (*it)->Print( os, indent + "   " );
55    }
56 }
57
58 void RLEFramesInfo::AddFrame(RLEFrame *frame)
59 {
60    Frames.push_back(frame);
61 }
62
63 RLEFrame *RLEFramesInfo::GetFirstFrame()
64 {
65    ItFrames = Frames.begin();
66    if (ItFrames != Frames.end())
67       return  *ItFrames;
68    return NULL;
69 }
70
71 RLEFrame *RLEFramesInfo::GetNexttFrame()
72 {
73    gdcmAssertMacro (ItFrames != Frames.end());
74
75    ++ItFrames;
76    if (ItFrames != Frames.end())
77       return  *ItFrames;
78    return NULL;
79 }
80
81 } // end namespace gdcm