SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
PythonRule.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 #ifndef smtk_attribute_PythonRule_h
11 #define smtk_attribute_PythonRule_h
12 
13 #include "smtk/CoreExports.h"
14 
15 #include "smtk/attribute/AssociationRule.h"
16 
17 #include "smtk/common/CompilerInformation.h"
18 
19 SMTK_THIRDPARTY_PRE_INCLUDE
20 #include "nlohmann/json.hpp"
21 SMTK_THIRDPARTY_POST_INCLUDE
22 
23 #include <string>
24 #include <vector>
25 
26 namespace pugi
27 {
28 class xml_node;
29 }
30 
31 namespace smtk
32 {
33 namespace attribute
34 {
35 
38 class SMTKCORE_EXPORT PythonRule : public Rule
39 {
40 public:
42 
43  bool operator()(const Attribute::ConstPtr&, const smtk::resource::PersistentObject::ConstPtr&)
44  const override;
45 
46  const PythonRule& operator>>(nlohmann::json& json) const override;
47  PythonRule& operator<<(const nlohmann::json& json) override;
48 
49  const PythonRule& operator>>(pugi::xml_node& node) const override;
50  PythonRule& operator<<(const pugi::xml_node& node) override;
51 
52 private:
53  std::vector<std::string> m_sourceFiles;
54  std::string m_functionString;
55 };
56 } // namespace attribute
57 } // namespace smtk
58 
59 #endif
smtk
The main namespace for the Simulation Modeling Tool Kit (SMTK).
Definition: doc.h:33
smtk::attribute::PythonRule
A custom rule type that evaluates a Python function to determine the validity of association or disso...
Definition: PythonRule.h:38
smtk::task::operator<<
std::ostream & operator<<(std::ostream &os, const State &s)
States may be appended to streams.
Definition: State.h:78
smtk::attribute::Rule
A base class for custom (i.e.
Definition: AssociationRule.h:36
smtkTypenameMacro
#define smtkTypenameMacro(...)
Add typedefs to a class for identifcation.
Definition: SharedFromThis.h:68