Home

DELTA_STATE Class Reference
[History]

Contains a sequence of bulletin boards. More...

#include <bulletin.hxx>

Inheritance diagram for DELTA_STATE:

Inheritance graph
[legend]
Collaboration diagram for DELTA_STATE:

Collaboration graph
[legend]

List of all members.

Public Member Functions

void add (BULLETIN_BOARD *bb)
 Adds a new bulletin board to this delta state.
logical backward () const
 Rolls the current state to the previous one in the DELTA_STATE.
BULLETIN_BOARDbb () const
 Returns the bb_ptr.
void clear_history_ptrs ()
 Clears reference to this history from entities in the delta state.
void compress ()
 Performs compression on a given DELTA_STATE.
void debug (int id, int level, FILE *fname=debug_file_ptr) const
 Outputs debug information about DELTA_STATE to the debug file or to the specified file.
void debug (FILE *fname=debug_file_ptr) const
 Outputs debug information about DELTA_STATE to the debug file or to the specified file.
void debug_list (DELTA_STATE_LIST &dslist, int id, int level, int ent_level=0, FILE *fname=debug_file_ptr)
 Prints debugging information with annotation support.
void debug_list (DELTA_STATE_LIST &dslist, int level=0, FILE *fname=debug_file_ptr)
 Aids in debugging the DELTA_STATE.
 DELTA_STATE (HISTORY_STREAM *hist=NULL)
 C++ initialize constructor requests memory for this object and populates it with the data supplied as arguments.
void find_bulletins (spa_is_function tester, BULLETIN_LIST &blist) const
 Function for finding annotations.
void find_bulletins (int type, int level, BULLETIN_LIST &blist) const
 Function for finding annotations.
void find_entities (enum ENTITY_TYPE type, ENTITY_LIST &elist)
 Searches in entity list for a type of entity recorded in the bulletin.
logical fix_pointers (ENTITY_ARRAY &elist, HISTORY_STREAM_LIST &hslist, DELTA_STATE_LIST &dslist)
 The fix_pointers method for each entity in the restore array is called, with the array as argument.
logical forward () const
 Rolls the current state to the next one in the DELTA_STATE.
STATE_ID from () const
 Read only access to the originating DELTA_STATE.
const char * get_name ()
 Returns a name string of the DELTA_STATE.
DELTA_STATE_user_data * get_user_data ()
 Returns the user data that was attached to the DELTA_STATE.
logical hide (logical h)
 Hides the given DELTA_STATE.
HISTORY_STREAMhistory_stream ()
 Returns the owner of the stream.
STATE_ID id () const
 Returns the STATE_ID.
logical is_empty () const
 Returns true if the DELTA_STATE contains no BULLETINs.
logical is_named (const char *n)
 Returns the name of the delta state.
void merge_next ()
 Merge with the next DELTA_STATE.
logical mixed_streams (HISTORY_STREAM *&alternate_hs)
 Checks for mixed history streams.
DELTA_STATEnext () const
 Returns the next DELTA_STATE.
DELTA_STATEpartner () const
 Returns the partner DELTA_STATE.
DELTA_STATEprev () const
 Returns the previous DELTA_STATE.
void remove (BULLETIN_BOARD *bb)
 Removes a new bulletin board from this delta state.
void reset_history_on_delete ()
 Reset the history stream on deletion.
logical restore ()
 Restores DELTA_STATE to the state provided by a previous bulletin board.
void roll ()
 Rolls back over a complete delta state, inverting it so as to allow roll forward the next time.
void scan (DELTA_STATE_LIST &dslist) const
 Adds connectees to the delta state list.
void set_from (STATE_ID from_id)
 Sets the identification of the from STATE_ID.
void set_history_ptrs ()
 Sets history pointers.
void set_name (const char *n)
 Changes name of DELTA_STATE.
void set_to (STATE_ID to_id)
 Sets the identification of the to_state to STATE_ID.
void set_user_data (DELTA_STATE_user_data *d)
 Permits users to change user data in DELTA_STATE.
int size (logical include_backups=TRUE) const
 Returns the size of the DELTA_STATE.
STATE_ID to () const
 Read only access to the destination DELTA_STATE.
 ~DELTA_STATE ()
 C++ destructor, deleting a DELTA_STATE and their bulletins,that constitute the DELTA_STATE.

Public Attributes

BULLETIN_BOARDbb_ptr
 Pointer to bulletin board.
STATE_ID from_state
 Previous modeler state.
logical hidden
 Not counted for roll_n_states or max_states.
DELTA_STATE_LISTmerged_states
 The delta states merged into this one.
DELTA_STATEmerged_with_ds
 The delta state this one merges into.
char * name_str
 Name string for the DELTA_STATE.
DELTA_STATEnext_ds
 A delta state whose from_state equals this to_state.
HISTORY_STREAMowner_stream
 Allows history stream to be found from delta state.
DELTA_STATEpartner_ds
 Circular list of delta states with same from_state.
DELTA_STATEprev_ds
 The delta state whose to_state equals this from_state.
logical rolls_back
 Delta records a backward change.
STATE_ID this_state
 Sets when state is noted.
STATE_ID to_state
 Next modeler state to change to.
DELTA_STATE_user_data * user_data
 Pointer to optional application data attached to the DELTA_STATE.


Detailed Description

Contains a sequence of bulletin boards.



Role: This class contains a sequence of bulletin boards that change the modeler from the from_state to the to_state. The bulletin boards are created between successive calls to api_note_state. They are chained together in a singly-linked list beginning at bb_ptr.

See also:
BULLETIN_BOARD, DELTA_STATE_LIST, ENTITY_TYPE, HISTORY_STREAM, BULLETIN_BOARD

Constructor & Destructor Documentation

DELTA_STATE::DELTA_STATE ( HISTORY_STREAM hist = NULL  ) 

C++ initialize constructor requests memory for this object and populates it with the data supplied as arguments.



Role: Creates a new state, with the to_state set to the current state, the from_state set to 0, and the bb_ptr set to NULL.

Parameters:
hist history.

DELTA_STATE::~DELTA_STATE (  ) 

C++ destructor, deleting a DELTA_STATE and their bulletins,that constitute the DELTA_STATE.


Member Function Documentation

void DELTA_STATE::add ( BULLETIN_BOARD bb  ) 

Adds a new bulletin board to this delta state.



Parameters:
bb bulletin board.

logical DELTA_STATE::backward (  )  const [inline]

Rolls the current state to the previous one in the DELTA_STATE.

BULLETIN_BOARD* DELTA_STATE::bb (  )  const [inline]

Returns the bb_ptr.

void DELTA_STATE::clear_history_ptrs (  ) 

Clears reference to this history from entities in the delta state.

void DELTA_STATE::compress (  ) 

Performs compression on a given DELTA_STATE.

void DELTA_STATE::debug ( int  id,
int  level,
FILE *  fname = debug_file_ptr 
) const

Outputs debug information about DELTA_STATE to the debug file or to the specified file.



Parameters:
id entity id.

level entity level.

fname file name.

void DELTA_STATE::debug ( FILE *  fname = debug_file_ptr  )  const

Outputs debug information about DELTA_STATE to the debug file or to the specified file.



Parameters:
fname file name.

void DELTA_STATE::debug_list ( DELTA_STATE_LIST dslist,
int  id,
int  level,
int  ent_level = 0,
FILE *  fname = debug_file_ptr 
)

Prints debugging information with annotation support.



Role: The second and third arguments specify a branch of the entity derivation hierarchy to call debug_ent on, in addition to the normal bulletin board debugging information. For annotations we use ANNOTATION_TYPE and ANNOTATION_LEVEL.

Parameters:
dslist delta state.

id entity id.

level level in state.

ent_level entity level.

fname file name.

void DELTA_STATE::debug_list ( DELTA_STATE_LIST dslist,
int  level = 0,
FILE *  fname = debug_file_ptr 
)

Aids in debugging the DELTA_STATE.



Parameters:
dslist delta state.

level level in state.

fname file name.

void DELTA_STATE::find_bulletins ( spa_is_function  tester,
BULLETIN_LIST blist 
) const

Function for finding annotations.



Role: The first two arguments specify a branch of the entity derivation hierarchy to return bulletins for. In this form the tester identifies the type of entity to look for. For annotation use, we can use ANNOTATION_TYPE and ANNOTATION_LEVEL. It may also be useful to be more specific, such as SWEEP_ANNOTATION_TYPE and SWEEP_ANNOTATION_LEVEL. The is_XXXX functions generated by the ENTITY_DEF macro work well.

Parameters:
tester test function.

blist bulletin list.

void DELTA_STATE::find_bulletins ( int  type,
int  level,
BULLETIN_LIST blist 
) const

Function for finding annotations.



Role: The first two arguments specify a branch of the entity derivation hierarchy to return bulletins for. For annotation use, we can use ANNOTATION_TYPE and ANNOTATION_LEVEL. It may also be useful to be more specific, such as SWEEP_ANNOTATION_TYPE and SWEEP_ANNOTATION_LEVEL. The is_XXXX functions generated by the ENTITY_DEF macro work well.

Parameters:
type entity type.

level entity level.

blist bulletin list.

void DELTA_STATE::find_entities ( enum ENTITY_TYPE  type,
ENTITY_LIST elist 
)

Searches in entity list for a type of entity recorded in the bulletin.



Parameters:
type type of entity.

elist entity list.

logical DELTA_STATE::fix_pointers ( ENTITY_ARRAY &  elist,
HISTORY_STREAM_LIST hslist,
DELTA_STATE_LIST dslist 
)

The fix_pointers method for each entity in the restore array is called, with the array as argument.



Role: This calls fix_common, which calls its parent's fix_common, and then corrects any pointers in the derived class. In practice there is never anything special for fix_pointers to do, but it is retained for consistency and compatibility. (Supplied by the ENTITY_FUNCTIONS and UTILITY_DEF macros.)

Parameters:
elist pointers to fix.

hslist hist stream list.

dslist delta state list.

logical DELTA_STATE::forward (  )  const [inline]

Rolls the current state to the next one in the DELTA_STATE.

STATE_ID DELTA_STATE::from (  )  const [inline]

Read only access to the originating DELTA_STATE.

const char* DELTA_STATE::get_name (  )  [inline]

Returns a name string of the DELTA_STATE.

DELTA_STATE_user_data* DELTA_STATE::get_user_data (  )  [inline]

Returns the user data that was attached to the DELTA_STATE.

logical DELTA_STATE::hide ( logical  h  )  [inline]

Hides the given DELTA_STATE.



Parameters:
h hide or not.

HISTORY_STREAM* DELTA_STATE::history_stream (  )  [inline]

Returns the owner of the stream.

STATE_ID DELTA_STATE::id (  )  const [inline]

Returns the STATE_ID.

logical DELTA_STATE::is_empty (  )  const

Returns true if the DELTA_STATE contains no BULLETINs.

logical DELTA_STATE::is_named ( const char *  n  ) 

Returns the name of the delta state.



Parameters:
n name of delta state.

void DELTA_STATE::merge_next (  ) 

Merge with the next DELTA_STATE.



Role: Keeping all the BULLETINs and BULLETIN_BOARDs from both states in the correct order in this state, and then deleting next. If the next state had partners, indicating a branch, the branch is pruned as there would no longer be a sensible way to roll the model to states on the branch. Repeated calls can be used to compress any linear range of delta states with the same roll direction, into one state.

logical DELTA_STATE::mixed_streams ( HISTORY_STREAM *&  alternate_hs  ) 

Checks for mixed history streams.



Parameters:
alternate_hs alternate stream.

DELTA_STATE* DELTA_STATE::next (  )  const [inline]

Returns the next DELTA_STATE.

DELTA_STATE* DELTA_STATE::partner (  )  const [inline]

Returns the partner DELTA_STATE.

DELTA_STATE* DELTA_STATE::prev (  )  const [inline]

Returns the previous DELTA_STATE.

void DELTA_STATE::remove ( BULLETIN_BOARD bb  ) 

Removes a new bulletin board from this delta state.



Parameters:
bb bulletin board.

void DELTA_STATE::reset_history_on_delete (  )  [inline]

Reset the history stream on deletion.

logical DELTA_STATE::restore (  ) 

Restores DELTA_STATE to the state provided by a previous bulletin board.

void DELTA_STATE::roll (  ) 

Rolls back over a complete delta state, inverting it so as to allow roll forward the next time.

void DELTA_STATE::scan ( DELTA_STATE_LIST dslist  )  const

Adds connectees to the delta state list.



Parameters:
dslist change state list.

void DELTA_STATE::set_from ( STATE_ID  from_id  )  [inline]

Sets the identification of the from STATE_ID.

void DELTA_STATE::set_history_ptrs (  ) 

Sets history pointers.

void DELTA_STATE::set_name ( const char *  n  ) 

Changes name of DELTA_STATE.



Parameters:
n name.

void DELTA_STATE::set_to ( STATE_ID  to_id  )  [inline]

Sets the identification of the to_state to STATE_ID.



Parameters:
to_id state ID number.

void DELTA_STATE::set_user_data ( DELTA_STATE_user_data *  d  )  [inline]

Permits users to change user data in DELTA_STATE.



Parameters:
d pointer to data.

int DELTA_STATE::size ( logical  include_backups = TRUE  )  const

Returns the size of the DELTA_STATE.



Parameters:
include_backups include backups as part of size.

STATE_ID DELTA_STATE::to (  )  const [inline]

Read only access to the destination DELTA_STATE.


Member Data Documentation

Pointer to bulletin board.

Previous modeler state.

Not counted for roll_n_states or max_states.

The delta states merged into this one.

The delta state this one merges into.

Name string for the DELTA_STATE.

A delta state whose from_state equals this to_state.

Allows history stream to be found from delta state.

Circular list of delta states with same from_state.

The delta state whose to_state equals this from_state.

Delta records a backward change.

Sets when state is noted.

Next modeler state to change to.

DELTA_STATE_user_data* DELTA_STATE::user_data

Pointer to optional application data attached to the DELTA_STATE.