OpFlex Framework  1.3.0
Mutator.h
Go to the documentation of this file.
1 /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */
6 /*
7  * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
8  *
9  * This program and the accompanying materials are made available under the
10  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
11  * and is available at http://www.eclipse.org/legal/epl-v10.html
12  */
13 
14 #ifndef MODB_MUTATOR_H
15 #define MODB_MUTATOR_H
16 
17 #include <string>
18 
19 #include "opflex/modb/URI.h"
21 
22 namespace opflex {
23 
24 namespace ofcore {
25 class OFFramework;
26 }
27 
28 namespace modb {
29 
60 class Mutator {
61 public:
68  Mutator(const std::string& owner);
69 
77  Mutator(ofcore::OFFramework& framework,
78  const std::string& owner);
79 
83  ~Mutator();
84 
92  void commit();
93 
101  boost::shared_ptr<mointernal::ObjectInstance>& modify(class_id_t class_id,
102  const URI& uri);
103 
113  void remove(class_id_t class_id, const URI& uri);
114 
126  boost::shared_ptr<mointernal
127  ::ObjectInstance>& addChild(class_id_t parent_class,
128  const URI& parent_uri,
129  prop_id_t parent_prop,
130  class_id_t child_class,
131  const URI& child_uri);
132 
133 private:
134  class MutatorImpl;
135  friend class MutatorImpl;
136  MutatorImpl* pimpl;
137 };
138 
139 /* @} modb */
140 /* @} cpp */
141 
142 } /* namespace modb */
143 } /* namespace opflex */
144 
145 #endif /* MODB_MUTATOR_H */
~Mutator()
Destroy the Mutator.
void commit()
Commit the changes stored in the mutator to the object store.
A mutator represents a set of changes to apply to the data store.
Definition: Mutator.h:60
Mutator(const std::string &owner)
Create a mutator that will work with the default framework instance and owner.
Main interface to the OpFlex framework.
Definition: OFFramework.h:644
An internal instance of an object in the managed object store.
Definition: ObjectInstance.h:58
boost::shared_ptr< mointernal::ObjectInstance > & addChild(class_id_t parent_class, const URI &parent_uri, prop_id_t parent_prop, class_id_t child_class, const URI &child_uri)
Create a new child object with the specified class and URI, and make it a child of the given parent...
uint64_t class_id_t
A unique class ID.
Definition: PropertyInfo.h:36
Interface definition file for ObjectInstance.
boost::shared_ptr< mointernal::ObjectInstance > & modify(class_id_t class_id, const URI &uri)
Create a new mutable object with the given URI which is a copy of any existing object with the specif...
A URI is used to identify managed objects in the MODB.
Definition: URI.h:41
uint64_t prop_id_t
A unique property ID.
Definition: PropertyInfo.h:41
Interface definition file for URIs.