| VRS - The Virtual Rendering System |
| version 3.3 |
#include <vrs/io/filedataresource.h>

Public Member Functions | |
| FileDataResource (const std::string &filename, bool isWritable=false) | |
| FileDataResource (const std::string &filename, unsigned int size, bool persistent=true) | |
| virtual | ~FileDataResource () |
| const std::string & | filename () const |
| Return the filename of the mapped file. | |
| virtual void * | pointer () const |
| virtual unsigned int | size () const |
| Return the size of mapped bytes. | |
| virtual bool | isWritable () const |
| Data resources can be writable, otherwise are read-only. | |
| VRS_TYPEINFO (FileDataResource, DataResource) | |
| VRS_SERIALIZABLE (FileDataResource) | |
Protected Member Functions | |
| FileDataResource () | |
| VRS::FileDataResource::FileDataResource | ( | const std::string & | filename, | |
| bool | isWritable = false | |||
| ) |
Open the file 'filename' in read-only or read-write-modus (depending on 'isWritable'). If the read-write-modus is chosen all modifications to the data are persistent! If the file cannot be opened, an IOError exception is thrown.
| VRS::FileDataResource::FileDataResource | ( | const std::string & | filename, | |
| unsigned int | size, | |||
| bool | persistent = true | |||
| ) |
Create a file 'filename' of given 'size' and open it in read-write-modus. If 'persistent' is set to 'false' the file will be deleted when the FileDataResource object is destroyed!
| virtual VRS::FileDataResource::~FileDataResource | ( | ) | [virtual] |
| VRS::FileDataResource::FileDataResource | ( | ) | [protected] |
| const std::string& VRS::FileDataResource::filename | ( | ) | const |
Return the filename of the mapped file.
| virtual void* VRS::FileDataResource::pointer | ( | ) | const [virtual] |
Return the start address of the mapped file contents. The file contents are mapped to the addresses [pointer(), ..., pointer() + size() - 1]. You can access these memory locations as every other "normal" memory location (e.g. using memcpy, memset, ...). But for writing to these addresses the object must be opened in read-write-mode! (If not, you get a seg fault!)
Implements VRS::DataResource.
| virtual unsigned int VRS::FileDataResource::size | ( | ) | const [virtual] |
| virtual bool VRS::FileDataResource::isWritable | ( | ) | const [virtual] |
| VRS::FileDataResource::VRS_TYPEINFO | ( | FileDataResource | , | |
| DataResource | ||||
| ) |
| VRS::FileDataResource::VRS_SERIALIZABLE | ( | FileDataResource | ) |