modelgbp Generated OpFlex Model  1.7.0
EpAttribute.hpp
1 
10 #pragma once
11 #ifndef GI_GBPE_EPATTRIBUTE_HPP
12 #define GI_GBPE_EPATTRIBUTE_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 gbpe {
20 
22  : public opflex::modb::mointernal::MO
23 {
24 public:
25 
29  static const opflex::modb::class_id_t CLASS_ID = 37;
30 
35  bool isNameSet()
36  {
37  return getObjectInstance().isSet(1212417ul, opflex::modb::PropertyInfo::STRING);
38  }
39 
44  boost::optional<const std::string&> getName()
45  {
46  if (isNameSet())
47  return getObjectInstance().getString(1212417ul);
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::gbpe::EpAttribute& setName(const std::string& newValue)
70  {
71  getTLMutator().modify(getClassId(), getURI())->setString(1212417ul, newValue);
72  return *this;
73  }
74 
82  {
83  getTLMutator().modify(getClassId(), getURI())->unset(1212417ul, opflex::modb::PropertyInfo::STRING, opflex::modb::PropertyInfo::SCALAR);
84  return *this;
85  }
86 
91  bool isValueSet()
92  {
93  return getObjectInstance().isSet(1212418ul, opflex::modb::PropertyInfo::STRING);
94  }
95 
100  boost::optional<const std::string&> getValue()
101  {
102  if (isValueSet())
103  return getObjectInstance().getString(1212418ul);
104  return boost::none;
105  }
106 
112  const std::string& getValue(const std::string& defaultValue)
113  {
114  return getValue().get_value_or(defaultValue);
115  }
116 
125  modelgbp::gbpe::EpAttribute& setValue(const std::string& newValue)
126  {
127  getTLMutator().modify(getClassId(), getURI())->setString(1212418ul, newValue);
128  return *this;
129  }
130 
138  {
139  getTLMutator().modify(getClassId(), getURI())->unset(1212418ul, opflex::modb::PropertyInfo::STRING, opflex::modb::PropertyInfo::SCALAR);
140  return *this;
141  }
142 
154  static boost::optional<OF_SHARED_PTR<modelgbp::gbpe::EpAttribute> > resolve(
155  opflex::ofcore::OFFramework& framework,
156  const opflex::modb::URI& uri)
157  {
158  return opflex::modb::mointernal::MO::resolve<modelgbp::gbpe::EpAttribute>(framework, CLASS_ID, uri);
159  }
160 
172  static boost::optional<OF_SHARED_PTR<modelgbp::gbpe::EpAttribute> > resolve(
173  const opflex::modb::URI& uri)
174  {
175  return opflex::modb::mointernal::MO::resolve<modelgbp::gbpe::EpAttribute>(opflex::ofcore::OFFramework::defaultInstance(), CLASS_ID, uri);
176  }
177 
196  static boost::optional<OF_SHARED_PTR<modelgbp::gbpe::EpAttribute> > resolve(
197  opflex::ofcore::OFFramework& framework,
198  const std::string& gbpeEpAttributeSetUuid,
199  const std::string& gbpeEpAttributeName)
200  {
201  return resolve(framework,opflex::modb::URIBuilder().addElement("GbpeVMUniverse").addElement("GbpeEpAttributeSet").addElement(gbpeEpAttributeSetUuid).addElement("GbpeEpAttribute").addElement(gbpeEpAttributeName).build());
202  }
203 
221  static boost::optional<OF_SHARED_PTR<modelgbp::gbpe::EpAttribute> > resolve(
222  const std::string& gbpeEpAttributeSetUuid,
223  const std::string& gbpeEpAttributeName)
224  {
225  return resolve(opflex::ofcore::OFFramework::defaultInstance(),gbpeEpAttributeSetUuid,gbpeEpAttributeName);
226  }
227 
236  void remove()
237  {
238  getTLMutator().remove(CLASS_ID, getURI());
239  }
240 
251  static void remove(opflex::ofcore::OFFramework& framework,
252  const opflex::modb::URI& uri)
253  {
254  MO::remove(framework, CLASS_ID, uri);
255  }
256 
267  static void remove(const opflex::modb::URI& uri)
268  {
269  remove(opflex::ofcore::OFFramework::defaultInstance(), uri);
270  }
271 
288  static void remove(
289  opflex::ofcore::OFFramework& framework,
290  const std::string& gbpeEpAttributeSetUuid,
291  const std::string& gbpeEpAttributeName)
292  {
293  MO::remove(framework, CLASS_ID, opflex::modb::URIBuilder().addElement("GbpeVMUniverse").addElement("GbpeEpAttributeSet").addElement(gbpeEpAttributeSetUuid).addElement("GbpeEpAttribute").addElement(gbpeEpAttributeName).build());
294  }
295 
312  static void remove(
313  const std::string& gbpeEpAttributeSetUuid,
314  const std::string& gbpeEpAttributeName)
315  {
316  remove(opflex::ofcore::OFFramework::defaultInstance(),gbpeEpAttributeSetUuid,gbpeEpAttributeName);
317  }
318 
330  static void registerListener(
331  opflex::ofcore::OFFramework& framework,
332  opflex::modb::ObjectListener* listener)
333  {
334  opflex::modb::mointernal
335  ::MO::registerListener(framework, listener, CLASS_ID);
336  }
337 
349  static void registerListener(
350  opflex::modb::ObjectListener* listener)
351  {
352  registerListener(opflex::ofcore::OFFramework::defaultInstance(), listener);
353  }
354 
361  static void unregisterListener(
362  opflex::ofcore::OFFramework& framework,
363  opflex::modb::ObjectListener* listener)
364  {
365  opflex::modb::mointernal
366  ::MO::unregisterListener(framework, listener, CLASS_ID);
367  }
368 
375  static void unregisterListener(
376  opflex::modb::ObjectListener* listener)
377  {
378  unregisterListener(opflex::ofcore::OFFramework::defaultInstance(), listener);
379  }
380 
386  opflex::ofcore::OFFramework& framework,
387  const opflex::modb::URI& uri,
388  const OF_SHARED_PTR<const opflex::modb::mointernal::ObjectInstance>& oi)
389  : MO(framework, CLASS_ID, uri, oi) { }
390 }; // class EpAttribute
391 
392 } // namespace gbpe
393 } // namespace modelgbp
394 #endif // GI_GBPE_EPATTRIBUTE_HPP
EpAttribute(opflex::ofcore::OFFramework &framework, const opflex::modb::URI &uri, const OF_SHARED_PTR< const opflex::modb::mointernal::ObjectInstance > &oi)
Construct an instance of EpAttribute.
Definition: EpAttribute.hpp:385
bool isValueSet()
Check whether value has been set.
Definition: EpAttribute.hpp:91
modelgbp::gbpe::EpAttribute & setName(const std::string &newValue)
Set name to the specified value in the currently-active mutator.
Definition: EpAttribute.hpp:69
boost::optional< const std::string & > getValue()
Get the value of value if it has been set.
Definition: EpAttribute.hpp:100
modelgbp::gbpe::EpAttribute & unsetName()
Unset name in the currently-active mutator.
Definition: EpAttribute.hpp:81
static void unregisterListener(opflex::modb::ObjectListener *listener)
Unregister a listener from updates to this class from the default framework instance.
Definition: EpAttribute.hpp:375
static boost::optional< OF_SHARED_PTR< modelgbp::gbpe::EpAttribute > > resolve(opflex::ofcore::OFFramework &framework, const opflex::modb::URI &uri)
Retrieve an instance of EpAttribute from the managed object store.
Definition: EpAttribute.hpp:154
boost::optional< const std::string & > getName()
Get the value of name if it has been set.
Definition: EpAttribute.hpp:44
static void unregisterListener(opflex::ofcore::OFFramework &framework, opflex::modb::ObjectListener *listener)
Unregister a listener from updates to this class.
Definition: EpAttribute.hpp:361
static boost::optional< OF_SHARED_PTR< modelgbp::gbpe::EpAttribute > > resolve(const opflex::modb::URI &uri)
Retrieve an instance of EpAttribute from the managed object store using the default framework instanc...
Definition: EpAttribute.hpp:172
modelgbp::gbpe::EpAttribute & unsetValue()
Unset value in the currently-active mutator.
Definition: EpAttribute.hpp:137
modelgbp::gbpe::EpAttribute & setValue(const std::string &newValue)
Set value to the specified value in the currently-active mutator.
Definition: EpAttribute.hpp:125
static const opflex::modb::class_id_t CLASS_ID
The unique class ID for EpAttribute.
Definition: EpAttribute.hpp:29
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: EpAttribute.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: EpAttribute.hpp:330
static boost::optional< OF_SHARED_PTR< modelgbp::gbpe::EpAttribute > > resolve(const std::string &gbpeEpAttributeSetUuid, const std::string &gbpeEpAttributeName)
Retrieve an instance of EpAttribute from the default managed object store by constructing its URI fro...
Definition: EpAttribute.hpp:221
bool isNameSet()
Check whether name has been set.
Definition: EpAttribute.hpp:35
const std::string & getName(const std::string &defaultValue)
Get the value of name if set, otherwise the value of default passed in.
Definition: EpAttribute.hpp:56
Definition: EpAttribute.hpp:21
const std::string & getValue(const std::string &defaultValue)
Get the value of value if set, otherwise the value of default passed in.
Definition: EpAttribute.hpp:112
static boost::optional< OF_SHARED_PTR< modelgbp::gbpe::EpAttribute > > resolve(opflex::ofcore::OFFramework &framework, const std::string &gbpeEpAttributeSetUuid, const std::string &gbpeEpAttributeName)
Retrieve an instance of EpAttribute from the managed object store by constructing its URI from the pa...
Definition: EpAttribute.hpp:196