modelgbp Generated OpFlex Model 1.7.0
Rule.hpp
1
10#pragma once
11#ifndef GI_GBP_RULE_HPP
12#define GI_GBP_RULE_HPP
13
14#include <boost/optional.hpp>
15#include "opflex/modb/URIBuilder.h"
16#include "opflex/modb/mo-internal/MO.h"
17/*
18 * contains: item:mclass(gbp/RuleToClassifierRSrc)
19 */
20#include "modelgbp/gbp/RuleToClassifierRSrc.hpp"
21/*
22 * contains: item:mclass(gbp/RuleToActionRSrc)
23 */
24#include "modelgbp/gbp/RuleToActionRSrc.hpp"
25
26namespace modelgbp {
27namespace gbp {
28
29class Rule
30 : public opflex::modb::mointernal::MO
31{
32public:
33
37 static const opflex::modb::class_id_t CLASS_ID = 145;
38
44 {
45 return getObjectInstance().isSet(4751363ul, opflex::modb::PropertyInfo::ENUM8);
46 }
47
52 boost::optional<const uint8_t> getDirection()
53 {
54 if (isDirectionSet())
55 return (const uint8_t)getObjectInstance().getUInt64(4751363ul);
56 return boost::none;
57 }
58
64 const uint8_t getDirection(const uint8_t defaultValue)
65 {
66 return getDirection().get_value_or(defaultValue);
67 }
68
77 modelgbp::gbp::Rule& setDirection(const uint8_t newValue)
78 {
79 getTLMutator().modify(getClassId(), getURI())->setUInt64(4751363ul, newValue);
80 return *this;
81 }
82
90 {
91 getTLMutator().modify(getClassId(), getURI())->unset(4751363ul, opflex::modb::PropertyInfo::ENUM8, opflex::modb::PropertyInfo::SCALAR);
92 return *this;
93 }
94
99 bool isNameSet()
100 {
101 return getObjectInstance().isSet(4751361ul, opflex::modb::PropertyInfo::STRING);
102 }
103
108 boost::optional<const std::string&> getName()
109 {
110 if (isNameSet())
111 return getObjectInstance().getString(4751361ul);
112 return boost::none;
113 }
114
120 const std::string& getName(const std::string& defaultValue)
121 {
122 return getName().get_value_or(defaultValue);
123 }
124
133 modelgbp::gbp::Rule& setName(const std::string& newValue)
134 {
135 getTLMutator().modify(getClassId(), getURI())->setString(4751361ul, newValue);
136 return *this;
137 }
138
146 {
147 getTLMutator().modify(getClassId(), getURI())->unset(4751361ul, opflex::modb::PropertyInfo::STRING, opflex::modb::PropertyInfo::SCALAR);
148 return *this;
149 }
150
156 {
157 return getObjectInstance().isSet(4751362ul, opflex::modb::PropertyInfo::U64);
158 }
159
164 boost::optional<uint32_t> getOrder()
165 {
166 if (isOrderSet())
167 return (uint32_t)getObjectInstance().getUInt64(4751362ul);
168 return boost::none;
169 }
170
176 uint32_t getOrder(uint32_t defaultValue)
177 {
178 return getOrder().get_value_or(defaultValue);
179 }
180
189 modelgbp::gbp::Rule& setOrder(uint32_t newValue)
190 {
191 getTLMutator().modify(getClassId(), getURI())->setUInt64(4751362ul, newValue);
192 return *this;
193 }
194
202 {
203 getTLMutator().modify(getClassId(), getURI())->unset(4751362ul, opflex::modb::PropertyInfo::U64, opflex::modb::PropertyInfo::SCALAR);
204 return *this;
205 }
206
218 static boost::optional<OF_SHARED_PTR<modelgbp::gbp::Rule> > resolve(
219 opflex::ofcore::OFFramework& framework,
220 const opflex::modb::URI& uri)
221 {
222 return opflex::modb::mointernal::MO::resolve<modelgbp::gbp::Rule>(framework, CLASS_ID, uri);
223 }
224
236 static boost::optional<OF_SHARED_PTR<modelgbp::gbp::Rule> > resolve(
237 const opflex::modb::URI& uri)
238 {
239 return opflex::modb::mointernal::MO::resolve<modelgbp::gbp::Rule>(opflex::ofcore::OFFramework::defaultInstance(), CLASS_ID, uri);
240 }
241
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)
270 {
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());
272 }
273
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)
300 {
301 return resolve(opflex::ofcore::OFFramework::defaultInstance(),policySpaceName,gbpContractName,gbpSubjectName,gbpRuleName);
302 }
303
317 boost::optional<OF_SHARED_PTR<modelgbp::gbp::RuleToClassifierRSrc> > resolveGbpRuleToClassifierRSrc(
318 const std::string& gbpRuleToClassifierRSrcTargetName)
319 {
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());
322 }
323
338 OF_SHARED_PTR<modelgbp::gbp::RuleToClassifierRSrc> addGbpRuleToClassifierRSrc(
339 const std::string& gbpRuleToClassifierRSrcTargetName)
340 {
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()
345 );
346 result->setTargetL24Classifier(opflex::modb::URI(gbpRuleToClassifierRSrcTargetName));
347 return result;
348 }
349
364 void resolveGbpRuleToClassifierRSrc(/* out */ std::vector<OF_SHARED_PTR<modelgbp::gbp::RuleToClassifierRSrc> >& out)
365 {
366 opflex::modb::mointernal::MO::resolveChildren<modelgbp::gbp::RuleToClassifierRSrc>(
367 getFramework(), CLASS_ID, getURI(), 2152235154ul, 146, out);
368 }
369
383 boost::optional<OF_SHARED_PTR<modelgbp::gbp::RuleToActionRSrc> > resolveGbpRuleToActionRSrc(
384 const std::string& gbpRuleToActionRSrcTargetName)
385 {
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());
388 }
389
404 OF_SHARED_PTR<modelgbp::gbp::RuleToActionRSrc> addGbpRuleToActionRSrc(
405 const std::string& gbpRuleToActionRSrcTargetName)
406 {
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()
411 );
412 result->setTargetAllowDenyAction(opflex::modb::URI(gbpRuleToActionRSrcTargetName));
413 return result;
414 }
415
430 void resolveGbpRuleToActionRSrc(/* out */ std::vector<OF_SHARED_PTR<modelgbp::gbp::RuleToActionRSrc> >& out)
431 {
432 opflex::modb::mointernal::MO::resolveChildren<modelgbp::gbp::RuleToActionRSrc>(
433 getFramework(), CLASS_ID, getURI(), 2152235157ul, 149, out);
434 }
435
444 void remove()
445 {
446 getTLMutator().remove(CLASS_ID, getURI());
447 }
448
459 static void remove(opflex::ofcore::OFFramework& framework,
460 const opflex::modb::URI& uri)
461 {
462 MO::remove(framework, CLASS_ID, uri);
463 }
464
475 static void remove(const opflex::modb::URI& uri)
476 {
477 remove(opflex::ofcore::OFFramework::defaultInstance(), uri);
478 }
479
500 static void remove(
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)
506 {
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());
508 }
509
530 static void remove(
531 const std::string& policySpaceName,
532 const std::string& gbpContractName,
533 const std::string& gbpSubjectName,
534 const std::string& gbpRuleName)
535 {
536 remove(opflex::ofcore::OFFramework::defaultInstance(),policySpaceName,gbpContractName,gbpSubjectName,gbpRuleName);
537 }
538
550 static void registerListener(
551 opflex::ofcore::OFFramework& framework,
552 opflex::modb::ObjectListener* listener)
553 {
554 opflex::modb::mointernal
555 ::MO::registerListener(framework, listener, CLASS_ID);
556 }
557
569 static void registerListener(
570 opflex::modb::ObjectListener* listener)
571 {
572 registerListener(opflex::ofcore::OFFramework::defaultInstance(), listener);
573 }
574
582 opflex::ofcore::OFFramework& framework,
583 opflex::modb::ObjectListener* listener)
584 {
585 opflex::modb::mointernal
586 ::MO::unregisterListener(framework, listener, CLASS_ID);
587 }
588
596 opflex::modb::ObjectListener* listener)
597 {
598 unregisterListener(opflex::ofcore::OFFramework::defaultInstance(), listener);
599 }
600
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) { }
610}; // class Rule
611
612} // namespace gbp
613} // namespace modelgbp
614#endif // GI_GBP_RULE_HPP
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
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
Definition Rule.hpp:31
modelgbp::gbp::Rule & unsetName()
Unset name in the currently-active mutator.
Definition Rule.hpp:145
static void unregisterListener(opflex::modb::ObjectListener *listener)
Unregister a listener from updates to this class from the default framework instance.
Definition Rule.hpp:595
boost::optional< const std::string & > getName()
Get the value of name if it has been set.
Definition Rule.hpp:108
uint32_t getOrder(uint32_t defaultValue)
Get the value of order if set, otherwise the value of default passed in.
Definition Rule.hpp:176
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
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 remove(const std::string &policySpaceName, const std::string &gbpContractName, const std::string &gbpSubjectName, const std::string &gbpRuleName)
Remove the Rule object with the specified path elements from the managed object store using the defau...
Definition Rule.hpp:530
modelgbp::gbp::Rule & unsetDirection()
Unset direction in the currently-active mutator.
Definition Rule.hpp:89
static void remove(const opflex::modb::URI &uri)
Remove the Rule object with the specified URI using the currently-active mutator and the default fram...
Definition Rule.hpp:475
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
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
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 void unregisterListener(opflex::ofcore::OFFramework &framework, opflex::modb::ObjectListener *listener)
Unregister a listener from updates to this class.
Definition Rule.hpp:581
static const opflex::modb::class_id_t CLASS_ID
The unique class ID for Rule.
Definition Rule.hpp:37
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
void remove()
Remove this instance using the currently-active mutator.
Definition Rule.hpp:444
bool isOrderSet()
Check whether order has been set.
Definition Rule.hpp:155
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
boost::optional< uint32_t > getOrder()
Get the value of order if it has been set.
Definition Rule.hpp:164
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
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
bool isDirectionSet()
Check whether direction has been set.
Definition Rule.hpp:43
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
modelgbp::gbp::Rule & setOrder(uint32_t newValue)
Set order to the specified value in the currently-active mutator.
Definition Rule.hpp:189
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 & setDirection(const uint8_t newValue)
Set direction to the specified value in the currently-active mutator.
Definition Rule.hpp:77
static void remove(opflex::ofcore::OFFramework &framework, const std::string &policySpaceName, const std::string &gbpContractName, const std::string &gbpSubjectName, const std::string &gbpRuleName)
Remove the Rule object with the specified path elements from the managed object store.
Definition Rule.hpp:500
bool isNameSet()
Check whether name has been set.
Definition Rule.hpp:99
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
static void remove(opflex::ofcore::OFFramework &framework, const opflex::modb::URI &uri)
Remove the Rule object with the specified URI using the currently-active mutator.
Definition Rule.hpp:459
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
boost::optional< const uint8_t > getDirection()
Get the value of direction if it has been set.
Definition Rule.hpp:52
modelgbp::gbp::Rule & setName(const std::string &newValue)
Set name to the specified value in the currently-active mutator.
Definition Rule.hpp:133
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
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
modelgbp::gbp::Rule & unsetOrder()
Unset order in the currently-active mutator.
Definition Rule.hpp:201
SOME COPYRIGHT.
Definition OpcodeEnumT.hpp:12