Flip Reference

 

DocumentLocal Class Reference

Namespace

ohm::flip

Inherits from

ohm::flip::DocumentBase

Declared in

ohm/flip/DocumentLocal.h

Overview

The DocumentLocal class implements a simple Flip document with an embedded client and server side. It should be used to quickly test the Flip framework (as in the Babystep Tutorials ) or as a easier way to implement a Flip application without its collaboration-oriented features. The following sections will only document the public API.

Partial Class Diagram

Methods Overview

Constructor

Initing/Restoring

Manipulating Flip Threads

Manipulating

Methods

DocumentLocal constructor

Constructs a DocumentLocal and bind it a DocumentObserver

               DocumentLocal (DocumentObserverMaster & observer);

init

Init a DocumentLocal with the document located on the disk at path as an fopen styled path. If the file pointed by path does not exist, create a blank document with a root class.

void           init ();

restore

Restore a DocumentLocal .

void           restore ();

create

Creates a Flip thread. Returns a reference to it.

DocumentClientMasterSlot &
               create (DocumentClientMaster & document_master);

pre_release

Pre-release a Flip thread. All Flip threads must be pre-released before they can be released.

void           pre_release ();

release

Release a Flip thread.

void           release ();

AutoUserInputs class

Implements an automatic way to let know the Flip framework that a transaction begin might occur, or that a transaction comes to its end, and acts as a safe guard.

            AutoUserInputs (DocumentBase & document);
virtual     ~AutoUserInputs ();

Each function that might change the model must be surrounded with an automatic variable of the type of this class. Usually this is done in the top function that handles user inputs or timers.

ListingExample of implementation

void  MySystemView::handle_user_inputs (SystemEvent & event)
{
   ohm::flip::AutoUserInputs auto_ui (_document);
   switch (event._type)
   {
      [...]
   }
}

Internally, AutoUserInputs will call notify_pre_user_inputs_tasks and notify_post_user_inputs_tasks in its destructor.

notify_pre_user_inputs_tasks

Indicates to the Flip framework that a transaction might start, and acts as a safe guard.

void           notify_pre_user_inputs_tasks ();

notify_post_user_inputs_tasks

Indicates to the Flip framework that any opened transactions must be ended.

void           notify_post_user_inputs_tasks ();