CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MappingElement.h
Go to the documentation of this file.
1 #ifndef INCLUDE_ORA_MAPPINGELEMENT_H
2 #define INCLUDE_ORA_MAPPINGELEMENT_H
3 
4 //
5 #include <map>
6 #include <vector>
7 #include <string>
8 #include <memory>
9 
10 namespace ora {
11 
19  {
20  public:
21  typedef enum { Undefined = -1,
37 
70 
73 
76 
77  public:
79  typedef std::map< std::string, MappingElement >::iterator iterator;
80  typedef std::map< std::string, MappingElement >::const_iterator const_iterator;
81 
82  public:
83 
86 
91  const std::string& tableName );
92 
93  // Copy constructor
94  MappingElement( const MappingElement& element);
95 
96  // Assignment operator
97  MappingElement& operator=(const MappingElement& element);
98 
100  ~MappingElement();
101 
105  ElementType elementType() const;
106 
108 
112  bool isDependent() const;
113 
118 
122  const std::string& scopeName() const;
126  const std::string& variableName() const;
127 
131  const std::string& variableNameForSchema() const;
135  const std::string& variableType() const;
136 
140  const std::string& tableName() const;
141 
145  const std::vector< std::string >& columnNames() const;
146 
147  std::string idColumn() const;
148 
149  std::string pkColumn() const;
150 
151  std::vector<std::string> recordIdColumns() const;
152 
153  std::string posColumn() const;
154 
158  std::vector<std::pair<std::string,std::string> > tableHierarchy() const;
159 
165  void alterType( const std::string& elementType );
166 
172  void alterTableName( const std::string& tableName );
173 
178  void setColumnNames( const std::vector< std::string >& columns );
179 
181  iterator begin();
182  const_iterator begin() const;
183 
185  iterator end();
186  const_iterator end() const;
187 
189  iterator find( const std::string& key );
190  const_iterator find( const std::string& key ) const;
191 
193  bool removeSubElement( const std::string& key );
194 
205  const std::string& variableName,
206  const std::string& variableType,
207  const std::string& tableName );
208 
209  /*
210  * replace present data with the provided source
211  */
212  void override(const MappingElement& source);
213 
214  void printXML( std::ostream& outputStream, std::string indentation="" ) const;
215 
216  private:
260  std::vector<std::string> m_columnNames;
261 
265  std::map< std::string, MappingElement > m_subElements;
266 
267  };
268 }
269 
270 inline
272  m_elementType(ora::MappingElement::Undefined),
273  m_isDependentTree(false),
274  m_scopeName(""),
275  m_variableName(""),
276  m_variableNameForSchema(""),
277  m_variableType(""),
278  m_tableName(""),
279  m_columnNames(),
280  m_subElements(){
281 }
282 
283 inline
285  m_elementType(element.m_elementType),
286  m_isDependentTree(element.m_isDependentTree),
287  m_scopeName(element.m_scopeName),
288  m_variableName(element.m_variableName),
289  m_variableNameForSchema(element.m_variableNameForSchema),
290  m_variableType(element.m_variableType),
291  m_tableName(element.m_tableName),
292  m_columnNames(element.m_columnNames),
293  m_subElements(element.m_subElements){
294 }
295 
296 inline ora::MappingElement&
298  if(this != &element){
299  m_elementType = element.m_elementType;
300  m_isDependentTree = element.m_isDependentTree;
301  m_scopeName = element.m_scopeName;
302  m_variableName = element.m_variableName;
303  m_variableNameForSchema = element.m_variableNameForSchema;
304  m_variableType = element.m_variableType;
305  m_tableName = element.m_tableName;
306  m_columnNames = element.m_columnNames;
307  m_subElements = element.m_subElements;
308  }
309  return *this;
310 }
311 
312 
315 {
316  return m_subElements.begin();
317 }
318 
321 {
322  return m_subElements.begin();
323 }
324 
327 {
328  return m_subElements.end();
329 }
330 
333 {
334  return m_subElements.end();
335 }
336 
339 {
340  return m_subElements.find( key );
341 }
342 
345 {
346  return m_subElements.find( key );
347 }
348 
351 {
352  return m_elementType;
353 }
354 
355 inline std::string
357 {
358  return elementTypeAsString( m_elementType );
359 }
360 
361 inline bool
363  return m_isDependentTree;
364 }
365 
366 inline const std::string&
368 {
369  return m_scopeName;
370 }
371 
372 inline const std::string&
374 {
375  return m_variableName;
376 }
377 
378 inline const std::string&
380 {
381  return m_variableNameForSchema;
382 }
383 
384 inline const std::string&
386 {
387  return m_variableType;
388 }
389 
390 inline const std::string&
392 {
393  return m_tableName;
394 }
395 
396 inline const std::vector< std::string >&
398 {
399  return m_columnNames;
400 }
401 
402 #endif
const MappingElement & parentClassMappingElement() const
static std::string namedReferenceMappingElementType()
Returns the name of the named reference element type.
static std::string blobMappingElementType()
Returns the name of the blob mapping element type.
static std::string arrayMappingElementType()
Returns the name of the array mapping element type.
std::string m_variableName
const std::string & variableName() const
static std::string primitiveMappingElementType()
Returns the name of the primitive mapping element type.
std::map< std::string, MappingElement > m_subElements
static std::string dependencyMappingElementType()
Returns the name of the dependent class mapping element type.
std::string m_variableNameForSchema
std::string idColumn() const
static std::string OraReferenceMappingElementType()
Returns the name of the ORA reference mapping element type.
ElementType elementType() const
std::vector< std::string > m_columnNames
std::string elementTypeString() const
MappingElement & operator=(const MappingElement &element)
MappingElement & appendSubElement(const std::string &elementType, const std::string &variableName, const std::string &variableType, const std::string &tableName)
MappingElement()
Empty Constructor.
void alterTableName(const std::string &tableName)
iterator begin()
Returns an iterator in the beginning of the sequence.
static std::string pointerMappingElementType()
Returns the name of the pointer mapping element type.
bool removeSubElement(const std::string &key)
Remove a sub-element.
std::vector< std::string > recordIdColumns() const
std::string posColumn() const
void alterType(const std::string &elementType)
static std::string elementTypeAsString(ElementType elementType)
Converts the enumeration type to a string.
static std::string objectMappingElementType()
Returns the name of the object mapping element type.
std::vector< std::pair< std::string, std::string > > tableHierarchy() const
static std::string uniqueReferenceMappingElementType()
Returns the name of the ORA polymorphic pointer mapping element type.
iterator find(const std::string &key)
Retrieves a sub-element.
std::string pkColumn() const
std::map< std::string, MappingElement >::iterator iterator
Iterator definition.
const std::vector< std::string > & columnNames() const
void printXML(std::ostream &outputStream, std::string indentation="") const
static std::string referenceMappingElementType()
Returns the name of the reference mapping element type.
~MappingElement()
Destructor.
static std::string inlineCArrayMappingElementType()
Returns the name of the inline array mapping element type.
const std::string & variableType() const
std::map< std::string, MappingElement >::const_iterator const_iterator
static ElementType elementTypeFromString(const std::string &elementType)
Converts a string into an element type.
iterator end()
Returns an iterator in the end of the sequence.
std::string m_scopeName
static std::string OraPointerMappingElementType()
Returns the name of the ORA pointer mapping element type.
list key
Definition: combine.py:13
static std::string OraArrayMappingElementType()
Returns the name of the ORA array mapping element type.
const std::string & variableNameForSchema() const
const std::string & tableName() const
volatile std::atomic< bool > shutdown_flag false
static bool isValidMappingElementType(const std::string &elementType)
Checks if the provided element type is valid.
bool isDependent() const
static std::string classMappingElementType()
Returns the name of the class mapping element type.
std::string m_variableType
static std::string const source
Definition: EdmProvDump.cc:43
static std::string CArrayMappingElementType()
Returns the name of the array mapping element type.
const std::string & scopeName() const
void setColumnNames(const std::vector< std::string > &columns)
std::string m_tableName
ElementType m_elementType