SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
A common base class for operators that act on resources and a manager to track subclasses. More...
Classes | |
class | ArcCreator |
A group holding operations which can connect a pair of Components instances. More... | |
class | ArcDeleter |
A group holding operations which can disconnect a pair of Component instances. More... | |
class | AssignColors |
class | CoordinateTransform |
Set (or remove) a coordinate transform on components. More... | |
class | CopyResources |
An operation that uses resource metadata to write resources. More... | |
class | CreateResource |
Create an SMTK resource. More... | |
class | CreatorGroup |
class | DeleterGroup |
A group that holds operations which can delete things. More... | |
struct | DispositionBatch |
A structure that holds operations configured via association. 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 | Helper |
A helper for dealing with serialization/deserialization done within an operation. 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 | MarkModified |
A "dummy" operation used to mark a resource as modified. 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::Operation > | OperationPtr |
typedef smtk::weak_ptr< smtk::operation::Operation > | WeakOperationPtr |
typedef smtk::shared_ptr< smtk::operation::Manager > | ManagerPtr |
typedef smtk::weak_ptr< smtk::operation::Manager > | WeakManagerPtr |
typedef std::function< void(const Operation::Index &, const std::string &, bool)> | GroupObserver |
typedef smtk::common::Observers< GroupObserver > | GroupObservers |
using | DispositionFunction = std::function< bool(DispositionBatch &batch)> |
A function that determines the disposition of a batch of operations that, for some reason, is not able to operate on a set of objects. More... | |
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< Observer > | Observers |
Operation observers are a specialization of the common SMTK observer pattern. | |
using | Handler = std::function< void(Operation &, const std::shared_ptr< smtk::attribute::Attribute > &)> |
using | ResourceAccessMap = std::map< std::weak_ptr< smtk::resource::Resource >, smtk::resource::LockType, std::owner_less< std::weak_ptr< smtk::resource::Resource > >> |
Hold a set of resources to be locked for an operation along with the type of lock to acquire. | |
typedef std::vector< smtk::attribute::ComponentItemDefinition::Ptr > | ComponentDefinitionVector |
smtk::operation::Operation::Specification is a typedef for std::shared_ptr<smtk::attribute::Resource>. More... | |
Enumerations | |
enum | EventType { EventType::WILL_OPERATE, EventType::DID_OPERATE } |
Enumerate events that an operation may encounter. More... | |
Functions | |
template<typename GroupType , typename Container > | |
bool SMTK_ALWAYS_EXPORT | processObjectsWithGroup (const Container &objects, const smtk::operation::Manager::Ptr &operationManager, DispositionFunction dispositionFn=[](DispositionBatch &) { return false;}) |
Given a Container of persistent objects and an operation GroupType, configure a batch of operations appropriate for the inputs and validate that each operation is able to run before launching any of them. More... | |
template<typename Container > | |
bool SMTK_ALWAYS_EXPORT | deleteObjects (const Container &objects, const Manager::Ptr &operationManager, DispositionFunction dispositionFn=[](DispositionBatch &) { return false;}) |
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) |
Operation::Outcome | outcome (const Operation::Result &result) |
Return the outcome of an operation given its result object. More... | |
bool | registerPythonOperations (const smtk::operation::Manager::Ptr &operationManager, const std::string &moduleName) |
void | addResourcesOfReferenceItem (const smtk::attribute::ReferenceItem::Ptr &item, std::set< smtk::resource::Resource::Ptr > &resources, bool includeProjectChildren=true) |
Insert any entries of item that are resources into the resources set. More... | |
std::set< smtk::resource::Resource::Ptr > | createdResourcesOfResult (const Operation::Result &result, bool includeProjectChildren=true) |
Construct a set of all newly-created resources referenced in the result. More... | |
std::set< smtk::resource::Resource::Ptr > | expungedResourcesOfResult (const Operation::Result &result, bool includeProjectChildren=true) |
Construct a set of all resources to be expunged after processing the result. | |
Operation::Parameters | createParameters (Operation::Specification specification, const std::string &operatorName, const std::string ¶metersName) |
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::ScopedLockSetGuard > | lockResources (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) |
A common base class for operators that act on resources and a manager to track subclasses.
typedef std::vector<smtk::attribute::ComponentItemDefinition::Ptr> smtk::operation::ComponentDefinitionVector |
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.
using smtk::operation::DispositionFunction = typedef std::function<bool(DispositionBatch& batch)> |
A function that determines the disposition of a batch of operations that, for some reason, is not able to operate on a set of objects.
This is used by functions (such as DeleteObjects) to ask users for feedback when operations in a group (such as DeleterGroup) either fails to associate to input objects or is subsequently unable to operate once associated.
This function may modify the operations it is passed (for example, to enable options to delete dependent objects, etc.).
If this function returns true, the operation should continue even if some subset of the objects cannot be processed. If this function returns false, then no deletion should be attempted.
typedef smtk::shared_ptr<smtk::operation::Manager> smtk::operation::ManagerPtr |
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.
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.
typedef smtk::shared_ptr<smtk::operation::Operation> smtk::operation::OperationPtr |
typedef smtk::weak_ptr<smtk::operation::Manager> smtk::operation::WeakManagerPtr |
typedef smtk::weak_ptr<smtk::operation::Operation> smtk::operation::WeakOperationPtr |
|
strong |
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. |
SMTKCORE_EXPORT void smtk::operation::addResourcesOfReferenceItem | ( | const smtk::attribute::ReferenceItem::Ptr & | item, |
std::set< smtk::resource::Resource::Ptr > & | resources, | ||
bool | includeProjectChildren = true |
||
) |
Insert any entries of item that are resources into the resources set.
If includeProjectChildren is true (the default), then if any resource mentioned in item is a project, its child resources will be added. Note that includeProjectChildren does not yet recurse projects whose child resources are themselves projects.
SMTKCORE_EXPORT std::set< smtk::resource::Resource::Ptr > smtk::operation::createdResourcesOfResult | ( | const Operation::Result & | result, |
bool | includeProjectChildren = true |
||
) |
Construct a set of all newly-created resources referenced in the result.
Note that unlike the extractResources() function, only new resources are included (rather than any resource referenced, particularly those resources mentioned by a component they own).
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).
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).
Operation::Outcome smtk::operation::outcome | ( | const Operation::Result & | result | ) |
Return the outcome of an operation given its result object.
This saves the tedium of fetching the integer item and casting it to an outcome.
bool SMTK_ALWAYS_EXPORT smtk::operation::processObjectsWithGroup | ( | const Container & | objects, |
const smtk::operation::Manager::Ptr & | operationManager, | ||
DispositionFunction | dispositionFn = [](DispositionBatch&) { return false; } |
||
) |
Given a Container of persistent objects and an operation GroupType, configure a batch of operations appropriate for the inputs and validate that each operation is able to run before launching any of them.
Optionally, if some objects have no corresponding operation or cannot be associated to their corresponding operation, call the dispositionFn to either fix the operations or ask the user whether to proceed.
This function will return true if any operations were launched and false otherwise (i.e., the objects container was empty, had no corresponding operations for any input, or was vetoed by the user).