api_distribute_state_to_streams
List of: Functions
Subjects: History and Roll
Contents: Kernel

Action: Distributes BULLETINs in a DELTA_STATE to one or more HISTORY_STREAMs as directed by a StreamFinder.

Prototype: outcome api_distribute_state_to_streams (


DELTA_STATE* pState,
// delta state to be





// distributed


StreamFinder* pStreamFinder, // used to direct





// distribution


logical clearDelta,
// TRUE to delta





// undistributed





// bulletins


logical hideStates
// TRUE to mark new





// states as hidden


);

Includes: #include "kernel/acis.hxx"

#include "kernel/kernapi/api/api.hxx"

#include "kernel/kernapi/api/kernapi.hxx"

#include "kernel/kerndata/bulletin/bulletin.hxx"

#include "kernel/sg_husk/history/history.hxx"

#include "baseutil/logical.h"

Description: This API distributes the given ds to one or more HISTORY_STREAMs as directed by the given StreamFinder. In each stream distributed to, a new DELTA_STATE will be created to hold the BULLETINs. StreamFinder is a class with one pure virtual function, findStream, which must return the HISTORY_STREAM* associated with the given entity. The findStream function may be called more than once for each entity. In a topology based search, the stream finder can cache data in an early pass, that can be used in a later pass. This is necessary because POINT, CURVE, PCURVE, and SURFACE do not know their owners. When the stream is found for the the corresponding VERTEX, EDGE, COEDGE and FACE, the stream for the subordinate entity can be saved and used in a later pass.


The base StreamFinder class provides functions for finding the stream based on an attached ATTRIB_HISTORY and for maintaining a mapping of entities to streams.


As an example, here is the StreamFinder used by the Part Management Component.


class StreamFinderPM : public StreamFinder {


// A StreamFinder for the PM_HUSK.


// Implements a nested approach to


// distribution in which bulletins go to


// the most specific stream available.


// Part streams are more specific than


// the default stream. Body streams are more


// specific than part streams.

public:


virtual HISTORY_STREAM* findStream( ENTITY* );

};


HISTORY_STREAM*

StreamFinderPM::findStream(


ENTITY* pEntity


)

{


HISTORY_STREAM* pStream = NULL;


// Look for a ATTRIB_HISTORY. If found add


// the entity and associated geometry to


// the stream map.


pStream = findStreamFromAttribute(pEntity);



if( !pStream ) {



// Still no stream?.



// Look for a stream on the part



// the entity is in.



PART* part = get_part(pEntity);



if(part) {




pStream = part->history_stream();



}


}



if( pStream ) {



addToStreamMap(pEntity, pStream);


}



return pStream;

}


The clearDelta argument tells how to handle BULLETINs for which a target stream could not be found. If TRUE they are deleted along with the input delta state. If FALSE, they are left in the input state.


The hideStates argument tells whether to mark the resulting states as hidden in the target streams. api_pm_roll_n_states does not count hidden states. Hidden states are useful for operations that should appear read only to the user. For example, a pick or display operation may calculate boxes and create DELTA_STATEs. One can hide these states so they are not apparent to the user.

Errors: The pointer to ds is NULL.

Library: kernel

Filename: kern/kernel/kernapi/api/kernapi.hxx

Effect: System routine
PDF/KERN/16FNA.PDF
HTM/DATA/KERN/KERN/16FNA/0036.HTM