nrEngine::CPriority Class Reference

Priorities class definition. More...


Public Types

enum  _PriorityType {
  IMMEDIATE = 0,
  FIRST = 1,
  ULTRA_HIGH = 10000,
  VERY_HIGH = 20000,
  HIGH = 30000,
  NORMAL = 40000,
  LOW = 50000,
  VERY_LOW = 60000,
  ULTRA_LOW = 70000,
  LAST = 0x8FFFFFFE
}
typedef enum nrEngine::CPriority::_PriorityType PriorityType

Public Member Functions

 CPriority ()
 Normal constructor.
 ~CPriority ()
 non-virtual destructor to prevent deriving of classes
 CPriority (const CPriority &p)
 Copy constructor for priorities.
 CPriority (const int32 &n)
 Create priority object from a number.
 CPriority (const std::string &str)
 operator int32 () const
 Get the priority as an integer number, Number will be saturated.
 operator uint32 () const
 Get the priority number.
CPriorityoperator+= (const CPriority &p)
 add new value to the priority number
CPriorityoperator+= (const uint32 &p)
CPriorityoperator+= (const int32 &p)
 Add an integer value can produce negative values.
CPriorityoperator-= (const CPriority &p)
 Substract a value from the priority by appropriate conversion between these types.
CPriorityoperator-= (const int32 &p)
CPriorityoperator-= (const uint32 &p)
bool operator< (const CPriority &p) const
 Check the priority eqiuvalence and order to other values.
bool operator> (const CPriority &p) const
bool operator== (const CPriority &p) const
bool operator!= (const CPriority &p) const
bool operator<= (const CPriority &p) const
bool operator>= (const CPriority &p) const
bool operator< (const int32 &p) const
 Check the priority eqiuvalence and order to other integer values.
bool operator> (const int32 &p) const
bool operator== (const int32 &p) const
bool operator!= (const int32 &p) const
bool operator<= (const int32 &p) const
bool operator>= (const int32 &p) const
bool operator< (PriorityType p) const
 Check to PriorityType.
bool operator> (PriorityType p) const
bool operator== (PriorityType p) const
bool operator!= (PriorityType p) const
bool operator<= (PriorityType p) const
bool operator>= (PriorityType p) const
 operator std::string ()
 Convert to a string.


Detailed Description

Priorities class definition.

Priorities definition. Priorities are used very often to determine for example which object should be removed first or which one has to get access to some resources.

In our engine we understand under priority numbers some numbers that handles like integers. You have two operations defined on the priorities: addidition and substraction. You can add integers to priority numbers to increase or decrease the meaning of such a priority.

The class which use such priorities should know how to handle with them. That means it has to know if the priority numbers are in increasing or decreasing order. Increasing order means that the element with the lowest priority is coming at last and with the highest as first. So to say colloquially, lower priority is better than higher. There can also be another way: decreasing order. Which is converse to increasing order.

All default priority numbers are stored in decreasing order. That means the best priority is the priority with the smallest number. So you are welcome to use this definition or just write you classes according to increasing definition.

You can also create priority numbers from strings. The given string will first be scanned for known names like "PRIORITY_FIRST" or "NR_PRIORITY_FIRST" and so on. If such known string was found, so the value according to such a string will be assigned. If no such name found, so standard boost's lexical cast will be used to cast for the value. So this can also fail if the given string could not been casted. (e.g. "5bla" -> not castable)

Definition at line 54 of file Priority.h.


Member Typedef Documentation

typedef enum nrEngine::CPriority::_PriorityType nrEngine::CPriority::PriorityType

Couple of pririoty default definitions. Can be used to specify a priority of any elements with CPriority-Class


Member Enumeration Documentation

enum nrEngine::CPriority::_PriorityType

Couple of pririoty default definitions. Can be used to specify a priority of any elements with CPriority-Class

Enumerator:
IMMEDIATE  This number represents an immediate priority (better than first).
FIRST  Smallest possible priority number.
ULTRA_HIGH  Ultry high priority.
VERY_HIGH  Next smaller priority to the ultra high value.
HIGH  High priority.
NORMAL  Default priority for all definitions (Center point).
LOW  Lower priority according to the normal.
VERY_LOW  Very low priority in relation to normal value.
ULTRA_LOW  Ultra low priority by comparison to the normal value.
LAST  Greatest possible priority number.

Definition at line 61 of file Priority.h.


Constructor & Destructor Documentation

nrEngine::CPriority::CPriority ( const std::string &  str  ) 

Create the priority from a string. String can contain either a number or a character array with priority names e.g. "PRIORITY_LAST"

Definition at line 113 of file Priority.h.


The documentation for this class was generated from the following file:
Generated on Wed Sep 12 23:19:43 2007 for nrEngine by  doxygen 1.5.1