memory block reader More...


Typedefs | |
| typedef typedefCGUL_BEGIN_C struct cgul_block_reader_memory * | cgul_block_reader_memory_t |
Implementation of the cgul_block_reader interface for data stored in memory.
| typedef typedefCGUL_BEGIN_C struct cgul_block_reader_memory* cgul_block_reader_memory_t |
Opaque pointer to a cgul_block_reader_memory instance.
| CGUL_EXPORT cgul_block_reader_t cgul_block_reader_memory__as_block_reader | ( | cgul_exception_t * | cex, |
| cgul_block_reader_memory_t | brmemory | ||
| ) |
Safely upcast brmemory to the cgul_block_reader interface.
| [in] | cex | c-style exception |
| [in] | brmemory | cgul_block_reader_memory instance |
Referenced by cgul_block_reader_memory_cxx::as_block_reader().
| CGUL_EXPORT cgul_block_reader_memory_t cgul_block_reader_memory__new | ( | cgul_exception_t * | cex | ) |
Create a new cgul_block_reader_memory instance. After this method returns, cgul_block_reader_memory__open() should be called before calling cgul_block_reader_memory__read_next_block(). The client is responsible for calling cgul_block_reader_memory__delete() on the object returned. If an error occurs, NULL is returned, and an exception is thrown.
cgul_block_reader (i.e., to the base type). | [in,out] | cex | c-style exception |
cgul_block_reader_memory instance Referenced by cgul_block_reader_memory_cxx::cgul_block_reader_memory_cxx().
| CGUL_EXPORT cgul_block_reader_memory_t cgul_block_reader_memory__new_from_memory | ( | cgul_exception_t * | cex, |
| void * | buffer, | ||
| size_t | buffer_size | ||
| ) |
This method creates a new cgul_block_reader_memory instance and calls cgul_block_reader_memory__open() passing it buffer and buffer_size. This class does not take ownership of buffer so the client is still responsible for freeing buffer if necessary. The client is also responsible for calling cgul_block_reader_memory__delete() on the object returned. If an error occurs, NULL is returned, and an exception is thrown.
| [in,out] | cex | c-style exception |
| [in] | buffer | memory buffer |
| [in] | buffer_size | size of buffer in bytes |
cgul_block_reader_memory instance Referenced by cgul_block_reader_memory_cxx::cgul_block_reader_memory_cxx().
| CGUL_EXPORT void cgul_block_reader_memory__delete | ( | cgul_block_reader_memory_t | brmemory | ) |
This virtual method deletes the brmemory instance freeing all internally allocated resources. The client must not use brmemory after calling this method.
| [in] | brmemory | cgul_block_reader_memory instance |
Referenced by cgul_block_reader_memory_cxx::set_obj(), and cgul_block_reader_memory_cxx::~cgul_block_reader_memory_cxx().
| CGUL_EXPORT void cgul_block_reader_memory__open | ( | cgul_exception_t * | cex, |
| cgul_block_reader_memory_t | brmemory, | ||
| void * | buffer, | ||
| size_t | buffer_size | ||
| ) |
Set the buffer buffer to use when reading blocks of data from memory. If a memory buffer is already open, it will be closed before this method attempts to open the new memory buffer. This class does not take ownership of buffer. Thus, the client is still responsible for freeing buffer if necessary. If an error occurs, an exception is thrown.
| [in,out] | cex | c-style exception |
| [in] | brmemory | cgul_block_reader_memory instance |
| [in] | buffer | input memory buffer |
| [in] | buffer_size | size of buffer in bytes |
Referenced by cgul_block_reader_memory_cxx::open().
| CGUL_EXPORT void cgul_block_reader_memory__close | ( | cgul_exception_t * | cex, |
| cgul_block_reader_memory_t | brmemory | ||
| ) |
Close the memory. After this method returns, cgul_block_reader_memory__open should be called before calling any other method.
| [in,out] | cex | c-style exception |
| [in] | brmemory | cgul_block_reader_memory instance |
Referenced by cgul_block_reader_memory_cxx::close().
| CGUL_EXPORT size_t cgul_block_reader_memory__read_next_block | ( | cgul_exception_t * | cex, |
| cgul_block_reader_memory_t | brmemory, | ||
| void * | block, | ||
| size_t | block_size | ||
| ) |
Virtual method that reads one block of data block of size block_size bytes from the underlying buffer. The user is responsible for making sure block points to at least block_size contiguous bytes of memory. The user is also responsible for making sure block does not overlap with the open buffer from which blocks are read (as required by memcpy()). This method returns the number of bytes read or 0 if EOF is reached without error. If an error occurs, 0 is returned, and an exception is thrown.
| [in,out] | cex | c-style exception |
| [in] | brmemory | cgul_block_reader_memory instance |
| [in] | block | block |
| [in] | block_size | block size in bytes |
Referenced by cgul_block_reader_memory_cxx::read_next_block().
| CGUL_EXPORT const char* cgul_block_reader_memory__get_presentation_name | ( | cgul_exception_t * | cex, |
| cgul_block_reader_memory_t | brmemory | ||
| ) |
Virtual method that returns the presentation name.
| [in,out] | cex | c-style exception |
| [in] | brmemory | cgul_block_reader_memory instance |
Referenced by cgul_block_reader_memory_cxx::get_presentation_name().
| CGUL_EXPORT void cgul_block_reader_memory__set_presentation_name | ( | cgul_exception_t * | cex, |
| cgul_block_reader_memory_t | brmemory, | ||
| const char * | presentation_name | ||
| ) |
Virtual method that sets the presentation name. The presentation name is primarily used for error reporting and can be set to anything, but it does need to be set again if the input buffer changes. If the presentation name is not set, "MEMORY" is returned. An exception is thrown if an attempt is made to set the presentation name without first setting the input buffer.
| [in,out] | cex | c-style exception |
| [in] | brmemory | cgul_block_reader_memory instance |
| [in] | presentation_name | presentation name |
Referenced by cgul_block_reader_memory_cxx::set_presentation_name().
| CGUL_EXPORT void* cgul_block_reader_memory__get_buffer | ( | cgul_exception_t * | cex, |
| cgul_block_reader_memory_t | brmemory | ||
| ) |
Return the currently opened buffer from which blocks are read. The client must not do anything that would invalidate the pointer or corrupt the associated data stream. This method throws an exception only if a file is not currently open.
Because the client is responsible for freeing the buffer if necessary, it can be convenient to call this method just before deleting the object in order to free the pointer returned.
| [in] | cex | c-style exception |
| [in] | brmemory | cgul_block_reader_memory instance |
Referenced by cgul_block_reader_memory_cxx::get_buffer().