ML Reference
ml::BaseField Class Reference

Field to encapsulate a pointer to an ML base object. More...

#include <mlFields.h>

Inheritance diagram for ml::BaseField:
ml::Field

List of all members.

Public Member Functions

 BaseField ()
 Default constructor, do not use it.
 BaseField (const std::string &name)
 Constructor, creates a field with a name to manage a base pointer.
 ~BaseField ()
 Destructor.
void setStringValue (const std::string &stringValue)
 Sets pointer value from string stringValue. If string cannot be parsed successfully, a NULL pointer is set.
void setBaseValue (Base *basePointerValue)
 Sets the value of the field to basePointerValue.
void setBaseValue (const RefCountedBasePtr &value)
 Sets the value from intrusive pointer.
std::string getStringValue () const
 Returns the value of the field as a string value.
BasegetBaseValue () const
 Returns current field value.
virtual void touchSourceFields (void)
 Touches the source fields.
void addAllowedType (const RuntimeType *allowedType)
 Add type to list of allowed types.
template<typename T >
void addAllowedType ()
 Same as above, with template parameter where the Base type can be specified directly.
template<typename T >
void setBaseValueAndAddAllowedType (T *value)
 convenience routine for setting the base value and its type at the same time.
template<typename T >
void setBaseValueAndAddAllowedType (const ::boost::intrusive_ptr< T > &value)
 convenience routine for setting the base value and its type at the same time using an intrusive pointer.
std::vector< const RuntimeType * > getAllowedTypes () const
 Get list of allowed Base types for this field.
bool hasUnallowedType () const
 return true if the last call of setBaseValue had an unallowed type as argument, getBaseValue will return NULL then

Protected Member Functions

virtual void setValueFromField (const Field &field)
 Reimplementation from Field which copies the field value more efficiently.

Detailed Description

Field to encapsulate a pointer to an ML base object.

Definition at line 981 of file mlFields.h.


Constructor & Destructor Documentation

ml::BaseField::BaseField ( )

Default constructor, do not use it.

ml::BaseField::BaseField ( const std::string &  name)

Constructor, creates a field with a name to manage a base pointer.

Default value is NULL.

ml::BaseField::~BaseField ( )

Destructor.


Member Function Documentation

void ml::BaseField::addAllowedType ( const RuntimeType allowedType)

Add type to list of allowed types.

This will set the Base value to NULL if it isn't NULL already and should only be called when creating the BaseField. Calls to setBaseValue (or setStringValue) will only succeed if the given Base object is of one of the allowed types or NULL, or if the list is empty, otherwise NULL will be set instead.

template<typename T >
void ml::BaseField::addAllowedType ( ) [inline]

Same as above, with template parameter where the Base type can be specified directly.

Definition at line 1027 of file mlFields.h.

References addAllowedType().

Referenced by addAllowedType().

std::vector<const RuntimeType*> ml::BaseField::getAllowedTypes ( ) const [inline]

Get list of allowed Base types for this field.

Definition at line 1041 of file mlFields.h.

Base* ml::BaseField::getBaseValue ( ) const

Returns current field value.

std::string ml::BaseField::getStringValue ( ) const [virtual]

Returns the value of the field as a string value.

setStringValue must be able to reinterpret this returned string correctly.

Implements ml::Field.

bool ml::BaseField::hasUnallowedType ( ) const [inline]

return true if the last call of setBaseValue had an unallowed type as argument, getBaseValue will return NULL then

Definition at line 1045 of file mlFields.h.

void ml::BaseField::setBaseValue ( Base basePointerValue)

Sets the value of the field to basePointerValue.

void ml::BaseField::setBaseValue ( const RefCountedBasePtr &  value)

Sets the value from intrusive pointer.

template<typename T >
void ml::BaseField::setBaseValueAndAddAllowedType ( T *  value) [inline]

convenience routine for setting the base value and its type at the same time.

The type is evaluated at compile-time, so even NULL works if it is cast to the right pointer type! (Or you might specify the type as template argument for NULL arguments!)

Definition at line 1033 of file mlFields.h.

template<typename T >
void ml::BaseField::setBaseValueAndAddAllowedType ( const ::boost::intrusive_ptr< T > &  value) [inline]

convenience routine for setting the base value and its type at the same time using an intrusive pointer.

See above methods for details.

Definition at line 1038 of file mlFields.h.

References setBaseValueAndAddAllowedType().

Referenced by setBaseValueAndAddAllowedType().

void ml::BaseField::setStringValue ( const std::string &  stringValue) [virtual]

Sets pointer value from string stringValue. If string cannot be parsed successfully, a NULL pointer is set.

Implements ml::Field.

virtual void ml::BaseField::setValueFromField ( const Field field) [protected, virtual]

Reimplementation from Field which copies the field value more efficiently.

Reimplemented from ml::Field.

virtual void ml::BaseField::touchSourceFields ( void  ) [virtual]

Touches the source fields.


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