SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
11 #ifndef smtk_resource_CopyOptions_h
12 #define smtk_resource_CopyOptions_h
14 #include "smtk/resource/Links.h"
15 #include "smtk/resource/PersistentObject.h"
17 #include "smtk/common/TypeContainer.h"
20 #include <unordered_map>
43 using ObjectMapType = std::unordered_map<smtk::common::UUID, smtk::resource::PersistentObject*>;
56 bool setCopyLocation(
bool copy);
57 bool copyLocation()
const {
return m_copyLocation; }
63 bool setCopyComponents(
bool copy);
64 bool copyComponents()
const {
return m_copyComponents; }
71 bool setCopyProperties(
bool copy);
72 bool copyProperties()
const {
return m_copyProperties; }
83 bool setCopyGeometry(
bool copy);
84 bool copyGeometry()
const {
return m_copyGeometry; }
92 bool setCopyTemplateData(
bool copy);
93 bool copyTemplateData()
const {
return m_copyTemplateData; }
100 bool setCopyTemplateVersion(
bool copy);
101 bool copyTemplateVersion()
const {
return m_copyTemplateVersion; }
104 bool setCopyUnitSystem(CopyType copy);
105 CopyType copyUnitSystem()
const {
return m_copyUnitSystem; }
112 bool setCopyLinks(
bool copy);
113 bool copyLinks()
const {
return m_copyLinks; }
119 bool clearLinkRolesToExclude();
120 bool addLinkRoleToExclude(smtk::resource::Links::RoleType linkRole);
121 bool removeLinkRoleToExclude(smtk::resource::Links::RoleType linkRole);
122 const std::set<smtk::resource::Links::RoleType>& linkRolesToExclude()
const
124 return m_linkRolesToExclude;
126 bool shouldExcludeLinksInRole(smtk::resource::Links::RoleType role)
const
128 return m_linkRolesToExclude.find(role) != m_linkRolesToExclude.end();
136 const ObjectMapType& objectMapping()
const {
return m_objectMapping; }
143 template<
typename ObjectType>
146 auto it = m_objectMapping.find(sourceId);
147 if (it == m_objectMapping.end())
151 return dynamic_cast<ObjectType*
>(it->second);
160 const std::unordered_set<smtk::common::UUID>&
omit()
const {
return m_omit; }
161 std::unordered_set<smtk::common::UUID>& omit() {
return m_omit; }
171 void omitComponents(
const std::shared_ptr<const Resource>& resource);
184 bool m_copyTemplateData{
true };
185 bool m_copyTemplateVersion{
true };
186 CopyType m_copyUnitSystem{ CopyType::Shallow };
187 bool m_copyLocation{
false };
188 bool m_copyComponents{
true };
189 bool m_copyProperties{
true };
190 bool m_copyGeometry{
true };
191 bool m_copyLinks{
true };
192 std::set<smtk::resource::Links::RoleType> m_linkRolesToExclude;
194 ObjectMapType m_objectMapping;
195 std::unordered_set<smtk::common::UUID> m_omit;
196 std::unordered_set<smtk::common::UUID> m_omitComponentsResources;
207 #endif // smtk_resource_CopyOptions_h
The main namespace for the Simulation Modeling Tool Kit (SMTK).
Definition: doc.h:33
@ None
Do not copy data at all; omit it.
Definition: CopyOptions.h:37
Log messages for later presentation to a user or a file.
Definition: Logger.h:94
@ Shallow
Copy data by reference (the source and target will share access).
Definition: CopyOptions.h:38
ObjectType * targetObjectFromSourceId(const smtk::common::UUID &sourceId) const
A convenience to fetch an entry from objectMapping(), casting it to the given type.
Definition: CopyOptions.h:144
std::unordered_map< smtk::common::UUID, smtk::resource::PersistentObject * > ObjectMapType
A type alias for the container holding the UUID translation table.
Definition: CopyOptions.h:43
smtk::io::Logger & log() const
Return a logger to be used to provide feedback on copying.
Definition: CopyOptions.h:181
CopyType
Control whether copies are omitted, by reference, or by value.
Definition: CopyOptions.h:35
ObjectMapType & objectMapping()
Provide a map from source-resource object-IDs to copied-resource object-pointers.
Definition: CopyOptions.h:135
const std::unordered_set< smtk::common::UUID > & omit() const
Return a set of UUIDs to omit from copying.
Definition: CopyOptions.h:160
const smtk::common::TypeContainer & suboptions() const
Provide a type-container to hold options specific to Resource subclasses.
Definition: CopyOptions.h:177
Definition: CopyOptions.h:31
A container for caching and retrieving instances of types.
Definition: TypeContainer.h:42