libFAUDES

Sections

Index

faudes::AttributeFlags Class Reference

#include <attributes.h>

Inherits faudes::AttributeVoid.

Inherited by faudes::AttributeCFlags, faudes::AttributeColoredState, faudes::AttributeTimedState, faudes::AttributeTimedTrans, 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.

Public Member Functions

virtual AttributeFlagsNew (void) const
 Construct on heap.
virtual const AttributeFlagsCast (const Type *pOther) const
 Cast other object to this type.
 AttributeFlags (void)
 Default constructor.
virtual ~AttributeFlags (void)
 Destructor.
virtual void Copy (AttributeVoid &rOtherAttr) const
 Copy attribute.
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

void DoCopy (AttributeFlags &rOtherAttr) const
 Copy all attribute members.
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.

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

Destructor.


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::HioEventFlags, faudes::HioStateFlags, faudes::AttributeColoredState, faudes::AttributeTimedTrans, faudes::AttributeTimedState, and faudes::SimEventAttribute.

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.

Returns:
Typed pointer object

Reimplemented from faudes::AttributeVoid.

Reimplemented in faudes::AttributeCFlags.

void faudes::AttributeFlags::Copy ( AttributeVoid rOtherAttr  )  const [virtual]

Copy attribute.

Virtual interface to copy members using a dynamic cast to figure the actual type of the destination. If the latter is known at compiletime, performance is better via the assignment operator.

Parameters:
rOtherAttr Destination to copy to

Reimplemented from faudes::AttributeVoid.

Reimplemented in faudes::AttributeColoredState.

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

Test a flag.

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

Test multible flags, combine by "and".

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

Test multible flags, combine by "or".

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

Test multible flags, combine by "not or".

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

Set multiple flags.

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

Clear multiple flags.

virtual bool faudes::AttributeFlags::IsDefault ( void   )  const [inline, virtual]

void faudes::AttributeFlags::DoCopy ( AttributeFlags rOtherAttr  )  const [protected]

Copy all attribute members.

Parameters:
rOtherAttr Destination to copy to

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::HioEventFlags, faudes::HioStateFlags, faudes::AttributeColoredState, faudes::AttributeTimedTrans, faudes::AttributeTimedState, and faudes::SimEventAttribute.

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::HioEventFlags, faudes::HioStateFlags, faudes::AttributeColoredState, faudes::AttributeTimedTrans, faudes::AttributeTimedState, and faudes::SimEventAttribute.


Member Data Documentation

Flags (public access for convenience).


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

libFAUDES 2.13a c++ source docu by doxygen 1.5.6