Ilwis-Objects  1.0
GIS and Remote Sensing framework for data access and processing
 All Classes Functions Enumerations Pages
Public Member Functions | Protected Member Functions | Friends | List of all members
Ilwis::ItemDomain< D > Class Template Reference

#include <itemdomain.h>

Inheritance diagram for Ilwis::ItemDomain< D >:
Ilwis::Domain Ilwis::IlwisObject Ilwis::Identity

Public Member Functions

 ItemDomain ()
 
 ItemDomain (const Resource &resource)
 
 ItemDomain (Range *rng)
 
Domain::Containement contains (const QVariant &val) const
 
bool isCompatibleWith (const IDomain &dom) const
 
QVariant impliedValue (const QVariant &v) const
 
SPDomainItem item (quint32 index) const
 
SPDomainItem item (const QString &nam) const
 
void addItem (DomainItem *thing)
 
void removeItem (const QString &nme)
 
void range (Range *rng)
 
void setRange (const ItemRange &range)
 
quint32 count () const
 
QString theme () const
 
void setTheme (const QString &theme)
 
void setParent (const IDomain &dm)
 
IlwisTypes ilwisType () const
 
IlwisTypes valueType () const
 
ItemIterator< D > begin () const
 
ItemIterator< D > end () const
 
bool isValid () const
 
- Public Member Functions inherited from Ilwis::Domain
 Domain ()
 
 Domain (const Resource &resource)
 
bool isStrict () const
 
void setStrict (bool yesno)
 
IDomain parent () const
 
template<typename T = Range>
QSharedPointer< T > range2range () const
 
- Public Member Functions inherited from Ilwis::IlwisObject
 IlwisObject ()
 
 IlwisObject (const Resource &source)
 
virtual bool prepare ()
 
void setName (const QString &nm)
 
void setCode (const QString &cd)
 
QDateTime modifiedTime () const
 returns the moment when the object was last modified More...
 
void setModifiedTime (const Time &time)
 sets the last modified time of the object More...
 
Time createTime () const
 
void setCreateTime (const Time &time)
 
virtual QString toString ()
 translates the defintion of an object to a string representation More...
 
virtual void setConnector (ConnectorInterface *connector, int mode=cmINPUT|cmOUTPUT)
 connects an ilwisobject to an input or output source More...
 
virtual bool isEqual (const Ilwis::IlwisObject *obj) const
 isEqual compares the properties of ilwisobjects to test for equality. More...
 
virtual bool isReadOnly () const
 isReadOnly tells if the source/target of the ilwisobject maybe modifiable. More...
 
virtual void setReadOnly (bool yesno)
 
virtual bool hasChanged () const
 
virtual void changed (bool yesno)
 
virtual bool prepare (const QString &def)
 prepare More...
 
bool fromInternal (const QSqlRecord &rec)
 
bool isAnonymous () const
 
virtual Resource source (int mode=cmINPUT) const
 source the location of the source that represents the physical read origin of this object More...
 
virtual bool store (int mode=smMETADATA|smBINARYDATA)
 target the location of the source that represents the physical write target of this object More...
 
void connectTo (const QUrl &url, const QString &format, const QString &fnamespace, ConnectorMode cmode)
 
virtual IlwisObjectclone ()
 
virtual bool merge (const IlwisObject *obj, int options=0)
 
bool isSystemObject () const
 
bool isInternalObject () const
 
- Public Member Functions inherited from Ilwis::Identity
QString code () const
 code returns the code of the identity. If no code is attached it will return sUNDEF ("?"). More...
 
quint64 id () const
 id returns a unsigned 64-bit number unique for the objects using the identity More...
 
virtual QString name () const
 name returns the name of an object. All objects have names though names need not to be unique More...
 
void setName (const QString &n)
 setName sets the name of an object. All objects have names though names need not to be unique More...
 
virtual QString description () const
 
void setDescription (const QString &desc)
 

Protected Member Functions

SPRange getRange () const
 
- Protected Member Functions inherited from Ilwis::Domain
void addChildDomain (quint64 idchild)
 
bool removeChildDomain (quint64 idchild)
 
- Protected Member Functions inherited from Ilwis::IlwisObject
QScopedPointer
< ConnectorInterface > & 
connector (int mode=cmINPUT|cmOUTPUT)
 
const QScopedPointer
< ConnectorInterface > & 
connector (int mode=cmINPUT|cmOUTPUT) const
 
bool setValid (bool yesno)
 
void copyTo (IlwisObject *obj)
 
- Protected Member Functions inherited from Ilwis::Identity
 Identity (const QString &name, qint64 id=i64UNDEF, const QString &cde=sUNDEF, const QString &descr=sUNDEF)
 
void prepare (quint64 base=0)
 
void setId (quint64 newid)
 

Friends

template<typename T >
class ItemIterator
 

Additional Inherited Members

- Public Types inherited from Ilwis::Domain
enum  Containement { cSELF =1, cPARENT =2, cDECLARED =3, cNONE =0 }
 
- Static Public Member Functions inherited from Ilwis::Domain
static IlwisTypes ilwType (const QVariant &v)
 
static IlwisTypes ilwType (const QString &impliedValue)
 
- Protected Attributes inherited from Ilwis::Domain
std::map< quint64, quint32 > _childDomains
 

Detailed Description

template<class D>
class Ilwis::ItemDomain< D >

An item domain is a domain that contains discrete items (duh). The items determine the value type of the domain. Item domains with different value types are not compatible. We have the following value (and thus Item) types

The differences between the first three are rather subtle. They are all just labels. First of all, identifiers have no attached meaning. They are labels, they identify something. As such, a street sign has no attached meaning apart from the fact that it marks a location. From the name itself you don’t get extra information. The difference between named and indexed easier. Named are unique names (in the domain), indexed are prefixes plus a number. Thematic items are also labels but they have meaning. Their name implies the value they represent. As such, these items may have metadata associated with them further defining the item. The difference is quite subtle but it has effects. For example, because a thematic item has meaning it makes sense to have a standard (UI) presentation for it. This makes no sense for an identifier item as the name implies nothing. Numeric items are ordered items that have numeric sub-ranges. For example 0-100,100-200,300-400. Time Interval Items are ordered sets of time intervals. For example 20090301-20090311, 20090312-20090322,20090323-20090402. They are very similar to numerical items . Item domains have a property called “theme”. In a way this is a poor man’s parent domain. In cases where it is not feasible or practical to define a whole parent domain (e.g. insufficient knowledge) one can make item domains compatible by giving them the same theme. At a string based representation level of the items they become comparable but not on the programmatic level below that (see later). What is meant by this? All items in an item domain have a string representation(name). If item domains have the same theme you may assume that names in the domain are pointing to things of the same type/identity. But always remember that this is a shallow equality. The domains don’t have knowledge of each other, their internal representation is different. Only parent domains enforce that also the internal representation is equal. All child domains have by definition have the same theme.

Constructor & Destructor Documentation

template<class D>
Ilwis::ItemDomain< D >::ItemDomain ( )
inline

Creates an empty ItemDomain of type D

template<class D>
Ilwis::ItemDomain< D >::ItemDomain ( const Resource resource)
inline

Creates an itemdomain from a Resource

Parameters
resourceThe resource to be used by this ItemDomain

Member Function Documentation

template<class D>
void Ilwis::ItemDomain< D >::addItem ( DomainItem thing)
inline

Adds an item of the templated type to the range. If no range is yet defined, one will be created

Parameters
theitem to be added. Note that ownership of the item is transferred to the range. no delete allowed
template<class D>
ItemIterator<D> Ilwis::ItemDomain< D >::begin ( ) const
inline

Create an ItemIterator over this domain This ItemIterators current position is at the start

Returns
ItemIterator<D>(*this)
template<class D>
Domain::Containement Ilwis::ItemDomain< D >::contains ( const QVariant &  val) const
inlinevirtual

Checks if the value is contained in either this domain or the parentdomain.

See Also
Domain
Parameters
valThe value to be checked
Returns
cPARENT when the value is contained in the parent and this domain is not strict, cSELF if the value is contained in this domain and cNONE if the value is contained in neither

Implements Ilwis::Domain.

template<class D>
quint32 Ilwis::ItemDomain< D >::count ( ) const
inline

Query for the amount of items in the ItemRange of this ItemDomain

Returns
the amount of items in the ItemRange of this domain or undefined if there are no items in the range
template<class D>
ItemIterator<D> Ilwis::ItemDomain< D >::end ( ) const
inline

Create an ItemIterator over this domain This ItemIterators current position is at the end

Returns
ItemIterator<D>(*this, count())
template<class D>
IlwisTypes Ilwis::ItemDomain< D >::ilwisType ( ) const
inlinevirtual

Gives the IlwisTypes of this object

See Also
IlwisObject
Returns
the IlwisTypes of this IlwisObject

Implements Ilwis::IlwisObject.

template<class D>
QVariant Ilwis::ItemDomain< D >::impliedValue ( const QVariant &  v) const
inlinevirtual

returns a string representation of the item pointed to by the index

Parameters
0based index, if the index is invalid sUNDEF will be returned
Returns
the string representation or sUNDEDF in case no items are defined

Reimplemented from Ilwis::Domain.

template<class D>
bool Ilwis::ItemDomain< D >::isCompatibleWith ( const IDomain dom) const
inlinevirtual

Checks if this itemdomain is compatible with another domain, will not be compatible if the other domain is:

  • invalid
  • not an itemdomain
  • has another or an undefined theme (both the parent of the other domain and itself)
Parameters
domthe domain to be tested
Returns
true when compatible

Implements Ilwis::Domain.

template<class D>
bool Ilwis::ItemDomain< D >::isValid ( ) const
inlinevirtual

Check if this is a valid domain A ItemDomain is valid when the range is not null

Returns
true if this domain is valid

Reimplemented from Ilwis::IlwisObject.

template<class D>
SPDomainItem Ilwis::ItemDomain< D >::item ( quint32  index) const
inline

returns a pointer to the domain item pointed to by the index

Parameters
0based index, if the index is invalid 0 will be returned
Returns
a (pointer to) domain item or 0 if no items are defined
template<class D>
SPDomainItem Ilwis::ItemDomain< D >::item ( const QString &  nam) const
inline

returns a pointer to the item that is identified by the string name

Parameters
aname that must be in the range of the domain. If not a 0 pointer will be returned
Returns
a (pointer to) domain item or 0 if no items are defined
template<class D>
void Ilwis::ItemDomain< D >::range ( Range rng)
inlinevirtual

Tries to set a new range on this ItemDomain Will fail if the range doesnt fit

Parameters
rngthe new range

Implements Ilwis::Domain.

template<class D>
void Ilwis::ItemDomain< D >::removeItem ( const QString &  nme)
inline

removes an item from the range

Parameters
theitem to be removed
template<class D>
void Ilwis::ItemDomain< D >::setParent ( const IDomain dm)
inlinevirtual

Changes the parent IDomain of this ItemDomain. If the new IDomain is invalid and this ItemDomain has a parent, the parent will be removed and a raw ItemDomain remains If the new domain does not meet the requirements but is valid nothing will happen

Parameters
dmThe new Domain

Reimplemented from Ilwis::Domain.

template<class D>
void Ilwis::ItemDomain< D >::setRange ( const ItemRange range)
inline

Sets a new range on this ItemDomain, if the excisting range / parent range / child range contain the new range

Parameters
rangeThe new ItemRange
template<class D>
void Ilwis::ItemDomain< D >::setTheme ( const QString &  theme)
inline

Changes the Theme of this ItemDomain

Parameters
themeThe new Theme of this Itemdomain
template<class D>
QString Ilwis::ItemDomain< D >::theme ( ) const
inline

Query for the theme of this ItemDomain

Returns
The theme of this ItemDomain

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