Home

acis_scm_entity_mgr Class Reference
[Scheme Toolkit Support]

Concrete entity manager class for ACIS Assembly Modeling with the Scheme example application. More...

#include <acis_scm_entity_mgr.hxx>

Inheritance diagram for acis_scm_entity_mgr:

Inheritance graph
[legend]
Collaboration diagram for acis_scm_entity_mgr:

Collaboration graph
[legend]

List of all members.

Public Member Functions

acis_ha_part_entity_mgracis_ha_part_cast ()
 Dynamic down-cast to acis_ha_part_entity_mgr.
virtual acis_pm_entity_mgracis_pm_cast ()
 Dynamic down-cast to acis_pm_entity_mgr.
acis_scm_entity_mgracis_scm_cast ()
 Dynamic down-cast to acis_scm_entity_mgr.
 acis_scm_entity_mgr (PART *part=NULL)
 Default constructor.
virtual void * customer_cast ()
 Dynamic down-cast to a customer sub-type (represented by void*).
virtual default_entity_mgrdefault_cast ()
 Dynamic down-cast to default_entity_mgr.
ASM_ASSEMBLYget_assembly_ptr () const
 Returns a pointer to the entity manager's ASM_ASSEMBLY object, if any.
asm_modelget_model () const
 Returns the asm_model associated with this entity manager.
PARTget_part () const
 Gets the PART bound to this entity manager.
void * pm_customer_cast ()
 Dynamic down-cast to a customer sub-type (represented by void*).
void set_model_info (asm_model_info const &context)
 Changes the model_info information associated with the entity manager's bound PART.
void set_part (PART *part)
 Binds this entity manager to the specified PART.

Protected Member Functions

virtual acis_pm_entity_mgracis_pm_cast_vf ()
 Dynamic down-cast to acis_pm_entity_mgr.
virtual void add_entities_vf (ENTITY_LIST &ents, logical restoring_asat)
 Notifies the entity manager of entities that are being added to it.
virtual void clear_vf ()
 Asks a subclass to put itself into the "empty" state.
virtual void * customer_cast_vf ()
 Dynamic down-cast to a customer sub-type (represented by void*).
virtual default_entity_mgrdefault_cast_vf ()
 Dynamic down-cast to default_entity_mgr.
virtual void done_restoring_vf ()
 Notifies the entity manager of the completion of the restore process.
virtual void entities_changed_vf (outcome &result, asm_event_type &ev_type)
 Notifies the entity manager of changes made to its contents while the entity manager was activated.
virtual ASM_ASSEMBLYget_assembly_ptr_vf () const
 Returns a pointer to the assembly entity, if any, owned by this entity manager.
virtual HISTORY_STREAMget_history_vf ()
 Returns a pointer to the history stream associated with the entity manager.
virtual asm_model_info get_model_info_vf () const
 Returns a structure containing information about the associated assembly model.
virtual logical get_models_which_share_history_vf (asm_model_list &sharing_models)
 Returns a list of all models that share the manager's history stream (including the manager's model).
virtual void get_top_level_entities_vf (ENTITY_LIST &ents, logical include_assemblies) const
 Returns an entity list containing pointers to all top-level entities owned by the entity manager.
virtual void nested_activate_vf (asm_model const *from_model) const
 Requests that the entity manager make its modeling context (that is, history stream, units, tolerances) active in a nested way.
virtual void nested_deactivate_vf (asm_model const *to_model) const
 Requests that the entity manager deactivate its modeling context (that is, history stream, units, tolerances).
virtual logical owned_by_model_vf () const
 Asks a subclass if it is owned by its associated model.
virtual void set_assembly_ptr_vf (ASM_ASSEMBLY *assembly_ptr)
 Transfers ownership of an assembly entity to this entity manager.
virtual void sub_model_changed_vf (asm_event_type ev_type, asm_model *changed_model)
 Notifies the entity manager that a change was made to one of its sub-models.
void unbind ()
 Unbinds the manager from the owning model.
virtual void unbind_vf (asm_model *model)
 Notifies the entity manager that its asm_model is breaking their association.


Detailed Description

Concrete entity manager class for ACIS Assembly Modeling with the Scheme example application.



Role: The acis_scm_entity_mgr (and its corresponding factory) is used to integrate ACIS Assembly Modeling with the Scheme example application. The implementations of acis_scm_entity_mgr and acis_scm_entity_mgr_factory are provided as example code. Please refer to the assembly modeling technical articles for further details.

See also:
acis_pm_entity_mgr, acis_scm_entity_mgr

Constructor & Destructor Documentation

acis_scm_entity_mgr::acis_scm_entity_mgr ( PART part = NULL  ) 

Default constructor.



Role: Constructs an unbound acis_scm_entity_mgr object. If a PART object is specified, it will be bound to the new entity manager.

Parameters:
part part to be bound.


Member Function Documentation

acis_ha_part_entity_mgr* acis_pm_entity_mgr::acis_ha_part_cast (  )  [inherited]

Dynamic down-cast to acis_ha_part_entity_mgr.



Role: Downcasts this pointer to an acis_ha_part_entity_mgr if the concrete type of this is acis_scm_entity_mgr or a sub-class.

Returns NULL if this is not an acis_ha_part_entity_mgr. This method must not be overridden by customers.

virtual acis_pm_entity_mgr* asm_model_entity_mgr::acis_pm_cast (  )  [virtual, inherited]

Dynamic down-cast to acis_pm_entity_mgr.



Role: Downcasts this pointer to an acis_pm_entity_mgr if the concrete type of this is acis_pm_entity_mgr or a sub-class.

Returns NULL if this is not an acis_pm_entity_mgr.

virtual acis_pm_entity_mgr* acis_pm_entity_mgr::acis_pm_cast_vf (  )  [protected, virtual, inherited]

Dynamic down-cast to acis_pm_entity_mgr.



Role: Downcasts this pointer to an acis_pm_entity_mgr if the concrete type of this is acis_pm_entity_mgr or a sub-class.

Returns NULL if this is not an acis_pm_entity_mgr. This routine must not be overridden by customers.

Reimplemented from asm_model_entity_mgr.

acis_scm_entity_mgr* acis_ha_part_entity_mgr::acis_scm_cast (  )  [inherited]

Dynamic down-cast to acis_scm_entity_mgr.



Role: Downcasts this pointer to an acis_scm_entity_mgr if the concrete type of this is acis_scm_entity_mgr or a sub-class.

Returns NULL if this is not an acis_scm_entity_mgr. This routine must not be overridden by customers.

virtual void acis_pm_entity_mgr::add_entities_vf ( ENTITY_LIST ents,
logical  restoring_asat 
) [protected, virtual, inherited]

Notifies the entity manager of entities that are being added to it.



Role: Subclasses must override this function.

This method is used to give ownership of a set of entities to the entity manager. If the restoring_asat flag is TRUE, then the entities are being added to the manager as part of the ASAT restore process. In this case, the model will only be in a partially constructed state, in that submodels may not have yet been read in, so that processing (such as rendering) of these entities should be deferred to the done_restoring_vf method.

Parameters:
ents the entities being restored. Note that these may not all be top-level entities.
restoring_asat indicates whether the entities are to be added to the manager as part of the ASAT restore process.

Implements asm_model_entity_mgr.

virtual void acis_pm_entity_mgr::clear_vf (  )  [protected, virtual, inherited]

Asks a subclass to put itself into the "empty" state.



Role: Subclasses must override this function.

This routine is intended to ensure that all deletions to be done by this entity manager are done before static destruction. It will be called by unbind, as part of unbinding the entity mananager from its associated asm_model object.

This routine should delete all entities and history streams owned by the asm_model_entity_mgr subclass object, including the assembly (if any) and all backup copies of these objects owned by the object's history stream. Deleting entities is done by calling api_del_entity or api_del_entity_list; deleting backup copies is done by deleting delta states from the history stream.

Note that the assembly entity is always owned by the asm_model_entity_mgr subclass object, and so must always be deleted by this routine.

Note that the history stream and/or entities may be owned by the customer's entity management object (which is wrapped by the asm_model_entity_mgr subclass object) rather than by the asm_model_entity_mgr subclass object. Any such objects owned by the customer's entity management object need not be deleted by this routine; instead they may be deleted by the customer's entity management object, with the caveat that the customer must ensure that any delta states containing backup copies of entities owned by the asm_model_entity_mgr subclass object are deleted. Practically speaking, this means that this routine should either call api_delete_history, delete_all_delta_states with a keep_stream flag of TRUE, or api_asm_prune_assembly_history if the asm_model_entity_mgr subclass object has ever owned an assembly object, whether or not it has been deleted. Note that this will result in a side effect for other models whose entity managers share this one's history stream, namely that their history and entities will be deleted as well.

For the case of the acis_pm_entity_mgr supplied with the ACIS Part Management component, the asm_model_entity_mgr subclass object referred to above is an acis_pm_entity_mgr object, while the customer's entity management object referred to above is the corresponding PART object. In that case, this routine could be implemented by calling the PART::clear method, which deletes all entities and delta states associated with the PART. For a more sophisticated example implementation using api_prune_history, refer to the actual implementation of acis_pm_entity_mgr::clear_vf in the example source files.

Entities should be deleted with api_del_entity_list.

History streams should be deleted with api_delete_history.

Note that the entity manager destructor should not delete any entities, because it may be called during static destruction after the history streams have already been deleted.

This routine will not be called within a MODEL_BEGIN/MODEL_END block, so it is the subclass' responsibility to ensure that operations are performed in the correct history stream, to use API_BEGIN/API_END blocks where necessary, and to ensure that the history stream is reset to its original value upon exit.

Implements asm_model_entity_mgr.

virtual void* asm_model_entity_mgr::customer_cast (  )  [virtual, inherited]

Dynamic down-cast to a customer sub-type (represented by void*).



Role: The customer_cast method is the mechanism for customers to determine whether a pointer to an asm_model_entity_mgr is pointing to a customer-defined subclass of asm_model_entity_mgr or a subclass provided by Spatial. If this method returns a non-NULL void*, then the customer will know that the pointer can safely be down-cast to the customer-defined subclass of asm_model_entity_mgr. A Spatial-defined subclass of asm_model_entity_mgr will never return a non-NULL value from this method.

virtual void* asm_model_entity_mgr::customer_cast_vf (  )  [protected, virtual, inherited]

Dynamic down-cast to a customer sub-type (represented by void*).



Role: The customer_cast method is the mechanism for customers to determine whether a pointer to an asm_model_entity_mgr is pointing to a customer-defined subclass of asm_model_entity_mgr or a subclass provided by Spatial. Customers who derive their own subclass of asm_model_entity_mgr must override this routine to return the this pointer of the object. If this method returns a non-NULL void*, then the customer will know that the pointer can safely be down-cast to the customer-defined subclass of asm_model_entity_mgr. A Spatial-defined subclass of asm_model_entity_mgr will never return a non-NULL value from this method.

virtual default_entity_mgr* asm_model_entity_mgr::default_cast (  )  [virtual, inherited]

Dynamic down-cast to default_entity_mgr.



Role: Downcasts this pointer to a default_entity_mgr if the concrete type of this is default_entity_mgr or a sub-class.

Returns NULL if this is not a default_entity_mgr.

virtual default_entity_mgr* asm_model_entity_mgr::default_cast_vf (  )  [protected, virtual, inherited]

Dynamic down-cast to default_entity_mgr.



Role: Downcasts this pointer to a default_entity_mgr if the concrete type of this is default_entity_mgr or a sub-class.

This routine should be overridden by customer classes that are directly derived from asm_model_entity_mgr. A default implementation of NULL is provided for non-customer classes, or for customer subclasses that are derived from other Spatial entity managers (that is, that are derived from Spatial-supplied subclasses of asm_model_entity_mgr).

Reimplemented in default_entity_mgr.

virtual void acis_scm_entity_mgr::done_restoring_vf (  )  [protected, virtual]

Notifies the entity manager of the completion of the restore process.



Role: This method is called at the end of the restore process, when all models that were successfully read in are in a valid state. It is intended to give the customer a chance to process the entities that were added to it by the method add_entities_vf.

Reimplemented from acis_ha_part_entity_mgr.

virtual void asm_model_entity_mgr::entities_changed_vf ( outcome result,
asm_event_type ev_type 
) [protected, virtual, inherited]

Notifies the entity manager of changes made to its contents while the entity manager was activated.



Role: This method is used to notify the customer's entity management object of the severity of changes that were made to the entities owned by the object by assembly modeling while the object was active. The event type is passed by reference so that customer code can perform error recovery operations that adjust the type of event. This routine is called before nested_deactivate_vf during the MODEL_END portion of a model block.

Parameters:
result outcome object from the last API operation performed while active.
ev_type severity of the change. This will have a value of ASM_BREP_GEOM_CHANGE, ASM_COMP_GEOM_CHANGE, ASM_BREP_RENDER_CHANGE, ASM_COMP_RENDER_CHANGE, ASM_OTHER_CHANGE, or ASM_NO_CHANGE.

See also:
asm_event_type

ASM_ASSEMBLY* asm_model_entity_mgr::get_assembly_ptr (  )  const [inherited]

Returns a pointer to the entity manager's ASM_ASSEMBLY object, if any.



Role: This routine returns a pointer to the assembly entity owned by the entity manager. It returns NULL if the entity manager does not own an assembly.

virtual ASM_ASSEMBLY* acis_pm_entity_mgr::get_assembly_ptr_vf (  )  const [protected, virtual, inherited]

Returns a pointer to the assembly entity, if any, owned by this entity manager.



Role: Subclasses must override this function.

Implements asm_model_entity_mgr.

virtual HISTORY_STREAM* acis_pm_entity_mgr::get_history_vf (  )  [protected, virtual, inherited]

Returns a pointer to the history stream associated with the entity manager.



Role: Subclasses must override this function.

This routine should return a pointer to the history stream containing the entities owned by the entity manager. It is primarily used during save and restore to determine which models share history streams. This routine should always return a non-NULL value, even if the entity manager is using a global default history stream.

Implements asm_model_entity_mgr.

asm_model* asm_model_entity_mgr::get_model (  )  const [inherited]

Returns the asm_model associated with this entity manager.



Role: Returns the asm_model object to which this entity manager is bound.

virtual asm_model_info acis_pm_entity_mgr::get_model_info_vf (  )  const [protected, virtual, inherited]

Returns a structure containing information about the associated assembly model.



Role: Subclasses must override this function.

This routine is used to query the entity manager for information about the model that is to be saved to an ASAT file. This routine may be replaced by individual queries in the future.

Implements asm_model_entity_mgr.

virtual logical acis_pm_entity_mgr::get_models_which_share_history_vf ( asm_model_list sharing_models  )  [protected, virtual, inherited]

Returns a list of all models that share the manager's history stream (including the manager's model).



Role: This routine should add pointers to all of the asm_model objects that own entity managers that share history with this entity manager and return a value of TRUE if successful. It is used as an optimization during save to determine which models must have their entities written to the same entity segment in the ASAT file. A return value of TRUE indicates that the correct sharing_models have been added to this list. A value of FALSE indicates that this routine either is not overridden or that an error has occurred, in which case the calling function will fall back on a less efficient algorithm that uses get_history_vf.

Reimplemented from asm_model_entity_mgr.

PART* acis_pm_entity_mgr::get_part (  )  const [inherited]

Gets the PART bound to this entity manager.

virtual void acis_pm_entity_mgr::get_top_level_entities_vf ( ENTITY_LIST ents,
logical  include_assemblies 
) const [protected, virtual, inherited]

Returns an entity list containing pointers to all top-level entities owned by the entity manager.



Role: Subclasses must override this function.

If the include_assemblies flag is FALSE, then the assembly entity (if one is owned by this entity manager) should be excluded from the list.

Parameters:
ents list of top-level entities owned by the entity manager. An entity is top-level if its owner method returns NULL.
include_assemblies indicates whether the entity manager's assembly pointer (if any) should be included in the list.

Implements asm_model_entity_mgr.

virtual void acis_scm_entity_mgr::nested_activate_vf ( asm_model const *  from_model  )  const [protected, virtual]

Requests that the entity manager make its modeling context (that is, history stream, units, tolerances) active in a nested way.



Role: Subclasses must override this function.

This method is used to pass a request to the customer's entity management object that it make itself active, so that operations can be performed on entities owned by the entity management object. This routine is called during the MODEL_BEGIN portion of a model block.

Parameters:
from_model the currently active model. NULL if this is the outermost call to nested_activate_vf.

Reimplemented from acis_pm_entity_mgr.

virtual void acis_scm_entity_mgr::nested_deactivate_vf ( asm_model const *  to_model  )  const [protected, virtual]

Requests that the entity manager deactivate its modeling context (that is, history stream, units, tolerances).



Role: Subclasses must override this function.

This method is used to pass a request to the customer's entity management object that it deactivate itself and reactivate the previously active object. It is called during the MODEL_END portion of a model block, after entity_changed_vf.

Parameters:
to_model previously active model. NULL if deactivating the outermost call to nested_activate_vf.

Reimplemented from acis_pm_entity_mgr.

virtual logical acis_pm_entity_mgr::owned_by_model_vf (  )  const [protected, virtual, inherited]

Asks a subclass if it is owned by its associated model.



Role: Subclasses must override this function.

This routine is intended to allow customers to configure the ownership policy of their entity managers. If the return value is TRUE, then unbinding the manager from its associated model will result in a call ACIS_DELETE on the manager. If the return value is FALSE, then the customer has responsibility for ensuring that unbound manager objects are deleted.

Implements asm_model_entity_mgr.

void* acis_pm_entity_mgr::pm_customer_cast (  )  [inherited]

Dynamic down-cast to a customer sub-type (represented by void*).



Role: The customer_cast method is the mechanism for customers to determine whether a pointer to an acis_pm_entity_mgr is pointing to a customer-defined subclass of acis_pm_entity_mgr or a subclass provided by Spatial. Customers who derive their own subclass of acis_pm_entity_mgr must override this routine to return the this pointer of the object. If this method returns a non-NULL void*, then the customer will know that the pointer can safely be down-cast to the customer-defined subclass of acis_pm_entity_mgr. A Spatial-defined subclass of acis_pm_entity_mgr will never return a non-NULL value from this method.

virtual void acis_pm_entity_mgr::set_assembly_ptr_vf ( ASM_ASSEMBLY assembly_ptr  )  [protected, virtual, inherited]

Transfers ownership of an assembly entity to this entity manager.



Role: Subclasses must override this function.

Parameters:
assembly_ptr pointer to the new assembly entity. If NULL, the entity manager should delete its old assembly pointer, if it owns one, using api_del_entity or api_del_entity_list. If non-NULL and the entity manager already owns an assembly, this routine should call sys_error.

Implements asm_model_entity_mgr.

void acis_pm_entity_mgr::set_model_info ( asm_model_info const &  context  )  [inherited]

Changes the model_info information associated with the entity manager's bound PART.

void acis_pm_entity_mgr::set_part ( PART part  )  [inherited]

Binds this entity manager to the specified PART.

Parameters:
part part to be bound.

virtual void acis_scm_entity_mgr::sub_model_changed_vf ( asm_event_type  ev_type,
asm_model changed_model 
) [protected, virtual]

Notifies the entity manager that a change was made to one of its sub-models.



Role: This method is used to notify the customer's entity management object that a sub-model has changed. This allows the customer object to, for example, re-render its assembly. This routine is called during the MODEL_END portion of a model block, after nested_deactivate_vf. It is also called by asm_model::contents_changed.

Parameters:
ev_type severity of the change. This will have a value of ASM_BREP_GEOM_CHANGE, ASM_COMP_GEOM_CHANGE, ASM_BREP_RENDER_CHANGE, ASM_COMP_RENDER_CHANGE, ASM_OTHER_CHANGE, or ASM_NO_CHANGE.
changed_model indicates the sub-model that has changed.

Reimplemented from acis_ha_part_entity_mgr.

void asm_model_entity_mgr::unbind (  )  [protected, inherited]

Unbinds the manager from the owning model.



Role: This function is used internally by ACIS to unbind an entity manager from its model, usually when the model is being cleaned up or during model destruction. It calls clear_vf, calls unbind_vf, unbinds the manager from the model and, if owned_by_model_vf returns TRUE, calls the destructor of the entity manager.

virtual void acis_scm_entity_mgr::unbind_vf ( asm_model model  )  [protected, virtual]

Notifies the entity manager that its asm_model is breaking their association.



Role: This function is intended to allow the entity manager to take action when it is being unbound from its asm_model object. A default implementation of "do nothing" is provided by the base class, so it is not required that subclasses override this function.

Parameters:
model the model breaking the association. This should agree with the asm_model_entity_mgr's internal model pointer.

Reimplemented from acis_ha_part_entity_mgr.