Program: gdcm
Module: $RCSfile: gdcmSQItem.cxx,v $
Language: C++
- Date: $Date: 2004/10/12 04:35:47 $
- Version: $Revision: 1.29 $
+ Date: $Date: 2004/10/28 03:10:58 $
+ Version: $Revision: 1.33 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmGlobal.h"
#include "gdcmUtil.h"
#include "gdcmDebug.h"
+#include <fstream>
namespace gdcm
{
-
//-----------------------------------------------------------------------------
// Constructor / Destructor
/**
*/
SQItem::~SQItem()
{
- for(ListDocEntry::iterator cc = docEntries.begin();
- cc != docEntries.end();
- ++cc)
+ for(ListDocEntry::iterator cc = DocEntries.begin();
+ cc != DocEntries.end();
+ ++cc)
{
- delete (*cc);
+ delete *cc;
}
- docEntries.clear();
+ DocEntries.clear();
}
//-----------------------------------------------------------------------------
s << " | " ;
}
}
- std::cout << s.str() << " --- SQItem number " << SQItemNumber << std::endl;
- for (ListDocEntry::iterator i = docEntries.begin();
- i != docEntries.end();
+ //std::cout << s.str() << " --- SQItem number " << SQItemNumber << std::endl;
+ for (ListDocEntry::iterator i = DocEntries.begin();
+ i != DocEntries.end();
++i)
{
DocEntry* Entry = *i;
* \ingroup SQItem
* \brief canonical Writer
*/
-void SQItem::Write(FILE* fp,FileType filetype)
+void SQItem::Write(std::ofstream* fp, FileType filetype)
{
uint16_t item[4] = { 0xfffe, 0xe000, 0xffff, 0xffff };
uint16_t itemt[4]= { 0xfffe, 0xe00d, 0xffff, 0xffff };
//we force the writting of an 'Item' Start Element
// because we want to write the Item as a 'no Length' item
- fwrite(&item[0],8,1,fp); // fffe e000 ffff ffff
+ fp->write((char*)&item[0],8); // fffe e000 ffff ffff
- for (ListDocEntry::iterator i = docEntries.begin();
- i != docEntries.end();
- ++i)
+ for (ListDocEntry::iterator i = DocEntries.begin();
+ i != DocEntries.end();
+ ++i)
{
// we skip delimitors (start and end one) because
// we force them as 'no length'
//we force the writting of an 'Item Delimitation' item
// because we wrote the Item as a 'no Length' item
- fwrite(&itemt[0],8,1,fp); // fffe e000 ffff ffff
+ fp->write((char*)&itemt[0],8); // fffe e000 ffff ffff
}
*/
bool SQItem::AddEntry(DocEntry* entry)
{
- docEntries.push_back(entry);
+ DocEntries.push_back(entry);
//TODO : check if it worked
return true;
}
* @return true if element was found or created successfully
*/
-bool SQItem::SetEntryByNumber(std::string val, uint16_t group,
- uint16_t element)
+bool SQItem::SetEntryByNumber(std::string const & val, uint16_t group,
+ uint16_t element)
{
- for(ListDocEntry::iterator i = docEntries.begin(); i != docEntries.end(); ++i)
+ for(ListDocEntry::iterator i = DocEntries.begin();
+ i != DocEntries.end();
+ ++i)
{
if ( (*i)->GetGroup() == 0xfffe && (*i)->GetElement() == 0xe000 )
{
Dict *pubDict = Global::GetDicts()->GetDefaultPubDict();
// if the invoked (group,elem) doesn't exist inside the Dictionary
// we create a VirtualDictEntry
- DictEntry *dictEntry = pubDict->GetDictEntryByNumber(group,
- element);
+ DictEntry *dictEntry = pubDict->GetDictEntryByNumber(group, element);
if (dictEntry == NULL)
{
dictEntry =
Global::GetDicts()->NewVirtualDictEntry(group, element,
- "UN", "??", "??");
+ "UN", "??", "??");
}
// we assume the constructor didn't fail
entry = new ValEntry(dictEntry);
entry->SetValue(val);
}
entry->SetLength(val.length());
- docEntries.insert(i,entry);
+ DocEntries.insert(i,entry);
return true;
}
*/
DocEntry* SQItem::GetDocEntryByNumber(uint16_t group, uint16_t element)
{
- for(ListDocEntry::iterator i = docEntries.begin();
- i != docEntries.end(); ++i)
+ for(ListDocEntry::iterator i = DocEntries.begin();
+ i != DocEntries.end(); ++i)
{
if ( (*i)->GetGroup() == group && (*i)->GetElement() == element )
{
std::string SQItem::GetEntryByNumber(uint16_t group, uint16_t element)
{
- for(ListDocEntry::iterator i = docEntries.begin();
- i != docEntries.end(); ++i)
+ for(ListDocEntry::iterator i = DocEntries.begin();
+ i != DocEntries.end(); ++i)
{
if ( (*i)->GetGroup() == group && (*i)->GetElement() == element)
{