hgl 0.5.25
A compiler/interpreter suite for developing images
Public Member Functions | List of all members
HGL::Type::IReferenceHolder Interface Referenceabstract

Interface to IType which can refer to other types. More...

#include "ireferenceholder.h"

Inheritance diagram for HGL::Type::IReferenceHolder:
[legend]

Public Member Functions

virtual uint16_t getHash () const =0
 Calculates the hash value. More...
 
Reference access and manipulation
virtual const std::string * getReference () const =0
 Gets the reference. More...
 
virtual void setReference (const std::string &ref, bool fromStdLib=false)=0
 Sets the reference. More...
 
virtual void setReference (const std::string &ref, IType *scope)=0
 Sets the reference. More...
 
virtual void removeReference ()=0 throw (Exception::ReferenceException)
 Removes the reference. More...
 
virtual const ITypefindReference (bool recache=false) const =0
 Searches the tree for the associated reference. More...
 
- Public Member Functions inherited from HGL::IType
virtual IType::Ptr clone () const =0 throw (Exception::CloneNotSupportedException)
 Creates a clone of the type. More...
 
virtual BOUNDINGBOX getBoundingBox () const =0
 Gets the bounding box of the type. More...
 
virtual const std::string & getId () const =0
 Gets the identifier. More...
 
virtual void setId (const std::string &id)=0
 Sets the identifier. More...
 
virtual const std::string & getDescription () const =0
 Gets the description of the type. More...
 
virtual void setDescription (const std::string &desc)=0
 Sets the description of the type. More...
 
virtual void setControlSourceParameter (const uint32_t &par)=0
 
virtual uint32_t getControlSourceParameter () const =0
 
virtual operator float () const =0 throw (Exception::ReferenceException, Exception::InvalidExpressionException)
 Converts the type into a float More...
 
virtual operator Type::Vector2D & () const =0 throw (Exception::InvalidExpressionException)
 Converts the type into a HGL::Type::Vector2D More...
 
virtual operator Type::StringParam & () const =0 throw (Exception::InvalidExpressionException)
 Converts the type into a HGL::Type::StringParam More...
 
virtual ITypeoperator= (const IType &)=0 throw (Exception::InvalidExpressionException)
 
virtual ITypeoperator+ (const IType &)=0 throw (Exception::ReferenceException, Exception::InvalidExpressionException)
 
virtual ITypeoperator- (const IType &)=0 throw (Exception::ReferenceException, Exception::InvalidExpressionException)
 
virtual ITypeoperator* (const IType &)=0 throw (Exception::ReferenceException, Exception::InvalidExpressionException)
 
virtual ITypeoperator* (const float *)=0 throw (Exception::ReferenceException, Exception::InvalidExpressionException)
 
virtual ITypeoperator/ (const IType &)=0 throw (Exception::ReferenceException, Exception::InvalidExpressionException)
 
virtual ITypeoperator- ()=0 throw (Exception::InvalidExpressionException)
 
virtual ITypepower (const IType &)=0 throw (Exception::InvalidExpressionException)
 
virtual ITypesinus ()=0 throw (Exception::InvalidExpressionException)
 
virtual ITypecosinus ()=0 throw (Exception::InvalidExpressionException)
 
virtual operator iterator ()=0
 Gets the iterator over this type's attached types. More...
 
virtual void invalidateIterator (bool parent=false) const =0
 
virtual iterator begin ()=0
 Gets the iterator to the begin over this type's attached types. More...
 
virtual iterator end ()=0
 Gets the iterator to the end over this type's attached types. More...
 
virtual bool isNull () const =0
 Checks if the type is null type. More...
 
virtual bool isValid () const =0
 Checks if the type is valid. More...
 
virtual SERIALID getSerialID () const =0
 Gets the serialization ID of the object. More...
 
virtual const ITypegetRoot (const IType &type) const =0
 Get the root of a type. More...
 
virtual void setRoot (IType *)=0
 
virtual ITypegetParent () const =0
 Returns the parent IType. More...
 
virtual void setParent (IType *parent)=0
 Set parent of the type. More...
 
virtual ITyperesolve (const std::string &id) const =0
 Resolves a type by its ID. More...
 
virtual const TYPELISTgetAttachedTypes () const =0
 Returns all attached IType instances. More...
 
virtual ITypeattachType (IType *type, bool check=true)=0 throw (Exception::AttachException)
 Attach child objects to the IType at end of list. More...
 
virtual void detachType (IType *type)=0
 Detaches a child from the IType. More...
 

Detailed Description

Interface to IType which can refer to other types.

A type can hold a reference to another IType and should behave like that type. A reference itself is only a string to an identifier.

See Also
IType::getId
IType::setId
Author
Heiko Schäfer heiko.nosp@m.@hgl.nosp@m..rang.nosp@m.un.d.nosp@m.e

Member Function Documentation

virtual const IType* HGL::Type::IReferenceHolder::findReference ( bool  recache = false) const
pure virtual

Searches the tree for the associated reference.

Note
To check if a reference was actually found use IType::isNull
See Also
IType::isNull
Returns
an IType to a reference or the special NullType if not found

Implemented in HGL::Type::ExpressionParam, HGL::Type::Line, HGL::Type::ReferenceParam, and HGL::Type::ReferenceHolderBase.

virtual uint16_t HGL::Type::IReferenceHolder::getHash ( ) const
pure virtual

Calculates the hash value.

Returns
uint16_t the hash value
virtual const std::string* HGL::Type::IReferenceHolder::getReference ( ) const
pure virtual

Gets the reference.

Returns
pointer to the reference, NULL if no reference is set

Implemented in HGL::Type::ReferenceHolderBase.

virtual void HGL::Type::IReferenceHolder::removeReference ( )
throw (Exception::ReferenceException
)
pure virtual

Removes the reference.

Precondition
The underlying type has to be valid (isValid() == true), i.e. if the reference is removed the resulting type must be valid, otherwise an ReferenceRemoveException is thrown
See Also
isValid
Exceptions
HGL::Exception::ReferenceRemoveExceptionif the underlying type is not valid
virtual void HGL::Type::IReferenceHolder::setReference ( const std::string &  ref,
bool  fromStdLib = false 
)
pure virtual

Sets the reference.

Parameters
refthe reference
fromStdLibtrue if the reference points into the stdlib

Implemented in HGL::Type::ReferenceHolderBase.

virtual void HGL::Type::IReferenceHolder::setReference ( const std::string &  ref,
IType scope 
)
pure virtual

Sets the reference.

Scoped references are useful for types which are created at runtime.

Parameters
refthe reference
scopethe scope in which the reference should be found