|
imebra
build 2011-09-18_22-24-41
|
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>
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 |
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().
| 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.
| 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().
| index | the zero base index of the buffer's element to retrieve |
| pYear | a pointer to a value that will be filled with the UTC date's year |
| pMonth | a pointer to a value that will be filled with the UTC date's month |
| pDay | a pointer to a value that will be filled with the UTC date's day of the month |
| pHour | a pointer to a value that will be filled with the UTC hour |
| pMinutes | a pointer to a value that will be filled with the UTC minutes |
| pSeconds | a pointer to a value that will be filled with the UTC seconds |
| pNanoseconds | a pointer to a value that will be filled with the UTC nanosecods |
| pOffsetHours | a pointer to a value that will be filled with the difference between the date time zone and the UTC time zone |
| pOffsetMinutes | a 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().
| index | the zero base index of the buffer's element to retrieve |
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.
| 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().
| index | the zero base index of the buffer's element to retrieve |
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).
| 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().
| index | the zero base index of the buffer's element to retrieve |
| 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().
| index | the zero base index of the buffer's element to retrieve |
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.
| 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().
| index | the zero base index of the buffer's element to retrieve |
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.
| index | the index to be tested |
| 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().
| index | the zero base index of the buffer's element to be set |
| year | the UTC date's year |
| month | the UTC date's month |
| day | the UTC date's day of the month |
| hour | the UTC hour |
| minutes | the UTC minutes |
| seconds | the UTC seconds |
| nanoseconds | the UTC nanosecods |
| offsetHours | the difference between the date time zone and the UTC time zone |
| offsetMinutes | the 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().
| index | the zero base index of the buffer's element to be set |
| value | the 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().
| index | the zero base index of the buffer's element to be set |
| value | the 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.
| elementsNumber | the 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().
| index | the zero base index of the buffer's element to be set |
| value | the 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().
| index | the zero base index of the buffer's element to be set |
| value | the 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().
| index | the zero base index of the buffer's element to be set |
| value | the value to write into the active data element. |
Implemented in puntoexe::imebra::handlers::dataHandlerStringAS.