• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

kig

Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
ObjectCalcer Class Referenceabstract

#include <object_calcer.h>

Inheritance diagram for ObjectCalcer:
Inheritance graph
[legend]

Public Types

typedef myboost::intrusive_ptr
< ObjectCalcer > 
shared_ptr
 

Public Member Functions

virtual ~ObjectCalcer ()
 
void addChild (ObjectCalcer *c)
 
virtual void calc (const KigDocument &)=0
 
virtual bool canMove () const
 
std::vector< ObjectCalcer * > children () const
 
void delChild (ObjectCalcer *c)
 
virtual const ObjectImp * imp () const =0
 
virtual const ObjectImpType * impRequirement (ObjectCalcer *o, const std::vector< ObjectCalcer * > &os) const =0
 
virtual bool isDefinedOnOrThrough (const ObjectCalcer *o) const =0
 
virtual bool isFreelyTranslatable () const
 
virtual std::vector
< ObjectCalcer * > 
movableParents () const
 
virtual void move (const Coordinate &to, const KigDocument &doc)
 
virtual Coordinate moveReferencePoint () const
 
virtual std::vector
< ObjectCalcer * > 
parents () const =0
 

Protected Member Functions

 ObjectCalcer ()
 
void deref ()
 
void ref ()
 

Protected Attributes

std::vector< ObjectCalcer * > mchildren
 
int refcount
 

Friends

void intrusive_ptr_add_ref (ObjectCalcer *p)
 
void intrusive_ptr_release (ObjectCalcer *p)
 

Detailed Description

An ObjectCalcer is an object that represents an algorithm for calculating an ObjectImp from other ObjectImp's.

It is also a node in the dependency graph of a certain document. E.g. a LineImp can be calculated from the two PointImp's it has to go through; every time either of them moves, this calculation is redone. In this case, there would be an ObjectCalcer that keeps a reference to its two parents ( the ObjectCalcer's representing the points ), and that will calculate its ObjectImp value every time it is asked to do so ( i.e. every time one of its parents moves ).

Each ObjectHolder keeps its ObjectImp itself, and recalculates it from its parents in its calc() method ( if necessary ).

Because of the complex relations that ObjectCalcer's hold to other ObjectCalcer's and to other classes, they have been made reference-counted. This means that they keep a count internally of how much times a pointer to them is held. If this count reaches 0, this means that nobody needs them anymore, and they delete themselves. E.g. an ObjectCalcer always keeps a reference to its parents, to ensure that those aren't deleted before it is deleted.

At runtime, there will be an entire graph of ObjectCalcer that depend on their parents. At the bottom, there are Calcer's that the user is aware of, and that are held by ObjectHolder's. At the top, there are Calcer's without parents that serve only to hold some data. Those are most likely ObjectConstCalcer's. There are some algorithms to work with the dependency graph in various ways in ../misc/calcpath.h

ObjectCalcer's also decide how an object should be allowed to move. If the user selects a point, and tries to move it, then its ObjectCalcer will be asked whether it can move, and if so, will be asked to move. See below with the canMove(), move() and moveReferencePoint() methods.

Definition at line 66 of file object_calcer.h.

Member Typedef Documentation

typedef myboost::intrusive_ptr<ObjectCalcer> ObjectCalcer::shared_ptr

Definition at line 101 of file object_calcer.h.

Constructor & Destructor Documentation

ObjectCalcer::ObjectCalcer ( )
protected

Definition at line 311 of file object_calcer.cc.

ObjectCalcer::~ObjectCalcer ( )
virtual

Definition at line 51 of file object_calcer.cc.

Member Function Documentation

void ObjectCalcer::addChild ( ObjectCalcer *  c)

a calcer should call this to register itself as a child of this calcer.

This automatically takes a reference.

Definition at line 110 of file object_calcer.cc.

virtual void ObjectCalcer::calc ( const KigDocument &  )
pure virtual

Makes the ObjectCalcer recalculate its ObjectImp from its parents.

Implemented in ObjectPropertyCalcer, ObjectConstCalcer, ObjectTypeCalcer, and MeasureTransportCalcer.

bool ObjectCalcer::canMove ( ) const
virtual

Returns whether this ObjectCalcer supports moving.

Reimplemented in ObjectTypeCalcer.

Definition at line 260 of file object_calcer.cc.

std::vector< ObjectCalcer * > ObjectCalcer::children ( ) const

Returns the child ObjectCalcer's of this ObjectCalcer.

Definition at line 209 of file object_calcer.cc.

void ObjectCalcer::delChild ( ObjectCalcer *  c)

a calcer should call this in its destructor, to inform its parent that it is no longer a child of this calcer.

This will release the reference taken in addChild.

Definition at line 116 of file object_calcer.cc.

void ObjectCalcer::deref ( )
protected

Definition at line 85 of file object_calcer.cc.

virtual const ObjectImp* ObjectCalcer::imp ( ) const
pure virtual

Returns the ObjectImp of this ObjectCalcer.

Implemented in ObjectPropertyCalcer, ObjectConstCalcer, and ObjectTypeCalcer.

virtual const ObjectImpType* ObjectCalcer::impRequirement ( ObjectCalcer *  o,
const std::vector< ObjectCalcer * > &  os 
) const
pure virtual

An ObjectCalcer expects its parents to have an ObjectImp of a certain type.

This method returns the ObjectImpType that o should have. os is a list of all the parents in order, and o is part of it. This method will return the ObjectImpType that the parent should at least be. For example, a Translated object can translate any sort of object, so it will return ObjectImp::stype() here ( the topmost ObjectImpType, that all other ObjectImpType's inherit ).

Implemented in ObjectPropertyCalcer, ObjectConstCalcer, ObjectTypeCalcer, and MeasureTransportCalcer.

virtual bool ObjectCalcer::isDefinedOnOrThrough ( const ObjectCalcer *  o) const
pure virtual

If this ObjectCalcer represents a curve, return true if the given point is by construction on this curve.

If this ObjectCalcer represents a point, return true if this point is by construction on the given curve.

Implemented in ObjectPropertyCalcer, ObjectConstCalcer, and ObjectTypeCalcer.

bool ObjectCalcer::isFreelyTranslatable ( ) const
virtual

Returns whether this ObjectCalcer can be translated at any position in the coordinate plane.

Note that a ConstrainedPointType can be moved, but cannot be moved everywhere.

Reimplemented in ObjectTypeCalcer.

Definition at line 265 of file object_calcer.cc.

std::vector< ObjectCalcer * > ObjectCalcer::movableParents ( ) const
virtual

Moving an object most of the time signifies invoking changes in some of its parents.

This method returns the set of parents that will be changed in the move() method. The object itself should not be included.

Reimplemented in ObjectTypeCalcer.

Definition at line 316 of file object_calcer.cc.

void ObjectCalcer::move ( const Coordinate &  to,
const KigDocument &  doc 
)
virtual

This is the method that does the real moving work.

It will be invoked to tell the object to move to the new location to. After this, the calc() method will be calced, so you only need to do the real changes in this method, updating the ObjectImp should be done in the calc() method, not here.

Reimplemented in ObjectTypeCalcer.

Definition at line 276 of file object_calcer.cc.

Coordinate ObjectCalcer::moveReferencePoint ( ) const
virtual

In order to support simultaneously moving objects that are in different locations, we need for each object a location that it is assumed to be at, at the moment the moving starts.

This method returns such a point.

Reimplemented in ObjectTypeCalcer.

Definition at line 270 of file object_calcer.cc.

virtual std::vector<ObjectCalcer*> ObjectCalcer::parents ( ) const
pure virtual

Returns the parent ObjectCalcer's of this ObjectCalcer.

Implemented in ObjectPropertyCalcer, ObjectConstCalcer, ObjectTypeCalcer, and MeasureTransportCalcer.

void ObjectCalcer::ref ( )
protected

Definition at line 80 of file object_calcer.cc.

Friends And Related Function Documentation

void intrusive_ptr_add_ref ( ObjectCalcer *  p)
friend

ObjectCalcer's are reference counted.

They all take a reference to their parents, and some other classes like ObjectHolder take a reference to some ObjectCalcer's that they don't want to see deleted.

Definition at line 90 of file object_calcer.cc.

void intrusive_ptr_release ( ObjectCalcer *  p)
friend

Definition at line 95 of file object_calcer.cc.

Member Data Documentation

std::vector<ObjectCalcer*> ObjectCalcer::mchildren
protected

Definition at line 84 of file object_calcer.h.

int ObjectCalcer::refcount
protected

Definition at line 77 of file object_calcer.h.


The documentation for this class was generated from the following files:
  • object_calcer.h
  • object_calcer.cc
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:35:41 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kig

Skip menu "kig"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal