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

container for an instance of an IlwisObject More...

#include <ilwisdata.h>

Public Member Functions

 IlwisData (const QString &name, IlwisTypes tp=itANY, const PrepareOptions &options=PrepareOptions())
 
 IlwisData (const Resource &resource1, const PrepareOptions &options=PrepareOptions())
 
 IlwisData (T *data)
 
 IlwisData (const ESPIlwisObject &impl)
 
template<typename K >
 IlwisData (const IlwisData< K > &obj)
 
 IlwisData (const IlwisData &obj)
 
void set (T *data)
 
template<typename K >
IlwisData< T > & assign (const IlwisData< K > &obj)
 
template<typename K >
IlwisData< T > & operator= (const IlwisData< K > &obj)
 
IlwisDataoperator= (const IlwisData &obj)
 
T * operator-> ()
 
T * operator-> () const
 
T * ptr () const
 
template<class C = IlwisObject>
IlwisData< C > get () const
 casts an object to another object based on the template parameter. More...
 
bool prepare ()
 create a new pristine IlwisObject. It has no connector (yet) and exists only in memory More...
 
bool prepare (const QString &name, IlwisTypes tp=itANY, const PrepareOptions &options=PrepareOptions())
 
bool prepare (const Resource &resource1, const PrepareOptions &options=PrepareOptions())
 
bool prepare (const quint64 &iid, const PrepareOptions &options=PrepareOptions())
 constructs an IlwisObject and registers its existens. More...
 
bool isValid () const
 An instance is valid if an object has been allocated. More...
 

Friends

template<class C >
class IlwisData
 

Detailed Description

template<class T>
class Ilwis::IlwisData< T >

container for an instance of an IlwisObject

The IlwisData object ensures that every IlwisObject is a singleton in the system. The QExplicitlySharedDataPointer of the class holds an unique pointer to the instance. The class also holds a (static) hash table to instances of all ilwisobjects that functions as a lookup table to quickly create new references to a particular IlwisObject. If a to instanced object is not in the hash table it will be created and initialized from the container were the data of the object resides ( disk, database, ...). If the object already exists it will be fetched from the hash table and returned to the caller. Its reference count will go up by one (automaticly).

Member Function Documentation

template<class T>
template<class C = IlwisObject>
IlwisData<C> Ilwis::IlwisData< T >::get ( ) const
inline

casts an object to another object based on the template parameter.

If the cast is not to a child derivative of the class, the class will fail and a exception will be thrown. This one of the few places in the system were an exception will be thrown. The catch for these exceptions must be placed on a place were the system can resume normal operations This operation is usually used the gain access to methods of the child derivative.

Returns
Returns a new "upgraded" reference to the class.
template<class T>
bool Ilwis::IlwisData< T >::isValid ( ) const
inline

An instance is valid if an object has been allocated.

Returns
bool true of an object is allocated
template<class T>
bool Ilwis::IlwisData< T >::prepare ( )
inline

create a new pristine IlwisObject. It has no connector (yet) and exists only in memory

Returns
bool bool succes of the creation process. Any issues can be found in the issuelogger
template<class T>
bool Ilwis::IlwisData< T >::prepare ( const QString &  name,
IlwisTypes  tp = itANY,
const PrepareOptions options = PrepareOptions() 
)
inline

The method ensures that a proper IlwisResource is requested from the system. It then tries to create the resource and on success initializes it. After that it registers itself to the system to prevent the creation of other instances of this resource. Any warnings or errors during its creation are transferred to the created object and the issue stack is cleared.

Parameters
resourcethe resource to be instanced as an IlwisObject
connectorTypethe connector that should handle this resource. If none is given ("default"), the system will figure it out by it self
Returns
bool bool succes of the creation process. Any issues can be found in the issuelogger
template<class T>
bool Ilwis::IlwisData< T >::prepare ( const quint64 &  iid,
const PrepareOptions options = PrepareOptions() 
)
inline

constructs an IlwisObject and registers its existens.

The method ensures that a proper IlwisResource is requested from the system. It then tries to create the resource and on success initializes it. After that it registers itself to the system to prevent the creation of other instances of this resource. Any warnings or errors during its creation are transferred to the created object and the issue stack is cleared.

Parameters
namea string representation of a resource. This might be an Url/IlwisResource but other representations can also be used
Returns
bool succes of the creation process. Any issues can be found in the issuelogger

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