
#ifndef __RV_MPM_H_INCLUDED_
#define __RV_MPM_H_INCLUDED_
// The following ifdef block is the standard way of creating macros which make exporting 
// from a DLL simpler. All files within this DLL are compiled with the MPM_EXPORTS
// symbol defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see 
// MPM_API functions as being imported from a DLL, wheras this DLL sees symbols
// defined with this macro as being exported.
//#ifdef MPM_EXPORTS
//#define MPM_API __declspec(dllexport)
//#else
//#define MPM_API __declspec(dllimport)
//#endif



 
#include <rvb\rvtypes.h> 

#define MPM_API  WINAPI


#define  MPM_ROWS           3072 //2560
#define  MPM_COLS           4096  //2728

#define  MAX_MTX_SIZE      ((MPM_ROWS*4)*(MPM_COLS*4))

//#define MPM_DEFAILT_SIZE      (-1)



//#ifdef   WIN64 
    #define RvMemSize    LONGLONG 
    #define RvMemCount   LONGLONG 
//#else
 //   #define RvMemSize    int 
  ///  #define RvMemCount   int
//#endif
 

//memory pool management for RTE
 void* MPM_API rvAlloc(RvMemSize size);
 void  MPM_API rvFree(void* p);



//MPM_API BOOL MPM_Grow(UINT nUnitCount, UINT nUnitSize);



//Memory store class
 RvMemoryStore MPM_API rvCreateMemoryStore( RvMemSize nUnitSize, RvMemCount nUnitCount = 64);
 void    MPM_API       rvDestroyMemoryStore(RvMemoryStore store);

 void*      MPM_API   rvMemoryStoreAlloc(RvMemoryStore store/*, RvMemSize nSize=MPM_DEFAILT_SIZE*/);
 void      MPM_API    rvMemoryStoreFree(RvMemoryStore store, void* p);

 void      MPM_API    rvSetMemoryRecyclable(BOOL  flag);
 BOOL      MPM_API    rvIsMemoryRecyclable();


 
 

#define MPM_ALLOC(size)       rvAlloc(size)
#define MPM_FREE(pMem)        rvFree( pMem );  pMem =NULL

#define MPM_ALLOC_OBJ(obj)    ((obj*)rvAlloc(sizeof(obj)))
  

 #define rmsAlloc(store)        rvMemoryStoreAlloc(store)
 #define rmsFree(store, p)      rvMemoryStoreFree(store, p); p=NULL;

  






#endif //END OF __RV_MPM_H_INCLUDED_
