SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Classes | Typedefs | Enumerations | Functions
smtk::operation Namespace Reference

A common base class for operators that act on resources and a manager to track subclasses. More...

Classes

class  AssignColors
 
class  CoordinateTransform
 Set (or remove) a coordinate transform on components. More...
 
class  CreateResource
 Create an SMTK resource. More...
 
class  CreatorGroup
 
class  DeleterGroup
 A group that holds operations which can delete things. More...
 
class  EditProperties
 Set (or remove) an attribute value on a set of entities. More...
 
class  ExporterGroup
 
class  Group
 This class describes a stateless object associated with an operation manager that provides a unified API for grouping, ungrouping and querying operation groups. More...
 
class  GroupingGroup
 A group that holds operations which can group things. More...
 
class  ImporterGroup
 
class  ImportPythonOperation
 A class for adding python operations to the current session. More...
 
class  ImportResource
 Load an SMTK resource from a file. More...
 
struct  IndexTag
 Tags used to access Container data. More...
 
class  InternalGroup
 A group for operations that are used internally, and should therefore not be displayed to the user as an available operation. More...
 
class  Launchers
 A functor for executing operations and returning futures of the result. More...
 
class  Manager
 An operation Manager is responsible for creating new operations and filtering operations based on input type. More...
 
class  MarkGeometry
 Succinctly indicate components/resources whose geometry has changed. More...
 
class  Metadata
 Operations are registered to an operation manager at runtime with an instance of smtk::operation::Metadata. More...
 
struct  NameTag
 
class  NamingGroup
 A group that holds operations which can name Component. More...
 
class  Operation
 Operation is a base class for all SMTK operations. More...
 
class  ReaderGroup
 
class  ReadResource
 Load an SMTK resource from a file. More...
 
class  Registrar
 
class  RemoveResource
 Remove an SMTK resource from its resource manager. More...
 
class  ResourceIOGroup
 
class  SetProperty
 Set (or remove) a property value on a set of entities. More...
 
struct  SynchronizedCache
 A query cache that updates according to the result outputs of operations. More...
 
class  UngroupingGroup
 A group that holds operations which can group things. More...
 
class  WriteResource
 An operation that uses resource metadata to write resources. More...
 
class  WriterGroup
 
class  XMLOperation
 A specialization of smtk::operation::Operation for operations whose specifications are defined by an XML description that is accessible at compile time. More...
 

Typedefs

typedef smtk::shared_ptr< smtk::operation::OperationOperationPtr
 
typedef smtk::weak_ptr< smtk::operation::OperationWeakOperationPtr
 
typedef smtk::shared_ptr< smtk::operation::ManagerManagerPtr
 
typedef smtk::weak_ptr< smtk::operation::ManagerWeakManagerPtr
 
typedef std::function< void(const Operation::Index &, const std::string &, bool)> GroupObserver
 
typedef smtk::common::Observers< GroupObserver > GroupObservers
 
typedef std::function< std::shared_future< Operation::Result >const Operation::Ptr &)> Launcher
 
typedef boost::multi_index_container< Metadata, indexed_by< ordered_unique< tag< NameTag >, const_mem_fun< Metadata, const std::string &, &Metadata::typeName > >, ordered_unique< tag< IndexTag >, const_mem_fun< Metadata, const smtk::operation::Operation::Index &, &Metadata::index > > > > MetadataContainer
 A multi-index container for accessing operation metadata. More...
 
typedef std::function< void(const Metadata &, bool)> MetadataObserver
 
typedef smtk::common::Observers< MetadataObserver > MetadataObservers
 
typedef std::function< int(const Operation &, EventType, Operation::Result)> Observer
 Signature for methods observing operations. More...
 
typedef smtk::common::Observers< ObserverObservers
 Operation observers are a specialization of the common SMTK observer pattern.
 
using Handler = std::function< void(Operation &, const std::shared_ptr< smtk::attribute::Attribute > &)>
 
typedef std::map< std::weak_ptr< smtk::resource::Resource >, smtk::resource::LockType, std::owner_less< std::weak_ptr< smtk::resource::Resource > > > ResourceAccessMap
 smtk::operation::Operation::Specification is a typedef for std::shared_ptr<smtk::attribute::Resource>. More...
 
typedef std::vector< smtk::attribute::ComponentItemDefinition::Ptr > ComponentDefinitionVector
 

Enumerations

enum  EventType { EventType::WILL_OPERATE, EventType::DID_OPERATE }
 Enumerate events that an operation may encounter. More...
 

Functions

template<typename Container >
SMTK_ALWAYS_EXPORT smtk::attribute::Attribute::Ptr addHintWithAssociations (smtk::operation::Operation::Result result, const Container &associations, const std::string &hintType)
 
template<typename Container >
SMTK_ALWAYS_EXPORT smtk::attribute::Attribute::Ptr addSelectionHint (smtk::operation::Operation::Result result, const Container &associations, smtk::view::SelectionAction selectionAction=smtk::view::SelectionAction::DEFAULT, int selectionValue=1, bool bitwise=false, bool ephemeral=false)
 
template<typename Container >
SMTK_ALWAYS_EXPORT smtk::attribute::Attribute::Ptr addBrowserScrollHint (smtk::operation::Operation::Result result, const Container &associations)
 
template<typename Container >
SMTK_ALWAYS_EXPORT smtk::attribute::Attribute::Ptr addBrowserExpandHint (smtk::operation::Operation::Result result, const Container &associations)
 
template<typename Container >
SMTK_ALWAYS_EXPORT smtk::attribute::Attribute::Ptr addRenderFocusHint (smtk::operation::Operation::Result result, const Container &associations)
 
template<typename Functor >
SMTK_ALWAYS_EXPORT smtk::common::Visited visitSelectionHints (smtk::operation::Operation::Result result, Functor functor)
 
template<typename Functor >
SMTK_ALWAYS_EXPORT smtk::common::Visited visitFocusHintsOfType (smtk::operation::Operation::Result result, const std::string &hintType, Functor functor)
 
template<typename Container >
SMTK_ALWAYS_EXPORT smtk::attribute::Attribute::Ptr addHintWithTasks (smtk::operation::Operation::Result result, const smtk::project::Project::Ptr &project, const Container &taskIds, const std::string &hintType)
 
SMTK_ALWAYS_EXPORT smtk::attribute::Attribute::Ptr addActivateTaskHint (smtk::operation::Operation::Result result, const smtk::project::Project::Ptr &project, smtk::task::Task *task)
 Add a hint to the result indicating the given task should become active.
 
template<typename Functor >
SMTK_ALWAYS_EXPORT smtk::common::Visited visitTaskHintsOfType (smtk::operation::Operation::Result result, const std::string &hintType, Functor functor)
 
bool registerPythonOperations (const smtk::operation::Manager::Ptr &operationManager, const std::string &moduleName)
 
Operation::Parameters createParameters (Operation::Specification specification, const std::string &operatorName, const std::string &parametersName)
 Return a new set of parameters for an operation.
 
Operation::Parameters extractParameters (Operation::Specification specification, const std::string &operatorName)
 Return parameters for an operation if they already exist or a new parameters object otherwise.
 
Operation::Definition extractParameterDefinition (Operation::Specification specification, const std::string &operatorName)
 Return the definition for the operation.
 
Operation::Definition extractResultDefinition (Operation::Specification specification, const std::string &operatorName)
 Return the definition for the operation result.
 
std::set< std::weak_ptr< smtk::resource::Resource >, std::owner_less< std::weak_ptr< smtk::resource::Resource > > > extractResources (Operation::Result result)
 Construct a set of all of the resources referenced in the result.
 
ResourceAccessMap extractResourcesAndLockTypes (Operation::Parameters parameters)
 Construct a map of all of the resources referenced in the parameters and not in the result, along with their lock types (Read/Write/DoNotLock). More...
 
std::unique_ptr< smtk::resource::ScopedLockSetGuardlockResources (const ResourceAccessMap &resourcesAndLockTypes, bool nonBlocking=false)
 Obtain locks for all resources in a ResourceAccessMap. More...
 
ComponentDefinitionVector extractComponentDefinitions (Operation::Specification specification)
 Construct a vector of all of the resource component definitions referenced in the specification.
 
std::set< std::string > extractTagNames (Operation::Specification specification)
 Construct a set of all of the operator tags referenced in the specification.
 
bool addTag (Operation::Specification specification, const std::string &tagName)
 Add a tag to the specification.
 
bool addTag (Operation::Specification specification, const std::string &tagName, const std::set< std::string > &tagValues)
 Add a tag to the specification.
 
bool removeTag (Operation::Specification specification, const std::string &tagName)
 Remove a tag from the specification.
 
std::set< std::string > tagValues (Operation::Specification specification, const std::string &tagName)
 Retrieve a tag's values.
 
template<typename V , typename VL , typename VI >
void EditPropertiesValue (const std::string &name, const typename VI::Ptr &item, smtk::attribute::ReferenceItemPtr &entities, bool erase=false)
 
template<typename V , typename VI >
void EditPropertiesValue (const std::string &name, const typename VI::Ptr &item, smtk::attribute::ReferenceItemPtr &entities, bool erase=false)
 
void EditPropertiesValue (const std::string &name, const GroupItem::Ptr &item, smtk::attribute::ReferenceItemPtr &entities, bool erase=false)
 
template<typename V , typename VL , typename VI >
void SetPropertyValue (const std::string &name, typename VI::Ptr item, smtk::attribute::ReferenceItemPtr &entities)
 

Detailed Description

A common base class for operators that act on resources and a manager to track subclasses.

Typedef Documentation

◆ ManagerPtr

◆ MetadataContainer

typedef boost::multi_index_container< Metadata, indexed_by< ordered_unique<tag<NameTag>, const_mem_fun<Metadata, const std::string&, &Metadata::typeName> >, ordered_unique< tag<IndexTag>, const_mem_fun<Metadata, const smtk::operation::Operation::Index&, &Metadata::index> > > > smtk::operation::MetadataContainer

A multi-index container for accessing operation metadata.

This class is primarily intended to be used in the implementation of smtk::operation::Manager only.

◆ Observer

typedef std::function<int(const Operation&, EventType, Operation::Result)> smtk::operation::Observer

Signature for methods observing operations.

Observers must not modify nor retain a pointer to the provided operation. Observers must return an integer. If the event type is WILL_OPERATE and the integer is non-zero, the operation will be canceled.

◆ OperationPtr

◆ ResourceAccessMap

typedef std::map< std::weak_ptr<smtk::resource::Resource>, smtk::resource::LockType, std::owner_less<std::weak_ptr<smtk::resource::Resource> > > smtk::operation::ResourceAccessMap

smtk::operation::Operation::Specification is a typedef for std::shared_ptr<smtk::attribute::Resource>.

In the future, it could become a class that simply holds a std::shared_ptr<smtk::attribute::Resource>. For now, though, we construct an API around Specification, giving it functions that are unique to its role as an operation specification.

◆ WeakManagerPtr

◆ WeakOperationPtr

Enumeration Type Documentation

◆ EventType

Enumerate events that an operation may encounter.

No event is provided for operation deletion because (1) operation deletion is not managed and (2) "this" is not complete in class destructors (subclass data is already freed). So, there is no easy way to observe when an operation is about to be deleted but is still valid.

Enumerator
WILL_OPERATE 

The operation will commence if no observers cancel it.

DID_OPERATE 

The operation has completed or been canceled.

Function Documentation

◆ extractResourcesAndLockTypes()

SMTKCORE_EXPORT ResourceAccessMap smtk::operation::extractResourcesAndLockTypes ( const Operation::Parameters  parameters)

Construct a map of all of the resources referenced in the parameters and not in the result, along with their lock types (Read/Write/DoNotLock).

Construct a map of all of the resources referenced in the specification and not in the result, along with their lock types (Read/Write/DoNotLock).

◆ lockResources()

std::unique_ptr< smtk::resource::ScopedLockSetGuard > smtk::operation::lockResources ( const ResourceAccessMap resourcesAndLockTypes,
bool  nonBlocking = false 
)

Obtain locks for all resources in a ResourceAccessMap.

If nonBlocking is false (the default), this method will block until all the resources are locked and will never return a null pointer. This may result in a deadlock if you are not careful.

If nonBlocking is true (the default is false), then always return immediately. In this case, the return value may be a null pointer (indicating that at least one of the resources could not be locked without blocking).