imebra  build 2011-09-18_22-24-41
puntoexe::imebra::handlers::dataHandler Class Reference

This is the base class for all the imebra data handlers. A data handler allows to read/write the data stored in a puntoexe::imebra::buffer object without worrying about the data format. More...

#include <dataHandler.h>

Inheritance diagram for puntoexe::imebra::handlers::dataHandler:
puntoexe::baseObject puntoexe::imebra::handlers::dataHandlerNumericBase puntoexe::imebra::handlers::dataHandlerString puntoexe::imebra::handlers::dataHandlerNumeric< imbxUint8 > puntoexe::imebra::handlers::dataHandlerNumeric< dataHandlerType > puntoexe::imebra::handlers::dataHandlerDateTimeBase puntoexe::imebra::handlers::dataHandlerStringAE puntoexe::imebra::handlers::dataHandlerStringAS puntoexe::imebra::handlers::dataHandlerStringCS puntoexe::imebra::handlers::dataHandlerStringDS puntoexe::imebra::handlers::dataHandlerStringIS puntoexe::imebra::handlers::dataHandlerStringUnicode

List of all members.

Public Member Functions

void copyBack ()
 In a writing handler copies back the modified data to the buffer.
void commit ()
 Finalize the copy of the data from the handler to the buffer.
void abort ()
 Discard all the changes made on a writing handler.
Data pointer

The following functions set the value of the internal pointer that references the data element read/written by the reading/writing functions.

virtual bool pointerIsValid (const imbxUint32 index) const =0
 Returns true if the specified index points to a valid element in the buffer.
Buffer and elements size
virtual void setSize (const imbxUint32 elementsNumber)=0
 Set the buffer's size, in elements.
virtual imbxUint32 getSize () const =0
 Retrieve the data handler's local buffer buffer size (in elements).
virtual imbxUint32 getUnitSize () const =0
 Returns a single element's size in bytes.
Attributes
std::string getDataType () const
 Get the dicom data type managed by this handler.
virtual imbxUint8 getPaddingByte () const
 Return the byte that this handler uses to fill its content to make its size even.
Reading/writing functions
virtual imbxInt32 getSignedLong (const imbxUint32 index) const =0
 Retrieve the buffer's element referenced by the zero-based index specified in the parameter and returns it as a signed long value.
virtual imbxUint32 getUnsignedLong (const imbxUint32 index) const =0
 Retrieve the buffer's element referenced by the zero-based index specified in the parameter and returns it as an unsigned long value.
virtual double getDouble (const imbxUint32 index) const =0
 Retrieve the buffer's element referenced by the zero-based index specified in the parameter and returns it as a double floating point value.
virtual std::string getString (const imbxUint32 index) const =0
 Retrieve the buffer's element referenced by the zero-based index specified in the parameter and returns it as a string value.
virtual std::wstring getUnicodeString (const imbxUint32 index) const =0
 Retrieve the buffer's element referenced by the zero-based index specified in the parameter and returns it as an unicode string value.
virtual void getDate (const imbxUint32 index, imbxInt32 *pYear, imbxInt32 *pMonth, imbxInt32 *pDay, imbxInt32 *pHour, imbxInt32 *pMinutes, imbxInt32 *pSeconds, imbxInt32 *pNanoseconds, imbxInt32 *pOffsetHours, imbxInt32 *pOffsetMinutes) const
 Retrieve the buffer's element referenced by the zero-based index specified in the parameter and returns it as a date/time value.
virtual void setDate (const imbxUint32 index, imbxInt32 year, imbxInt32 month, imbxInt32 day, imbxInt32 hour, imbxInt32 minutes, imbxInt32 seconds, imbxInt32 nanoseconds, imbxInt32 offsetHours, imbxInt32 offsetMinutes)
 Set the buffer's element referenced by the zero-based index specified in the parameter to a date/time value.
virtual void setSignedLong (const imbxUint32 index, const imbxInt32 value)=0
 Set the buffer's element referenced by the zero-based index specified in the parameter to a signed long value.
virtual void setUnsignedLong (const imbxUint32 index, const imbxUint32 value)=0
 Set the buffer's element referenced by the zero-based index specified in the parameter to an unsigned long value.
virtual void setDouble (const imbxUint32 index, const double value)=0
 Set the buffer's element referenced by the zero-based index specified in the parameter to a double floating point value.
virtual void setString (const imbxUint32 index, const std::string &value)=0
 Set the buffer's element referenced by the zero-based index specified in the parameter to a string value. See also setUnicodeString().
virtual void setUnicodeString (const imbxUint32 index, const std::wstring &value)=0
 Set the buffer's element referenced by the zero-based index specified in the parameter to a string value. See also seString().

Friends

class puntoexe::imebra::buffer
class puntoexe::imebra::transaction

Detailed Description

This is the base class for all the imebra data handlers. A data handler allows to read/write the data stored in a puntoexe::imebra::buffer object without worrying about the data format.

Data handlers work on a local copy of the buffer, then they don't need to worry about multithreading accesses.

Also, once a dataHandler has been obtained from a buffer, it cannot be shared between threads and it doesn't provide any multithread-safe mechanism, except for its destructor which copies the local buffer back to the original one (only for the writable handlers).

Data handlers are also used to access to the decompressed image's pixels (see image and handlers::dataHandlerNumericBase).

To obtain a data handler your application has to call buffer::getDataHandler() or image::getDataHandler().


Member Function Documentation

void puntoexe::imebra::handlers::dataHandler::abort ( )

Discard all the changes made on a writing handler.

The function also switches the write flag to false, so it also prevent further changes from being committed into the buffer.

void puntoexe::imebra::handlers::dataHandler::commit ( )

Finalize the copy of the data from the handler to the buffer.

Is not necessary to call this function directly because it is called by the handler's destructor, which copy any modification back to the buffer and then finalize it.

void puntoexe::imebra::handlers::dataHandler::copyBack ( )

In a writing handler copies back the modified data to the buffer.

Is not necessary to call this function directly because it is called by the handler's destructor, which copy any modification back to the buffer and finalize it.

The operation must be finalized by a call to commit(), or will be finalized by the destructor unless a call to abort() happen.

std::string puntoexe::imebra::handlers::dataHandler::getDataType ( ) const

Get the dicom data type managed by this handler.

The dicom data type is formed by 2 uppercase chars, as described by the dicom standard. See buffer for further information.

Returns:
the data handler's dicom data type
void puntoexe::imebra::handlers::dataHandler::getDate ( const imbxUint32  index,
imbxInt32 pYear,
imbxInt32 pMonth,
imbxInt32 pDay,
imbxInt32 pHour,
imbxInt32 pMinutes,
imbxInt32 pSeconds,
imbxInt32 pNanoseconds,
imbxInt32 pOffsetHours,
imbxInt32 pOffsetMinutes 
) const [virtual]

Retrieve the buffer's element referenced by the zero-based index specified in the parameter and returns it as a date/time value.

Returns all zeros if the specified index is out of range. You can check the validity of the index by using the function pointerIsValid().

Parameters:
indexthe zero base index of the buffer's element to retrieve
pYeara pointer to a value that will be filled with the UTC date's year
pMontha pointer to a value that will be filled with the UTC date's month
pDaya pointer to a value that will be filled with the UTC date's day of the month
pHoura pointer to a value that will be filled with the UTC hour
pMinutesa pointer to a value that will be filled with the UTC minutes
pSecondsa pointer to a value that will be filled with the UTC seconds
pNanosecondsa pointer to a value that will be filled with the UTC nanosecods
pOffsetHoursa pointer to a value that will be filled with the difference between the date time zone and the UTC time zone
pOffsetMinutesa pointer to a value that will be filled with the difference between the date time zone and the UTC time zone
virtual double puntoexe::imebra::handlers::dataHandler::getDouble ( const imbxUint32  index) const [pure virtual]

Retrieve the buffer's element referenced by the zero-based index specified in the parameter and returns it as a double floating point value.

Returns 0 if the specified index is out of range. You can check the validity of the index by using the function pointerIsValid().

Parameters:
indexthe zero base index of the buffer's element to retrieve
Returns:
the value of the data element referenced by the index, transformed into a double floating point, or 0 if the index is out of range

Implemented in puntoexe::imebra::handlers::dataHandlerStringAS.

imbxUint8 puntoexe::imebra::handlers::dataHandler::getPaddingByte ( ) const [virtual]

Return the byte that this handler uses to fill its content to make its size even.

Returns:
the byte used to make the content's size even
virtual imbxInt32 puntoexe::imebra::handlers::dataHandler::getSignedLong ( const imbxUint32  index) const [pure virtual]

Retrieve the buffer's element referenced by the zero-based index specified in the parameter and returns it as a signed long value.

Returns 0 if the specified index is out of range. You can check the validity of the index by using the function pointerIsValid().

Parameters:
indexthe zero base index of the buffer's element to retrieve
Returns:
the value of the data element referenced by the index, transformed into a signed long, or 0 if the index is out of range

Implemented in puntoexe::imebra::handlers::dataHandlerStringAS.

virtual imbxUint32 puntoexe::imebra::handlers::dataHandler::getSize ( ) const [pure virtual]

Retrieve the data handler's local buffer buffer size (in elements).

Returns:
the buffer's size in elements
virtual std::string puntoexe::imebra::handlers::dataHandler::getString ( const imbxUint32  index) const [pure virtual]

Retrieve the buffer's element referenced by the zero-based index specified in the parameter and returns it as a string value.

Returns 0 if the specified index is out of range. You can check the validity of the index by using the function pointerIsValid().

Parameters:
indexthe zero base index of the buffer's element to retrieve
Returns:
the value of the data element referenced by the index, transformed into a string, or 0 if the index is out of range
virtual std::wstring puntoexe::imebra::handlers::dataHandler::getUnicodeString ( const imbxUint32  index) const [pure virtual]

Retrieve the buffer's element referenced by the zero-based index specified in the parameter and returns it as an unicode string value.

Returns 0 if the specified index is out of range. You can check the validity of the index by using the function pointerIsValid().

Parameters:
indexthe zero base index of the buffer's element to retrieve
Returns:
the value of the data element referenced by the index, transformed into an unicode string, or 0 if the index is out of range

Implemented in puntoexe::imebra::handlers::dataHandlerTime, and puntoexe::imebra::handlers::dataHandlerDate.

imbxUint32 puntoexe::imebra::handlers::dataHandler::getUnitSize ( ) const [pure virtual]

Returns a single element's size in bytes.

If the element doesn't have a fixed size, then this function return 0.

Returns:
the element's size in bytes, or zero if the element doesn't have a fixed size
virtual imbxUint32 puntoexe::imebra::handlers::dataHandler::getUnsignedLong ( const imbxUint32  index) const [pure virtual]

Retrieve the buffer's element referenced by the zero-based index specified in the parameter and returns it as an unsigned long value.

Returns 0 if the specified index is out of range. You can check the validity of the index by using the function pointerIsValid().

Parameters:
indexthe zero base index of the buffer's element to retrieve
Returns:
the value of the data element referenced by the index, transformed into an unsigned long, or 0 if the index is out of range

Implemented in puntoexe::imebra::handlers::dataHandlerStringAS.

virtual bool puntoexe::imebra::handlers::dataHandler::pointerIsValid ( const imbxUint32  index) const [pure virtual]

Returns true if the specified index points to a valid element in the buffer.

If the index is out of the valid range, then this method returns false.

Parameters:
indexthe index to be tested
Returns:
true if the index is valid, false if it is out of range
void puntoexe::imebra::handlers::dataHandler::setDate ( const imbxUint32  index,
imbxInt32  year,
imbxInt32  month,
imbxInt32  day,
imbxInt32  hour,
imbxInt32  minutes,
imbxInt32  seconds,
imbxInt32  nanoseconds,
imbxInt32  offsetHours,
imbxInt32  offsetMinutes 
) [virtual]

Set the buffer's element referenced by the zero-based index specified in the parameter to a date/time value.

Does nothing if the specified index is out of range You can check the validity of the index by using the function pointerIsValid(), you can resize the buffer by using the function setSize().

Parameters:
indexthe zero base index of the buffer's element to be set
yearthe UTC date's year
monththe UTC date's month
daythe UTC date's day of the month
hourthe UTC hour
minutesthe UTC minutes
secondsthe UTC seconds
nanosecondsthe UTC nanosecods
offsetHoursthe difference between the date time zone and the UTC time zone
offsetMinutesthe difference between the date time zone and the UTC time zone
virtual void puntoexe::imebra::handlers::dataHandler::setDouble ( const imbxUint32  index,
const double  value 
) [pure virtual]

Set the buffer's element referenced by the zero-based index specified in the parameter to a double floating point value.

Does nothing if the specified index is out of range You can check the validity of the index by using the function pointerIsValid(), you can resize the buffer by using the function setSize().

Parameters:
indexthe zero base index of the buffer's element to be set
valuethe value to write into the active data element.

Implemented in puntoexe::imebra::handlers::dataHandlerStringAS.

virtual void puntoexe::imebra::handlers::dataHandler::setSignedLong ( const imbxUint32  index,
const imbxInt32  value 
) [pure virtual]

Set the buffer's element referenced by the zero-based index specified in the parameter to a signed long value.

Does nothing if the specified index is out of range You can check the validity of the index by using the function pointerIsValid(), you can resize the buffer by using the function setSize().

Parameters:
indexthe zero base index of the buffer's element to be set
valuethe value to write into the active data element.

Implemented in puntoexe::imebra::handlers::dataHandlerStringAS.

virtual void puntoexe::imebra::handlers::dataHandler::setSize ( const imbxUint32  elementsNumber) [pure virtual]

Set the buffer's size, in elements.

The function resize the data handler's local buffer to the requested number of elements.

Parameters:
elementsNumberthe requested buffer's size, in data elements
virtual void puntoexe::imebra::handlers::dataHandler::setString ( const imbxUint32  index,
const std::string &  value 
) [pure virtual]

Set the buffer's element referenced by the zero-based index specified in the parameter to a string value. See also setUnicodeString().

Does nothing if the specified index is out of range You can check the validity of the index by using the function pointerIsValid(), you can resize the buffer by using the function setSize().

Parameters:
indexthe zero base index of the buffer's element to be set
valuethe value to write into the active data element.
virtual void puntoexe::imebra::handlers::dataHandler::setUnicodeString ( const imbxUint32  index,
const std::wstring &  value 
) [pure virtual]

Set the buffer's element referenced by the zero-based index specified in the parameter to a string value. See also seString().

Does nothing if the specified index is out of range You can check the validity of the index by using the function pointerIsValid(), you can resize the buffer by using the function setSize().

Parameters:
indexthe zero base index of the buffer's element to be set
valuethe value to write into the active data element.

Implemented in puntoexe::imebra::handlers::dataHandlerTime, and puntoexe::imebra::handlers::dataHandlerDate.

virtual void puntoexe::imebra::handlers::dataHandler::setUnsignedLong ( const imbxUint32  index,
const imbxUint32  value 
) [pure virtual]

Set the buffer's element referenced by the zero-based index specified in the parameter to an unsigned long value.

Does nothing if the specified index is out of range You can check the validity of the index by using the function pointerIsValid(), you can resize the buffer by using the function setSize().

Parameters:
indexthe zero base index of the buffer's element to be set
valuethe value to write into the active data element.

Implemented in puntoexe::imebra::handlers::dataHandlerStringAS.


The documentation for this class was generated from the following files: