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 persistencyPropertyNameInDictionary();
39  static bool isLooseOnReading(const std::string& persistencyProperty );
40  static bool isLooseOnWriting(const std::string& persistencyProperty );
41  static std::string classId( const std::string& className, const std::string& classVersion );
42  static std::string classVersionFromId( const std::string& classId );
43  static std::string baseIdForClass( const std::string& className );
44  static std::string baseClassVersion();
45  static std::pair<bool,std::string> classNameFromBaseId( const std::string& classId );
46  static std::string defaultClassVersion(const std::string& className);
47  static std::string classVersionPropertyNameInDictionary();
48 
50  static std::string scopedVariableName( const std::string& variableName, const std::string& scope );
51  static std::string variableNameForArrayIndex( const std::string& arrayVariable, unsigned int index );
52  static std::string variableNameForArrayColumn( unsigned int arrayIndex );
53  static std::string variableNameForArrayColumn( const Reflex::Type& array );
54  static std::string variableNameForContainerValue();
55  static std::string variableNameForContainerKey();
56  static std::string scopedVariableForSchemaObjects( const std::string& variableName, const std::string& scope );
57 
59  static std::string newNameForSchemaObject( const std::string& initialName, unsigned int index, size_t maxLength, char indexTrailer=0 );
60  static std::string newNameForDepSchemaObject( const std::string& initialName, unsigned int index, size_t maxLength);
61  static std::string newNameForArraySchemaObject( const std::string& initialName, unsigned int index, size_t maxLength);
62 
64  static std::string tableNameForItem( const std::string& itemName );
65  static std::string columnNameForId();
66  static std::string columnNameForRefColumn();
67  static std::string columnNameForVariable( const std::string& variableName, const std::string& scope, bool forData=true );
68  static std::string columnNameForOID( const std::string& variableName, const std::string& scope, unsigned int index );
69  static std::string columnNameForRefMetadata( const std::string& variableName, const std::string& scope );
70  static std::string columnNameForRefId( const std::string& variableName, const std::string& scope );
71  static std::string columnNameForPosition();
72  static std::string columnNameForNamedReference( const std::string& variableName, const std::string& scope );
73  static std::string columnNameForBlobMetadata( const std::string& dataColumnName );
74  static std::string fkNameForIdentity( const std::string& tableName, int index=0 );
75 
77  static std::string formatName( const std::string& variableName, size_t maxLength );
78 
79  private:
80 
81  struct ToUpper {
82  ToUpper(const std::locale& l):loc(l) {}
83  char operator() (char c) const { return std::toupper(c,loc); }
84  std::locale const& loc;
85  };
86  static std::string nameForSchema( const std::string& variableName );
87  static std::string shortNameByUpperCase( const std::string& className, size_t maxLength );
88  static std::string shortScopedName( const std::string& scopedClassName, size_t maxLength );
89  static std::string nameFromTemplate( const std::string& templateClassName, size_t maxLength );
90 
91  static std::string newMappingVersion( const std::string& itemName, int iteration, char versionTrailer );
92 
93 
98 
100 
106 
113 
120 
122 
127  };
128 }
129 
130 #endif
131 
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 persistencyPropertyNameInDictionary()
Definition: MappingRules.cc:47
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:78
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:83
static std::string mappingPropertyNameInDictionary()
class related parameters
Definition: MappingRules.cc:35
ToUpper(const std::locale &l)
Definition: MappingRules.h:82
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:29
static std::string defaultClassVersion(const std::string &className)
static std::string newMappingVersion(const std::string &itemName, int iteration, char versionTrailer)
static std::string columnNameForOID(const std::string &variableName, const std::string &scope, unsigned int index)
static bool isLooseOnReading(const std::string &persistencyProperty)
Definition: MappingRules.cc:53
static std::string columnNameForBlobMetadata(const std::string &dataColumnName)
static std::string newNameForArraySchemaObject(const std::string &initialName, unsigned int index, size_t maxLength)
static bool isMappedToBlob(const std::string &mappingProperty)
Definition: MappingRules.cc:42
static std::string columnNameForId()
static std::string classVersionFromId(const std::string &classId)
Definition: MappingRules.cc:68
static std::pair< bool, std::string > classNameFromBaseId(const std::string &classId)
Definition: MappingRules.cc:89
static bool isLooseOnWriting(const std::string &persistencyProperty)
Definition: MappingRules.cc:58
static std::string columnNameForRefMetadata(const std::string &variableName, const std::string &scope)
std::locale const & loc
Definition: MappingRules.h:84
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:83
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:63
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()
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