The Fib multimedia system
Fib is a system for storing multimedia data (like images or films).
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
fib::cCondition Class Reference

#include <cCondition.h>

Inheritance diagram for fib::cCondition:
Collaboration diagram for fib::cCondition:

List of all members.

Public Member Functions

virtual ~cCondition ()
virtual bool isValid () const =0
virtual bool isUsedVariable (const cFibVariable *variable) const =0
virtual set< cFibVariable * > getUsedVariables ()=0
virtual bool replaceVariable (cFibVariable *variableOld, cFibVariable *variableNew)=0
virtual bool getValue () const =0
virtual unsignedIntFib getNumberOfConditions () const =0
virtual unsignedIntFib getNumberOfUnderFunctions () const =0
cFibElementgetDefiningFibElement () const
cConditiongetSuperiorCondition () const
virtual void setDefiningFibElement (cFibElement *fibElement=NULL, bool bCheckDomains=true)
virtual unsignedLongFib getTimeNeed (unsignedLongFib lMaxTime=0) const =0
virtual unsignedLongFib getCompressedSize () const =0
virtual bool storeXml (ostream &stream) const =0
virtual bool store (ostream &stream, char &cRestBits, unsigned char &uiRestBitPosition) const =0
virtual unsignedIntFib getType () const =0
virtual string getConditionName () const =0
virtual bool equal (const cCondition &condition) const =0
virtual bool operator== (const cCondition &condition) const
bool operator!= (const cCondition &condition) const
virtual cConditionclone (cCondition *pInSuperiorCondition=NULL, cFibElement *pInDefiningFibElement=NULL) const =0

Static Public Member Functions

static cConditionrestoreXml (const TiXmlElement *pXmlElement, intFib &outStatus, list< cFibVariable * > &liDefinedVariables, cCondition *pInSuperiorCondition=NULL, cFibElement *pInDefiningFibElement=NULL)
static cConditionrestore (cReadBits &iBitStream, intFib &outStatus, list< cFibVariable * > &liDefinedVariables, const cDomainSingle *pInValueDomain, const cDomainSingle *pInDomainVariable, cCondition *pInSuperiorCondition=NULL, cFibElement *pInDefiningFibElement=NULL)

Static Public Attributes

static const unsignedIntFib CONDITION_FALSE = 0
static const unsignedIntFib CONDITION_TRUE = 1
static const unsignedIntFib CONDITION_NOT = 10
static const unsignedIntFib CONDITION_OR = 20
static const unsignedIntFib CONDITION_AND = 21
static const unsignedIntFib CONDITION_XOR = 23
static const unsignedIntFib CONDITION_EQUAL_INTEGER = 25
static const unsignedIntFib CONDITION_LOWER = 26
static const unsignedIntFib CONDITION_GREATER = 27

Protected Member Functions

 cCondition (cCondition *pInSuperiorCondition=NULL, cFibElement *pInDefiningFibElement=NULL)
 cCondition (const cCondition &condition, cCondition *pInSuperiorCondition=NULL, cFibElement *pInDefiningFibElement=NULL)

Protected Attributes

cConditionpSuperiorCondition
cFibElementpDefiningFibElement

Friends

class cIf
class cFunctionIf
class cConditionNot
class cConditionTwoValue

Detailed Description

Definition at line 69 of file cCondition.h.


Constructor & Destructor Documentation

fib::cCondition::cCondition ( cCondition pInSuperiorCondition = NULL,
cFibElement pInDefiningFibElement = NULL 
)
protected

The constructor of the condition.

Parameters:
pInSuperiorConditionthe condition which contains
pInDefiningFibElementthe Fib-element which defines/ uses the new condition
fib::cCondition::cCondition ( const cCondition condition,
cCondition pInSuperiorCondition = NULL,
cFibElement pInDefiningFibElement = NULL 
)
protected

The copy constructor of the condition.

Parameters:
conditionthe condition which to copy
pSuperiorConditionthe condition which contains
pInDefiningFibElementthe Fib-element which defines/ uses
virtual fib::cCondition::~cCondition ( )
virtual

The destructor of the condition.


Member Function Documentation

virtual cCondition* fib::cCondition::clone ( cCondition pInSuperiorCondition = NULL,
cFibElement pInDefiningFibElement = NULL 
) const
pure virtual

This method duplicates this whole condition. subcondition of this condition are also cloned.

Parameters:
pSuperiorConditionthe condition which contains the cloned condition
pInDefiningFibElementthe Fib-element which defines/ uses the cloned condition
Returns:
the cloned/ duplicated condition

Implemented in fib::cConditionNot, fib::cConditionFalse, fib::cConditionTrue, fib::cConditionEqualInteger, fib::cConditionLower, fib::cConditionGreater, fib::cConditionAnd, fib::cConditionOr, and fib::cConditionXor.

virtual bool fib::cCondition::equal ( const cCondition condition) const
pure virtual

This method checks if the given condition is equal to this condition.

Parameters:
conditionthe condition to compare with this condition
Returns:
true if the given condition is equal to this condition, else false

Implemented in fib::cConditionNot, fib::cConditionComparison, fib::cConditionTwoValue, fib::cConditionFalse, and fib::cConditionTrue.

virtual unsignedLongFib fib::cCondition::getCompressedSize ( ) const
pure virtual

This method evaluades the size of the Fib-object in bits in the compressed file form. The optionalpart field of point -elements will be ignored.

See also:
store()
Returns:
the size of the Fib-object in bits in the compressed form

Implemented in fib::cConditionComparison, fib::cConditionTwoValue, fib::cConditionNot, fib::cConditionFalse, and fib::cConditionTrue.

virtual string fib::cCondition::getConditionName ( ) const
pure virtual
cFibElement* fib::cCondition::getDefiningFibElement ( ) const
Returns:
the Fib-element which defines/ uses this condition or a Nullpointer NULL if non such Fib-element exists
virtual unsignedIntFib fib::cCondition::getNumberOfConditions ( ) const
pure virtual
Returns:
the number of sub-condition, a condition of this type has

Implemented in fib::cConditionComparison, fib::cConditionTwoValue, fib::cConditionNot, fib::cConditionFalse, and fib::cConditionTrue.

virtual unsignedIntFib fib::cCondition::getNumberOfUnderFunctions ( ) const
pure virtual
Returns:
the number of underfunctions, a condition of this type has

Implemented in fib::cConditionComparison, fib::cConditionTwoValue, fib::cConditionNot, fib::cConditionFalse, and fib::cConditionTrue.

cCondition* fib::cCondition::getSuperiorCondition ( ) const
Returns:
the superior condition to this or NULL, if non such exists (the superior condition is the condition, which contains this condition)
virtual unsignedLongFib fib::cCondition::getTimeNeed ( unsignedLongFib  lMaxTime = 0) const
pure virtual

This method evaluades a value for the time needed to evalue the condition. This value should not exceed lMaxTime, if the value for the time is greater than lMaxTime the evaluation will be stopt and lMaxTime returned. If lMaxTime is 0 (for infinity) the evaluation won't be stoped, this is the standard case.

See also:
cFibElement::evalueObject()
Parameters:
lMaxTimethe maximum time for the evaluation, the returned exceed this value; the value 0 stands for infinity, so the evaluation won't be stoped
Returns:
a value for the time needed to evalue this condition

Implemented in fib::cConditionComparison, fib::cConditionTwoValue, fib::cConditionNot, fib::cConditionFalse, and fib::cConditionTrue.

virtual unsignedIntFib fib::cCondition::getType ( ) const
pure virtual
virtual set<cFibVariable*> fib::cCondition::getUsedVariables ( )
pure virtual

This method returns all variables used in this condition.

See also:
cFibVariable
Returns:
all variables used in this condition

Implemented in fib::cConditionComparison, fib::cConditionTwoValue, fib::cConditionNot, fib::cConditionFalse, and fib::cConditionTrue.

virtual bool fib::cCondition::getValue ( ) const
pure virtual

Returns the value of the condition (if it is true or false).

Returns:
the value of the condition

Implemented in fib::cConditionNot, fib::cConditionFalse, fib::cConditionTrue, fib::cConditionEqualInteger, fib::cConditionLower, fib::cConditionGreater, fib::cConditionAnd, fib::cConditionOr, and fib::cConditionXor.

virtual bool fib::cCondition::isUsedVariable ( const cFibVariable variable) const
pure virtual

This method checks if the given variable is used in this condition.

See also:
cFibVariable
Parameters:
variablethe variable to check if it is used
Returns:
true if the variable is used, else false

Implemented in fib::cConditionComparison, fib::cConditionTwoValue, fib::cConditionNot, fib::cConditionFalse, and fib::cConditionTrue.

virtual bool fib::cCondition::isValid ( ) const
pure virtual

This method returns if this condition is valid, else false. All subcondition and underfunctions must be valid. No condition should contain itself or should be contained in one of its condition (no cycles allowed).

Returns:
true if this condition is valid, else false

Implemented in fib::cConditionComparison, fib::cConditionTwoValue, fib::cConditionNot, fib::cConditionFalse, and fib::cConditionTrue.

bool fib::cCondition::operator!= ( const cCondition condition) const

This method checks if the given condition is not equal to this condition.

Parameters:
conditionthe condition to compare with this condition
Returns:
true if the given condition is not equal to this condition, else false
virtual bool fib::cCondition::operator== ( const cCondition condition) const
virtual

This method checks if the given condition is equal to this condition.

Parameters:
conditionthe condition to compare with this condition
Returns:
true if the given condition is equal to this condition, else false
virtual bool fib::cCondition::replaceVariable ( cFibVariable variableOld,
cFibVariable variableNew 
)
pure virtual

This method replace the variable variableOld with the variable variableNew in the condition.

See also:
cFibVariable
isVariable()
isUsedVariable()
Parameters:
variableOldthe variable to replace
variableNewthe variable with which the variable variableOld is to replace
Returns:
true if the variable variableOld is replaced with variableNew, else false

Implemented in fib::cConditionComparison, fib::cConditionTwoValue, fib::cConditionNot, fib::cConditionFalse, and fib::cConditionTrue.

static cCondition* fib::cCondition::restore ( cReadBits iBitStream,
intFib outStatus,
list< cFibVariable * > &  liDefinedVariables,
const cDomainSingle pInValueDomain,
const cDomainSingle pInDomainVariable,
cCondition pInSuperiorCondition = NULL,
cFibElement pInDefiningFibElement = NULL 
)
static

This method restores a condition from a bitstream, wher it is stored in the compressed Fib-format.

See also:
store
Parameters:
iBitStreamthe stream where the condition is stored in, because the stream is an cReadBits, any number of bits can be readed from it
outStatusan integervalue with the errorvalue possible errorvalues are:
  • 0 loading successful
  • -1 loading error, invalid pXmlElement
  • -2 loading error, invalid data in pXmlElement
  • 1 loading warning, invalid data in pXmlElement, error could be corrected
  • 2 loading warning, invalid data in pXmlElement, maybe the loaded object is wrong
liDefinedVariablesa list with the defined variables for the to restore Fib-element, every variable should have it's number (the number under which it is stored) as it's value
pInValueDomainthe domain for value condition
pInDomainVariablethe domain for variables
pInSuperiorConditionthe condition which contains the to restore condition
pInDefiningFibElementthe Fib-element which defines/ uses the to restore condition
Returns:
a pointer to the restored condition or NULL
static cCondition* fib::cCondition::restoreXml ( const TiXmlElement *  pXmlElement,
intFib outStatus,
list< cFibVariable * > &  liDefinedVariables,
cCondition pInSuperiorCondition = NULL,
cFibElement pInDefiningFibElement = NULL 
)
static

This method restores a condition in the XML-format from an TinyXml element.

Parameters:
pXmlNodea pointer to the TinyXml node wher the condition is stored in
outStatusan integervalue with the errorvalue possible errorvalues are:
  • 0 loading successful
  • -1 loading error, invalid pXmlElement
  • -2 loading error, invalid data in pXmlElement
  • 1 loading warning, invalid data in pXmlElement, error could be corrected
  • 2 loading warning, invalid data in pXmlElement, maybe the loaded object is wrong
liDefinedVariablesa list with the defined variables for the to restore Fib-element, every variable should have it's number (the number under which it is stored) as it's value
pInSuperiorConditionthe condition which contains the to restore condition
pInDefiningFibElementthe Fib-element which defines/ uses the to restore condition
Returns:
the pointers to the restored condition, if non could be restored the returned pointer is NULL
virtual void fib::cCondition::setDefiningFibElement ( cFibElement fibElement = NULL,
bool  bCheckDomains = true 
)
virtual

Sets the Fib-element which defines/ uses this condition. If the given pointer is the nullpointer (standardvalue), no Fib-element defines this condition.

Parameters:
definingFibElementa pointer to the Fib-element which defines/ uses this condition
bCheckDomainsget the domains of the defining element and check the conditionelements with it

Reimplemented in fib::cConditionComparison, fib::cConditionTwoValue, and fib::cConditionNot.

virtual bool fib::cCondition::store ( ostream &  stream,
char &  cRestBits,
unsigned char &  uiRestBitPosition 
) const
pure virtual

This method stores this Fib-object in the compressed Fib-format into the given stream. It is needed becouse the stream can yust store byts but the size of Fib-elements can be any number of bits. Because of that ther have to be a possibility to exchange the missing bits betwean the Fib-elements.

See also:
store
Parameters:
streamthe stream where this Fib-object should be stored to
cRestBitsthe not yet writen bits which should be stored
uiRestBitPositionthe number of bits in the cRestBits which should be writen respectively containing valid information
Returns:
true if this Fib-object is stored, else false

Implemented in fib::cConditionComparison, fib::cConditionTwoValue, fib::cConditionNot, fib::cConditionFalse, and fib::cConditionTrue.

virtual bool fib::cCondition::storeXml ( ostream &  stream) const
pure virtual

This method stores this condition in the XML -format into the given stream. Variables should have ther number as ther value.

Parameters:
streamthe stream where this conditionhould be stored to
Returns:
true if this condition is stored, else false

Implemented in fib::cConditionComparison, fib::cConditionTwoValue, fib::cConditionNot, fib::cConditionFalse, and fib::cConditionTrue.


Friends And Related Function Documentation

friend class cConditionNot
friend

Definition at line 73 of file cCondition.h.

friend class cConditionTwoValue
friend

Definition at line 74 of file cCondition.h.

friend class cFunctionIf
friend

Definition at line 72 of file cCondition.h.

friend class cIf
friend

Definition at line 71 of file cCondition.h.


Member Data Documentation

const unsignedIntFib fib::cCondition::CONDITION_AND = 21
static

Definition at line 85 of file cCondition.h.

const unsignedIntFib fib::cCondition::CONDITION_EQUAL_INTEGER = 25
static

Definition at line 87 of file cCondition.h.

const unsignedIntFib fib::cCondition::CONDITION_FALSE = 0
static

the definitions for the condition

Definition at line 81 of file cCondition.h.

const unsignedIntFib fib::cCondition::CONDITION_GREATER = 27
static

Definition at line 89 of file cCondition.h.

const unsignedIntFib fib::cCondition::CONDITION_LOWER = 26
static

Definition at line 88 of file cCondition.h.

const unsignedIntFib fib::cCondition::CONDITION_NOT = 10
static

Definition at line 83 of file cCondition.h.

const unsignedIntFib fib::cCondition::CONDITION_OR = 20
static

Definition at line 84 of file cCondition.h.

const unsignedIntFib fib::cCondition::CONDITION_TRUE = 1
static

Definition at line 82 of file cCondition.h.

const unsignedIntFib fib::cCondition::CONDITION_XOR = 23
static

Definition at line 86 of file cCondition.h.

cFibElement* fib::cCondition::pDefiningFibElement
protected

the Fib-element which defines/ uses the condition

Definition at line 101 of file cCondition.h.

cCondition* fib::cCondition::pSuperiorCondition
protected

the Fib-element which defines/ uses the condition

Definition at line 96 of file cCondition.h.


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