STL container of DcmDataset

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
hardwick
Posts: 3
Joined: Fri, 2005-07-22, 16:05

STL container of DcmDataset

#1 Post by hardwick »

I would like to create a std::list<DcmDataset> to hold a series of images. This doesn't work because DcmDataset defines operator=() as private. Suggestions? (A std::list<DcmDataset*> is a last resort, since I would like the list to clean up it's contained instances.)

This brings up a question. DcmDataset does have a public copy constructor, which confuses me... why is operator=() private? Usually that is done to prevent copying, but the public copy constructor obviously allows that.

Regards,
Jim

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1444
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

#2 Post by Marco Eichelberg »

The copy constructors and copy assignment operators in the dcmdata module need some overhaul. Part of this has already been done and will be present in the next release. There is no reason why there should not be a copy assignment operator for class DcmDataset, but currently it just does not work (and yes, it was declared private to prevent people from using it).

hardwick
Posts: 3
Joined: Fri, 2005-07-22, 16:05

#3 Post by hardwick »

Thanks for the reply. Until the assignment operator is fixed, can I make an OFList of DcmDatasets?

Jim

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1444
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

#4 Post by Marco Eichelberg »

No. OFList is essentially the same as std::list. The class implements a true subset of the standard list clas, and if you compile with -DHAVE_STL it is actually just an alias for std::list. Therefore, the same rules apply. Currently you have to use a std::list<DcmDataset *> or OFList<DcmDataset *>. Make sure that the destructor of the class in which you declare the list cares about memory clean-up.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 1 guest