modelgbp Generated OpFlex Model  1.3.0
RuleToClassifierRSrc.hpp
1 
10 #pragma once
11 #ifndef GI_GBP_RULETOCLASSIFIERRSRC_HPP
12 #define GI_GBP_RULETOCLASSIFIERRSRC_HPP
13 
14 #include <boost/optional.hpp>
15 #include "opflex/modb/URIBuilder.h"
16 #include "opflex/modb/mo-internal/MO.h"
17 
18 namespace modelgbp {
19 namespace gbp {
20 
22  : public opflex::modb::mointernal::MO
23 {
24 public:
25 
29  static const opflex::modb::class_id_t CLASS_ID = 105;
30 
35  bool isRoleSet()
36  {
37  return getObjectInstance().isSet(3440642ul, opflex::modb::PropertyInfo::ENUM8);
38  }
39 
44  boost::optional<const uint8_t> getRole()
45  {
46  if (isRoleSet())
47  return (const uint8_t)getObjectInstance().getUInt64(3440642ul);
48  return boost::none;
49  }
50 
56  const uint8_t getRole(const uint8_t defaultValue)
57  {
58  return getRole().get_value_or(defaultValue);
59  }
60 
70  {
71  getTLMutator().modify(getClassId(), getURI())->setUInt64(3440642ul, newValue);
72  return *this;
73  }
74 
82  {
83  getTLMutator().modify(getClassId(), getURI())->unset(3440642ul, opflex::modb::PropertyInfo::ENUM8, opflex::modb::PropertyInfo::SCALAR);
84  return *this;
85  }
86 
91  bool isTargetSet()
92  {
93  return getObjectInstance().isSet(3440643ul, opflex::modb::PropertyInfo::REFERENCE);
94  }
95 
100  boost::optional<opflex::modb::class_id_t> getTargetClass()
101  {
102  if (isTargetSet())
103  return getObjectInstance().getReference(3440643ul).first;
104  return boost::none;
105  }
106 
111  boost::optional<opflex::modb::URI> getTargetURI()
112  {
113  if (isTargetSet())
114  return getObjectInstance().getReference(3440643ul).second;
115  return boost::none;
116  }
117 
123  opflex::modb::class_id_t getTargetClass(opflex::modb::class_id_t defaultValue)
124  {
125  return getTargetClass().get_value_or(defaultValue);
126  }
127 
133  opflex::modb::URI getTargetURI(opflex::modb::URI defaultValue)
134  {
135  return getTargetURI().get_value_or(defaultValue);
136  }
137 
148  {
149  getTLMutator().modify(getClassId(), getURI())->setReference(3440643ul, 31, uri);
150  return *this;
151  }
152 
171  const std::string& policySpaceName,
172  const std::string& gbpeL24ClassifierName)
173  {
174  getTLMutator().modify(getClassId(), getURI())->setReference(3440643ul, 31, opflex::modb::URIBuilder().addElement("PolicyUniverse").addElement("PolicySpace").addElement(policySpaceName).addElement("GbpeL24Classifier").addElement(gbpeL24ClassifierName).build());
175  return *this;
176  }
177 
185  {
186  getTLMutator().modify(getClassId(), getURI())->unset(3440643ul, opflex::modb::PropertyInfo::REFERENCE, opflex::modb::PropertyInfo::SCALAR);
187  return *this;
188  }
189 
194  bool isTypeSet()
195  {
196  return getObjectInstance().isSet(3440641ul, opflex::modb::PropertyInfo::ENUM8);
197  }
198 
203  boost::optional<const uint8_t> getType()
204  {
205  if (isTypeSet())
206  return (const uint8_t)getObjectInstance().getUInt64(3440641ul);
207  return boost::none;
208  }
209 
215  const uint8_t getType(const uint8_t defaultValue)
216  {
217  return getType().get_value_or(defaultValue);
218  }
219 
229  {
230  getTLMutator().modify(getClassId(), getURI())->setUInt64(3440641ul, newValue);
231  return *this;
232  }
233 
241  {
242  getTLMutator().modify(getClassId(), getURI())->unset(3440641ul, opflex::modb::PropertyInfo::ENUM8, opflex::modb::PropertyInfo::SCALAR);
243  return *this;
244  }
245 
257  static boost::optional<boost::shared_ptr<modelgbp::gbp::RuleToClassifierRSrc> > resolve(
258  opflex::ofcore::OFFramework& framework,
259  const opflex::modb::URI& uri)
260  {
261  return opflex::modb::mointernal::MO::resolve<modelgbp::gbp::RuleToClassifierRSrc>(framework, CLASS_ID, uri);
262  }
263 
275  static boost::optional<boost::shared_ptr<modelgbp::gbp::RuleToClassifierRSrc> > resolve(
276  const opflex::modb::URI& uri)
277  {
278  return opflex::modb::mointernal::MO::resolve<modelgbp::gbp::RuleToClassifierRSrc>(opflex::ofcore::OFFramework::defaultInstance(), CLASS_ID, uri);
279  }
280 
307  static boost::optional<boost::shared_ptr<modelgbp::gbp::RuleToClassifierRSrc> > resolve(
308  opflex::ofcore::OFFramework& framework,
309  const std::string& policySpaceName,
310  const std::string& gbpContractName,
311  const std::string& gbpSubjectName,
312  const std::string& gbpRuleName,
313  uint16_t gbpRuleToClassifierRSrcTargetClass,
314  const std::string& gbpRuleToClassifierRSrcTargetName)
315  {
316  return resolve(framework,opflex::modb::URIBuilder().addElement("PolicyUniverse").addElement("PolicySpace").addElement(policySpaceName).addElement("GbpContract").addElement(gbpContractName).addElement("GbpSubject").addElement(gbpSubjectName).addElement("GbpRule").addElement(gbpRuleName).addElement("GbpRuleToClassifierRSrc").addElement(gbpRuleToClassifierRSrcTargetClass).addElement(gbpRuleToClassifierRSrcTargetName).build());
317  }
318 
344  static boost::optional<boost::shared_ptr<modelgbp::gbp::RuleToClassifierRSrc> > resolve(
345  const std::string& policySpaceName,
346  const std::string& gbpContractName,
347  const std::string& gbpSubjectName,
348  const std::string& gbpRuleName,
349  uint16_t gbpRuleToClassifierRSrcTargetClass,
350  const std::string& gbpRuleToClassifierRSrcTargetName)
351  {
352  return resolve(opflex::ofcore::OFFramework::defaultInstance(),policySpaceName,gbpContractName,gbpSubjectName,gbpRuleName,gbpRuleToClassifierRSrcTargetClass,gbpRuleToClassifierRSrcTargetName);
353  }
354 
363  void remove()
364  {
365  getTLMutator().remove(CLASS_ID, getURI());
366  }
367 
378  static void remove(opflex::ofcore::OFFramework& framework,
379  const opflex::modb::URI& uri)
380  {
381  MO::remove(framework, CLASS_ID, uri);
382  }
383 
394  static void remove(const opflex::modb::URI& uri)
395  {
396  remove(opflex::ofcore::OFFramework::defaultInstance(), uri);
397  }
398 
423  static void remove(
424  opflex::ofcore::OFFramework& framework,
425  const std::string& policySpaceName,
426  const std::string& gbpContractName,
427  const std::string& gbpSubjectName,
428  const std::string& gbpRuleName,
429  uint16_t gbpRuleToClassifierRSrcTargetClass,
430  const std::string& gbpRuleToClassifierRSrcTargetName)
431  {
432  MO::remove(framework, CLASS_ID, opflex::modb::URIBuilder().addElement("PolicyUniverse").addElement("PolicySpace").addElement(policySpaceName).addElement("GbpContract").addElement(gbpContractName).addElement("GbpSubject").addElement(gbpSubjectName).addElement("GbpRule").addElement(gbpRuleName).addElement("GbpRuleToClassifierRSrc").addElement(gbpRuleToClassifierRSrcTargetClass).addElement(gbpRuleToClassifierRSrcTargetName).build());
433  }
434 
459  static void remove(
460  const std::string& policySpaceName,
461  const std::string& gbpContractName,
462  const std::string& gbpSubjectName,
463  const std::string& gbpRuleName,
464  uint16_t gbpRuleToClassifierRSrcTargetClass,
465  const std::string& gbpRuleToClassifierRSrcTargetName)
466  {
467  remove(opflex::ofcore::OFFramework::defaultInstance(),policySpaceName,gbpContractName,gbpSubjectName,gbpRuleName,gbpRuleToClassifierRSrcTargetClass,gbpRuleToClassifierRSrcTargetName);
468  }
469 
481  static void registerListener(
482  opflex::ofcore::OFFramework& framework,
483  opflex::modb::ObjectListener* listener)
484  {
485  opflex::modb::mointernal
486  ::MO::registerListener(framework, listener, CLASS_ID);
487  }
488 
500  static void registerListener(
501  opflex::modb::ObjectListener* listener)
502  {
503  registerListener(opflex::ofcore::OFFramework::defaultInstance(), listener);
504  }
505 
512  static void unregisterListener(
513  opflex::ofcore::OFFramework& framework,
514  opflex::modb::ObjectListener* listener)
515  {
516  opflex::modb::mointernal
517  ::MO::unregisterListener(framework, listener, CLASS_ID);
518  }
519 
526  static void unregisterListener(
527  opflex::modb::ObjectListener* listener)
528  {
529  unregisterListener(opflex::ofcore::OFFramework::defaultInstance(), listener);
530  }
531 
537  opflex::ofcore::OFFramework& framework,
538  const opflex::modb::URI& uri,
539  const boost::shared_ptr<const opflex::modb::mointernal::ObjectInstance>& oi)
540  : MO(framework, CLASS_ID, uri, oi) { }
541 }; // class RuleToClassifierRSrc
542 
543 } // namespace gbp
544 } // namespace modelgbp
545 #endif // GI_GBP_RULETOCLASSIFIERRSRC_HPP
static const opflex::modb::class_id_t CLASS_ID
The unique class ID for RuleToClassifierRSrc.
Definition: RuleToClassifierRSrc.hpp:29
static void registerListener(opflex::modb::ObjectListener *listener)
Register a listener that will get called for changes related to this class with the default framework...
Definition: RuleToClassifierRSrc.hpp:500
modelgbp::gbp::RuleToClassifierRSrc & setRole(const uint8_t newValue)
Set role to the specified value in the currently-active mutator.
Definition: RuleToClassifierRSrc.hpp:69
modelgbp::gbp::RuleToClassifierRSrc & setType(const uint8_t newValue)
Set type to the specified value in the currently-active mutator.
Definition: RuleToClassifierRSrc.hpp:228
static boost::optional< boost::shared_ptr< modelgbp::gbp::RuleToClassifierRSrc > > resolve(const opflex::modb::URI &uri)
Retrieve an instance of RuleToClassifierRSrc from the managed object store using the default framewor...
Definition: RuleToClassifierRSrc.hpp:275
const uint8_t getType(const uint8_t defaultValue)
Get the value of type if set, otherwise the value of default passed in.
Definition: RuleToClassifierRSrc.hpp:215
modelgbp::gbp::RuleToClassifierRSrc & unsetRole()
Unset role in the currently-active mutator.
Definition: RuleToClassifierRSrc.hpp:81
boost::optional< opflex::modb::URI > getTargetURI()
Get the value of targetURI if it has been set.
Definition: RuleToClassifierRSrc.hpp:111
RuleToClassifierRSrc(opflex::ofcore::OFFramework &framework, const opflex::modb::URI &uri, const boost::shared_ptr< const opflex::modb::mointernal::ObjectInstance > &oi)
Construct an instance of RuleToClassifierRSrc.
Definition: RuleToClassifierRSrc.hpp:536
Definition: RuleToClassifierRSrc.hpp:21
boost::optional< const uint8_t > getRole()
Get the value of role if it has been set.
Definition: RuleToClassifierRSrc.hpp:44
static void unregisterListener(opflex::modb::ObjectListener *listener)
Unregister a listener from updates to this class from the default framework instance.
Definition: RuleToClassifierRSrc.hpp:526
modelgbp::gbp::RuleToClassifierRSrc & setTargetL24Classifier(const std::string &policySpaceName, const std::string &gbpeL24ClassifierName)
Set the reference to point to an instance of L24Classifier in the currently-active mutator by constru...
Definition: RuleToClassifierRSrc.hpp:170
static void registerListener(opflex::ofcore::OFFramework &framework, opflex::modb::ObjectListener *listener)
Register a listener that will get called for changes related to this class.
Definition: RuleToClassifierRSrc.hpp:481
modelgbp::gbp::RuleToClassifierRSrc & setTargetL24Classifier(const opflex::modb::URI &uri)
Set the reference to point to an instance of L24Classifier with the specified URI.
Definition: RuleToClassifierRSrc.hpp:147
bool isRoleSet()
Check whether role has been set.
Definition: RuleToClassifierRSrc.hpp:35
static boost::optional< boost::shared_ptr< modelgbp::gbp::RuleToClassifierRSrc > > resolve(const std::string &policySpaceName, const std::string &gbpContractName, const std::string &gbpSubjectName, const std::string &gbpRuleName, uint16_t gbpRuleToClassifierRSrcTargetClass, const std::string &gbpRuleToClassifierRSrcTargetName)
Retrieve an instance of RuleToClassifierRSrc from the default managed object store by constructing it...
Definition: RuleToClassifierRSrc.hpp:344
boost::optional< opflex::modb::class_id_t > getTargetClass()
Get the value of targetClass if it has been set.
Definition: RuleToClassifierRSrc.hpp:100
opflex::modb::class_id_t getTargetClass(opflex::modb::class_id_t defaultValue)
Get the value of targetClass if set, otherwise the value of default passed in.
Definition: RuleToClassifierRSrc.hpp:123
modelgbp::gbp::RuleToClassifierRSrc & unsetTarget()
Unset target in the currently-active mutator.
Definition: RuleToClassifierRSrc.hpp:184
bool isTargetSet()
Check whether target has been set.
Definition: RuleToClassifierRSrc.hpp:91
bool isTypeSet()
Check whether type has been set.
Definition: RuleToClassifierRSrc.hpp:194
static boost::optional< boost::shared_ptr< modelgbp::gbp::RuleToClassifierRSrc > > resolve(opflex::ofcore::OFFramework &framework, const opflex::modb::URI &uri)
Retrieve an instance of RuleToClassifierRSrc from the managed object store.
Definition: RuleToClassifierRSrc.hpp:257
const uint8_t getRole(const uint8_t defaultValue)
Get the value of role if set, otherwise the value of default passed in.
Definition: RuleToClassifierRSrc.hpp:56
boost::optional< const uint8_t > getType()
Get the value of type if it has been set.
Definition: RuleToClassifierRSrc.hpp:203
modelgbp::gbp::RuleToClassifierRSrc & unsetType()
Unset type in the currently-active mutator.
Definition: RuleToClassifierRSrc.hpp:240
opflex::modb::URI getTargetURI(opflex::modb::URI defaultValue)
Get the value of targetURI if set, otherwise the value of default passed in.
Definition: RuleToClassifierRSrc.hpp:133
static boost::optional< boost::shared_ptr< modelgbp::gbp::RuleToClassifierRSrc > > resolve(opflex::ofcore::OFFramework &framework, const std::string &policySpaceName, const std::string &gbpContractName, const std::string &gbpSubjectName, const std::string &gbpRuleName, uint16_t gbpRuleToClassifierRSrcTargetClass, const std::string &gbpRuleToClassifierRSrcTargetName)
Retrieve an instance of RuleToClassifierRSrc from the managed object store by constructing its URI fr...
Definition: RuleToClassifierRSrc.hpp:307
static void unregisterListener(opflex::ofcore::OFFramework &framework, opflex::modb::ObjectListener *listener)
Unregister a listener from updates to this class.
Definition: RuleToClassifierRSrc.hpp:512