Module Class Reference

A common base class for all modules. More...

#include <modules.h>

Inheritance diagram for Module:

Inheritance graph
[legend]
Collaboration diagram for Module:

Collaboration graph
[legend]

List of all members.

Classes

struct  SettingItem
 Represents one setting value in a module. More...
struct  SettingType
 Represents the type of one module's setting - without label and description. More...
struct  SettingTypeItem
 Represents the type of one setting - including label, description, etc. More...
union  SettingValue
 Represents one setting - one number, real or integer. More...
struct  TypeInfo
 Information about one module-type. More...

Public Types

enum  CloneMethod
 Two types of cloning, used in clone.
enum  ChoiceType {
  Stop,
  Int,
  IntLog2,
  Float,
  ModuleCombo,
  Combo
}
 Types of a setting. More...

Public Member Functions

template<class M >
M * concreteClone (CloneMethod method) const
 Concrete cloning method - templated by the actual type of the module.
virtual ~Module ()
 Deletes the settings, destroying child modules as well.
virtual const TypeInfoinfo () const =0
 Returns reference to module-type's information, like count and types of settings, etc. Implemented in all modules via macros.

Protected Member Functions

 Module ()
 Initializes an empty module.
virtual ModuleabstractClone (CloneMethod method) const =0
 Cloning method, implemented in all modules via macros.
void file_saveAllSettings (std::ostream &stream)
 Saves all the settings, icluding child modules.
void file_loadAllSettings (std::istream &stream)
 Loads all the settings, icluding child modules (and their settings).
void file_saveModuleType (std::ostream &os, int which)
 Puts a module-identifier in a stream (which is the index in settings).
void file_loadModuleType (std::istream &is, int which)
 Gets an module-identifier from the stream, initializes the pointer in settings with a new empty instance and does some checking (bounds,Iface).
int & settingsInt (int index)
 A shortcut method for working with integer settings.

Static Protected Member Functions

SettingType construction methods
  • to be used within DECLARE_TypeInfo macros when declaring modules


static SettingType settingInt (int min, int defaults, int max, ChoiceType type=Int)
 Creates a bounded integer setting, optionally shown as a power of two.
static SettingType settingFloat (float min, float defaults, float max)
 Creates a bounded real-number setting.
static SettingType settingCombo (const char *text, int defaults)
 Creates a choose-one-of setting shown as a combo-box.
template<class Iface >
static SettingType settingModule (int defaultID)
 Creates a connection to another module (type specified as a template parameter).
template<class Iface >
static SettingType settingModule ()
 A shortcut to set the first compatible module as the default one.

Protected Attributes

SettingItemsettings
 The current setting values of this Module.

Private Member Functions

Construction, destruction and related methods
  • all private, only to be used by ModuleFactory on module prototypes


SettingItemcopySettings (CloneMethod method) const
 Creates a copy of module's settings (includes the whole module subtree).
void initDefaultModuleLinks ()
 Called for prototypes to initialize the default links to other modules.
void nullModuleLinks ()
 Called for prototypes to null links to other modules.
void createDefaultSettings ()
 Called for prototypes to create the settings and inicialize them with defaults.
Moduleoperator= (const Module &)
 Denial of assigment.
 Module (const Module &)
 Denial of copying.

Friends

class ModuleFactory
 Permission for the ModuleFactory to manipulate Modules.

Settings visualization and related methods

  • common code for all modules, implemented in gui.cpp


void widget2settings (const QWidget *widget, int which)
 Reads a setting value from a widget.
void settings2widget (QWidget *widget, int which)
 Writes a setting value into a widget.
void settingsType2widget (QWidget *widget, const SettingTypeItem &typeItem)
 Initializes a widget according to a setting-item type.
virtual void adjustSettings (int which, QTreeWidgetItem *myTree, QGroupBox *setBox)
 Creates or updates settings-box and/or settings-tree. if overridden in derived modules, it is recommended to call this one at first.


Detailed Description

A common base class for all modules.

Definition at line 12 of file modules.h.


Member Enumeration Documentation

Types of a setting.

Enumerator:
Stop  a list-terminator
Int  integer from an interval
IntLog2  integer from an interval prefixed with 2^
Float  real number from an interval
ModuleCombo  a connection to another module (shown as a combo-box)
Combo  choice from a list of strings

Definition at line 19 of file modules.h.


Member Function Documentation

virtual Module* Module::abstractClone ( CloneMethod  method  )  const [protected, pure virtual]

Cloning method, implemented in all modules via macros.

Returns:
a new module
Parameters:
method determines creation of a deep or a shallow copy (zeroed children)

Referenced by Interface< ISquareRanges >::clone(), copySettings(), and ModuleFactory::newModule().

Here is the caller graph for this function:

template<class Iface >
static SettingType Module::settingModule ( int  defaultID  )  [inline, static, protected]

Creates a connection to another module (type specified as a template parameter).

It will be shown as a combo-box and automatically filled by compatible modules. The default possibility can be specified

Definition at line 188 of file modules.h.

References ModuleCombo.


The documentation for this class was generated from the following files:

Generated on Thu Aug 6 22:33:14 2009 for Fractal Image Compressor by  doxygen 1.5.8