7 #include "fwMedData/AttachmentSeries.hpp" 9 #include <fwData/Exception.hpp> 10 #include <fwData/registry/macros.hpp> 12 #include <fwMemory/stream/in/Raw.hpp> 14 #include <boost/filesystem/operations.hpp> 22 m_buffer(::
fwMemory::BufferObject::New()),
23 m_attachmentAvailability(NONE)
37 AttachmentSeries::csptr other = AttachmentSeries::dynamicConstCast(_source);
39 "Unable to copy" + (_source ? _source->getClassname() : std::string(
"<NULL>"))
44 if( !other->m_buffer->isEmpty() )
47 m_buffer->allocate(other->m_buffer->getSize());
48 char* buffDest =
static_cast< char*
>( lockerDest.
getBuffer() );
51 char* buffSrc =
static_cast< char*
>( lockerSource.
getBuffer() );
53 std::copy(buffSrc, buffSrc+other->m_buffer->getSize(), buffDest );
72 size_t buffSize = ::boost::filesystem::file_size(path);
73 m_buffer->setIStreamFactory( std::make_shared< ::fwMemory::stream::in::Raw >(path),
74 buffSize, path, ::fwMemory::RAW);
FWMEDDATA_API AttachmentSeries(::fwData::Object::Key key)
Constructor.
virtual const std::string & getClassname() const override
return full object's classname with its namespace, i.e. fwCore::BaseObject
FWMEDDATA_API::fwMemory::BufferObject::sptr getBufferObject() const
Returns BufferObject of the current attachment file.
FWMEDDATA_APIconst::boost::filesystem::path & getAttachmentPath() const
Local path of attachment file.
Namespace containing medical data.
FWMEDDATA_API void cachedDeepCopy(const ::fwData::Object::csptr &_source, DeepCopyCacheType &cache) override
Defines deep copy.
The namespace fwMemory contains tools to manage memory. Use for dump.
FWMEDDATA_API AttachmentAvailability getAttachmentAvailability() const
Returns the state of the attached file.
AttachmentAvailability m_attachmentAvailability
Attachment availability.
std::string m_mediaType
Media type of the attached file.
::boost::filesystem::path m_attachmentPath
Local path of attachment file.
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.
Implements data exception class.
FWMEDDATA_API void cachedDeepCopy(const ::fwData::Object::csptr &_source, DeepCopyCacheType &cache) override
Defines deep copy.
::fwMemory::BufferObject::sptr m_buffer
BufferObject of the current attachment file.
base class for BufferObject Lock
virtual FWMEDDATA_API ~AttachmentSeries()
Destructor.
LockBase< T >::BufferType getBuffer() const
Returns BufferObject's buffer pointer.
FWMEDDATA_API void setAttachmentPath(const ::boost::filesystem::path &path)
Local path of attachment file.
AttachmentAvailability
Availability.
Holds series information.
FWMEDDATA_API void setMediaType(const std::string &mediaType)
Specifies the media type of the attached file (see IANA list of official media types) ...
FWMEDDATA_API std::string getMediaType() const
Returns the media type of the attached file.