modelgbp Generated OpFlex Model  1.3.0
cdp/Config.hpp
1 
10 #pragma once
11 #ifndef GI_CDP_CONFIG_HPP
12 #define GI_CDP_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 cdp {
20 
21 class Config
22  : public opflex::modb::mointernal::MO
23 {
24 public:
25 
29  static const opflex::modb::class_id_t CLASS_ID = 39;
30 
35  bool isNameSet()
36  {
37  return getObjectInstance().isSet(1277953ul, opflex::modb::PropertyInfo::STRING);
38  }
39 
44  boost::optional<const std::string&> getName()
45  {
46  if (isNameSet())
47  return getObjectInstance().getString(1277953ul);
48  return boost::none;
49  }
50 
56  const std::string& getName(const std::string& defaultValue)
57  {
58  return getName().get_value_or(defaultValue);
59  }
60 
69  modelgbp::cdp::Config& setName(const std::string& newValue)
70  {
71  getTLMutator().modify(getClassId(), getURI())->setString(1277953ul, newValue);
72  return *this;
73  }
74 
82  {
83  getTLMutator().modify(getClassId(), getURI())->unset(1277953ul, opflex::modb::PropertyInfo::STRING, opflex::modb::PropertyInfo::SCALAR);
84  return *this;
85  }
86 
91  bool isStateSet()
92  {
93  return getObjectInstance().isSet(1277954ul, opflex::modb::PropertyInfo::ENUM8);
94  }
95 
100  boost::optional<const uint8_t> getState()
101  {
102  if (isStateSet())
103  return (const uint8_t)getObjectInstance().getUInt64(1277954ul);
104  return boost::none;
105  }
106 
112  const uint8_t getState(const uint8_t defaultValue)
113  {
114  return getState().get_value_or(defaultValue);
115  }
116 
125  modelgbp::cdp::Config& setState(const uint8_t newValue)
126  {
127  getTLMutator().modify(getClassId(), getURI())->setUInt64(1277954ul, newValue);
128  return *this;
129  }
130 
138  {
139  getTLMutator().modify(getClassId(), getURI())->unset(1277954ul, opflex::modb::PropertyInfo::ENUM8, opflex::modb::PropertyInfo::SCALAR);
140  return *this;
141  }
142 
154  static boost::optional<boost::shared_ptr<modelgbp::cdp::Config> > resolve(
155  opflex::ofcore::OFFramework& framework,
156  const opflex::modb::URI& uri)
157  {
158  return opflex::modb::mointernal::MO::resolve<modelgbp::cdp::Config>(framework, CLASS_ID, uri);
159  }
160 
172  static boost::optional<boost::shared_ptr<modelgbp::cdp::Config> > resolve(
173  const opflex::modb::URI& uri)
174  {
175  return opflex::modb::mointernal::MO::resolve<modelgbp::cdp::Config>(opflex::ofcore::OFFramework::defaultInstance(), CLASS_ID, uri);
176  }
177 
194  static boost::optional<boost::shared_ptr<modelgbp::cdp::Config> > resolve(
195  opflex::ofcore::OFFramework& framework,
196  const std::string& platformConfigName)
197  {
198  return resolve(framework,opflex::modb::URIBuilder().addElement("PolicyUniverse").addElement("PlatformConfig").addElement(platformConfigName).addElement("CdpConfig").build());
199  }
200 
216  static boost::optional<boost::shared_ptr<modelgbp::cdp::Config> > resolve(
217  const std::string& platformConfigName)
218  {
219  return resolve(opflex::ofcore::OFFramework::defaultInstance(),platformConfigName);
220  }
221 
230  void remove()
231  {
232  getTLMutator().remove(CLASS_ID, getURI());
233  }
234 
245  static void remove(opflex::ofcore::OFFramework& framework,
246  const opflex::modb::URI& uri)
247  {
248  MO::remove(framework, CLASS_ID, uri);
249  }
250 
261  static void remove(const opflex::modb::URI& uri)
262  {
263  remove(opflex::ofcore::OFFramework::defaultInstance(), uri);
264  }
265 
280  static void remove(
281  opflex::ofcore::OFFramework& framework,
282  const std::string& platformConfigName)
283  {
284  MO::remove(framework, CLASS_ID, opflex::modb::URIBuilder().addElement("PolicyUniverse").addElement("PlatformConfig").addElement(platformConfigName).addElement("CdpConfig").build());
285  }
286 
301  static void remove(
302  const std::string& platformConfigName)
303  {
304  remove(opflex::ofcore::OFFramework::defaultInstance(),platformConfigName);
305  }
306 
318  static void registerListener(
319  opflex::ofcore::OFFramework& framework,
320  opflex::modb::ObjectListener* listener)
321  {
322  opflex::modb::mointernal
323  ::MO::registerListener(framework, listener, CLASS_ID);
324  }
325 
337  static void registerListener(
338  opflex::modb::ObjectListener* listener)
339  {
340  registerListener(opflex::ofcore::OFFramework::defaultInstance(), listener);
341  }
342 
349  static void unregisterListener(
350  opflex::ofcore::OFFramework& framework,
351  opflex::modb::ObjectListener* listener)
352  {
353  opflex::modb::mointernal
354  ::MO::unregisterListener(framework, listener, CLASS_ID);
355  }
356 
363  static void unregisterListener(
364  opflex::modb::ObjectListener* listener)
365  {
366  unregisterListener(opflex::ofcore::OFFramework::defaultInstance(), listener);
367  }
368 
374  opflex::ofcore::OFFramework& framework,
375  const opflex::modb::URI& uri,
376  const boost::shared_ptr<const opflex::modb::mointernal::ObjectInstance>& oi)
377  : MO(framework, CLASS_ID, uri, oi) { }
378 }; // class Config
379 
380 } // namespace cdp
381 } // namespace modelgbp
382 #endif // GI_CDP_CONFIG_HPP
modelgbp::cdp::Config & setName(const std::string &newValue)
Set name to the specified value in the currently-active mutator.
Definition: cdp/Config.hpp:69
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: cdp/Config.hpp:337
boost::optional< const std::string & > getName()
Get the value of name if it has been set.
Definition: cdp/Config.hpp:44
static const opflex::modb::class_id_t CLASS_ID
The unique class ID for Config.
Definition: cdp/Config.hpp:29
Definition: cdp/Config.hpp:21
Config(opflex::ofcore::OFFramework &framework, const opflex::modb::URI &uri, const boost::shared_ptr< const opflex::modb::mointernal::ObjectInstance > &oi)
Construct an instance of Config.
Definition: cdp/Config.hpp:373
static boost::optional< boost::shared_ptr< modelgbp::cdp::Config > > resolve(const opflex::modb::URI &uri)
Retrieve an instance of Config from the managed object store using the default framework instance...
Definition: cdp/Config.hpp:172
const std::string & getName(const std::string &defaultValue)
Get the value of name if set, otherwise the value of default passed in.
Definition: cdp/Config.hpp:56
static void unregisterListener(opflex::modb::ObjectListener *listener)
Unregister a listener from updates to this class from the default framework instance.
Definition: cdp/Config.hpp:363
bool isNameSet()
Check whether name has been set.
Definition: cdp/Config.hpp:35
boost::optional< const uint8_t > getState()
Get the value of state if it has been set.
Definition: cdp/Config.hpp:100
static boost::optional< boost::shared_ptr< modelgbp::cdp::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: cdp/Config.hpp:194
static boost::optional< boost::shared_ptr< modelgbp::cdp::Config > > resolve(const std::string &platformConfigName)
Retrieve an instance of Config from the default managed object store by constructing its URI from the...
Definition: cdp/Config.hpp:216
modelgbp::cdp::Config & unsetName()
Unset name in the currently-active mutator.
Definition: cdp/Config.hpp:81
static void unregisterListener(opflex::ofcore::OFFramework &framework, opflex::modb::ObjectListener *listener)
Unregister a listener from updates to this class.
Definition: cdp/Config.hpp:349
static boost::optional< boost::shared_ptr< modelgbp::cdp::Config > > resolve(opflex::ofcore::OFFramework &framework, const opflex::modb::URI &uri)
Retrieve an instance of Config from the managed object store.
Definition: cdp/Config.hpp:154
bool isStateSet()
Check whether state has been set.
Definition: cdp/Config.hpp:91
modelgbp::cdp::Config & setState(const uint8_t newValue)
Set state to the specified value in the currently-active mutator.
Definition: cdp/Config.hpp:125
modelgbp::cdp::Config & unsetState()
Unset state in the currently-active mutator.
Definition: cdp/Config.hpp:137
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: cdp/Config.hpp:318
const uint8_t getState(const uint8_t defaultValue)
Get the value of state if set, otherwise the value of default passed in.
Definition: cdp/Config.hpp:112