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
23namespace opflex {
24
25namespace ofcore {
26class OFFramework;
27}
28
29namespace modb {
30
35
41
61class Mutator {
62public:
69 Mutator(const std::string& owner);
70
79 const std::string& owner);
80
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
134private:
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 */
Interface definition file for ObjectInstance.
Interface definition file for URIs.
A URI is used to identify managed objects in the MODB.
Definition URI.h:43
Main interface to the OpFlex framework.
Definition OFFramework.h:644
uint64_t prop_id_t
A unique property ID.
Definition PropertyInfo.h:39
uint64_t class_id_t
A unique class ID.
Definition PropertyInfo.h:34
Mutator(const std::string &owner)
Create a mutator that will work with the default framework instance and owner.
void remove(class_id_t class_id, const URI &uri)
Delete the child object specified along with its link to its parents.
Mutator(ofcore::OFFramework &framework, const std::string &owner)
Create a mutator that will work with the provided framework instance and owner.
~Mutator()
Destroy the Mutator.
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.
void commit()
Commit the changes stored in the mutator to the object store.
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...