Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields  

clawsoft::Memory Class Reference

#include <Memory.h>

Inheritance diagram for clawsoft::Memory:

Inheritance graph
[legend]
Collaboration diagram for clawsoft::Memory:

Collaboration graph
[legend]

Detailed Description

This class deals with memory management and temporary allocated buffer.

Temporary allocated buffer are like normal in-memory buffer structures, but as the name says they are temporary, after a specified ammount of time this buffers will be deleted from from memory so please be carefull while using them, they can help a lot but if you dont take the necesary safety measures they can hurt you a lot.

STATUS: READY TO TEST


Public Methods

 Memory ()
 Calling this will initialize some vital internal variables and cleanup processes.

void * temporaryAlloc (Uint32 size, Uint32 timeout=60)
 This will allocate a temporary memory buffer if size bytes with an expiration period of timeout seconds.

const char * getClassName ()
 Returns the name of the current class.


Static Public Methods

void * allocBuffer (Uint32 size)
 Using this will allocate size bytes in memory.

void freeBuffer (void **buf)
 Using this will deallocate the memory used by the buffer buf, call this method to deallocate memory allocated by allocBuffer.

void clearBuffer (void *buf, Uint32 siz, Uint8 value=0)
 Use this method to clear or set every byte in a buffer to a specific value.

void * duplicate (const void *buf, Uint32 siz)
 This allocate a buffer of size siz and will copy everything in buf to make an exact copy on the newly created buffer.

void copy (void *destination, const void *source, Uint32 siz)
 This will copy the contents of source and will put them into destination.

int installedCPUs ()
 This will return how many CPUs are installed in the system.

double cpuSpeed ()
 This will return the CPU speed in megahertz.

int totalMemory ()
 Will return the total amount of system memory.

int freeMemory ()
 Will return the total amount of free system memory.

void usleep (Uint32 usec)
 Will freeze the software for usec microseconds.


Protected Methods

void setClassName (const char *n)
 Call this method when you need to set the name of the class you're creating, typically in it's constructor, remember that you must set the classname for every class you create, that way you can have more information while debugging.


Constructor & Destructor Documentation

clawsoft::Memory::Memory  
 

Calling this will initialize some vital internal variables and cleanup processes.


Member Function Documentation

void * clawsoft::Memory::allocBuffer Uint32    size [static]
 

Using this will allocate size bytes in memory.

void clawsoft::Memory::clearBuffer void *    buf,
Uint32    siz,
Uint8    value = 0
[static]
 

Use this method to clear or set every byte in a buffer to a specific value.

void clawsoft::Memory::copy void *    destination,
const void *    source,
Uint32    siz
[static]
 

This will copy the contents of source and will put them into destination.

double clawsoft::System::cpuSpeed   [static, inherited]
 

This will return the CPU speed in megahertz.

void * clawsoft::Memory::duplicate const void *    buf,
Uint32    siz
[static]
 

This allocate a buffer of size siz and will copy everything in buf to make an exact copy on the newly created buffer.

void clawsoft::Memory::freeBuffer void **    buf [static]
 

Using this will deallocate the memory used by the buffer buf, call this method to deallocate memory allocated by allocBuffer.

int clawsoft::System::freeMemory   [static, inherited]
 

Will return the total amount of free system memory.

const char * clawsoft::Object::getClassName   [inherited]
 

Returns the name of the current class.

int clawsoft::System::installedCPUs   [static, inherited]
 

This will return how many CPUs are installed in the system.

void clawsoft::Object::setClassName const char *    n [protected, inherited]
 

Call this method when you need to set the name of the class you're creating, typically in it's constructor, remember that you must set the classname for every class you create, that way you can have more information while debugging.

void * clawsoft::Memory::temporaryAlloc Uint32    size,
Uint32    timeout = 60
 

This will allocate a temporary memory buffer if size bytes with an expiration period of timeout seconds.

int clawsoft::System::totalMemory   [static, inherited]
 

Will return the total amount of system memory.

void clawsoft::System::usleep Uint32    usec [static, inherited]
 

Will freeze the software for usec microseconds.


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

Authors:

Juan V. Guerrero
Jannette C. Mejia
Juan C. Guevara

Powered by:

SourceForgeLogo