OpFlex Framework  1.7.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 #include "opflex/ofcore/OFTypes.h"
22 
23 namespace opflex {
24 
25 namespace ofcore {
26 class OFFramework;
27 }
28 
29 namespace modb {
30 
61 class Mutator {
62 public:
69  Mutator(const std::string& owner);
70 
78  Mutator(ofcore::OFFramework& framework,
79  const std::string& owner);
80 
84  ~Mutator();
85 
93  void commit();
94 
102  OF_SHARED_PTR<mointernal::ObjectInstance>& modify(class_id_t class_id,
103  const URI& uri);
104 
114  void remove(class_id_t class_id, const URI& uri);
115 
127  OF_SHARED_PTR<mointernal
128  ::ObjectInstance>& addChild(class_id_t parent_class,
129  const URI& parent_uri,
130  prop_id_t parent_prop,
131  class_id_t child_class,
132  const URI& child_uri);
133 
134 private:
135  class MutatorImpl;
136  friend class MutatorImpl;
137  MutatorImpl* pimpl;
138 };
139 
140 /* @} modb */
141 /* @} cpp */
142 
143 } /* namespace modb */
144 } /* namespace opflex */
145 
146 #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:61
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
OF_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...
OF_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...
uint64_t class_id_t
A unique class ID.
Definition: PropertyInfo.h:34
Definition: OFLogHandler.h:20
Interface definition file for ObjectInstance.
A URI is used to identify managed objects in the MODB.
Definition: URI.h:43
uint64_t prop_id_t
A unique property ID.
Definition: PropertyInfo.h:39
Interface definition file for URIs.