# Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics

[Home] [Tutorials] [All Classes] [Grouped Classes]

Public Member Functions | Protected Member Functions | Protected Attributes

# vl::MemoryFile Class Reference

A VirtualFile to manipulate files stored in memory. More...

`#include <MemoryFile.hpp>`

Inheritance diagram for vl::MemoryFile:

List of all members.

## Public Member Functions

| MemoryFile ()
const Buffer * | buffer () const
Buffer * | buffer ()
void | setBuffer (Buffer *buffer)
| This is useful when you want to point more MemoryFiles to the same Buffer object.
unsigned char * | ptr ()
virtual bool | exists () const
| A MemoryFile always exists.
virtual bool | open (EOpenMode mode)
| Opens the file in the specified mode.
virtual bool | isOpen () const
| Returns `true` if the file has been opened.
virtual void | close ()
| Closes the file.
void | allocateBuffer (long long byte_count)
virtual long long | size () const
| Returns the size of the file in bytes.
void | copy (VirtualFile *file)
| Copies the data of any kind of VirtualFile.
MemoryFile & | operator= (const MemoryFile &other)
ref< VirtualFile > | clone () const
| Creates a clone of this class instance.

## Protected Member Functions

virtual long long | position_Implementation () const
virtual long long | read_Implementation (void *buffer, long long byte_count)
virtual long long | write_Implementation (const void *, long long)
virtual bool | seekSet_Implementation (long long offset)

## Protected Attributes

ref< Buffer > | mBuffer
long long | mPtr
bool | mIsOpen

## Detailed Description

A VirtualFile to manipulate files stored in memory.

See also:
  - VirtualDirectory
  - DiskDirectory
  - MemoryDirectory
  - ZippedDirectory
  - FileSystem
  - VirtualFile
  - DiskFile
  - ZippedFile

Definition at line 56 of file MemoryFile.hpp.

## Constructor & Destructor Documentation

MemoryFile::MemoryFile | ( | ) |

Definition at line 40 of file MemoryFile.cpp.

References mBuffer, mIsOpen, and mPtr.

Referenced by clone().

## Member Function Documentation

const Buffer* vl::MemoryFile::buffer | ( | ) | const`[inline]`

Definition at line 63 of file MemoryFile.hpp.

Buffer* vl::MemoryFile::buffer | ( | ) | `[inline]`

Definition at line 65 of file MemoryFile.hpp.

void vl::MemoryFile::setBuffer | ( | Buffer * | buffer ) | `[inline]`

This is useful when you want to point more MemoryFiles to the same Buffer object.

Definition at line 68 of file MemoryFile.hpp.

unsigned char* vl::MemoryFile::ptr | ( | ) | `[inline]`

Definition at line 70 of file MemoryFile.hpp.

Referenced by copy(), and read_Implementation().

virtual bool vl::MemoryFile::exists | ( | ) | const`[inline, virtual]`

A MemoryFile always exists.

Implements vl::VirtualFile.

Definition at line 73 of file MemoryFile.hpp.

bool MemoryFile::open | ( | EOpenMode | mode ) | `[virtual]`

Opens the file in the specified mode.

Implements vl::VirtualFile.

Definition at line 47 of file MemoryFile.cpp.

References vl::Log::error(), isOpen(), mIsOpen, and vl::OM_ReadOnly.

virtual bool vl::MemoryFile::isOpen | ( | ) | const`[inline, virtual]`

Returns `true` if the file has been opened.

Implements vl::VirtualFile.

Definition at line 77 of file MemoryFile.hpp.

Referenced by open(), position_Implementation(), read_Implementation(), and seekSet_Implementation().

virtual void vl::MemoryFile::close | ( | ) | `[inline, virtual]`

Closes the file.

Implements vl::VirtualFile.

Definition at line 79 of file MemoryFile.hpp.

void vl::MemoryFile::allocateBuffer | ( | long long | byte_count ) | `[inline]`

Definition at line 81 of file MemoryFile.hpp.

Referenced by copy().

virtual long long vl::MemoryFile::size | ( | ) | const`[inline, virtual]`

Returns the size of the file in bytes.

Implements vl::VirtualFile.

Definition at line 83 of file MemoryFile.hpp.

Referenced by copy().

void MemoryFile::copy | ( | VirtualFile * | file ) |

Copies the data of any kind of VirtualFile.

Definition at line 60 of file MemoryFile.cpp.

References allocateBuffer(), vl::VirtualFile::close(), vl::VirtualFile::isOpen(), vl::OM_ReadOnly, vl::VirtualFile::open(), ptr(), vl::VirtualFile::read(), size(), and vl::VirtualFile::size().

MemoryFile& vl::MemoryFile::operator= | ( | const MemoryFile & | other ) | `[inline]`

Definition at line 88 of file MemoryFile.hpp.

References mBuffer.

ref< VirtualFile > MemoryFile::clone | ( | ) | const`[virtual]`

Creates a clone of this class instance.

Implements vl::VirtualFile.

Definition at line 111 of file MemoryFile.cpp.

References MemoryFile().

long long MemoryFile::position_Implementation | ( | ) | const`[protected, virtual]`

Implements vl::VirtualFile.

Definition at line 74 of file MemoryFile.cpp.

References isOpen(), and mPtr.

long long MemoryFile::read_Implementation | ( | void * | buffer,
|  | long long | byte_count
| ) |  | `[protected, virtual]`

Implements vl::VirtualFile.

Definition at line 81 of file MemoryFile.cpp.

References isOpen(), mBuffer, mPtr, and ptr().

virtual long long vl::MemoryFile::write_Implementation | ( | const void * | ,
|  | long long |
| ) |  | `[inline, protected, virtual]`

Implements vl::VirtualFile.

Definition at line 97 of file MemoryFile.hpp.

bool MemoryFile::seekSet_Implementation | ( | long long | offset ) | `[protected, virtual]`

Implements vl::VirtualFile.

Definition at line 100 of file MemoryFile.cpp.

References isOpen(), mBuffer, and mPtr.

## Member Data Documentation

ref<Buffer> vl::MemoryFile::mBuffer`[protected]`

Definition at line 102 of file MemoryFile.hpp.

Referenced by MemoryFile(), operator=(), read_Implementation(), and seekSet_Implementation().

long long vl::MemoryFile::mPtr`[protected]`

Definition at line 103 of file MemoryFile.hpp.

Referenced by MemoryFile(), position_Implementation(), read_Implementation(), and seekSet_Implementation().

bool vl::MemoryFile::mIsOpen`[protected]`

Definition at line 104 of file MemoryFile.hpp.

Referenced by MemoryFile(), and open().

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

- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlCore/MemoryFile.hpp
- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlCore/MemoryFile.cpp

Visualization Library v2011.09.1162 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu Jan 26 2012 00:44:08.
Permission is granted to use this page to write and publish articles regarding Visualization Library.