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 
22 namespace opflex {
23 namespace modb {
24 
39 class ClassInfo {
40 public:
45  enum class_type_t {
96  };
97 
101  typedef OF_UNORDERED_MAP<prop_id_t, PropertyInfo> property_map_t;
102 
107 
111  ClassInfo(class_id_t class_id,
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 
121  ~ClassInfo();
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 
184 private:
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 */
An MO describing a policy enforcement endpoint that must be registered in the endpoint registry...
Definition: ClassInfo.h:64
A type that represents a relationship between two managed objects.
Definition: ClassInfo.h:88
A special managed object that will be created by the framework and will contain state about pending m...
Definition: ClassInfo.h:81
const std::string & getOwner() const
Get the owner for this class.
Definition: ClassInfo.h:133
An MO describing a configured policy that describes some user intent.
Definition: ClassInfo.h:51
class_type_t
The type of an MO in the Opflex protocol.
Definition: ClassInfo.h:45
const PropertyInfo & getProperty(prop_id_t &prop_id) const
Get the PropertyInfo for the given property ID.
Definition: ClassInfo.h:180
class_id_t getId() const
Get the unique class ID for this class.
Definition: ClassInfo.h:139
class_type_t getType() const
Get the type of this class.
Definition: ClassInfo.h:146
ClassInfo()
Default constructor.
Definition: ClassInfo.h:106
~ClassInfo()
Destroy the class index.
Interface definition file for PropertyInfo.
An MO describing a policy enforcement endpoint that resolved from the endpoint registry.
Definition: ClassInfo.h:58
A reverse relationship works just like a relationship except that it represents the reverse direction...
Definition: ClassInfo.h:95
An MO that exists only locally and will not be transmitted over the OpFlex protocol.
Definition: ClassInfo.h:75
uint64_t class_id_t
A unique class ID.
Definition: PropertyInfo.h:34
Class info provides metadata about managed object classes and properties.
Definition: ClassInfo.h:39
const property_map_t & getProperties() const
Get the properties that exist for this class.
Definition: ClassInfo.h:152
An MO containing information that is reported to the observer.
Definition: ClassInfo.h:70
uint64_t prop_id_t
A unique property ID.
Definition: PropertyInfo.h:39
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
const PropertyInfo & getProperty(const std::string &name) const
Get the PropertyInfo for the given named property.
Definition: ClassInfo.h:170
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 & getName() const
Get the name for this class.
Definition: ClassInfo.h:127