11 #ifndef GI_CDP_CONFIG_HPP
12 #define GI_CDP_CONFIG_HPP
14 #include <boost/optional.hpp>
15 #include "opflex/modb/URIBuilder.h"
16 #include "opflex/modb/mo-internal/MO.h"
22 :
public opflex::modb::mointernal::MO
29 static const opflex::modb::class_id_t
CLASS_ID = 53;
37 return getObjectInstance().isSet(1736705ul, opflex::modb::PropertyInfo::STRING);
44 boost::optional<const std::string&>
getName()
47 return getObjectInstance().getString(1736705ul);
56 const std::string&
getName(
const std::string& defaultValue)
58 return getName().get_value_or(defaultValue);
71 getTLMutator().modify(getClassId(), getURI())->setString(1736705ul, newValue);
83 getTLMutator().modify(getClassId(), getURI())->unset(1736705ul, opflex::modb::PropertyInfo::STRING, opflex::modb::PropertyInfo::SCALAR);
93 return getObjectInstance().isSet(1736706ul, opflex::modb::PropertyInfo::ENUM8);
103 return (
const uint8_t)getObjectInstance().getUInt64(1736706ul);
114 return getState().get_value_or(defaultValue);
127 getTLMutator().modify(getClassId(), getURI())->setUInt64(1736706ul, newValue);
139 getTLMutator().modify(getClassId(), getURI())->unset(1736706ul, opflex::modb::PropertyInfo::ENUM8, opflex::modb::PropertyInfo::SCALAR);
154 static boost::optional<OF_SHARED_PTR<modelgbp::cdp::Config> >
resolve(
155 opflex::ofcore::OFFramework& framework,
156 const opflex::modb::URI& uri)
158 return opflex::modb::mointernal::MO::resolve<modelgbp::cdp::Config>(framework,
CLASS_ID, uri);
172 static boost::optional<OF_SHARED_PTR<modelgbp::cdp::Config> >
resolve(
173 const opflex::modb::URI& uri)
175 return opflex::modb::mointernal::MO::resolve<modelgbp::cdp::Config>(opflex::ofcore::OFFramework::defaultInstance(),
CLASS_ID, uri);
194 static boost::optional<OF_SHARED_PTR<modelgbp::cdp::Config> >
resolve(
195 opflex::ofcore::OFFramework& framework,
196 const std::string& platformConfigName)
198 return resolve(framework,opflex::modb::URIBuilder().addElement(
"PolicyUniverse").addElement(
"PlatformConfig").addElement(platformConfigName).addElement(
"CdpConfig").build());
216 static boost::optional<OF_SHARED_PTR<modelgbp::cdp::Config> >
resolve(
217 const std::string& platformConfigName)
219 return resolve(opflex::ofcore::OFFramework::defaultInstance(),platformConfigName);
232 getTLMutator().remove(
CLASS_ID, getURI());
245 static void remove(opflex::ofcore::OFFramework& framework,
246 const opflex::modb::URI& uri)
248 MO::remove(framework,
CLASS_ID, uri);
261 static void remove(
const opflex::modb::URI& uri)
263 remove(opflex::ofcore::OFFramework::defaultInstance(), uri);
281 opflex::ofcore::OFFramework& framework,
282 const std::string& platformConfigName)
284 MO::remove(framework,
CLASS_ID, opflex::modb::URIBuilder().addElement(
"PolicyUniverse").addElement(
"PlatformConfig").addElement(platformConfigName).addElement(
"CdpConfig").build());
302 const std::string& platformConfigName)
304 remove(opflex::ofcore::OFFramework::defaultInstance(),platformConfigName);
319 opflex::ofcore::OFFramework& framework,
320 opflex::modb::ObjectListener* listener)
322 opflex::modb::mointernal
323 ::MO::registerListener(framework, listener,
CLASS_ID);
338 opflex::modb::ObjectListener* listener)
350 opflex::ofcore::OFFramework& framework,
351 opflex::modb::ObjectListener* listener)
353 opflex::modb::mointernal
354 ::MO::unregisterListener(framework, listener,
CLASS_ID);
364 opflex::modb::ObjectListener* listener)
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) { }
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
static boost::optional< OF_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
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
static boost::optional< OF_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
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< OF_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 boost::optional< OF_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
static void unregisterListener(opflex::ofcore::OFFramework &framework, opflex::modb::ObjectListener *listener)
Unregister a listener from updates to this class.
Definition: cdp/Config.hpp:349
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
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: cdp/Config.hpp:373