libFAUDES

Sections

Index

faudes::AttributeFlags Class Reference

#include <attributes.h>

Inherits faudes::AttributeVoid.

Inherited by faudes::AttributeCFlags, faudes::AttributeColoredState, faudes::AttributeDiagnoserState, faudes::AttributeFailureEvents, faudes::AttributeFailureTypeMap, faudes::AttributeTimedState, faudes::AttributeTimedTrans, faudes::DiagLabelSet, faudes::HioEventFlags, and faudes::HioStateFlags.

List of all members.


Detailed Description

Boolean flags Attribute.

This attribute class uses a flag word to represent boolean values. The current implementation uses a long int type and hence handles up to 32 flags. Each flag is accessed by the according bit mask.

The current version of libFAUDES uses bits 0,1,2 of event attributes for controllability properties (see AttributeCFlags) and the bits 31 and 32 of state attributes for the Qt based GUI project. Further versions may use the lower 8 bits of the event aflags and the higher 8 bits of state flags. You are free to use any flags for your application, but if possible try to avoid the above mentioned. For extensive use of flags, you may also consider to define a separate attribute class, perhaps with a different fType.

Definition at line 181 of file attributes.h.


Public Member Functions

virtual AttributeFlagsNew (void) const
 Construct on heap.
virtual AttributeFlagsCopy (void) const
 Construct on heap.
virtual const AttributeFlagsCast (const Type *pOther) const
 Cast other object to this type.
virtual AttributeFlagsAssign (const Type &rSrc)
 Assign configuration data from other object.
virtual bool Equal (const Type &rOther) const
 Test equality of configuration data.
virtual AttributeFlagsoperator= (const AttributeFlags &rSrc)
virtual bool operator== (const AttributeFlags &rOther) const
virtual bool operator!= (const AttributeFlags &rOther) const
 AttributeFlags (void)
 Default constructor.
 AttributeFlags (const AttributeFlags &rOther)
 Copy constructor.
virtual ~AttributeFlags (void)
 Destructor.
bool Test (fType mask) const
 Test a flag.
bool TestAll (fType mask) const
 Test multible flags, combine by "and".
bool TestSome (fType mask) const
 Test multible flags, combine by "or".
bool TestNone (fType mask) const
 Test multible flags, combine by "not or".
void Set (fType mask)
 Set multiple flags.
void Clr (fType mask)
 Clear multiple flags.
virtual bool IsDefault (void) const
 Test for default value.

Public Attributes

fType mFlags
 Flags (public access for convenience).

Static Public Attributes

static const fType mDefFlags = 0x0

Protected Member Functions

AttributeFlagsDoAssign (const AttributeFlags &rSrcAttr)
 Assignment method.
virtual bool DoEqual (const AttributeFlags &rOther) const
 Test equality of configuration data.
virtual void DoRead (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0)
 Reads attribute from TokenReader, see Type for public wrappers.
virtual void DoWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Write to TokenWriter, see Type for public wrappers.

Constructor & Destructor Documentation

faudes::AttributeFlags::AttributeFlags ( void   )  [inline]

Default constructor.

Definition at line 188 of file attributes.h.

faudes::AttributeFlags::AttributeFlags ( const AttributeFlags rOther  )  [inline]

Copy constructor.

Definition at line 191 of file attributes.h.

virtual faudes::AttributeFlags::~AttributeFlags ( void   )  [inline, virtual]

Destructor.

Definition at line 194 of file attributes.h.


Member Function Documentation

AttributeFlags * faudes::AttributeFlags::New ( void   )  const [virtual]

Construct on heap.

Technically not a constructor, this function creates an object with the same type Type. New() is defined as a virtual function and derived classes are meant to re-implement with the appropiate constructor. This can be done via the provided macros FAUDES_TYPE_DECLARATION and FAUDES_TYPE_IMPLEMENTATION. As with new, it is the callers reponsabilty to delete the object when no longer needed.

Returns:
Pointer to new Type object

Reimplemented from faudes::AttributeVoid.

Reimplemented in faudes::AttributeCFlags, faudes::AttributeDiagnoserState, faudes::AttributeFailureEvents, faudes::AttributeFailureTypeMap, faudes::DiagLabelSet, faudes::HioEventFlags, faudes::HioStateFlags, faudes::AttributeColoredState, faudes::AttributeTimedTrans, faudes::AttributeTimedState, and faudes::SimEventAttribute.

Definition at line 96 of file attributes.cpp.

AttributeFlags * faudes::AttributeFlags::Copy ( void   )  const [virtual]

Construct on heap.

Technically not a constructor, this function creates an object with the same type Type and the same configuration. Copy() is defined as a virtual function and derived classes are meant to re-implement with the appropiate copy constructor. This can be done via the provided macros FAUDES_TYPE_DECLARATION and FAUDES_TYPE_IMPLEMENTATION. As with new, it is the callers reponsabilty to delete the object when no longer needed.

Returns:
Pointer to new Type object

Reimplemented from faudes::AttributeVoid.

Reimplemented in faudes::AttributeCFlags, faudes::AttributeDiagnoserState, faudes::AttributeFailureEvents, faudes::AttributeFailureTypeMap, faudes::DiagLabelSet, faudes::HioEventFlags, faudes::HioStateFlags, faudes::AttributeColoredState, faudes::AttributeTimedTrans, faudes::AttributeTimedState, and faudes::SimEventAttribute.

Definition at line 96 of file attributes.cpp.

const AttributeFlags * faudes::AttributeFlags::Cast ( const Type pOther  )  const [virtual]

Cast other object to this type.

Enables the run-time interface to test whether pObject is derived from this object. This feature is used e.g. in the faudes container classes to test attributes. Derived classes must reimplement this function using the appropriate dynamic cast.

Re-implementation can be done via the convenience macros FAUDES_TYPE_DECLARATION and FAUDES_TYPE_IMPLEMENTATION.

Returns:
Typed pointer object

Reimplemented from faudes::AttributeVoid.

Reimplemented in faudes::AttributeCFlags, faudes::AttributeDiagnoserState, faudes::AttributeFailureEvents, faudes::AttributeFailureTypeMap, faudes::DiagLabelSet, faudes::HioEventFlags, faudes::HioStateFlags, faudes::AttributeColoredState, faudes::AttributeTimedTrans, faudes::AttributeTimedState, and faudes::SimEventAttribute.

Definition at line 96 of file attributes.cpp.

AttributeFlags & faudes::AttributeFlags::Assign ( const Type rSrc  )  [virtual]

Assign configuration data from other object.

Derived classes should reimplement this method to first try to cast the source to the respective class. If successful, the protected function DoAssign is invoked to perform the actual assignment. If the cast fails, the Assign method of the parent class is called. Thus, faudes objects are up- and downcatsted for assignment, maintaining as much of the source data as digestable by the destination object. On the downside, there is no sensible typechecking at compile-time.

Re-implementation can be done via the convenience macros FAUDES_TYPE_DECLARATION and FAUDES_TYPE_IMPLEMENTATION.

Parameters:
rSrc Source to copy from
Returns:
Reference to this object.

Reimplemented from faudes::AttributeVoid.

Reimplemented in faudes::AttributeCFlags, faudes::AttributeDiagnoserState, faudes::AttributeFailureEvents, faudes::AttributeFailureTypeMap, faudes::DiagLabelSet, faudes::HioEventFlags, faudes::HioStateFlags, faudes::AttributeColoredState, faudes::AttributeTimedTrans, faudes::AttributeTimedState, and faudes::SimEventAttribute.

Definition at line 96 of file attributes.cpp.

bool faudes::AttributeFlags::Equal ( const Type rOther  )  const [virtual]

Test equality of configuration data.

Derived classes should reimplement this method to return true if both actual types and configuration data match. The object name is not consired in the test.

This method calls the virtual method DoEqual(). Re-implementation can be done via the convenience macros FAUDES_TYPE_DECLARATION and FAUDES_TYPE_IMPLEMENTATION.

Parameters:
rOther Other objevt to compare with.
Returns:
True on match.

Reimplemented from faudes::AttributeVoid.

Reimplemented in faudes::AttributeCFlags, faudes::AttributeDiagnoserState, faudes::AttributeFailureEvents, faudes::AttributeFailureTypeMap, faudes::DiagLabelSet, faudes::HioEventFlags, faudes::HioStateFlags, faudes::AttributeColoredState, faudes::AttributeTimedTrans, faudes::AttributeTimedState, and faudes::SimEventAttribute.

Definition at line 96 of file attributes.cpp.

AttributeFlags & faudes::AttributeFlags::operator= ( const AttributeFlags rSrc  )  [virtual]

Definition at line 96 of file attributes.cpp.

bool faudes::AttributeFlags::operator== ( const AttributeFlags rOther  )  const [virtual]

Definition at line 96 of file attributes.cpp.

bool faudes::AttributeFlags::operator!= ( const AttributeFlags rOther  )  const [virtual]

Definition at line 96 of file attributes.cpp.

bool faudes::AttributeFlags::Test ( fType  mask  )  const [inline]

Test a flag.

Definition at line 199 of file attributes.h.

bool faudes::AttributeFlags::TestAll ( fType  mask  )  const [inline]

Test multible flags, combine by "and".

Definition at line 204 of file attributes.h.

bool faudes::AttributeFlags::TestSome ( fType  mask  )  const [inline]

Test multible flags, combine by "or".

Definition at line 209 of file attributes.h.

bool faudes::AttributeFlags::TestNone ( fType  mask  )  const [inline]

Test multible flags, combine by "not or".

Definition at line 214 of file attributes.h.

void faudes::AttributeFlags::Set ( fType  mask  )  [inline]

Set multiple flags.

Definition at line 219 of file attributes.h.

void faudes::AttributeFlags::Clr ( fType  mask  )  [inline]

Clear multiple flags.

Definition at line 224 of file attributes.h.

AttributeFlags & faudes::AttributeFlags::DoAssign ( const AttributeFlags rSrcAttr  )  [protected]

Assignment method.

Parameters:
rSrcAttr Source to assign from

Definition at line 99 of file attributes.cpp.

bool faudes::AttributeFlags::DoEqual ( const AttributeFlags rOther  )  const [protected, virtual]

Test equality of configuration data.

Parameters:
rOther Other object to compare with.
Returns:
True on match.

Definition at line 108 of file attributes.cpp.

void faudes::AttributeFlags::DoRead ( TokenReader rTr,
const std::string &  rLabel = "",
const Type pContext = 0 
) [protected, virtual]

Reads attribute from TokenReader, see Type for public wrappers.

Test whether the current token is an integer with base 16. If so, read the token to the flags value. Else, dont take any tokens. The label and context arguments are ignored.

Parameters:
rTr TokenReader to read from
rLabel Section to read
pContext Read context to provide contextual information
Exceptions:
Exception 
  • IO error (id 1)

Reimplemented from faudes::AttributeVoid.

Reimplemented in faudes::AttributeCFlags, faudes::AttributeDiagnoserState, faudes::AttributeFailureEvents, faudes::AttributeFailureTypeMap, faudes::DiagLabelSet, faudes::HioEventFlags, faudes::HioStateFlags, faudes::AttributeColoredState, faudes::AttributeTimedTrans, faudes::AttributeTimedState, and faudes::SimEventAttribute.

Definition at line 128 of file attributes.cpp.

void faudes::AttributeFlags::DoWrite ( TokenWriter rTw,
const std::string &  rLabel = "",
const Type pContext = 0 
) const [protected, virtual]

Write to TokenWriter, see Type for public wrappers.

If not the defult value, write the flag value as base 16 integer token. Else, do nothing. The label and context arguments are ignored.

Parameters:
rTw Reference to TokenWriter
rLabel Label of section to write
pContext Write context to provide contextual information
Exceptions:
Exception 
  • IO errors (id 2)

Reimplemented from faudes::AttributeVoid.

Reimplemented in faudes::AttributeCFlags, faudes::AttributeDiagnoserState, faudes::AttributeFailureEvents, faudes::AttributeFailureTypeMap, faudes::DiagLabelSet, faudes::HioEventFlags, faudes::HioStateFlags, faudes::AttributeColoredState, faudes::AttributeTimedTrans, faudes::AttributeTimedState, and faudes::SimEventAttribute.

Definition at line 116 of file attributes.cpp.


Member Data Documentation

Flags (public access for convenience).

Definition at line 229 of file attributes.h.

Definition at line 235 of file attributes.h.


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

libFAUDES 2.14g --- 2009-12-3 --- c++ source docu by doxygen 1.5.6