PikeAero::CMap Class Reference

#include <cmap.h>

Inheritance diagram for PikeAero::CMap:

Inheritance graph
[legend]
Collaboration diagram for PikeAero::CMap:

Collaboration graph
[legend]

Data Structures

union  tMap
 Map union. More...
struct  tMap1D
struct  tMap1DScaled
struct  tMap2D
struct  tMap2DScaled

Public Types


Public Member Functions

virtual CMachine::ubit32 calculateCRC ()
 Calculate a CRC record for the map.
 CMap (CConfiguration *config, tMap *map)
CConfigurationconfig ()
bool load ()
 Load the record into volatile memory.
bool loaded ()
tMapmap ()
tMapromMap ()
void unload ()
 Unload the record from volatile memory.
virtual bool valid ()
 record is valid?
bool validType (tMapType type)
virtual ~CMap ()

Private Attributes

CConfigurationmConfig
bool mLoaded
tMapmMap
tMapmRomMap

Detailed Description

Definition at line 37 of file cmap.h.


Member Enumeration Documentation

Enumerated data type for describing the type of dat contained in a map.

Enumerator:
invalid 
typeReal  Unknown
typeBit8  Real Number
typeUBit8  8 bit signed
typeBit16  8 bit unsigned
typeUBit16  16 bit signed
typeBit32  16 bit unsigned
typeUBit32  32 bit signed 32 bit unsigned

Definition at line 45 of file cmap.h.

00046         {
00047             invalid         =   0,      /** Unknown */
00048             typeReal        =   1,      /** Real Number */
00049             typeBit8,                   /** 8 bit signed */
00050             typeUBit8,                  /** 8 bit unsigned */
00051             typeBit16,                  /** 16 bit signed */
00052             typeUBit16,                 /** 16 bit unsigned */
00053             typeBit32,                  /** 32 bit signed */
00054             typeUBit32                  /** 32 bit unsigned */
00055         } tDataType;

describes the type of map.

Enumerator:
unknown 
map1D  Unknown
map1DScaled  1D Map
map2D  1D Map Scaled
map2DScaled  2D Map

Definition at line 60 of file cmap.h.

00061         {
00062             unknown         =   0,      /** Unknown */
00063             map1D           =   1,      /** 1D Map */
00064             map1DScaled,                /** 1D Map Scaled */
00065             map2D,                      /** 2D Map */
00066             map2DScaled,                /** 2D Map Scaled */
00067         } tMapType;


Constructor & Destructor Documentation

PikeAero::CMap::CMap ( CConfiguration config,
tMap map 
)

Definition at line 27 of file cmap.cpp.

00028 : inherited()
00029 , mConfig(config)
00030 , mRomMap(map)
00031 , mMap(NULL)
00032 , mLoaded(false)
00033 {
00034 
00035 }

PikeAero::CMap::~CMap (  )  [virtual]

Definition at line 37 of file cmap.cpp.

References unload().

00038 {
00039     unload();
00040 }

Here is the call graph for this function:


Member Function Documentation

CMachine::ubit32 PikeAero::CMap::calculateCRC (  )  [virtual]

Calculate a CRC record for the map.

FIXME - do stuff

Definition at line 102 of file cmap.cpp.

Referenced by valid().

00103 {
00104     /** FIXME - do stuff */
00105     return 0;
00106 }

Here is the caller graph for this function:

CConfiguration* PikeAero::CMap::config (  )  [inline]

Definition at line 118 of file cmap.h.

References mConfig.

00118 { return mConfig; }

bool PikeAero::CMap::load (  ) 

Load the record into volatile memory.

Returns:
true on success else false.

FIXME - do stuff here

Definition at line 46 of file cmap.cpp.

References PikeAero::CMemHeap::malloc(), memset, mLoaded, mMap, unload(), and valid().

00047 {
00048     unload();
00049     mMap = (tMap*)CMemHeap::malloc(sizeof(tMap));
00050     memset(mMap,0,sizeof(tMap));
00051     if ( valid() )
00052     {
00053         /** FIXME - do stuff here */
00054         mLoaded = true;
00055     }
00056     else
00057     {
00058         mLoaded = true;
00059     }
00060     return mLoaded;
00061 }

Here is the call graph for this function:

bool PikeAero::CMap::loaded (  )  [inline]

Definition at line 117 of file cmap.h.

References mLoaded.

Referenced by map().

00117 { return mLoaded; }

Here is the caller graph for this function:

tMap* PikeAero::CMap::map (  )  [inline]

Definition at line 120 of file cmap.h.

References loaded(), mMap, and romMap().

Referenced by valid().

00120 { return loaded() ? mMap : romMap(); }

Here is the call graph for this function:

Here is the caller graph for this function:

tMap* PikeAero::CMap::romMap (  )  [inline]

Definition at line 119 of file cmap.h.

References mRomMap.

Referenced by map().

00119 { return mRomMap; }

Here is the caller graph for this function:

void PikeAero::CMap::unload (  ) 

Unload the record from volatile memory.

Definition at line 67 of file cmap.cpp.

References PikeAero::CMemHeap::free(), mLoaded, and mMap.

Referenced by load(), and ~CMap().

00068 {
00069     if ( mMap != NULL )
00070     {
00071         CMemHeap::free( mMap );
00072         mMap = NULL;
00073     }
00074     mLoaded = false;
00075 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool PikeAero::CMap::valid (  )  [virtual]

record is valid?

Reimplemented in PikeAero::CMap1D.

Definition at line 80 of file cmap.cpp.

References calculateCRC(), map(), MAP_HEAD, MAP_TAIL, and validType().

Referenced by load().

00081 {
00082     bool rc = false;
00083     if ( map()->head == MAP_HEAD )
00084     {
00085         if ( map()->tail == MAP_TAIL )
00086         {
00087             if ( validType( (CMap::tMapType)map()->type ) )
00088             {
00089                 if ( map()->crc == calculateCRC() )
00090                 {
00091                     rc = true;
00092                 }
00093             }
00094         }
00095     }
00096     return rc;
00097 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool PikeAero::CMap::validType ( tMapType  type  )  [inline]

Definition at line 121 of file cmap.h.

References map2DScaled, and unknown.

Referenced by valid().

00121 { return type > unknown && type <= map2DScaled; }

Here is the caller graph for this function:


Field Documentation

Reimplemented in PikeAero::CMap1D.

Definition at line 146 of file cmap.h.

Referenced by config().

bool PikeAero::CMap::mLoaded [private]

the in-RAM map pointer

Definition at line 149 of file cmap.h.

Referenced by load(), loaded(), and unload().

the in-ROM map pointer

Reimplemented in PikeAero::CMap1D.

Definition at line 148 of file cmap.h.

Referenced by load(), map(), and unload().

the configuration record

Reimplemented in PikeAero::CMap1D.

Definition at line 147 of file cmap.h.

Referenced by romMap().


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

Generated on Sun Oct 25 14:00:07 2009 for stingray3 by  doxygen 1.5.8