hgl 0.5.25
A compiler/interpreter suite for developing images
Public Member Functions | List of all members
HGL::Type::ReferenceHolderBase Class Reference

#include "referenceholderbase.h"

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

Public Member Functions

virtual const ITypefindReference (bool recache=false) const
 Searches the tree for the associated reference. More...
 
virtual const std::string * getReference () const
 Gets the reference. More...
 
virtual bool isValid () const
 Checks if the type is valid. More...
 
virtual void setReference (const std::string &ref, bool fromStdLib=false)
 Sets the reference. More...
 
Reference access and manipulation
- Public Member Functions inherited from HGL::IType
virtual operator iterator ()=0
 Gets the iterator over this type's attached types. More...
 
virtual SERIALID getSerialID () const =0
 Gets the serialization ID of the object. More...
 
- Public Member Functions inherited from HGL::Type::TypeBase
ITypeattachType (IType *type, bool check=true) throw (Exception::AttachException)
 Attach child objects to the IType at end of list. More...
 
virtual IType::iterator begin ()
 Gets the iterator to the begin over this type's attached types. More...
 
virtual void detachType (IType *type)
 Detaches a child from the IType. More...
 
virtual IType::iterator end ()
 Gets the iterator to the end over this type's attached types. More...
 
virtual const TYPELISTgetAttachedTypes () const
 Returns all attached IType instances. More...
 
virtual BOUNDINGBOX getBoundingBox () const
 Gets the bounding box of the type. More...
 
virtual const std::string & getId () const
 Gets the identifier. More...
 
virtual ITypegetParent () const
 Returns the parent IType. More...
 
virtual bool isNull () const
 Checks if the type is null type. More...
 
virtual void setDescription (const std::string &desc)
 Sets the description of the type. More...
 
virtual void setId (const std::string &id)
 Sets the identifier. More...
 

Additional Inherited Members

- Public Types inherited from HGL::IType
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.
 
typedef std::list< PtrTYPELIST
 List of attached IType instances.
 
- Protected Member Functions inherited from HGL::Type::TypeBase
virtual ITypeattachType (IType *type, const TYPELIST::iterator &before, bool check=true) throw (Exception::AttachException)
 Attaches a child at the position before. More...
 
virtual IType::Ptr clone () const throw (Exception::CloneNotSupportedException)
 Creates a clone of the type. More...
 
virtual const std::string & getDescription () const
 Gets the description of the type. More...
 
virtual const ITypegetRoot (const IType &type) const
 Get the root of a type. More...
 
virtual std::string getTypeName () const
 Displayable name of the IType. More...
 
virtual operator float () const throw (Exception::ReferenceException, Exception::InvalidExpressionException)
 Converts the type into a float More...
 
virtual ITyperesolve (const std::string &id) const
 Resolves a type by its ID. More...
 
virtual void setParent (IType *parent)
 Set parent of the type. More...
 

Detailed Description

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

Member Function Documentation

const HGL::IType * ReferenceHolderBase::findReference ( bool  recache = false) const
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

Implements HGL::Type::IReferenceHolder.

Reimplemented in HGL::Type::ExpressionParam, HGL::Type::Line, and HGL::Type::ReferenceParam.

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

const std::string * ReferenceHolderBase::getReference ( ) const
virtual

Gets the reference.

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

Implements HGL::Type::IReferenceHolder.

Referenced by HGL::Type::Line::findReference(), and HGL::Type::ExpressionParam::findReference().

bool ReferenceHolderBase::isValid ( ) const
virtual

Checks if the type is valid.

Note
This method returns true if a reference is set, but not checking if the reference itself is valid. A type is valid
  1. if all attached types are allowed for this type, if not the type is invalid
  2. if all attached types itself are valid, if not the type is invalid

Subclasses can add more checks if neccessary.

Returns
true if the type is valid, false otherwise

Reimplemented from HGL::Type::TypeBase.

Reimplemented in HGL::Type::Point, HGL::Type::Curve, and HGL::Type::Poly.

References HGL::Type::TypeBase::isValid().

Referenced by HGL::Type::Poly::isValid(), HGL::Type::Curve::isValid(), and HGL::Type::Point::isValid().

void ReferenceHolderBase::setReference ( const std::string &  ref,
bool  fromStdLib = false 
)
virtual

Sets the reference.

Parameters
refthe reference
fromStdLibtrue if the reference points into the stdlib

Implements HGL::Type::IReferenceHolder.