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

Base interface of types. More...

#include "itype.h"

Inheritance diagram for HGL::IType:
[legend]

Classes

class  iterator
 Iterator over an IType tree. More...
 
class  Ptr
 Smart pointer to IType instances. More...
 

Public Member Functions

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...
 
Identification and description of types
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...
 
Managing control source parameters
virtual void setControlSourceParameter (const uint32_t &par)=0
 
virtual uint32_t getControlSourceParameter () const =0
 
Type conversion
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...
 
Aritmetic operators
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)
 
Iterator over this type's attached types
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...
 
Type checks
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...
 

Serialization and type identification

enum  SERIALID { ,
  NOTSERIALIZEABLE = -1,
  SASSIGNMENTOPERATOR,
  SDEBUGPROCEDURE,
  SELLIPSE,
  SEXPRESSIONPARAM,
  SFILL,
  SFLOATPARAM,
  SLINE,
  SMAINSEGMENT,
  SNAMEDPARAM,
  SOBJECTSSEGMENT,
  SPARAMSECTION,
  SPOINT,
  SPOLY,
  SPROCCALL,
  SPROCEDURE,
  SPROCEDURESSEGMENT,
  SPROCINITSTATEMENT,
  SPROJECT,
  SREFERENCEPARAM,
  SRENDERPROCEDURE,
  SSTDLIBCALL,
  SSTRINGPARAM,
  STEXT,
  SVECTOR2D,
  SRENDERCALLBACK,
  SSRENDERCALLBACK,
  SVIRTUALGROUP,
  SCOMMENT,
  SCURVE,
  SSIGNATURE,
  SINCLUDE
}
 Enum of the serializeable objects. More...
 
typedef std::deque< uint8_t > BUFFER
 Buffer of the serialized data.
 
virtual SERIALID getSerialID () const =0
 Gets the serialization ID of the object. More...
 

Accessing attached types

typedef std::list< PtrTYPELIST
 List of attached IType instances.
 
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

Base interface of types.

Author
Heiko Schäfer heiko.nosp@m.@hgl.nosp@m..rang.nosp@m.un.d.nosp@m.e

Member Enumeration Documentation

Enum of the serializeable objects.

This types are used for the compiler and interpreter to denote the type of the object

Note
Do not alter the order of this enum since it will break compatibility! If you need to reorder values here, change the global min version in CompilerBase, if compiled signatures changed or new signatures are introduced, mark it in the appropriate CompilerType subclass.
Enumerator
NOTSERIALIZEABLE 

Denotes a non-serializeable type.

SASSIGNMENTOPERATOR 

Serial type id of HGL::Type::AssignmentOperator

SDEBUGPROCEDURE 

Serial type id of HGL::Type::DebugProcedure

SELLIPSE 

Serial type id of HGL::Type::Ellipse

SEXPRESSIONPARAM 

Serial type id of HGL::Type::ExpressionParam

SFILL 

Serial type id of HGL::Type::Fill

SFLOATPARAM 

Serial type id of HGL::Type::FloatParam

SLINE 

Serial type id of HGL::Type::Line

SMAINSEGMENT 

Serial type id of HGL::Type::MainSegment

SNAMEDPARAM 

Serial type id of HGL::Type::NamedParam

SOBJECTSSEGMENT 

Serial type id of HGL::Type::ObjectsSegment

SPARAMSECTION 

Serial type id of HGL::Type::ParamSection

SPOINT 

Serial type id of HGL::Type::Point

SPOLY 

Serial type id of HGL::Type::Poly

SPROCCALL 

Serial type id of HGL::Type::ProcCall

SPROCEDURE 

Serial type id of HGL::Type::Procedure

SPROCEDURESSEGMENT 

Serial type id of HGL::Type::ProceduresSegment

SPROCINITSTATEMENT 

Serial type id of HGL::Type::ProcInitStatement

SPROJECT 

Serial type id of HGL::Type::Project

SREFERENCEPARAM 

Serial type id of HGL::Type::ReferenceParam

SRENDERPROCEDURE 

Serial type id of HGL::Type::RenderProcedure

SSTDLIBCALL 

Serial type id of HGL::Type::StdLibCall

SSTRINGPARAM 

Serial type id of HGL::Type::StringParam

STEXT 

Serial type id of HGL::Type::Text

SVECTOR2D 

Serial type id of HGL::Type::Vector2D

SRENDERCALLBACK 

Serial type id of HGL::Type::RenderCallback

SSRENDERCALLBACK 

Serial type id of HGL::Type::RenderCallback (stdlib)

SVIRTUALGROUP 

Serial type id of HGL::Type::VirtualGroup

SCOMMENT 

Serial type id of HGL::Type::Comment

SCURVE 

Serial type id of HGL::Type::Curve

SSIGNATURE 

Serial type id of HGL::Type::Signature

SINCLUDE 

Serial type id of HGL::Type::Include

Member Function Documentation

virtual IType* HGL::IType::attachType ( IType type,
bool  check = true 
)
throw (Exception::AttachException
)
pure virtual

Attach child objects to the IType at end of list.

Parameters
typethe IType to attach as child
checktrue (default), if validity checks should be performed
Exceptions
Exception::AttachExceptionif a disallowed type gets attached. See Types for more.
Returns
the attached type

Implemented in HGL::Type::TypeBase.

Referenced by HGL::Type::Project::addMainSegment(), HGL::Type::Project::addObjectsSegment(), and HGL::Type::Project::addProceduresSegment().

virtual iterator HGL::IType::begin ( )
pure virtual

Gets the iterator to the begin over this type's attached types.

Returns
the iterator to the begin over this type's attached types

Implemented in HGL::Type::TypeBase.

virtual IType::Ptr HGL::IType::clone ( ) const
throw (Exception::CloneNotSupportedException
)
pure virtual

Creates a clone of the type.

Returns
a smart pointer to the cloned type

Implemented in HGL::Type::TypeBase, and HGL::Type::FloatParam.

virtual void HGL::IType::detachType ( IType type)
pure virtual

Detaches a child from the IType.

Parameters
typethe IType to detach
Since
0.5.21

Implemented in HGL::Type::Poly, HGL::Type::TypeBase, and HGL::Type::RenderCallback.

virtual iterator HGL::IType::end ( )
pure virtual

Gets the iterator to the end over this type's attached types.

Returns
the iterator to the end over this type's attached types

Implemented in HGL::Type::TypeBase.

virtual const TYPELIST& HGL::IType::getAttachedTypes ( ) const
pure virtual

Returns all attached IType instances.

Returns
all attached IType instances

Implemented in HGL::Type::TypeBase, HGL::Type::RenderCallback, and HGL::Type::VirtualGroup.

Referenced by HGL::Type::Project::isValid().

virtual BOUNDINGBOX HGL::IType::getBoundingBox ( ) const
pure virtual

Gets the bounding box of the type.

Returns
the bounding box of the type

Implemented in HGL::Type::TypeBase, HGL::Type::Point, HGL::Type::Line, HGL::Type::Vector2D, HGL::Type::Fill, HGL::Type::ParamBase, and HGL::Type::Text.

Referenced by HGL::Type::Line::getBoundingBox().

virtual const std::string& HGL::IType::getDescription ( ) const
pure virtual

Gets the description of the type.

Returns
the description of the type

Implemented in HGL::Type::TypeBase.

virtual const std::string& HGL::IType::getId ( ) const
pure virtual

Gets the identifier.

Returns
the identifier

Implemented in HGL::Type::TypeBase, HGL::Type::NamedParam, and HGL::Type::Procedure.

virtual IType* HGL::IType::getParent ( ) const
pure virtual

Returns the parent IType.

Returns
the parent IType or NULL if there is no parent

Implemented in HGL::Type::TypeBase.

virtual const IType* HGL::IType::getRoot ( const IType type) const
pure virtual

Get the root of a type.

Parameters
typethe type to get the root of
Returns
the the root of a type

Implemented in HGL::Type::TypeBase.

Referenced by HGL::Type::TypeBase::getRoot().

virtual SERIALID HGL::IType::getSerialID ( ) const
pure virtual
virtual bool HGL::IType::isNull ( ) const
pure virtual

Checks if the type is null type.

See Also
IReferenceHolder::findReference
Returns
true if the type is null type, false otherwise

Implemented in HGL::Type::TypeBase.

Referenced by HGL::Type::Line::findReference(), HGL::Type::NamedParam::getTypeName(), and HGL::Type::ReferenceParam::operator float().

virtual bool HGL::IType::isValid ( ) const
pure virtual
virtual HGL::IType::operator float ( ) const
throw (Exception::ReferenceException,
Exception::InvalidExpressionException
)
pure virtual

Converts the type into a float

Returns
the type as float

Implemented in HGL::Type::TypeBase, HGL::Type::FloatParam, and HGL::Type::ReferenceParam.

virtual HGL::IType::operator iterator ( )
pure virtual

Gets the iterator over this type's attached types.

Returns
the iterator over this type's attached types
virtual HGL::IType::operator Type::StringParam & ( ) const
throw (Exception::InvalidExpressionException
)
pure virtual

Converts the type into a HGL::Type::StringParam

Returns
the type as HGL::Type::StringParam

Implemented in HGL::Type::FloatParam.

virtual HGL::IType::operator Type::Vector2D & ( ) const
throw (Exception::InvalidExpressionException
)
pure virtual

Converts the type into a HGL::Type::Vector2D

Returns
the type as HGL::Type::Vector2D reference

Implemented in HGL::Type::FloatParam.

virtual IType* HGL::IType::resolve ( const std::string &  id) const
pure virtual

Resolves a type by its ID.

Parameters
idthe id to resolve
Returns
the resolved type or 0L if no type could get resolved by that id

Implemented in HGL::Type::TypeBase, and HGL::Type::AssignmentOperator.

virtual void HGL::IType::setDescription ( const std::string &  desc)
pure virtual

Sets the description of the type.

Parameters
descthe description of the type

Implemented in HGL::Type::TypeBase.

virtual void HGL::IType::setId ( const std::string &  id)
pure virtual

Sets the identifier.

Parameters
idthe identifier

Implemented in HGL::Type::TypeBase, and HGL::Type::NamedParam.

virtual void HGL::IType::setParent ( IType parent)
pure virtual

Set parent of the type.

Parameters
parentthe parent of the type

Implemented in HGL::Type::TypeBase.