SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Friends | List of all members
smtk::project::Project Class Reference

A Project represents an encapsulation of a subset of SMTK's Resources and Operations for the purpose of accomplishing a targeted set of tasks. More...

#include <Project.h>

Inheritance diagram for smtk::project::Project:
[legend]
Collaboration diagram for smtk::project::Project:
[legend]

Public Types

typedef std::size_t Index
 A hash value uniquely representing the project type.
 
- Public Types inherited from smtk::resource::DerivedFrom< Project, smtk::resource::Resource >
using ParentResource = smtk::resource::Resource
 
using Superclass = smtk::resource::Resource
 
using DirectSuperclass = DerivedFrom< Project, smtk::resource::Resource >
 
- Public Types inherited from smtk::resource::Resource
typedef std::size_t Index
 
typedef smtk::resource::Metadata Metadata
 
typedef detail::ResourceLinks Links
 
typedef detail::ResourceProperties Properties
 
typedef query::Queries Queries
 

Public Member Functions

 smtkTypedefs (smtk::project::Project)
 
 smtkSharedFromThisMacro (smtk::resource::PersistentObject)
 
std::string typeName () const override
 
smtk::string::Token typeToken () const override
 
std::vector< smtk::string::TokenclassHierarchy () const override
 
bool matchesType (smtk::string::Token candidate) const override
 
Index index () const override
 Index is a compile-time intrinsic of the derived resource's type; as such, it cannot be set.
 
const ResourceContainerresources () const
 Access the Project's Resources.
 
ResourceContainerresources ()
 
const OperationFactoryoperations () const
 Access the Project's Operations.
 
OperationFactoryoperations ()
 
const std::string & version () const
 Access the Project's version string.
 
void setVersion (const std::string &version)
 
std::function< bool(const smtk::resource::Component &)> queryOperation (const std::string &query) const override
 Return a functor that evaluates whether a component matches the query string.
 
void visit (smtk::resource::Component::Visitor &) const override
 Visit components this project owns.
 
smtk::resource::ComponentPtr find (const smtk::common::UUID &compId) const override
 Return a project component pointer given its UUID.
 
const smtk::project::Managermanager () const
 
const smtk::task::ManagertaskManager () const
 Return this project's task manager.
 
smtk::task::ManagertaskManager ()
 
bool clean () const override
 Resources that have a non-empty location and are identical to the data stored at location are clean. More...
 
- Public Member Functions inherited from smtk::resource::DerivedFrom< Project, smtk::resource::Resource >
bool isOfType (const Resource::Index &index) const override
 given a resource index, return whether or not this resource is or is derived from the resource described by the index.
 
bool isOfType (const std::string &typeName) const override
 given a resource's unique name, return whether or not this resource is or is derived from the resource described by the name.
 
int numberOfGenerationsFromBase (const std::string &typeName) const override
 
 DerivedFrom (const DerivedFrom &)=delete
 
- Public Member Functions inherited from smtk::resource::Resource
 smtkTypeMacro (smtk::resource::Resource)
 
 smtkSuperclassMacro (smtk::resource::PersistentObject)
 
 smtkSharedFromThisMacro (smtk::resource::PersistentObject)
 
bool setManager (ManagerPtr newManager)
 Set the manager that the resource will use to decode its link information. More...
 
 Resource (Resource &&) noexcept
 
template<class ResourceType >
bool isOfType () const
 Given a resource type, return whether or not this resource is or is derived from the resource described by the index.
 
const smtk::common::UUIDid () const override
 Set/get the UUID of a resource. More...
 
bool setId (const smtk::common::UUID &myID) override
 Set/get the UUID of a resource. More...
 
const std::string & location () const
 Set/get the location (a URL) where the resource is stored persistently. More...
 
virtual bool setLocation (const std::string &location)
 Set/get the location (a URL) where the resource is stored persistently. More...
 
std::string name () const override
 Set/get the user-assigned name of the resource. More...
 
virtual bool setName (const std::string &name)
 Set/get the user-assigned name of the resource. More...
 
bool isNameSet () const
 Set/get the user-assigned name of the resource. More...
 
void setClean (bool state=true)
 Resources that have a non-empty location and are identical to the data stored at location are clean. More...
 
void setMarkedForRemoval (bool val)
 Mark the resource to indicate it is about to removed (meaning it is being removed from memory not necessarily for deletion)
 
virtual bool isMarkedForRemoval () const
 Return whether the object is marked for removal.
 
ManagerPtr manager () const
 Resources that are managed have a non-null pointer to their manager.
 
virtual Componentcomponent (const smtk::common::UUID &compId) const
 Given a component's UUID, return a raw pointer to the component.
 
template<typename ComponentType >
ComponentType * componentAs (const smtk::common::UUID &uuid) const
 A templated version of component() that casts its result to a type. More...
 
virtual void visit (std::function< void(const ComponentPtr &)> &v) const =0
 visit all components in a resource.
 
ComponentSet filter (const std::string &queryString) const
 Given a resource component's UUID, return the resource component.
 
template<typename Collection >
Collection filterAs (const std::string &queryString) const
 given a a std::string describing a query and a type of container, return a set of components that satisfy both. More...
 
Linkslinks () override
 Fetch the links stored for this resource and its components.
 
const Linkslinks () const override
 Fetch the links stored for this resource and its components.
 
Propertiesproperties () override
 
const Propertiesproperties () const override
 
const Queriesqueries () const
 
Queriesqueries ()
 
Locklock (Key()) const
 Classes that are granted permission to the key may retrieve the resource's lock. More...
 
LockType locked () const
 Anyone can query whether or not the resource is locked.
 
virtual bool setUnitsSystem (const shared_ptr< units::System > &unitsSystem)
 Sets the system of units used by this resource.
 
const shared_ptr< units::System > & unitsSystem () const
 Gets the system of units used by this resource.
 
virtual bool setTemplateType (const smtk::string::Token &templateType)
 Set/get the "type" of a resource's template. More...
 
virtual smtk::string::Token templateType () const
 Set/get the "type" of a resource's template. More...
 
virtual bool setTemplateVersion (std::size_t templateVersion)
 Set/get the version number of the template this instance of the resource is based upon. More...
 
virtual std::size_t templateVersion () const
 Set/get the "type" of a resource's template. More...
 
virtual std::shared_ptr< Resourceclone (CopyOptions &options) const
 Create an empty, un-managed clone of this resource instance. More...
 
virtual bool copyInitialize (const std::shared_ptr< const Resource > &source, CopyOptions &options)
 Copy initial data from a source resource into this resource. More...
 
virtual bool copyFinalize (const std::shared_ptr< const Resource > &source, CopyOptions &options)
 Finalize copying of a resource by resolving internal and external references among components copied from any of the source resources mapped in options. More...
 
void copyUnitSystem (const std::shared_ptr< const Resource > &rsrc, const CopyOptions &options)
 Copy the units system from rsrc into this resource as specified by options. More...
 
void copyProperties (const std::shared_ptr< const Resource > &rsrc, CopyOptions &options)
 Copy all property data from rsrc, mapping them along the way via options. More...
 
- Public Member Functions inherited from smtk::resource::PersistentObject
 smtkTypeMacroBase (smtk::resource::PersistentObject)
 
template<typename T >
T::Ptr as ()
 Attempt to cast this object to a subclass.
 
template<typename T >
T::ConstPtr as () const
 Attempt to cast this object to a subclass.
 

Static Public Member Functions

static std::shared_ptr< smtk::project::Projectcreate (const std::string &typeName="")
 
- Static Public Member Functions inherited from smtk::resource::Resource
static constexpr smtk::resource::Links::RoleType visuallyLinkedRole ()
 

Static Public Attributes

static constexpr const char *const type_name = "smtk::project::Project"
 
- Static Public Attributes inherited from smtk::resource::DerivedFrom< Project, smtk::resource::Resource >
static const Resource::Index type_index
 A static index for this resource type. More...
 
- Static Public Attributes inherited from smtk::resource::Resource
static const Resource::Index type_index = std::type_index(typeid(Resource)).hash_code()
 
static constexpr smtk::resource::Links::RoleType VisuallyLinkedRole = -4
 A role for components that implies their visibility in renderings should be linked to another object. More...
 

Protected Member Functions

 Project (const std::string &typeName="")
 
- Protected Member Functions inherited from smtk::resource::DerivedFrom< Project, smtk::resource::Resource >
 DerivedFrom (T &&... all)
 Forward all constructor arguments to the parent class.
 
 DerivedFrom (DerivedFrom &&rhs) noexcept=default
 
- Protected Member Functions inherited from smtk::resource::Resource
 Resource (const smtk::common::UUID &, ManagerPtr manager=nullptr)
 
 Resource (ManagerPtr manager=nullptr)
 
bool copyPropertiesForId (const std::shared_ptr< Resource > &rsrc, const smtk::common::UUID &sourceId, const smtk::common::UUID &targetId, const CopyOptions &options)
 Copy all property data for sourceId from rsrc into targetId of this resource. More...
 
void copyLinks (const std::shared_ptr< const Resource > &rsrc, const CopyOptions &options)
 Copy links from rsrc (except those excluded by options), mapping them along the way. More...
 

Friends

class Manager
 The Manager is a singleton interface for registering available plugins to manager instances. More...
 

Additional Inherited Members

- Protected Attributes inherited from smtk::resource::Resource
WeakManagerPtr m_manager
 
std::shared_ptr< units::System > m_unitsSystem
 

Detailed Description

A Project represents an encapsulation of a subset of SMTK's Resources and Operations for the purpose of accomplishing a targeted set of tasks.

It contains Resources and a list of Operations that are pertinent to the Project. As a descendent of Resource, it also contains links, properties, and Query functionality.

Member Function Documentation

◆ clean()

bool smtk::project::Project::clean ( ) const
overridevirtual

Resources that have a non-empty location and are identical to the data stored at location are clean.

All other resources are dirty.

Operations that are write-operators (i.e., not read-only) should mark resources as modified. Saving a resource using its metadata's write method will mark the resource as clean. Loading a resource using its metadata's read method should return a clean resource.

Reimplemented from smtk::resource::Resource.

Friends And Related Function Documentation

◆ Manager

friend class Manager
friend

The Manager is a singleton interface for registering available plugins to manager instances.

When a plugin is loaded, it creates a Client that adds itself to Manager's set of Client weak_ptrs. When a manager instance is passed into the Manager's "registerPluginsTo" method, each Client in the set that accepts a manager of this type constructs a Registry that tethers the scope of the manager's ability to use features from the plugin to the lifetime of the Registry object. Additionally, when a manager is passed into this class a register function is created that facilitates the registration of future plugins to the manager.


The documentation for this class was generated from the following files: