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

kig

Public Member Functions | List of all members
FakeClass Class Reference

#include <common.h>

Public Member Functions

 FakeClass (const ObjectType *)
 

Detailed Description

The below is a trick.

ObjectType's implement the singleton pattern. There can be only one of them at each time. This one instance of them needs to be constructed at some time, within the following restrictions:

  1. They need to be constructed in the right order: if one ObjectType uses another in its constructor, the other needs to be constructed first. To achieve this, we use a scheme with ::instance() functions, that have a static variable in the body of the function ( if we would define them static outside of the function body, C++ would provide no guarantee on the order they would be called in ).
  2. They need to be constructed before Kig tries to use them. They need to be added to the ObjectTypeFactory before anyone tries to use that class to fetch a type. The below is a trick to achieve that in combination with the previous. Basically, we add a fake static instance of an empty class that receives the instance of the ObjectType as an argument to its constructor. C++ then guarantees that these things will be constructed before main() is entered.

Thus, for your own ObjectType classes: use the scheme with the static ::instance methods, and add

KIG_INSTANTIATE_OBJECT_TYPE_INSTANCE( MyObjectType)

to the .cpp file of your class.

Definition at line 99 of file objects/common.h.

Constructor & Destructor Documentation

FakeClass::FakeClass ( const ObjectType *  )
inline

Definition at line 101 of file objects/common.h.


The documentation for this class was generated from the following file:
  • objects/common.h
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