CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MappingRules.h
Go to the documentation of this file.
1 #ifndef INCLUDE_ORA_MAPPINGRULES_H
2 #define INCLUDE_ORA_MAPPINGRULES_H
3 
4 //
5 #include <string>
6 #include <locale>
7 #include <algorithm>
8 
9 namespace Reflex{
10  class Type;
11 }
12 
13 namespace ora {
14 
15  class MappingRules {
16  public:
18  static const size_t ClassNameLengthForSchema = 7;
19  static const size_t MaxTableNameLength = 20;
20  static const size_t MaxColumnNameLength = 30;
21  static const size_t MaxColumnsPerTable = 100;
22  static const size_t MaxColumnsForInlineCArray = 13;
23 
24  public:
26  static std::string sequenceNameForContainerId();
27  static std::string sequenceNameForContainer( const std::string& containerName );
28  static std::string sequenceNameForDependentClass( const std::string& containerName, const std::string& className );
29  static std::string sequenceNameForMapping();
30 
32  static std::string newMappingVersionForContainer( const std::string& containerName, int iteration );
33  static std::string newMappingVersionForDependentClass( const std::string& containerName, const std::string& className, int iteration );
34 
36  static std::string mappingPropertyNameInDictionary();
37  static bool isMappedToBlob(const std::string& mappingProperty);
38  static std::string classId( const std::string& className, const std::string& classVersion );
39  static std::string classVersionFromId( const std::string& classId );
40  static std::string baseIdForClass( const std::string& className );
41  static std::string baseClassVersion();
42  static std::pair<bool,std::string> classNameFromBaseId( const std::string& classId );
43  static std::string defaultClassVersion(const std::string& className);
44  static std::string classVersionPropertyNameInDictionary();
45 
47  static std::string scopedVariableName( const std::string& variableName, const std::string& scope );
48  static std::string variableNameForArrayIndex( const std::string& arrayVariable, unsigned int index );
49  static std::string variableNameForArrayColumn( unsigned int arrayIndex );
50  static std::string variableNameForArrayColumn( const Reflex::Type& array );
51  static std::string variableNameForContainerValue();
52  static std::string variableNameForContainerKey();
53  static std::string scopedVariableForSchemaObjects( const std::string& variableName, const std::string& scope );
54 
56  static std::string newNameForSchemaObject( const std::string& initialName, unsigned int index, size_t maxLength, char indexTrailer=0 );
57  static std::string newNameForDepSchemaObject( const std::string& initialName, unsigned int index, size_t maxLength);
58  static std::string newNameForArraySchemaObject( const std::string& initialName, unsigned int index, size_t maxLength);
59 
61  static std::string tableNameForItem( const std::string& itemName );
62  static std::string columnNameForId();
63  static std::string columnNameForRefColumn();
64  static std::string columnNameForVariable( const std::string& variableName, const std::string& scope, bool forData=true );
65  static std::string columnNameForOID( const std::string& variableName, const std::string& scope, unsigned int index );
66  static std::string columnNameForRefMetadata( const std::string& variableName, const std::string& scope );
67  static std::string columnNameForRefId( const std::string& variableName, const std::string& scope );
68  static std::string columnNameForPosition();
69  static std::string columnNameForNamedReference( const std::string& variableName, const std::string& scope );
70  static std::string fkNameForIdentity( const std::string& tableName, int index=0 );
71 
73  static std::string formatName( const std::string& variableName, size_t maxLength );
74 
75  private:
76 
77  struct ToUpper {
78  ToUpper(const std::locale& l):loc(l) {}
79  char operator() (char c) const { return std::toupper(c,loc); }
80  std::locale const& loc;
81  };
82  static std::string nameForSchema( const std::string& variableName );
83  static std::string shortNameByUpperCase( const std::string& className, size_t maxLength );
84  static std::string shortScopedName( const std::string& scopedClassName, size_t maxLength );
85  static std::string nameFromTemplate( const std::string templateClassName, size_t maxLength );
86 
87  static std::string newMappingVersion( const std::string& itemName, int iteration, char versionTrailer );
88 
89 
94 
96 
102 
109 
116 
118 
123  };
124 }
125 
126 #endif
127 
static std::string columnNameForRefId(const std::string &variableName, const std::string &scope)
static std::string variableNameForArrayIndex(const std::string &arrayVariable, unsigned int index)
static std::string scopedVariableName(const std::string &variableName, const std::string &scope)
variable name manipulation
static std::string newMappingVersionForContainer(const std::string &containerName, int iteration)
mapping versions
static std::string variableNameForContainerKey()
static std::string variableNameForArrayColumn(unsigned int arrayIndex)
static std::string variableNameForContainerValue()
static std::string newNameForDepSchemaObject(const std::string &initialName, unsigned int index, size_t maxLength)
static const size_t MaxColumnsForInlineCArray
Definition: MappingRules.h:22
static std::string baseIdForClass(const std::string &className)
Definition: MappingRules.cc:61
static std::string scopedVariableForSchemaObjects(const std::string &variableName, const std::string &scope)
static std::string shortScopedName(const std::string &scopedClassName, size_t maxLength)
static std::string columnNameForRefColumn()
static std::string columnNameForVariable(const std::string &variableName, const std::string &scope, bool forData=true)
char operator()(char c) const
Definition: MappingRules.h:79
static std::string mappingPropertyNameInDictionary()
class related parameters
Definition: MappingRules.cc:34
ToUpper(const std::locale &l)
Definition: MappingRules.h:78
static std::string columnNameForPosition()
tuple iteration
Definition: align_cfg.py:5
static std::string shortNameByUpperCase(const std::string &className, size_t maxLength)
static std::string sequenceNameForMapping()
Definition: MappingRules.cc:28
static std::string defaultClassVersion(const std::string &className)
Definition: MappingRules.cc:83
static std::string newMappingVersion(const std::string &itemName, int iteration, char versionTrailer)
Definition: MappingRules.cc:99
static std::string columnNameForOID(const std::string &variableName, const std::string &scope, unsigned int index)
static std::string newNameForArraySchemaObject(const std::string &initialName, unsigned int index, size_t maxLength)
static bool isMappedToBlob(const std::string &mappingProperty)
Definition: MappingRules.cc:41
static std::string columnNameForId()
static std::string classVersionFromId(const std::string &classId)
Definition: MappingRules.cc:51
static std::pair< bool, std::string > classNameFromBaseId(const std::string &classId)
Definition: MappingRules.cc:72
static std::string columnNameForRefMetadata(const std::string &variableName, const std::string &scope)
std::locale const & loc
Definition: MappingRules.h:80
static const size_t MaxColumnsPerTable
Definition: MappingRules.h:21
static std::string nameFromTemplate(const std::string templateClassName, size_t maxLength)
static std::string baseClassVersion()
Definition: MappingRules.cc:66
static std::string columnNameForNamedReference(const std::string &variableName, const std::string &scope)
static const size_t ClassNameLengthForSchema
size parameters for table creation
Definition: MappingRules.h:18
static std::string nameForSchema(const std::string &variableName)
static std::string classId(const std::string &className, const std::string &classVersion)
Definition: MappingRules.cc:46
static std::string sequenceNameForContainer(const std::string &containerName)
Definition: MappingRules.cc:14
static std::string tableNameForItem(const std::string &itemName)
schema object naming
static const size_t MaxColumnNameLength
Definition: MappingRules.h:20
static std::string sequenceNameForContainerId()
sequence names
Definition: MappingRules.cc:9
static std::string newMappingVersionForDependentClass(const std::string &containerName, const std::string &className, int iteration)
static std::string sequenceNameForDependentClass(const std::string &containerName, const std::string &className)
Definition: MappingRules.cc:20
static std::string classVersionPropertyNameInDictionary()
Definition: MappingRules.cc:91
static const size_t MaxTableNameLength
Definition: MappingRules.h:19
static std::string newNameForSchemaObject(const std::string &initialName, unsigned int index, size_t maxLength, char indexTrailer=0)
functions for new schema object name generation
static std::string formatName(const std::string &variableName, size_t maxLength)
formatting for variable names to schema object names
static std::string fkNameForIdentity(const std::string &tableName, int index=0)
std::string className(const T &t)
Definition: ClassName.h:30