11 #ifndef GI_GBP_RULE_HPP
12 #define GI_GBP_RULE_HPP
14 #include <boost/optional.hpp>
15 #include "opflex/modb/URIBuilder.h"
16 #include "opflex/modb/mo-internal/MO.h"
20 #include "modelgbp/gbp/RuleToClassifierRSrc.hpp"
24 #include "modelgbp/gbp/RuleToActionRSrc.hpp"
30 :
public opflex::modb::mointernal::MO
37 static const opflex::modb::class_id_t
CLASS_ID = 145;
45 return getObjectInstance().isSet(4751363ul, opflex::modb::PropertyInfo::ENUM8);
55 return (
const uint8_t)getObjectInstance().getUInt64(4751363ul);
79 getTLMutator().modify(getClassId(), getURI())->setUInt64(4751363ul, newValue);
91 getTLMutator().modify(getClassId(), getURI())->unset(4751363ul, opflex::modb::PropertyInfo::ENUM8, opflex::modb::PropertyInfo::SCALAR);
101 return getObjectInstance().isSet(4751361ul, opflex::modb::PropertyInfo::STRING);
111 return getObjectInstance().getString(4751361ul);
120 const std::string&
getName(
const std::string& defaultValue)
122 return getName().get_value_or(defaultValue);
135 getTLMutator().modify(getClassId(), getURI())->setString(4751361ul, newValue);
147 getTLMutator().modify(getClassId(), getURI())->unset(4751361ul, opflex::modb::PropertyInfo::STRING, opflex::modb::PropertyInfo::SCALAR);
157 return getObjectInstance().isSet(4751362ul, opflex::modb::PropertyInfo::U64);
167 return (uint32_t)getObjectInstance().getUInt64(4751362ul);
178 return getOrder().get_value_or(defaultValue);
191 getTLMutator().modify(getClassId(), getURI())->setUInt64(4751362ul, newValue);
203 getTLMutator().modify(getClassId(), getURI())->unset(4751362ul, opflex::modb::PropertyInfo::U64, opflex::modb::PropertyInfo::SCALAR);
218 static boost::optional<OF_SHARED_PTR<modelgbp::gbp::Rule> >
resolve(
219 opflex::ofcore::OFFramework& framework,
220 const opflex::modb::URI& uri)
222 return opflex::modb::mointernal::MO::resolve<modelgbp::gbp::Rule>(framework,
CLASS_ID, uri);
236 static boost::optional<OF_SHARED_PTR<modelgbp::gbp::Rule> >
resolve(
237 const opflex::modb::URI& uri)
239 return opflex::modb::mointernal::MO::resolve<modelgbp::gbp::Rule>(opflex::ofcore::OFFramework::defaultInstance(),
CLASS_ID, uri);
264 static boost::optional<OF_SHARED_PTR<modelgbp::gbp::Rule> >
resolve(
265 opflex::ofcore::OFFramework& framework,
266 const std::string& policySpaceName,
267 const std::string& gbpContractName,
268 const std::string& gbpSubjectName,
269 const std::string& gbpRuleName)
271 return resolve(framework,opflex::modb::URIBuilder().addElement(
"PolicyUniverse").addElement(
"PolicySpace").addElement(policySpaceName).addElement(
"GbpContract").addElement(gbpContractName).addElement(
"GbpSubject").addElement(gbpSubjectName).addElement(
"GbpRule").addElement(gbpRuleName).build());
295 static boost::optional<OF_SHARED_PTR<modelgbp::gbp::Rule> >
resolve(
296 const std::string& policySpaceName,
297 const std::string& gbpContractName,
298 const std::string& gbpSubjectName,
299 const std::string& gbpRuleName)
301 return resolve(opflex::ofcore::OFFramework::defaultInstance(),policySpaceName,gbpContractName,gbpSubjectName,gbpRuleName);
318 const std::string& gbpRuleToClassifierRSrcTargetName)
320 opflex::modb::class_id_t gbpRuleToClassifierRSrcTargetClass = 42;
321 return modelgbp::gbp::RuleToClassifierRSrc::resolve(getFramework(), opflex::modb::URIBuilder(getURI()).addElement(
"GbpRuleToClassifierRSrc").addElement(gbpRuleToClassifierRSrcTargetClass).addElement(gbpRuleToClassifierRSrcTargetName).build());
339 const std::string& gbpRuleToClassifierRSrcTargetName)
341 opflex::modb::class_id_t gbpRuleToClassifierRSrcTargetClass = 42;
342 OF_SHARED_PTR<modelgbp::gbp::RuleToClassifierRSrc> result = addChild<modelgbp::gbp::RuleToClassifierRSrc>(
343 CLASS_ID, getURI(), 2152235154ul, 146,
344 opflex::modb::URIBuilder(getURI()).addElement(
"GbpRuleToClassifierRSrc").addElement(gbpRuleToClassifierRSrcTargetClass).addElement(gbpRuleToClassifierRSrcTargetName).build()
346 result->setTargetL24Classifier(opflex::modb::URI(gbpRuleToClassifierRSrcTargetName));
366 opflex::modb::mointernal::MO::resolveChildren<modelgbp::gbp::RuleToClassifierRSrc>(
367 getFramework(),
CLASS_ID, getURI(), 2152235154ul, 146, out);
384 const std::string& gbpRuleToActionRSrcTargetName)
386 opflex::modb::class_id_t gbpRuleToActionRSrcTargetClass = 141;
387 return modelgbp::gbp::RuleToActionRSrc::resolve(getFramework(), opflex::modb::URIBuilder(getURI()).addElement(
"GbpRuleToActionRSrc").addElement(gbpRuleToActionRSrcTargetClass).addElement(gbpRuleToActionRSrcTargetName).build());
405 const std::string& gbpRuleToActionRSrcTargetName)
407 opflex::modb::class_id_t gbpRuleToActionRSrcTargetClass = 141;
408 OF_SHARED_PTR<modelgbp::gbp::RuleToActionRSrc> result = addChild<modelgbp::gbp::RuleToActionRSrc>(
409 CLASS_ID, getURI(), 2152235157ul, 149,
410 opflex::modb::URIBuilder(getURI()).addElement(
"GbpRuleToActionRSrc").addElement(gbpRuleToActionRSrcTargetClass).addElement(gbpRuleToActionRSrcTargetName).build()
412 result->setTargetAllowDenyAction(opflex::modb::URI(gbpRuleToActionRSrcTargetName));
432 opflex::modb::mointernal::MO::resolveChildren<modelgbp::gbp::RuleToActionRSrc>(
433 getFramework(),
CLASS_ID, getURI(), 2152235157ul, 149, out);
446 getTLMutator().remove(
CLASS_ID, getURI());
459 static void remove(opflex::ofcore::OFFramework& framework,
460 const opflex::modb::URI& uri)
462 MO::remove(framework,
CLASS_ID, uri);
475 static void remove(
const opflex::modb::URI& uri)
477 remove(opflex::ofcore::OFFramework::defaultInstance(), uri);
501 opflex::ofcore::OFFramework& framework,
502 const std::string& policySpaceName,
503 const std::string& gbpContractName,
504 const std::string& gbpSubjectName,
505 const std::string& gbpRuleName)
507 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).build());
531 const std::string& policySpaceName,
532 const std::string& gbpContractName,
533 const std::string& gbpSubjectName,
534 const std::string& gbpRuleName)
536 remove(opflex::ofcore::OFFramework::defaultInstance(),policySpaceName,gbpContractName,gbpSubjectName,gbpRuleName);
551 opflex::ofcore::OFFramework& framework,
552 opflex::modb::ObjectListener* listener)
554 opflex::modb::mointernal
555 ::MO::registerListener(framework, listener,
CLASS_ID);
570 opflex::modb::ObjectListener* listener)
582 opflex::ofcore::OFFramework& framework,
583 opflex::modb::ObjectListener* listener)
585 opflex::modb::mointernal
586 ::MO::unregisterListener(framework, listener,
CLASS_ID);
596 opflex::modb::ObjectListener* listener)
606 opflex::ofcore::OFFramework& framework,
607 const opflex::modb::URI& uri,
608 const OF_SHARED_PTR<const opflex::modb::mointernal::ObjectInstance>& oi)
609 : MO(framework,
CLASS_ID, uri, oi) { }
614 #endif // GI_GBP_RULE_HPP
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: Rule.hpp:569
static void unregisterListener(opflex::ofcore::OFFramework &framework, opflex::modb::ObjectListener *listener)
Unregister a listener from updates to this class.
Definition: Rule.hpp:581
static boost::optional< OF_SHARED_PTR< modelgbp::gbp::Rule > > resolve(opflex::ofcore::OFFramework &framework, const opflex::modb::URI &uri)
Retrieve an instance of Rule from the managed object store.
Definition: Rule.hpp:218
modelgbp::gbp::Rule & setName(const std::string &newValue)
Set name to the specified value in the currently-active mutator.
Definition: Rule.hpp:133
modelgbp::gbp::Rule & unsetOrder()
Unset order in the currently-active mutator.
Definition: Rule.hpp:201
void resolveGbpRuleToClassifierRSrc(std::vector< OF_SHARED_PTR< modelgbp::gbp::RuleToClassifierRSrc > > &out)
Resolve and retrieve all of the immediate children of type modelgbp::gbp::RuleToClassifierRSrc.
Definition: Rule.hpp:364
static boost::optional< OF_SHARED_PTR< modelgbp::gbp::RuleToActionRSrc > > resolve(opflex::ofcore::OFFramework &framework, const opflex::modb::URI &uri)
Retrieve an instance of RuleToActionRSrc from the managed object store.
Definition: RuleToActionRSrc.hpp:257
modelgbp::gbp::Rule & unsetName()
Unset name in the currently-active mutator.
Definition: Rule.hpp:145
static boost::optional< OF_SHARED_PTR< modelgbp::gbp::Rule > > resolve(opflex::ofcore::OFFramework &framework, const std::string &policySpaceName, const std::string &gbpContractName, const std::string &gbpSubjectName, const std::string &gbpRuleName)
Retrieve an instance of Rule from the managed object store by constructing its URI from the path elem...
Definition: Rule.hpp:264
bool isNameSet()
Check whether name has been set.
Definition: Rule.hpp:99
boost::optional< const uint8_t > getDirection()
Get the value of direction if it has been set.
Definition: Rule.hpp:52
Rule(opflex::ofcore::OFFramework &framework, const opflex::modb::URI &uri, const OF_SHARED_PTR< const opflex::modb::mointernal::ObjectInstance > &oi)
Construct an instance of Rule.
Definition: Rule.hpp:605
uint32_t getOrder(uint32_t defaultValue)
Get the value of order if set, otherwise the value of default passed in.
Definition: Rule.hpp:176
const uint8_t getDirection(const uint8_t defaultValue)
Get the value of direction if set, otherwise the value of default passed in.
Definition: Rule.hpp:64
modelgbp::gbp::Rule & unsetDirection()
Unset direction in the currently-active mutator.
Definition: Rule.hpp:89
static boost::optional< OF_SHARED_PTR< modelgbp::gbp::Rule > > resolve(const opflex::modb::URI &uri)
Retrieve an instance of Rule from the managed object store using the default framework instance...
Definition: Rule.hpp:236
boost::optional< uint32_t > getOrder()
Get the value of order if it has been set.
Definition: Rule.hpp:164
static boost::optional< OF_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
boost::optional< OF_SHARED_PTR< modelgbp::gbp::RuleToActionRSrc > > resolveGbpRuleToActionRSrc(const std::string &gbpRuleToActionRSrcTargetName)
Retrieve the child object with the specified naming properties.
Definition: Rule.hpp:383
static void unregisterListener(opflex::modb::ObjectListener *listener)
Unregister a listener from updates to this class from the default framework instance.
Definition: Rule.hpp:595
bool isOrderSet()
Check whether order has been set.
Definition: Rule.hpp:155
boost::optional< const std::string & > getName()
Get the value of name if it has been set.
Definition: Rule.hpp:108
OF_SHARED_PTR< modelgbp::gbp::RuleToActionRSrc > addGbpRuleToActionRSrc(const std::string &gbpRuleToActionRSrcTargetName)
Create a new child object with the specified naming properties and make it a child of this object in ...
Definition: Rule.hpp:404
const std::string & getName(const std::string &defaultValue)
Get the value of name if set, otherwise the value of default passed in.
Definition: Rule.hpp:120
static const opflex::modb::class_id_t CLASS_ID
The unique class ID for Rule.
Definition: Rule.hpp:37
OF_SHARED_PTR< modelgbp::gbp::RuleToClassifierRSrc > addGbpRuleToClassifierRSrc(const std::string &gbpRuleToClassifierRSrcTargetName)
Create a new child object with the specified naming properties and make it a child of this object in ...
Definition: Rule.hpp:338
modelgbp::gbp::Rule & setDirection(const uint8_t newValue)
Set direction to the specified value in the currently-active mutator.
Definition: Rule.hpp:77
static boost::optional< OF_SHARED_PTR< modelgbp::gbp::Rule > > resolve(const std::string &policySpaceName, const std::string &gbpContractName, const std::string &gbpSubjectName, const std::string &gbpRuleName)
Retrieve an instance of Rule from the default managed object store by constructing its URI from the p...
Definition: Rule.hpp:295
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: Rule.hpp:550
bool isDirectionSet()
Check whether direction has been set.
Definition: Rule.hpp:43
boost::optional< OF_SHARED_PTR< modelgbp::gbp::RuleToClassifierRSrc > > resolveGbpRuleToClassifierRSrc(const std::string &gbpRuleToClassifierRSrcTargetName)
Retrieve the child object with the specified naming properties.
Definition: Rule.hpp:317
modelgbp::gbp::Rule & setOrder(uint32_t newValue)
Set order to the specified value in the currently-active mutator.
Definition: Rule.hpp:189
void resolveGbpRuleToActionRSrc(std::vector< OF_SHARED_PTR< modelgbp::gbp::RuleToActionRSrc > > &out)
Resolve and retrieve all of the immediate children of type modelgbp::gbp::RuleToActionRSrc.
Definition: Rule.hpp:430