modelgbp Generated OpFlex Model 1.7.0
dfw/Config.hpp
1
10#pragma once
11#ifndef GI_DFW_CONFIG_HPP
12#define GI_DFW_CONFIG_HPP
13
14#include <boost/optional.hpp>
15#include "opflex/modb/URIBuilder.h"
16#include "opflex/modb/mo-internal/MO.h"
17
18namespace modelgbp {
19namespace dfw {
20
21class Config
22 : public opflex::modb::mointernal::MO
23{
24public:
25
29 static const opflex::modb::class_id_t CLASS_ID = 54;
30
35 bool isNameSet()
36 {
37 return getObjectInstance().isSet(1769473ul, opflex::modb::PropertyInfo::STRING);
38 }
39
44 boost::optional<const std::string&> getName()
45 {
46 if (isNameSet())
47 return getObjectInstance().getString(1769473ul);
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::dfw::Config& setName(const std::string& newValue)
70 {
71 getTLMutator().modify(getClassId(), getURI())->setString(1769473ul, newValue);
72 return *this;
73 }
74
82 {
83 getTLMutator().modify(getClassId(), getURI())->unset(1769473ul, opflex::modb::PropertyInfo::STRING, opflex::modb::PropertyInfo::SCALAR);
84 return *this;
85 }
86
92 {
93 return getObjectInstance().isSet(1769474ul, opflex::modb::PropertyInfo::ENUM8);
94 }
95
100 boost::optional<const uint8_t> getState()
101 {
102 if (isStateSet())
103 return (const uint8_t)getObjectInstance().getUInt64(1769474ul);
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::dfw::Config& setState(const uint8_t newValue)
126 {
127 getTLMutator().modify(getClassId(), getURI())->setUInt64(1769474ul, newValue);
128 return *this;
129 }
130
138 {
139 getTLMutator().modify(getClassId(), getURI())->unset(1769474ul, opflex::modb::PropertyInfo::ENUM8, opflex::modb::PropertyInfo::SCALAR);
140 return *this;
141 }
142
154 static boost::optional<OF_SHARED_PTR<modelgbp::dfw::Config> > resolve(
155 opflex::ofcore::OFFramework& framework,
156 const opflex::modb::URI& uri)
157 {
158 return opflex::modb::mointernal::MO::resolve<modelgbp::dfw::Config>(framework, CLASS_ID, uri);
159 }
160
172 static boost::optional<OF_SHARED_PTR<modelgbp::dfw::Config> > resolve(
173 const opflex::modb::URI& uri)
174 {
175 return opflex::modb::mointernal::MO::resolve<modelgbp::dfw::Config>(opflex::ofcore::OFFramework::defaultInstance(), CLASS_ID, uri);
176 }
177
194 static boost::optional<OF_SHARED_PTR<modelgbp::dfw::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("DfwConfig").build());
199 }
200
216 static boost::optional<OF_SHARED_PTR<modelgbp::dfw::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("DfwConfig").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
350 opflex::ofcore::OFFramework& framework,
351 opflex::modb::ObjectListener* listener)
352 {
353 opflex::modb::mointernal
354 ::MO::unregisterListener(framework, listener, CLASS_ID);
355 }
356
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 OF_SHARED_PTR<const opflex::modb::mointernal::ObjectInstance>& oi)
377 : MO(framework, CLASS_ID, uri, oi) { }
378}; // class Config
379
380} // namespace dfw
381} // namespace modelgbp
382#endif // GI_DFW_CONFIG_HPP
Definition dfw/Config.hpp:23
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 dfw/Config.hpp:373
static void unregisterListener(opflex::ofcore::OFFramework &framework, opflex::modb::ObjectListener *listener)
Unregister a listener from updates to this class.
Definition dfw/Config.hpp:349
static void remove(const opflex::modb::URI &uri)
Remove the Config object with the specified URI using the currently-active mutator and the default fr...
Definition dfw/Config.hpp:261
bool isNameSet()
Check whether name has been set.
Definition dfw/Config.hpp:35
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 dfw/Config.hpp:337
modelgbp::dfw::Config & unsetState()
Unset state in the currently-active mutator.
Definition dfw/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 dfw/Config.hpp:318
static void unregisterListener(opflex::modb::ObjectListener *listener)
Unregister a listener from updates to this class from the default framework instance.
Definition dfw/Config.hpp:363
void remove()
Remove this instance using the currently-active mutator.
Definition dfw/Config.hpp:230
const uint8_t getState(const uint8_t defaultValue)
Get the value of state if set, otherwise the value of default passed in.
Definition dfw/Config.hpp:112
static const opflex::modb::class_id_t CLASS_ID
The unique class ID for Config.
Definition dfw/Config.hpp:29
boost::optional< const uint8_t > getState()
Get the value of state if it has been set.
Definition dfw/Config.hpp:100
static boost::optional< OF_SHARED_PTR< modelgbp::dfw::Config > > resolve(const std::string &platformConfigName)
Retrieve an instance of Config from the default managed object store by constructing its URI from the...
Definition dfw/Config.hpp:216
const std::string & getName(const std::string &defaultValue)
Get the value of name if set, otherwise the value of default passed in.
Definition dfw/Config.hpp:56
static boost::optional< OF_SHARED_PTR< modelgbp::dfw::Config > > resolve(const opflex::modb::URI &uri)
Retrieve an instance of Config from the managed object store using the default framework instance.
Definition dfw/Config.hpp:172
modelgbp::dfw::Config & setName(const std::string &newValue)
Set name to the specified value in the currently-active mutator.
Definition dfw/Config.hpp:69
modelgbp::dfw::Config & unsetName()
Unset name in the currently-active mutator.
Definition dfw/Config.hpp:81
static void remove(const std::string &platformConfigName)
Remove the Config object with the specified path elements from the managed object store using the def...
Definition dfw/Config.hpp:301
modelgbp::dfw::Config & setState(const uint8_t newValue)
Set state to the specified value in the currently-active mutator.
Definition dfw/Config.hpp:125
static void remove(opflex::ofcore::OFFramework &framework, const opflex::modb::URI &uri)
Remove the Config object with the specified URI using the currently-active mutator.
Definition dfw/Config.hpp:245
static void remove(opflex::ofcore::OFFramework &framework, const std::string &platformConfigName)
Remove the Config object with the specified path elements from the managed object store.
Definition dfw/Config.hpp:280
static boost::optional< OF_SHARED_PTR< modelgbp::dfw::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 dfw/Config.hpp:194
boost::optional< const std::string & > getName()
Get the value of name if it has been set.
Definition dfw/Config.hpp:44
static boost::optional< OF_SHARED_PTR< modelgbp::dfw::Config > > resolve(opflex::ofcore::OFFramework &framework, const opflex::modb::URI &uri)
Retrieve an instance of Config from the managed object store.
Definition dfw/Config.hpp:154
bool isStateSet()
Check whether state has been set.
Definition dfw/Config.hpp:91
SOME COPYRIGHT.
Definition OpcodeEnumT.hpp:12