/** SGX

The   sss    gggg x   x   
     s      g      x x    Engine
      sss   g  gg   x
         s  g   g  x x          Copyright 1995-2008.
     ssss    gggg x   x         Steven Goodwin. All Rights Reserved.
    
This version has been released under the GNU Public License v2.0.

Please see the license files for details.

File: include/sgx/filesystem/ramfile/ramfile.hpp

*/

#ifndef SGX_FILESYSTEM_RAMFILE_HPP
#define SGX_FILESYSTEM_RAMFILE_HPP


class CSGXDeviceMemory : public CSGXDevice    // controlling manager
{
public:
    tBYTE   *m_Ptr;
    tUINT32 m_Size;

    CSGXDeviceMemory(tBYTE *ptr, tUINT32 size);
    virtual ~CSGXDeviceMemory() {}
    virtual tBOOL mountDirectory(CSGXFileEntry *pEntry, const sgxString &rootmount, tBOOL recursive);

    virtual CSGXDeviceBlockState *open(CSGXDeviceBlock *pBlk, const sgxString &access);
    virtual tBOOL close(CSGXDeviceBlockState *pBlk);

	virtual void getRoot(sgxString &rootPath);

};

class CSGXDeviceBlockStateMemory : public CSGXDeviceBlockState
{
public:
    CSGXDeviceMemory *m_pMemDevice;
    tMEM_SIZE         m_CurrOffset;

    virtual ~CSGXDeviceBlockStateMemory() {}

    virtual tMEM_SIZE   read(tBYTE *pDest, tMEM_SIZE size);
    virtual tMEM_SIZE	write(tBYTE *pDest, tMEM_SIZE size);
    virtual tBOOL		seek(tINT32 offset, CSGXDeviceBlockState::tSeekFrom from);
    virtual tDISC_SIZE	getSeekPos() const;

};


#endif // SGX_RAMFILE_H
