modelgbp Generated OpFlex Model  1.7.0
Attribute.hpp
1 
10 #pragma once
11 #ifndef GI_INV_ATTRIBUTE_HPP
12 #define GI_INV_ATTRIBUTE_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 inv {
20 
21 class Attribute
22  : public opflex::modb::mointernal::MO
23 {
24 public:
25 
29  static const opflex::modb::class_id_t CLASS_ID = 136;
30 
35  bool isNameSet()
36  {
37  return getObjectInstance().isSet(4456449ul, opflex::modb::PropertyInfo::STRING);
38  }
39 
44  boost::optional<const std::string&> getName()
45  {
46  if (isNameSet())
47  return getObjectInstance().getString(4456449ul);
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::inv::Attribute& setName(const std::string& newValue)
70  {
71  getTLMutator().modify(getClassId(), getURI())->setString(4456449ul, newValue);
72  return *this;
73  }
74 
82  {
83  getTLMutator().modify(getClassId(), getURI())->unset(4456449ul, opflex::modb::PropertyInfo::STRING, opflex::modb::PropertyInfo::SCALAR);
84  return *this;
85  }
86 
91  bool isValueSet()
92  {
93  return getObjectInstance().isSet(4456450ul, opflex::modb::PropertyInfo::STRING);
94  }
95 
100  boost::optional<const std::string&> getValue()
101  {
102  if (isValueSet())
103  return getObjectInstance().getString(4456450ul);
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::inv::Attribute& setValue(const std::string& newValue)
126  {
127  getTLMutator().modify(getClassId(), getURI())->setString(4456450ul, newValue);
128  return *this;
129  }
130 
138  {
139  getTLMutator().modify(getClassId(), getURI())->unset(4456450ul, opflex::modb::PropertyInfo::STRING, opflex::modb::PropertyInfo::SCALAR);
140  return *this;
141  }
142 
154  static boost::optional<OF_SHARED_PTR<modelgbp::inv::Attribute> > resolve(
155  opflex::ofcore::OFFramework& framework,
156  const opflex::modb::URI& uri)
157  {
158  return opflex::modb::mointernal::MO::resolve<modelgbp::inv::Attribute>(framework, CLASS_ID, uri);
159  }
160 
172  static boost::optional<OF_SHARED_PTR<modelgbp::inv::Attribute> > resolve(
173  const opflex::modb::URI& uri)
174  {
175  return opflex::modb::mointernal::MO::resolve<modelgbp::inv::Attribute>(opflex::ofcore::OFFramework::defaultInstance(), CLASS_ID, uri);
176  }
177 
198  static boost::optional<OF_SHARED_PTR<modelgbp::inv::Attribute> > resolve(
199  opflex::ofcore::OFFramework& framework,
200  const std::string& invLocalEndpointInventoryName,
201  const std::string& invLocalInventoryEpUuid,
202  const std::string& invAttributeName)
203  {
204  return resolve(framework,opflex::modb::URIBuilder().addElement("InvUniverse").addElement("InvLocalEndpointInventory").addElement(invLocalEndpointInventoryName).addElement("InvLocalInventoryEp").addElement(invLocalInventoryEpUuid).addElement("InvAttribute").addElement(invAttributeName).build());
205  }
206 
226  static boost::optional<OF_SHARED_PTR<modelgbp::inv::Attribute> > resolve(
227  const std::string& invLocalEndpointInventoryName,
228  const std::string& invLocalInventoryEpUuid,
229  const std::string& invAttributeName)
230  {
231  return resolve(opflex::ofcore::OFFramework::defaultInstance(),invLocalEndpointInventoryName,invLocalInventoryEpUuid,invAttributeName);
232  }
233 
242  void remove()
243  {
244  getTLMutator().remove(CLASS_ID, getURI());
245  }
246 
257  static void remove(opflex::ofcore::OFFramework& framework,
258  const opflex::modb::URI& uri)
259  {
260  MO::remove(framework, CLASS_ID, uri);
261  }
262 
273  static void remove(const opflex::modb::URI& uri)
274  {
275  remove(opflex::ofcore::OFFramework::defaultInstance(), uri);
276  }
277 
296  static void remove(
297  opflex::ofcore::OFFramework& framework,
298  const std::string& invLocalEndpointInventoryName,
299  const std::string& invLocalInventoryEpUuid,
300  const std::string& invAttributeName)
301  {
302  MO::remove(framework, CLASS_ID, opflex::modb::URIBuilder().addElement("InvUniverse").addElement("InvLocalEndpointInventory").addElement(invLocalEndpointInventoryName).addElement("InvLocalInventoryEp").addElement(invLocalInventoryEpUuid).addElement("InvAttribute").addElement(invAttributeName).build());
303  }
304 
323  static void remove(
324  const std::string& invLocalEndpointInventoryName,
325  const std::string& invLocalInventoryEpUuid,
326  const std::string& invAttributeName)
327  {
328  remove(opflex::ofcore::OFFramework::defaultInstance(),invLocalEndpointInventoryName,invLocalInventoryEpUuid,invAttributeName);
329  }
330 
342  static void registerListener(
343  opflex::ofcore::OFFramework& framework,
344  opflex::modb::ObjectListener* listener)
345  {
346  opflex::modb::mointernal
347  ::MO::registerListener(framework, listener, CLASS_ID);
348  }
349 
361  static void registerListener(
362  opflex::modb::ObjectListener* listener)
363  {
364  registerListener(opflex::ofcore::OFFramework::defaultInstance(), listener);
365  }
366 
373  static void unregisterListener(
374  opflex::ofcore::OFFramework& framework,
375  opflex::modb::ObjectListener* listener)
376  {
377  opflex::modb::mointernal
378  ::MO::unregisterListener(framework, listener, CLASS_ID);
379  }
380 
387  static void unregisterListener(
388  opflex::modb::ObjectListener* listener)
389  {
390  unregisterListener(opflex::ofcore::OFFramework::defaultInstance(), listener);
391  }
392 
398  opflex::ofcore::OFFramework& framework,
399  const opflex::modb::URI& uri,
400  const OF_SHARED_PTR<const opflex::modb::mointernal::ObjectInstance>& oi)
401  : MO(framework, CLASS_ID, uri, oi) { }
402 }; // class Attribute
403 
404 } // namespace inv
405 } // namespace modelgbp
406 #endif // GI_INV_ATTRIBUTE_HPP
modelgbp::inv::Attribute & setValue(const std::string &newValue)
Set value to the specified value in the currently-active mutator.
Definition: Attribute.hpp:125
Attribute(opflex::ofcore::OFFramework &framework, const opflex::modb::URI &uri, const OF_SHARED_PTR< const opflex::modb::mointernal::ObjectInstance > &oi)
Construct an instance of Attribute.
Definition: Attribute.hpp:397
bool isValueSet()
Check whether value has been set.
Definition: Attribute.hpp:91
static void unregisterListener(opflex::ofcore::OFFramework &framework, opflex::modb::ObjectListener *listener)
Unregister a listener from updates to this class.
Definition: Attribute.hpp:373
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: Attribute.hpp:342
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: Attribute.hpp:361
static boost::optional< OF_SHARED_PTR< modelgbp::inv::Attribute > > resolve(opflex::ofcore::OFFramework &framework, const std::string &invLocalEndpointInventoryName, const std::string &invLocalInventoryEpUuid, const std::string &invAttributeName)
Retrieve an instance of Attribute from the managed object store by constructing its URI from the path...
Definition: Attribute.hpp:198
const std::string & getValue(const std::string &defaultValue)
Get the value of value if set, otherwise the value of default passed in.
Definition: Attribute.hpp:112
modelgbp::inv::Attribute & setName(const std::string &newValue)
Set name to the specified value in the currently-active mutator.
Definition: Attribute.hpp:69
Definition: Attribute.hpp:21
static boost::optional< OF_SHARED_PTR< modelgbp::inv::Attribute > > resolve(opflex::ofcore::OFFramework &framework, const opflex::modb::URI &uri)
Retrieve an instance of Attribute from the managed object store.
Definition: Attribute.hpp:154
modelgbp::inv::Attribute & unsetValue()
Unset value in the currently-active mutator.
Definition: Attribute.hpp:137
static void unregisterListener(opflex::modb::ObjectListener *listener)
Unregister a listener from updates to this class from the default framework instance.
Definition: Attribute.hpp:387
boost::optional< const std::string & > getValue()
Get the value of value if it has been set.
Definition: Attribute.hpp:100
static const opflex::modb::class_id_t CLASS_ID
The unique class ID for Attribute.
Definition: Attribute.hpp:29
boost::optional< const std::string & > getName()
Get the value of name if it has been set.
Definition: Attribute.hpp:44
bool isNameSet()
Check whether name has been set.
Definition: Attribute.hpp:35
modelgbp::inv::Attribute & unsetName()
Unset name in the currently-active mutator.
Definition: Attribute.hpp:81
const std::string & getName(const std::string &defaultValue)
Get the value of name if set, otherwise the value of default passed in.
Definition: Attribute.hpp:56
static boost::optional< OF_SHARED_PTR< modelgbp::inv::Attribute > > resolve(const std::string &invLocalEndpointInventoryName, const std::string &invLocalInventoryEpUuid, const std::string &invAttributeName)
Retrieve an instance of Attribute from the default managed object store by constructing its URI from ...
Definition: Attribute.hpp:226
static boost::optional< OF_SHARED_PTR< modelgbp::inv::Attribute > > resolve(const opflex::modb::URI &uri)
Retrieve an instance of Attribute from the managed object store using the default framework instance...
Definition: Attribute.hpp:172
SOME COPYRIGHT.
Definition: OpcodeEnumT.hpp:12