11 #ifndef GI_L2_CONFIG_HPP
12 #define GI_L2_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 = 63;
37 return getObjectInstance().isSet(2064385ul, opflex::modb::PropertyInfo::STRING);
44 boost::optional<const std::string&>
getName()
47 return getObjectInstance().getString(2064385ul);
56 const std::string&
getName(
const std::string& defaultValue)
58 return getName().get_value_or(defaultValue);
71 getTLMutator().modify(getClassId(), getURI())->setString(2064385ul, newValue);
83 getTLMutator().modify(getClassId(), getURI())->unset(2064385ul, opflex::modb::PropertyInfo::STRING, opflex::modb::PropertyInfo::SCALAR);
93 return getObjectInstance().isSet(2064386ul, opflex::modb::PropertyInfo::U64);
103 return (uint32_t)getObjectInstance().getUInt64(2064386ul);
114 return getState().get_value_or(defaultValue);
127 getTLMutator().modify(getClassId(), getURI())->setUInt64(2064386ul, newValue);
139 getTLMutator().modify(getClassId(), getURI())->unset(2064386ul, opflex::modb::PropertyInfo::U64, opflex::modb::PropertyInfo::SCALAR);
154 static boost::optional<OF_SHARED_PTR<modelgbp::l2::Config> >
resolve(
155 opflex::ofcore::OFFramework& framework,
156 const opflex::modb::URI& uri)
158 return opflex::modb::mointernal::MO::resolve<modelgbp::l2::Config>(framework,
CLASS_ID, uri);
172 static boost::optional<OF_SHARED_PTR<modelgbp::l2::Config> >
resolve(
173 const opflex::modb::URI& uri)
175 return opflex::modb::mointernal::MO::resolve<modelgbp::l2::Config>(opflex::ofcore::OFFramework::defaultInstance(),
CLASS_ID, uri);
194 static boost::optional<OF_SHARED_PTR<modelgbp::l2::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(
"L2Config").build());
216 static boost::optional<OF_SHARED_PTR<modelgbp::l2::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(
"L2Config").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_L2_CONFIG_HPP
static boost::optional< OF_SHARED_PTR< modelgbp::l2::Config > > resolve(const std::string &platformConfigName)
Retrieve an instance of Config from the default managed object store by constructing its URI from the...
Definition: l2/Config.hpp:216
uint32_t getState(uint32_t defaultValue)
Get the value of state if set, otherwise the value of default passed in.
Definition: l2/Config.hpp:112
static boost::optional< OF_SHARED_PTR< modelgbp::l2::Config > > resolve(opflex::ofcore::OFFramework &framework, const opflex::modb::URI &uri)
Retrieve an instance of Config from the managed object store.
Definition: l2/Config.hpp:154
static const opflex::modb::class_id_t CLASS_ID
The unique class ID for Config.
Definition: l2/Config.hpp:29
static boost::optional< OF_SHARED_PTR< modelgbp::l2::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: l2/Config.hpp:194
modelgbp::l2::Config & setName(const std::string &newValue)
Set name to the specified value in the currently-active mutator.
Definition: l2/Config.hpp:69
const std::string & getName(const std::string &defaultValue)
Get the value of name if set, otherwise the value of default passed in.
Definition: l2/Config.hpp:56
boost::optional< uint32_t > getState()
Get the value of state if it has been set.
Definition: l2/Config.hpp:100
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: l2/Config.hpp:337
bool isStateSet()
Check whether state has been set.
Definition: l2/Config.hpp:91
bool isNameSet()
Check whether name has been set.
Definition: l2/Config.hpp:35
Definition: l2/Config.hpp:21
modelgbp::l2::Config & unsetName()
Unset name in the currently-active mutator.
Definition: l2/Config.hpp:81
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: l2/Config.hpp:373
modelgbp::l2::Config & unsetState()
Unset state in the currently-active mutator.
Definition: l2/Config.hpp:137
static void unregisterListener(opflex::modb::ObjectListener *listener)
Unregister a listener from updates to this class from the default framework instance.
Definition: l2/Config.hpp:363
boost::optional< const std::string & > getName()
Get the value of name if it has been set.
Definition: l2/Config.hpp:44
static boost::optional< OF_SHARED_PTR< modelgbp::l2::Config > > resolve(const opflex::modb::URI &uri)
Retrieve an instance of Config from the managed object store using the default framework instance...
Definition: l2/Config.hpp:172
static void unregisterListener(opflex::ofcore::OFFramework &framework, opflex::modb::ObjectListener *listener)
Unregister a listener from updates to this class.
Definition: l2/Config.hpp:349
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: l2/Config.hpp:318
modelgbp::l2::Config & setState(uint32_t newValue)
Set state to the specified value in the currently-active mutator.
Definition: l2/Config.hpp:125