modelgbp Generated OpFlex Model  1.7.0
stp/Config.hpp
1 
10 #pragma once
11 #ifndef GI_STP_CONFIG_HPP
12 #define GI_STP_CONFIG_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 stp {
20 
21 class Config
22  : public opflex::modb::mointernal::MO
23 {
24 public:
25 
29  static const opflex::modb::class_id_t CLASS_ID = 80;
30 
36  {
37  return getObjectInstance().isSet(2621443ul, opflex::modb::PropertyInfo::ENUM8);
38  }
39 
44  boost::optional<const uint8_t> getBpduFilter()
45  {
46  if (isBpduFilterSet())
47  return (const uint8_t)getObjectInstance().getUInt64(2621443ul);
48  return boost::none;
49  }
50 
56  const uint8_t getBpduFilter(const uint8_t defaultValue)
57  {
58  return getBpduFilter().get_value_or(defaultValue);
59  }
60 
69  modelgbp::stp::Config& setBpduFilter(const uint8_t newValue)
70  {
71  getTLMutator().modify(getClassId(), getURI())->setUInt64(2621443ul, newValue);
72  return *this;
73  }
74 
82  {
83  getTLMutator().modify(getClassId(), getURI())->unset(2621443ul, opflex::modb::PropertyInfo::ENUM8, opflex::modb::PropertyInfo::SCALAR);
84  return *this;
85  }
86 
92  {
93  return getObjectInstance().isSet(2621442ul, opflex::modb::PropertyInfo::ENUM8);
94  }
95 
100  boost::optional<const uint8_t> getBpduGuard()
101  {
102  if (isBpduGuardSet())
103  return (const uint8_t)getObjectInstance().getUInt64(2621442ul);
104  return boost::none;
105  }
106 
112  const uint8_t getBpduGuard(const uint8_t defaultValue)
113  {
114  return getBpduGuard().get_value_or(defaultValue);
115  }
116 
125  modelgbp::stp::Config& setBpduGuard(const uint8_t newValue)
126  {
127  getTLMutator().modify(getClassId(), getURI())->setUInt64(2621442ul, newValue);
128  return *this;
129  }
130 
138  {
139  getTLMutator().modify(getClassId(), getURI())->unset(2621442ul, opflex::modb::PropertyInfo::ENUM8, opflex::modb::PropertyInfo::SCALAR);
140  return *this;
141  }
142 
147  bool isNameSet()
148  {
149  return getObjectInstance().isSet(2621441ul, opflex::modb::PropertyInfo::STRING);
150  }
151 
156  boost::optional<const std::string&> getName()
157  {
158  if (isNameSet())
159  return getObjectInstance().getString(2621441ul);
160  return boost::none;
161  }
162 
168  const std::string& getName(const std::string& defaultValue)
169  {
170  return getName().get_value_or(defaultValue);
171  }
172 
181  modelgbp::stp::Config& setName(const std::string& newValue)
182  {
183  getTLMutator().modify(getClassId(), getURI())->setString(2621441ul, newValue);
184  return *this;
185  }
186 
194  {
195  getTLMutator().modify(getClassId(), getURI())->unset(2621441ul, opflex::modb::PropertyInfo::STRING, opflex::modb::PropertyInfo::SCALAR);
196  return *this;
197  }
198 
210  static boost::optional<OF_SHARED_PTR<modelgbp::stp::Config> > resolve(
211  opflex::ofcore::OFFramework& framework,
212  const opflex::modb::URI& uri)
213  {
214  return opflex::modb::mointernal::MO::resolve<modelgbp::stp::Config>(framework, CLASS_ID, uri);
215  }
216 
228  static boost::optional<OF_SHARED_PTR<modelgbp::stp::Config> > resolve(
229  const opflex::modb::URI& uri)
230  {
231  return opflex::modb::mointernal::MO::resolve<modelgbp::stp::Config>(opflex::ofcore::OFFramework::defaultInstance(), CLASS_ID, uri);
232  }
233 
250  static boost::optional<OF_SHARED_PTR<modelgbp::stp::Config> > resolve(
251  opflex::ofcore::OFFramework& framework,
252  const std::string& platformConfigName)
253  {
254  return resolve(framework,opflex::modb::URIBuilder().addElement("PolicyUniverse").addElement("PlatformConfig").addElement(platformConfigName).addElement("StpConfig").build());
255  }
256 
272  static boost::optional<OF_SHARED_PTR<modelgbp::stp::Config> > resolve(
273  const std::string& platformConfigName)
274  {
275  return resolve(opflex::ofcore::OFFramework::defaultInstance(),platformConfigName);
276  }
277 
286  void remove()
287  {
288  getTLMutator().remove(CLASS_ID, getURI());
289  }
290 
301  static void remove(opflex::ofcore::OFFramework& framework,
302  const opflex::modb::URI& uri)
303  {
304  MO::remove(framework, CLASS_ID, uri);
305  }
306 
317  static void remove(const opflex::modb::URI& uri)
318  {
319  remove(opflex::ofcore::OFFramework::defaultInstance(), uri);
320  }
321 
336  static void remove(
337  opflex::ofcore::OFFramework& framework,
338  const std::string& platformConfigName)
339  {
340  MO::remove(framework, CLASS_ID, opflex::modb::URIBuilder().addElement("PolicyUniverse").addElement("PlatformConfig").addElement(platformConfigName).addElement("StpConfig").build());
341  }
342 
357  static void remove(
358  const std::string& platformConfigName)
359  {
360  remove(opflex::ofcore::OFFramework::defaultInstance(),platformConfigName);
361  }
362 
374  static void registerListener(
375  opflex::ofcore::OFFramework& framework,
376  opflex::modb::ObjectListener* listener)
377  {
378  opflex::modb::mointernal
379  ::MO::registerListener(framework, listener, CLASS_ID);
380  }
381 
393  static void registerListener(
394  opflex::modb::ObjectListener* listener)
395  {
396  registerListener(opflex::ofcore::OFFramework::defaultInstance(), listener);
397  }
398 
405  static void unregisterListener(
406  opflex::ofcore::OFFramework& framework,
407  opflex::modb::ObjectListener* listener)
408  {
409  opflex::modb::mointernal
410  ::MO::unregisterListener(framework, listener, CLASS_ID);
411  }
412 
419  static void unregisterListener(
420  opflex::modb::ObjectListener* listener)
421  {
422  unregisterListener(opflex::ofcore::OFFramework::defaultInstance(), listener);
423  }
424 
430  opflex::ofcore::OFFramework& framework,
431  const opflex::modb::URI& uri,
432  const OF_SHARED_PTR<const opflex::modb::mointernal::ObjectInstance>& oi)
433  : MO(framework, CLASS_ID, uri, oi) { }
434 }; // class Config
435 
436 } // namespace stp
437 } // namespace modelgbp
438 #endif // GI_STP_CONFIG_HPP
bool isNameSet()
Check whether name has been set.
Definition: stp/Config.hpp:147
modelgbp::stp::Config & setBpduGuard(const uint8_t newValue)
Set bpduGuard to the specified value in the currently-active mutator.
Definition: stp/Config.hpp:125
boost::optional< const uint8_t > getBpduFilter()
Get the value of bpduFilter if it has been set.
Definition: stp/Config.hpp:44
modelgbp::stp::Config & setBpduFilter(const uint8_t newValue)
Set bpduFilter to the specified value in the currently-active mutator.
Definition: stp/Config.hpp:69
static boost::optional< OF_SHARED_PTR< modelgbp::stp::Config > > resolve(opflex::ofcore::OFFramework &framework, const opflex::modb::URI &uri)
Retrieve an instance of Config from the managed object store.
Definition: stp/Config.hpp:210
bool isBpduFilterSet()
Check whether bpduFilter has been set.
Definition: stp/Config.hpp:35
const uint8_t getBpduGuard(const uint8_t defaultValue)
Get the value of bpduGuard if set, otherwise the value of default passed in.
Definition: stp/Config.hpp:112
Config(opflex::ofcore::OFFramework &framework, const opflex::modb::URI &uri, const OF_SHARED_PTR< const opflex::modb::mointernal::ObjectInstance > &oi)
Construct an instance of Config.
Definition: stp/Config.hpp:429
static boost::optional< OF_SHARED_PTR< modelgbp::stp::Config > > resolve(const std::string &platformConfigName)
Retrieve an instance of Config from the default managed object store by constructing its URI from the...
Definition: stp/Config.hpp:272
modelgbp::stp::Config & unsetName()
Unset name in the currently-active mutator.
Definition: stp/Config.hpp:193
const std::string & getName(const std::string &defaultValue)
Get the value of name if set, otherwise the value of default passed in.
Definition: stp/Config.hpp:168
boost::optional< const std::string & > getName()
Get the value of name if it has been set.
Definition: stp/Config.hpp:156
modelgbp::stp::Config & unsetBpduFilter()
Unset bpduFilter in the currently-active mutator.
Definition: stp/Config.hpp:81
static void unregisterListener(opflex::ofcore::OFFramework &framework, opflex::modb::ObjectListener *listener)
Unregister a listener from updates to this class.
Definition: stp/Config.hpp:405
boost::optional< const uint8_t > getBpduGuard()
Get the value of bpduGuard if it has been set.
Definition: stp/Config.hpp:100
static const opflex::modb::class_id_t CLASS_ID
The unique class ID for Config.
Definition: stp/Config.hpp:29
static void unregisterListener(opflex::modb::ObjectListener *listener)
Unregister a listener from updates to this class from the default framework instance.
Definition: stp/Config.hpp:419
const uint8_t getBpduFilter(const uint8_t defaultValue)
Get the value of bpduFilter if set, otherwise the value of default passed in.
Definition: stp/Config.hpp:56
static boost::optional< OF_SHARED_PTR< modelgbp::stp::Config > > resolve(opflex::ofcore::OFFramework &framework, const std::string &platformConfigName)
Retrieve an instance of Config from the managed object store by constructing its URI from the path el...
Definition: stp/Config.hpp:250
modelgbp::stp::Config & setName(const std::string &newValue)
Set name to the specified value in the currently-active mutator.
Definition: stp/Config.hpp:181
static boost::optional< OF_SHARED_PTR< modelgbp::stp::Config > > resolve(const opflex::modb::URI &uri)
Retrieve an instance of Config from the managed object store using the default framework instance...
Definition: stp/Config.hpp:228
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: stp/Config.hpp:393
modelgbp::stp::Config & unsetBpduGuard()
Unset bpduGuard in the currently-active mutator.
Definition: stp/Config.hpp:137
bool isBpduGuardSet()
Check whether bpduGuard has been set.
Definition: stp/Config.hpp:91
SOME COPYRIGHT.
Definition: OpcodeEnumT.hpp:12
Definition: stp/Config.hpp:21
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: stp/Config.hpp:374