OpFlex Framework 1.7.0
ClassInfo.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_CLASSINFO_H
15#define MODB_CLASSINFO_H
16
17#include <string>
18#include <vector>
19
21
22namespace opflex {
23namespace modb {
24
31
39class ClassInfo {
40public:
97
101 typedef OF_UNORDERED_MAP<prop_id_t, PropertyInfo> property_map_t;
102
107
112 class_type_t class_type,
113 const std::string& class_name,
114 const std::string& owner,
115 const std::vector<PropertyInfo>& properties,
116 const std::vector<prop_id_t>& naming_props);
117
122
127 const std::string& getName() const { return class_name; }
128
133 const std::string& getOwner() const { return owner; }
134
139 class_id_t getId() const { return class_id; }
140
146 class_type_t getType() const { return class_type; }
147
152 const property_map_t& getProperties() const { return properties; }
153
160 const std::vector<prop_id_t>& getNamingProps() const {
161 return naming_props;
162 }
163
170 const PropertyInfo& getProperty(const std::string& name) const {
171 return properties.at(prop_names.at(name));
172 }
173
180 const PropertyInfo& getProperty(prop_id_t& prop_id) const {
181 return properties.at(prop_id);
182 }
183
184private:
188 class_id_t class_id;
189
193 class_type_t class_type;
194
198 std::string class_name;
199
203 std::string owner;
204
205 typedef OF_UNORDERED_MAP<std::string, prop_id_t> prop_name_map_t;
206
210 property_map_t properties;
211
215 prop_name_map_t prop_names;
216
221 std::vector<prop_id_t> naming_props;
222};
223
224/* @} metadata */
225/* @} cpp */
226
227} /* namespace modb */
228} /* namespace opflex */
229
230#endif /* MODB_CLASSINFO_H */
Interface definition file for PropertyInfo.
Property info provides metadata about a particular managed object property.
Definition PropertyInfo.h:48
const std::vector< prop_id_t > & getNamingProps() const
Get the vector of naming properties (in order) that make up the key or naming properties for this cla...
Definition ClassInfo.h:160
class_id_t getId() const
Get the unique class ID for this class.
Definition ClassInfo.h:139
const PropertyInfo & getProperty(prop_id_t &prop_id) const
Get the PropertyInfo for the given property ID.
Definition ClassInfo.h:180
ClassInfo()
Default constructor.
Definition ClassInfo.h:106
class_type_t
The type of an MO in the Opflex protocol.
Definition ClassInfo.h:45
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
OF_UNORDERED_MAP< prop_id_t, PropertyInfo > property_map_t
A map from a prop_id_t to a PropertyInfo object.
Definition ClassInfo.h:101
const std::string & getOwner() const
Get the owner for this class.
Definition ClassInfo.h:133
const PropertyInfo & getProperty(const std::string &name) const
Get the PropertyInfo for the given named property.
Definition ClassInfo.h:170
ClassInfo(class_id_t class_id, class_type_t class_type, const std::string &class_name, const std::string &owner, const std::vector< PropertyInfo > &properties, const std::vector< prop_id_t > &naming_props)
Construct a class info object for the given class ID.
class_type_t getType() const
Get the type of this class.
Definition ClassInfo.h:146
const std::string & getName() const
Get the name for this class.
Definition ClassInfo.h:127
~ClassInfo()
Destroy the class index.
const property_map_t & getProperties() const
Get the properties that exist for this class.
Definition ClassInfo.h:152
@ RESOLVER
A special managed object that will be created by the framework and will contain state about pending m...
Definition ClassInfo.h:81
@ POLICY
An MO describing a configured policy that describes some user intent.
Definition ClassInfo.h:51
@ RELATIONSHIP
A type that represents a relationship between two managed objects.
Definition ClassInfo.h:88
@ LOCAL_ONLY
An MO that exists only locally and will not be transmitted over the OpFlex protocol.
Definition ClassInfo.h:75
@ OBSERVABLE
An MO containing information that is reported to the observer.
Definition ClassInfo.h:70
@ REMOTE_ENDPOINT
An MO describing a policy enforcement endpoint that resolved from the endpoint registry.
Definition ClassInfo.h:58
@ LOCAL_ENDPOINT
An MO describing a policy enforcement endpoint that must be registered in the endpoint registry.
Definition ClassInfo.h:64
@ REVERSE_RELATIONSHIP
A reverse relationship works just like a relationship except that it represents the reverse direction...
Definition ClassInfo.h:95