< home

Basic exposition elements used to specify exposed functionality.


Classes

class  Exposer
 Used as a base class for UI specification. More...
class  Expo
 Base class for all exposition elements. More...
class  ExposerManifester
 Used to manifest the UI specified by an Exposer. More...
class  VariableExpo
 Exposition class used to access a variable. More...
class  PropertyExpo
 Exposition class used to access a variable which is accessed through a pair of get/set-like methods. More...
class  MethodExpo
 Exposition class used to access a method taking no arguments. More...

OpenExposition Introduction

This page describes the basic constructs used in OpenExposition:

There is also a simple Example that demonstrates the use of these constructs. You can download the compiled example (as well as the source code) for Mac OS X and Windows to try it out - see http://sourceforge.net/projects/openexposition/.

See also:
Basic OpenExposition Principles

Expositions

An exposition is the basic model element that specifies a connection between the computer application and the user. An exposition can be created to specify that the user should have access to a variable or a class method, for example.

Expositions are implemented by the Expo class and its subclasses.

Exposition Properties

Exposers

An exposer serves as a collection of expositions. It can be used to group expositions into units that will be manifested together by an exposer manifester. For example, a graphical user interface manifester might place them in the same window.

Exposers are implemented by the Exposer class. To create an exposer, either derive the Exposer class and configure the expositions in the constructor of the derived class, or create an instance of the Exposer class and then configure the expositions. When you are done configuring the expositions, you must call the exposer's DoneConstructing method.

Exposer Manifesters

Manifersters serve to create an actual interface between an exposer and the user. A manifester could be used to render a graphical user interface with the exposer's exposition elements, or to provide access to the elements through a Python program. Manifesters are derived from the ExposerManifester class.

Example

The following code highlights the most important part of an OpenExposition UI construction.

First, we define a class with some simple functionality.

class Test
{
protected:
    // the flag chooses whether the sum() method will return a+b or a-b
    bool flag;
    // a and b are used in the sum function
    int a;
    double b;
public:
    Test() {a = 1; b = 2.5; flag=false;}
    // this method provides the main functionality of this class
    double sum() {return flag ? a - b : a + b;}
    
    // these are the set/get methods that can be used to access the b variable
    void SetB(double val) {b = val;}
    double GetB() {return b;}
}; // end class Test

We can then derive that class as well as the Exposer class to specify the interface requirements.

class TestExposer : public Test, public Exposer
{
public:
    // Whenever an Exposer constructor is called, the instance is pushed on a stack
    // as the current exposer instance.  All instantiated expositions are automatically
    // assigned to the current exposer.
    TestExposer(string const &name="Test") : Exposer(name)
    {
        // this provides access to a method, which we mark as the "final" action of the exposer
        *new MethodExpo<double,Test>(*this, &Test::sum, "sum")
            << new Property(Property::final);
        // this provides direct access to the flag variable
        *new VariableExpo<bool>(flag, "flag")
            << new InfluencesProperty(GetExpo("sum"));
        // this provides direct access to the a variable
        *new VariableExpo<int>(a, "a")
            << new InfluencesProperty(GetExpo("sum"));
        // this provides access to a variable through a set of get/set methods
        *new PropertyExpo<double, Test>(*this, &Test::GetB, &Test::SetB, "b")
            << new InfluencesProperty(GetExpo("sum"));
        
        // the following call will mark the end of construction for this exposer
        DoneConstructing();
    }
}; // end class TestExposer

An instance of class TestExposer will automatically be manifested through all available exposer manifesters. You can see example screenshots at https://sourceforge.net/project/screenshots.php?group_id=168482.

 

Documentation generated on 14 Jun 2006 for OpenExposition by  doxygen 1.4.6>
Development hosted by SourceForge.net Logo