54 template<
class NumType>
80 LowerBound(Other.LowerBound),
81 UpperBound(Other.UpperBound)
86 Interval(
const NumType& Lower,
const NumType& Upper) :
100 void SetBounds(
const NumType& Lower,
const NumType& Upper)
102 this->LowerBound = Lower;
103 this->UpperBound = Upper;
110 {
return this->LowerBound <= Num && this->UpperBound >= Num; }
115 {
return this->LowerBound; }
119 {
return this->LowerBound; }
123 {
return this->UpperBound; }
127 {
return this->UpperBound; }
132 {
return this->UpperBound - this->LowerBound; }
162 {
return this->UpperBound < Num; }
167 {
return this->LowerBound < Num; }
173 {
return this->UpperBound <= Num; }
178 {
return this->LowerBound <= Num; }
219 if( !SelfRoot.
Empty() ) {
222 if( !CurrAttrib.
Empty() ) {
224 Converter >> this->UpperBound;
229 if( !CurrAttrib.
Empty() ) {
231 Converter >> this->LowerBound;
243 {
return "Interval"; }
Attribute AppendAttribute(const Char8 *Name)
Creates an Attribute and puts it at the end of this Nodes attributes.
A light-weight handle for manipulating attributes in DOM tree.
Boole operator>=(const NumType &Num) const
Greater-than or equal comparison with NumType.
bool Boole
Generally acts a single bit, true or false.
Boole operator==(const SelfType &Other) const
Equality comparison operator.
static String GetSerializableName()
Get the name of the the XML tag the Interval class will leave behind as its instances are serialized...
void SetBounds(const NumType &Lower, const NumType &Upper)
Sets both values of this Interval.
NumType LowerBound
The lower numeric boundry of the interval.
Boole IsWithinBounds(const NumType &Num) const
Gets whether or not a number is inside the bounds of this Interval.
Thrown when the requested identity could not be found.
#define MEZZ_EXCEPTION(num, desc)
An easy way to throw exceptions with rich information.
NumType & GetLowerBound()
Gets the lower boundry of this Interval.
Thrown when a version is accessed/parsed/required and it cannot work correctly or is missing...
const Char8 * AsString(const Char8 *def="") const
Attempts to convert the value of the attribute to a String and returns the results.
~Interval()
Class destructor.
Interval(const NumType &Lower, const NumType &Upper)
Descriptive constructor.
bool Empty() const
Is this storing anything at all?
This implements the exception hiearchy for Mezzanine.
Boole operator>(const NumType &Num) const
Greater-than comparison with NumType.
std::stringstream StringStream
A Datatype used for streaming operations with strings.
The interface for serialization.
Interval & operator=(const SelfType &Other)
Assignment operator.
bool SetValue(const Char8 *rhs)
Set the value of this.
NumType GetIntervalSize() const
Gets the numeric distance between the lower and upper bounds of this interval.
A light-weight handle for manipulating nodes in DOM tree.
int AsInt(int def=0) const
Attempts to convert the value of the attribute to an int and returns the results. ...
bool Empty() const
Is this storing anything at all?
NumType UpperBound
The upper numeric boundry of the interval.
NumType & GetUpperBound()
Gets the upper boundry of this Interval.
Boole operator<(const SelfType &Other) const
Less-than operator.
This class will generate keep track of a pool of unique 32-bit ID's that can be used for distinct obj...
const NumType & GetLowerBound() const
Gets the lower boundry of this Interval.
Interval()
Blank constructor.
The bulk of the engine components go in this namspace.
void ProtoSerialize(XML::Node &ParentNode) const
Convert this class to an XML::Node ready for serialization.
Boole operator<(const NumType &Num) const
Less-than comparison with NumType.
Boole operator!=(const SelfType &Other) const
Inequality comparison operator.
Interval< NumType > SelfType
Convenience type for the implemented type.
Interval(const SelfType &Other)
Copy constructor.
void ProtoDeSerialize(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite this object with it.
Boole operator<=(const NumType &Num) const
Less-than or equal comparison with NumType.
void SerializeError(const String &FailedTo, const String &ClassName, Boole SOrD)
Simply does some string concatenation, then throws an Exception.
Node AppendChild(NodeType Type=NodeElement)
Creates a Node and makes it a child of this one.
const NumType & GetUpperBound() const
Gets the upper boundry of this Interval.
std::string String
A datatype used to a series of characters.
Boole operator>(const SelfType &Other) const
Greater-than operator.
Attribute GetAttribute(const Char8 *Name) const
Attempt to get an Attribute on this Node with a given name.