SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Attribute.h
1 //=========================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //=========================================================================
10 // .NAME smtkAttribute.h - Represents a standalone piece of simulation information
11 // .SECTION Description
12 // .SECTION See Also
13 
14 #ifndef smtk_attribute_Attribute_h
15 #define smtk_attribute_Attribute_h
16 
17 #include "smtk/CoreExports.h"
18 #include "smtk/PublicPointerDefs.h"
19 #include "smtk/resource/Component.h"
20 
21 #include "smtk/attribute/CopyAssignmentOptions.h"
22 #include "smtk/attribute/ReferenceItem.h"
23 #include "smtk/attribute/SearchStyle.h"
24 #include "smtk/attribute/ValueItem.h"
25 
26 #include "smtk/common/Deprecation.h"
27 #include "smtk/common/UUID.h" // for template associatedModelEntities()
28 
29 #include <map>
30 #include <set>
31 #include <string>
32 #include <vector>
33 
34 namespace smtk
35 {
36 namespace io
37 {
38 class Logger;
39 };
40 
41 namespace attribute
42 {
43 class Evaluator;
44 class Item;
45 class Resource;
46 
50 class SMTKCORE_EXPORT Attribute : public resource::Component
51 {
52  friend class smtk::attribute::Definition;
53  friend class smtk::attribute::Resource;
54 
55 public:
58 
59  struct SMTKCORE_EXPORT CompareByName
60  {
61  bool operator()(
63  const smtk::attribute::AttributePtr& rhs) const
64  {
65  return lhs->name() < rhs->name();
66  }
67 
68  bool operator()(
70  const smtk::attribute::WeakAttributePtr& rhs) const
71  {
72  auto left = lhs.lock();
73  if (left == nullptr)
74  {
75  return true;
76  }
77  auto right = rhs.lock();
78  if (right == nullptr)
79  {
80  return false;
81  }
82  return left->name() < right->name();
83  }
84  };
85 
87  const std::string& myName,
88  const smtk::attribute::DefinitionPtr& myDefinition,
89  const smtk::common::UUID& myId)
90  {
91  return smtk::attribute::AttributePtr(new Attribute(myName, myDefinition, myId));
92  }
93 
94  ~Attribute() override;
95 
96  AttributePtr shared_from_this()
97  {
98  return static_pointer_cast<Attribute>(Component::shared_from_this());
99  }
100 
101  std::shared_ptr<const Attribute> shared_from_this() const
102  {
103  return static_pointer_cast<const Attribute>(Component::shared_from_this());
104  }
105 
106  // NOTE: To rename an attribute use the resource!
107  std::string name() const override { return m_name; }
108 
109  const std::string& type() const;
110  std::vector<std::string> types() const;
111  bool isA(const smtk::attribute::DefinitionPtr& def) const;
112  const smtk::attribute::DefinitionPtr& definition() const { return m_definition; }
113 
114  const double* color() const;
115  void setColor(double r, double g, double b, double alpha);
116  void setColor(const double* l_color)
117  {
118  this->setColor(l_color[0], l_color[1], l_color[2], l_color[3]);
119  }
120  bool isColorSet() const { return m_isColorSet; }
121  void unsetColor() { m_isColorSet = false; }
122 
130  unsigned int advanceLevel(int mode = 0) const;
131  void setLocalAdvanceLevel(int mode, unsigned int level);
132  unsigned int localAdvanceLevel(int mode = 0) const
133  {
134  return (mode == 1 ? m_localAdvanceLevel[1] : m_localAdvanceLevel[0]);
135  }
136  // unsetLocalAdvanceLevel causes the attribute to return its
137  // definition advance level information for the specified mode when calling
138  // the advanceLevel(mode) method
139  void unsetLocalAdvanceLevel(int mode = 0);
140  // Returns true if the attribute is returning its local
141  // advance level information
142  bool hasLocalAdvanceLevelInfo(int mode = 0) const
143  {
144  return (mode == 1 ? m_hasLocalAdvanceLevelInfo[1] : m_hasLocalAdvanceLevelInfo[0]);
145  }
146 
147  const std::vector<smtk::attribute::ItemPtr>& items() const { return m_items; }
148  smtk::attribute::ItemPtr item(int ith) const
149  {
150  return (ith < 0)
152  : (static_cast<unsigned int>(ith) >= m_items.size() ? smtk::attribute::ItemPtr()
153  : m_items[static_cast<std::size_t>(ith)]);
154  }
155 
167  itemAtPath(const std::string& path, const std::string& sep = "/", bool activeOnly = false) const;
169  itemAtPath(const std::string& path, const std::string& sep = "/", bool activeOnly = false);
170 
171  template<typename T>
172  typename T::ConstPtr itemAtPathAs(
173  const std::string& path,
174  const std::string& sep = "/",
175  bool activeOnly = false) const;
176  template<typename T>
177  typename T::Ptr
178  itemAtPathAs(const std::string& path, const std::string& sep = "/", bool activeOnly = false);
180 
183  SMTK_DEPRECATED_IN_24_11("Use Item::path() instead.")
184  std::string itemPath(const ItemPtr& item, const std::string& sep = "/") const;
186 
187  smtk::attribute::ItemPtr find(const std::string& name, SearchStyle style = RECURSIVE_ACTIVE);
188  smtk::attribute::ConstItemPtr find(const std::string& name, SearchStyle style = RECURSIVE_ACTIVE)
189  const;
190  std::size_t numberOfItems() const { return m_items.size(); }
191 
192  template<typename T>
193  typename T::Ptr findAs(const std::string& name, SearchStyle style = RECURSIVE_ACTIVE);
194 
195  template<typename T>
196  typename T::ConstPtr findAs(const std::string& name, SearchStyle style = RECURSIVE_ACTIVE) const;
197 
208  template<typename T>
209  void filterItems(
210  T& values,
211  std::function<bool(typename T::value_type)> test,
212  bool activeChildren = true);
213 
214  IntItemPtr findInt(const std::string& name);
215  ConstIntItemPtr findInt(const std::string& name) const;
216 
217  DoubleItemPtr findDouble(const std::string& name);
218  ConstDoubleItemPtr findDouble(const std::string& name) const;
219 
220  StringItemPtr findString(const std::string& name);
221  ConstStringItemPtr findString(const std::string& name) const;
222 
223  FileItemPtr findFile(const std::string& name);
224  ConstFileItemPtr findFile(const std::string& name) const;
225 
226  DirectoryItemPtr findDirectory(const std::string& name);
227  ConstDirectoryItemPtr findDirectory(const std::string& name) const;
228 
229  GroupItemPtr findGroup(const std::string& name);
230  ConstGroupItemPtr findGroup(const std::string& name) const;
231 
232  ModelEntityItemPtr findModelEntity(const std::string& name);
233  ConstModelEntityItemPtr findModelEntity(const std::string& name) const;
234 
235  VoidItemPtr findVoid(const std::string& name);
236  ConstVoidItemPtr findVoid(const std::string& name) const;
237 
238  DateTimeItemPtr findDateTime(const std::string& name);
239  ConstDateTimeItemPtr findDateTime(const std::string& name) const;
240 
241  ReferenceItemPtr findReference(const std::string& name);
242  ConstReferenceItemPtr findReference(const std::string& name) const;
243  template<typename T>
244  T entityRefsAs(const std::string& name) const;
245 
246  ResourceItemPtr findResource(const std::string& name);
247  ConstResourceItemPtr findResource(const std::string& name) const;
248 
249  ComponentItemPtr findComponent(const std::string& name);
250  ConstComponentItemPtr findComponent(const std::string& name) const;
251 
252  ConstReferenceItemPtr associatedObjects() const { return m_associatedObjects; }
253  ReferenceItemPtr associatedObjects() { return m_associatedObjects; }
254 
255  bool isObjectAssociated(const smtk::common::UUID& uid) const;
256  bool isObjectAssociated(const smtk::resource::PersistentObjectPtr& componentPtr) const;
257 
258  bool canBeAssociated(const smtk::resource::PersistentObjectPtr& obj) const;
259  bool canBeDisassociated(const smtk::resource::PersistentObjectPtr& obj, AttributePtr& probAtt)
260  const;
261  ConstReferenceItemPtr associations() const { return m_associatedObjects; }
262  ReferenceItemPtr associations() { return m_associatedObjects; }
263 
264  bool isEntityAssociated(const smtk::common::UUID& entity) const;
265  bool isEntityAssociated(const smtk::model::EntityRef& entityref) const;
266 
267  smtk::common::UUIDs associatedModelEntityIds() const;
268  template<typename T>
269  T associatedModelEntities() const;
270 
271  template<typename T>
272  T associatedObjects() const;
273 
274  bool associate(smtk::resource::PersistentObjectPtr obj);
275  bool associateEntity(const smtk::common::UUID& entity);
276  bool associateEntity(const smtk::model::EntityRef& entity);
277 
278  void disassociateEntity(const smtk::common::UUID& entity, bool reverse = true);
279  void disassociateEntity(const smtk::model::EntityRef& entity, bool reverse = true);
282  bool
283  disassociate(smtk::resource::PersistentObjectPtr obj, AttributePtr& probAtt, bool reverse = true);
285  bool disassociate(smtk::resource::PersistentObjectPtr obj, bool reverse = true);
286 
287  bool assign(
288  const AttributePtr& sourceAtt,
289  const CopyAssignmentOptions& options = CopyAssignmentOptions());
290 
291  bool assign(
292  const AttributePtr& sourceAtt,
293  const CopyAssignmentOptions& options,
294  smtk::io::Logger& logger);
295 
308  void detachItemsFromOwningResource();
309 
321  bool removeAllAssociations(bool partialRemovalOk = false);
322 
329  bool removeExpungedEntities(const smtk::model::EntityRefs& expungedEnts);
330 
331  // These methods only applies to Attributes whose
332  // definition returns true for isNodal()
333  bool appliesToBoundaryNodes() const { return m_appliesToBoundaryNodes; }
334  void setAppliesToBoundaryNodes(bool appliesValue) { m_appliesToBoundaryNodes = appliesValue; }
335  bool appliesToInteriorNodes() const { return m_appliesToInteriorNodes; }
336  void setAppliesToInteriorNodes(bool appliesValue) { m_appliesToInteriorNodes = appliesValue; }
337 
340  const smtk::attribute::Categories& categories() const;
341 
348  bool isValid(bool useActiveCategories = true) const;
349  bool isValid(const std::set<std::string>& categories) const;
350 
359  bool isRelevant(
360  bool requestCatagories = true,
361  bool includeReadAccess = false,
362  unsigned int readAccessLevel = 0) const;
363 
364  smtk::attribute::ResourcePtr attributeResource() const;
365  const smtk::resource::ResourcePtr resource() const override;
366 
367  void setUserData(const std::string& key, smtk::simulation::UserDataPtr value)
368  {
369  m_userData[key] = value;
370  }
371  smtk::simulation::UserDataPtr userData(const std::string& key) const;
372  void clearUserData(const std::string& key) { m_userData.erase(key); }
373  void clearAllUserData() { m_userData.clear(); }
374 
375  bool isAboutToBeDeleted() const { return m_aboutToBeDeleted; }
376 
377  const common::UUID& id() const override { return m_id; }
378 
383  bool setId(const common::UUID& uid) override;
384 
385  // These methods are use primarily by I/O operations. The include ID corresponds to
386  // the include directory information store in the attribute resource and is used
387  // when writing out the resource to use include files
388  void setIncludeIndex(std::size_t index) { m_includeIndex = index; }
389 
390  std::size_t includeIndex() const { return m_includeIndex; }
391 
392  // Returns true if an Evaluator can be created for this Attribute. Does not
393  // indicate that evaluation would be successful if attempted. Use
394  // doesEvaluate() for that information.
395  bool canEvaluate() const;
396 
397  // If an Evaluator can be created for this Attribute, returns the result of
398  // Evaluator::doesEvaluate(). Returns false if no Evaluator can be created.
399  bool doesEvalaute() const;
400 
401  // Returns an Evaluator for this Attribute if this Attribute's Definition is
402  // registered with an Evaluator, else returns nullptr.
403  std::unique_ptr<smtk::attribute::Evaluator> createEvaluator() const;
404 
417  const std::string& units() const;
418 
420  const std::string& localUnits() const { return m_localUnits; }
421 
430  bool setLocalUnits(const std::string& newUnits);
431 
435  bool supportsUnits() const;
436 
438  {
439  public:
440  GuardedLinks(std::mutex& mutex, const smtk::resource::Component::Links& links)
441  : m_guard(mutex)
442  , m_links(links)
443  {
444  }
445 
446  const smtk::resource::Component::Links* operator->() const { return &m_links; }
447 
449  {
450  return const_cast<smtk::resource::Component::Links*>(&m_links);
451  }
452 
453  private:
454  std::unique_lock<std::mutex> m_guard;
455  const smtk::resource::Component::Links& m_links;
456  };
457 
458  // Attributes are uniquely used outside of an operation context, where they
459  // are not guarded from concurrency issues. Specifically, ReferenceItems use
460  // ResourceLinks to store references to other resources, and the
461  // Resource::Links and Component::Links API is not thread-safe. This API
462  // ensures thread safety when manipulating smtk::attribute::(Resource,Attribute
463  // Links.
464  const GuardedLinks guardedLinks() const;
465  GuardedLinks guardedLinks();
466 
467 protected:
468  Attribute(
469  const std::string& myName,
470  const smtk::attribute::DefinitionPtr& myDefinition,
471  const smtk::common::UUID& myId);
472 
474  void build();
475 
476  void removeAllItems();
480  void forceDisassociate(smtk::resource::PersistentObjectPtr);
481  void addItem(smtk::attribute::ItemPtr& iPtr) { m_items.push_back(iPtr); }
482  void setName(const std::string& newname) { m_name = newname; }
483 
485  void resetId(const smtk::common::UUID& newId) { m_id = newId; }
486 
487  std::string m_name;
488  std::vector<smtk::attribute::ItemPtr> m_items;
494  std::map<std::string, smtk::simulation::UserDataPtr> m_userData;
495  // We need something to indicate that the attribute is in process of
496  // being deleted - this is used skip certain clean up steps that
497  // would need to be done otherwise
499  double m_color[4];
501  std::size_t m_includeIndex;
502  bool m_hasLocalAdvanceLevelInfo[2];
503  unsigned int m_localAdvanceLevel[2];
504  std::string m_localUnits;
505 };
506 
507 inline smtk::simulation::UserDataPtr Attribute::userData(const std::string& key) const
508 {
509  std::map<std::string, smtk::simulation::UserDataPtr>::const_iterator it = m_userData.find(key);
510  return ((it == m_userData.end()) ? smtk::simulation::UserDataPtr() : it->second);
511 }
512 
513 inline void Attribute::setColor(double r, double g, double b, double a)
514 {
515  m_isColorSet = true;
516  m_color[0] = r;
517  m_color[1] = g;
518  m_color[2] = b;
519  m_color[3] = a;
520 }
521 
522 template<typename T>
523 T Attribute::entityRefsAs(const std::string& iname) const
524 {
525  T result;
526  ConstReferenceItemPtr itm = this->findReference(iname);
527  if (!itm)
528  {
529  return result;
530  }
531 
532  for (auto it = itm->begin(); it != itm->end(); ++it)
533  {
534  if (!it.isSet())
535  {
536  continue;
537  }
538 
539  typename T::value_type entry = std::dynamic_pointer_cast<smtk::model::Entity>(*it);
540  if (entry.isValid())
541  {
542  result.insert(result.end(), entry);
543  }
544  }
545  return result;
546 }
547 
548 template<typename T>
549 T Attribute::associatedObjects() const
550 {
551  T result;
552  if (!m_associatedObjects)
553  {
554  return result;
555  }
556 
557  for (auto it = m_associatedObjects->begin(); it != m_associatedObjects->end(); ++it)
558  {
559  if (!it.isSet())
560  {
561  continue;
562  }
563 
564  auto entry = std::dynamic_pointer_cast<typename T::value_type::element_type>(*it);
565  if (entry)
566  {
567  result.insert(result.end(), entry);
568  }
569  }
570  return result;
571 }
572 
573 template<typename T>
575 {
576  T result;
577  if (!m_associatedObjects)
578  {
579  return result;
580  }
581 
582  for (auto it = m_associatedObjects->begin(); it != m_associatedObjects->end(); ++it)
583  {
584  if (!it.isSet())
585  {
586  continue;
587  }
588 
589  typename T::value_type entry = std::dynamic_pointer_cast<smtk::model::Entity>(*it);
590  if (entry.isValid())
591  {
592  result.insert(result.end(), entry);
593  }
594  }
595  return result;
596 }
597 
600 template<typename T>
601 typename T::Ptr
602 Attribute::itemAtPathAs(const std::string& path, const std::string& sep, bool activeOnly)
603 {
604  return smtk::dynamic_pointer_cast<T>(this->itemAtPath(path, sep, activeOnly));
605 }
606 
607 template<typename T>
608 typename T::ConstPtr
609 Attribute::itemAtPathAs(const std::string& path, const std::string& sep, bool activeOnly) const
610 {
611  return smtk::dynamic_pointer_cast<const T>(this->itemAtPath(path, sep, activeOnly));
612 }
613 
614 template<typename T>
615 typename T::Ptr Attribute::findAs(const std::string& iname, SearchStyle style)
616 {
617  return smtk::dynamic_pointer_cast<T>(this->find(iname, style));
618 }
619 
620 template<typename T>
621 typename T::ConstPtr Attribute::findAs(const std::string& iname, SearchStyle style) const
622 {
623  return smtk::dynamic_pointer_cast<const T>(this->find(iname, style));
624 }
625 
626 template<typename T>
628  T& filtered,
629  std::function<bool(typename T::value_type)> test,
630  bool activeChildren)
631 {
632  // Given an item, this lambda function which would recursively visit all children and apply test function
633  std::function<void(ItemPtr, bool)> visitor =
634  [&filtered, test, &visitor](smtk::attribute::ItemPtr item, bool activeChildrenLocal) {
635  typename T::value_type testItem =
636  smtk::dynamic_pointer_cast<typename T::value_type::element_type>(item);
637  // base condition
638  if (testItem && test(testItem))
639  {
640  filtered.insert(filtered.end(), testItem);
641  }
642  // Only items which have children would have a non-empty visitChildren method
643  item->visitChildren(visitor, activeChildrenLocal);
644  };
645 
646  for (std::size_t index = 0; index < this->numberOfItems(); ++index)
647  {
648  visitor(this->item(static_cast<int>(index)), activeChildren);
649  }
650 }
651 
652 } // namespace attribute
653 } // namespace smtk
654 
655 #endif /* smtk_attribute_Attribute_h */
smtk
The main namespace for the Simulation Modeling Tool Kit (SMTK).
Definition: doc.h:33
smtk::attribute::Attribute::localUnits
const std::string & localUnits() const
Return the units locally set on the attribute.
Definition: Attribute.h:420
PublicPointerDefs.h
smtk::attribute::Definition
Stores the definition of an attribute.
Definition: Definition.h:47
smtk::attribute::DefinitionPtr
smtk::shared_ptr< smtk::attribute::Definition > DefinitionPtr
Definition: PublicPointerDefs.h:457
smtk::attribute::Attribute::m_definition
smtk::attribute::DefinitionPtr m_definition
Returns true if the attribute is valid.
Definition: Attribute.h:490
smtk::attribute::SearchStyle
SearchStyle
How should searches for items be conducted?
Definition: SearchStyle.h:24
smtk::attribute::FileItemPtr
smtk::shared_ptr< smtk::attribute::FileItem > FileItemPtr
Definition: PublicPointerDefs.h:506
smtk::attribute::Attribute::m_color
double m_color[4]
Returns true if the attribute is valid.
Definition: Attribute.h:499
smtk::attribute::ConstComponentItemPtr
smtk::shared_ptr< const smtk::attribute::ComponentItem > ConstComponentItemPtr
Definition: PublicPointerDefs.h:601
smtk::simulation::UserDataPtr
smtk::shared_ptr< smtk::simulation::UserData > UserDataPtr
Definition: PublicPointerDefs.h:678
smtk::common::UUIDs
std::set< smtk::common::UUID > UUIDs
Definition: PublicPointerDefs.h:31
smtk::attribute::ConstModelEntityItemPtr
smtk::shared_ptr< const smtk::attribute::ModelEntityItem > ConstModelEntityItemPtr
Definition: PublicPointerDefs.h:586
smtk::attribute::ComponentItemPtr
smtk::shared_ptr< smtk::attribute::ComponentItem > ComponentItemPtr
Definition: PublicPointerDefs.h:546
smtk::attribute::ConstGroupItemPtr
smtk::shared_ptr< const smtk::attribute::GroupItem > ConstGroupItemPtr
Definition: PublicPointerDefs.h:574
smtk::attribute::Attribute::m_appliesToInteriorNodes
bool m_appliesToInteriorNodes
Returns true if the attribute is valid.
Definition: Attribute.h:492
smtk::attribute::Attribute::clearAllUserData
void clearAllUserData()
Returns true if the attribute is valid.
Definition: Attribute.h:373
smtk::attribute::Attribute::resetId
void resetId(const smtk::common::UUID &newId)
This allows the resource to change an Attribute ID.
Definition: Attribute.h:485
smtk::attribute::Attribute::m_isColorSet
bool m_isColorSet
Returns true if the attribute is valid.
Definition: Attribute.h:493
smtk::common::UUID
Definition: UUID.h:38
smtk::attribute::Attribute::m_items
std::vector< smtk::attribute::ItemPtr > m_items
Returns true if the attribute is valid.
Definition: Attribute.h:488
smtk::io::Logger
Log messages for later presentation to a user or a file.
Definition: Logger.h:94
smtk::attribute::GroupItemPtr
smtk::shared_ptr< smtk::attribute::GroupItem > GroupItemPtr
Definition: PublicPointerDefs.h:514
smtk::attribute::Attribute::find
smtk::attribute::ItemPtr find(const std::string &name, SearchStyle style=RECURSIVE_ACTIVE)
Return the item with the given inName, searching in the given style.
Definition: Attribute.cxx:902
smtk::attribute::Attribute::m_localUnits
std::string m_localUnits
Returns true if the attribute is valid.
Definition: Attribute.h:504
smtk::attribute::Attribute::m_appliesToBoundaryNodes
bool m_appliesToBoundaryNodes
Returns true if the attribute is valid.
Definition: Attribute.h:491
smtk::attribute::Attribute::isAboutToBeDeleted
bool isAboutToBeDeleted() const
Returns true if the attribute is valid.
Definition: Attribute.h:375
smtk::attribute::StringItemPtr
smtk::shared_ptr< smtk::attribute::StringItem > StringItemPtr
Definition: PublicPointerDefs.h:523
smtk::attribute::Attribute::m_aboutToBeDeleted
bool m_aboutToBeDeleted
Returns true if the attribute is valid.
Definition: Attribute.h:498
smtk::attribute::ConstResourceItemPtr
smtk::shared_ptr< const smtk::attribute::ResourceItem > ConstResourceItemPtr
Definition: PublicPointerDefs.h:596
smtk::attribute::ResourceItemPtr
smtk::shared_ptr< smtk::attribute::ResourceItem > ResourceItemPtr
Definition: PublicPointerDefs.h:542
smtk::attribute::ConstStringItemPtr
smtk::shared_ptr< const smtk::attribute::StringItem > ConstStringItemPtr
Definition: PublicPointerDefs.h:582
smtk::attribute::Attribute::filterItems
void filterItems(T &values, std::function< bool(typename T::value_type)> test, bool activeChildren=true)
Given a container, filter items in the attribute by a lambda function.
Definition: Attribute.h:627
smtk::attribute::Attribute::id
const common::UUID & id() const override
Returns true if the attribute is valid.
Definition: Attribute.h:377
smtk::attribute::Attribute::itemAtPath
smtk::attribute::ConstItemPtr itemAtPath(const std::string &path, const std::string &sep="/", bool activeOnly=false) const
Find an item via its path with respects to the attribute.
Definition: Attribute.cxx:188
smtk::attribute::ConstReferenceItemPtr
smtk::shared_ptr< const smtk::attribute::ReferenceItem > ConstReferenceItemPtr
Definition: PublicPointerDefs.h:591
smtk::attribute::Attribute::clearUserData
void clearUserData(const std::string &key)
Returns true if the attribute is valid.
Definition: Attribute.h:372
smtk::attribute::Attribute::setIncludeIndex
void setIncludeIndex(std::size_t index)
Returns true if the attribute is valid.
Definition: Attribute.h:388
smtk::attribute::Attribute::itemAtPathAs
T::ConstPtr itemAtPathAs(const std::string &path, const std::string &sep="/", bool activeOnly=false) const
Find an item via its path with respects to the attribute.
Definition: Attribute.h:609
smtkTypeMacro
#define smtkTypeMacro(...)
Add typedefs to a class for identifcation.
Definition: SharedFromThis.h:128
smtk::attribute::IntItemPtr
smtk::shared_ptr< smtk::attribute::IntItem > IntItemPtr
Definition: PublicPointerDefs.h:519
smtk::attribute::Attribute::m_id
smtk::common::UUID m_id
Returns true if the attribute is valid.
Definition: Attribute.h:500
smtk::attribute::Attribute::setName
void setName(const std::string &newname)
Returns true if the attribute is valid.
Definition: Attribute.h:482
smtk::attribute::DirectoryItemPtr
smtk::shared_ptr< smtk::attribute::DirectoryItem > DirectoryItemPtr
Definition: PublicPointerDefs.h:498
smtk::attribute::AttributePtr
smtk::shared_ptr< smtk::attribute::Attribute > AttributePtr
Definition: PublicPointerDefs.h:463
smtk::attribute::ConstDateTimeItemPtr
smtk::shared_ptr< const smtk::attribute::DateTimeItem > ConstDateTimeItemPtr
Definition: PublicPointerDefs.h:551
smtk::attribute::RECURSIVE_ACTIVE
@ RECURSIVE_ACTIVE
Recursively search for an active item.
Definition: SearchStyle.h:32
smtk::attribute::ReferenceItemPtr
smtk::shared_ptr< smtk::attribute::ReferenceItem > ReferenceItemPtr
Definition: PublicPointerDefs.h:538
smtk::attribute::ModelEntityItemPtr
smtk::shared_ptr< smtk::attribute::ModelEntityItem > ModelEntityItemPtr
Definition: PublicPointerDefs.h:527
smtk::attribute::ConstItemPtr
smtk::shared_ptr< const smtk::attribute::Item > ConstItemPtr
Definition: PublicPointerDefs.h:476
smtk::attribute::VoidItemPtr
smtk::shared_ptr< smtk::attribute::VoidItem > VoidItemPtr
Definition: PublicPointerDefs.h:534
smtk::attribute::Resource
Store information about attribute definitions and instances.
Definition: Resource.h:78
smtk::attribute::DateTimeItemPtr
smtk::shared_ptr< smtk::attribute::DateTimeItem > DateTimeItemPtr
Definition: PublicPointerDefs.h:494
smtkSuperclassMacro
#define smtkSuperclassMacro(...)
Add a typedef to the superclass of this class.
Definition: SharedFromThis.h:147
smtk::attribute::Attribute
Represent a (possibly composite) value according to a definition.
Definition: Attribute.h:50
smtk::attribute::Categories
Represents the category constraints associated with an Attribute, Attribute Definition,...
Definition: Categories.h:33
smtk::attribute::Attribute::associatedModelEntities
T associatedModelEntities() const
Return a container of associated entityref-subclass instances.
Definition: Attribute.h:574
smtk::attribute::ConstDoubleItemPtr
smtk::shared_ptr< const smtk::attribute::DoubleItem > ConstDoubleItemPtr
Definition: PublicPointerDefs.h:561
smtk::attribute::DoubleItemPtr
smtk::shared_ptr< smtk::attribute::DoubleItem > DoubleItemPtr
Definition: PublicPointerDefs.h:502
smtk::attribute::Attribute::includeIndex
std::size_t includeIndex() const
Returns true if the attribute is valid.
Definition: Attribute.h:390
smtk::attribute::Attribute::m_associatedObjects
ReferenceItemPtr m_associatedObjects
Returns true if the attribute is valid.
Definition: Attribute.h:489
smtk::attribute::Attribute::m_userData
std::map< std::string, smtk::simulation::UserDataPtr > m_userData
Returns true if the attribute is valid.
Definition: Attribute.h:494
smtk::attribute::Attribute::addItem
void addItem(smtk::attribute::ItemPtr &iPtr)
Returns true if the attribute is valid.
Definition: Attribute.h:481
smtk::resource::Component
Component is the base class for records stored in an smtk::resource::Resource.
Definition: Component.h:43
smtk::resource::PersistentObjectPtr
smtk::shared_ptr< smtk::resource::PersistentObject > PersistentObjectPtr
Definition: PublicPointerDefs.h:292
smtk::attribute::Attribute::name
std::string name() const override
Return the name of the object - by default it will return the UUID but that can be overridden.
Definition: Attribute.h:107
smtk::attribute::ConstFileItemPtr
smtk::shared_ptr< const smtk::attribute::FileItem > ConstFileItemPtr
Definition: PublicPointerDefs.h:565
smtk::attribute::ItemPtr
smtk::shared_ptr< smtk::attribute::Item > ItemPtr
Definition: PublicPointerDefs.h:474
smtk::attribute::Attribute::m_includeIndex
std::size_t m_includeIndex
Returns true if the attribute is valid.
Definition: Attribute.h:501
smtk::attribute::ConstIntItemPtr
smtk::shared_ptr< const smtk::attribute::IntItem > ConstIntItemPtr
Definition: PublicPointerDefs.h:578
smtk::attribute::ConstVoidItemPtr
smtk::shared_ptr< const smtk::attribute::VoidItem > ConstVoidItemPtr
Definition: PublicPointerDefs.h:606
smtk::attribute::Attribute::CompareByName
Definition: Attribute.h:59
smtk::attribute::WeakAttributePtr
smtk::weak_ptr< smtk::attribute::Attribute > WeakAttributePtr
Definition: PublicPointerDefs.h:467
smtk::attribute::Attribute::userData
smtk::simulation::UserDataPtr userData(const std::string &key) const
Returns true if the attribute is valid.
Definition: Attribute.h:507
smtk::model::EntityRefs
std::set< smtk::model::EntityRef > EntityRefs
Definition: PublicPointerDefs.h:162
smtk::attribute::Attribute::setUserData
void setUserData(const std::string &key, smtk::simulation::UserDataPtr value)
Returns true if the attribute is valid.
Definition: Attribute.h:367
smtk::attribute::Attribute::m_name
std::string m_name
Returns true if the attribute is valid.
Definition: Attribute.h:487
smtk::model::EntityRef
A lightweight entityref pointing to a model entity's resource.
Definition: EntityRef.h:112
smtk::attribute::ConstDirectoryItemPtr
smtk::shared_ptr< const smtk::attribute::DirectoryItem > ConstDirectoryItemPtr
Definition: PublicPointerDefs.h:556
smtk::attribute::ResourcePtr
smtk::shared_ptr< smtk::attribute::Resource > ResourcePtr
Definition: PublicPointerDefs.h:611
smtk::resource::ResourcePtr
smtk::shared_ptr< smtk::resource::Resource > ResourcePtr
Definition: PublicPointerDefs.h:302