FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
Public Types | Public Member Functions | Friends | List of all members

An abstract selection of fields, that is given by names of fields and possible types for each field. More...

#include <FieldSelection.hpp>

Inheritance diagram for Fiber::FieldSelection:
MemCore::ReferenceBase< FieldSelection >

Public Types

typedef std::map< string, TypeList_tFieldSelection_t
 The actual selection of fields, modelled as a mapping from string to a list of types.
 
- Public Types inherited from MemCore::ReferenceBase< FieldSelection >
typedef Object reference_domain_t
 
typedef WeakPtr< Object, Object > SelfPtr_t
 

Public Member Functions

 FieldSelection ()
 Constructor.
 
bool requiresType (const type_info &what)
 Check if this field selection requires the field to be of the specified type.
 
TypeList_tFieldTypes ()
 Beside a set of fields and their type, the FieldSelection also allows to store a set of types independently from the fields.
 
const TypeList_tFieldTypes () const
 Readonly retrieval of associated field types.
 
const FieldSelection_tgetSelection () const
 
 ~FieldSelection ()
 Destructor.
 
void setUniqueField (const string &fieldname, const TypeList_t &FT)
 Define one unique field here, removing all others.
 
string getFieldName () const
 Retrieve the name of a unique field, if only one is stored here.
 
unsigned getNumberOfFields () const
 Tell how many fields are referenced here.
 
bool setFieldType (const string &Fieldname, const FiberTypeBase &, bool append)
 Set the type of a field.
 
bool setFieldType (const string &Fieldname, const TypeList_t &FieldSelection)
 Set the type(s) of a field.
 
TypeList_t getFieldType (const string &Fieldname) const
 
TypeList_t getFieldType () const
 
template<class T >
bool setType (bool append=true)
 
template<class T >
void setType (const string &name, bool append=true)
 Define the types that this field accepts or provides.
 
RefPtr< RepresentationgetFields (const Representation &R) const
 Return a set of fields, as found on the given Representation object.
 
RefPtr< RepresentationgetCartesianVertexFields (const Grid &G) const
 Return a set of fields, as found on Vertices of the given Grid as represented in cartesian coordinates.
 
- Public Member Functions inherited from MemCore::ReferenceBase< FieldSelection >
auto getObjectCountID () const noexcept
 
bool isIdentical (const WeakPtr< Object, Object > &PossibleSelf) const noexcept
 
void mkAutoDestructive ()
 
refcount_t refcount () const noexcept
 
 ReferenceBase (Object *that) noexcept
 
const auto & self () const
 
refcount_t wrefcount () const noexcept
 

Friends

bool operator== (const FieldSelection &L, const FieldSelection &R)
 Compare two field selectors.
 
bool operator!= (const FieldSelection &L, const FieldSelection &R)
 Check if two field selectors differ.
 

Additional Inherited Members

- Protected Member Functions inherited from MemCore::ReferenceBase< FieldSelection >
virtual void extremeUnction ()
 
ReferenceBaseoperator= (const ReferenceBase &R)
 
void suicide ()
 

Detailed Description

An abstract selection of fields, that is given by names of fields and possible types for each field.

This selection is abstract because it only contains names of fields, but not actual references to fields. Thus a field selection may be use to query an arbitrary Grid object, requesting a selection of concrete fields given on this Grid.

Todo:
Add iterator class

Member Function Documentation

◆ FieldTypes()

TypeList_t & Fiber::FieldSelection::FieldTypes ( )
inline

Beside a set of fields and their type, the FieldSelection also allows to store a set of types independently from the fields.

This can be used to specify requirements on this set of fields.

Don't confuse it with the FieldType() function, that returns the types of one field, if only one field is in the selection here.

Referenced by requiresType().

◆ getCartesianVertexFields()

RefPtr< Representation > Fiber::FieldSelection::getCartesianVertexFields ( const Grid G) const

Return a set of fields, as found on Vertices of the given Grid as represented in cartesian coordinates.

The result is provided as a Representation object, but only for storage purposes. The result object is not suitable to be used within a Grid.

Use getFields() for more specific control from where the fields shall be extracted.

◆ getFieldName()

string Fiber::FieldSelection::getFieldName ( ) const

Retrieve the name of a unique field, if only one is stored here.

Will return an empty string if more than one is stored.

References std::map< typename _Key, typename _Tp, typename _Compare, typename _Alloc >::begin(), and std::map< typename _Key, typename _Tp, typename _Compare, typename _Alloc >::size().

Referenced by setUniqueField().

◆ getFields()

RefPtr< Representation > Fiber::FieldSelection::getFields ( const Representation R) const

Return a set of fields, as found on the given Representation object.

The result is provided in a Representation object as well, but only for storage purposes. The result object is not suitable to be used within a Grid.

◆ requiresType()

bool Fiber::FieldSelection::requiresType ( const type_info what)

Check if this field selection requires the field to be of the specified type.

Note that if there are no types defined in the FieldTypes() list, then it means there are no requirements an all types are required here, this function will always return true then.

References Fiber::containsType(), FieldTypes(), and size().

◆ setFieldType()

bool Fiber::FieldSelection::setFieldType ( const string &  Fieldname,
const FiberTypeBase FT,
bool  append 
)

Set the type of a field.

Parameters
appendFlag to tell if the type information should be set or appended to an existing list of types.
Returns
false if no such field is found here.

◆ setType()

template<class T >
bool Fiber::FieldSelection::setType ( bool  append = true)
inline
Returns
false if no or more than one field is found here.